pub trait SchemaSink {
Show 20 methods
// Required methods
fn seq_begin(&mut self, len: usize) -> Result<(), SchemaError>;
fn put_bool(&mut self, v: bool) -> Result<(), SchemaError>;
fn put_u8(&mut self, v: u8) -> Result<(), SchemaError>;
fn put_i8(&mut self, v: i8) -> Result<(), SchemaError>;
fn put_u16(&mut self, v: u16) -> Result<(), SchemaError>;
fn put_i16(&mut self, v: i16) -> Result<(), SchemaError>;
fn put_u32(&mut self, v: u32) -> Result<(), SchemaError>;
fn put_i32(&mut self, v: i32) -> Result<(), SchemaError>;
fn put_u64(&mut self, v: u64) -> Result<(), SchemaError>;
fn put_i64(&mut self, v: i64) -> Result<(), SchemaError>;
fn put_f32(&mut self, v: f32) -> Result<(), SchemaError>;
fn put_f64(&mut self, v: f64) -> Result<(), SchemaError>;
fn put_str(&mut self, v: &str) -> Result<(), SchemaError>;
// Provided methods
fn struct_begin(&mut self, type_name: &str) -> Result<(), SchemaError> { ... }
fn struct_end(&mut self) -> Result<(), SchemaError> { ... }
fn field_begin(&mut self, field: &'static Field) -> Result<(), SchemaError> { ... }
fn field_end(&mut self, field: &'static Field) -> Result<(), SchemaError> { ... }
fn array_begin(&mut self, len: usize) -> Result<(), SchemaError> { ... }
fn array_end(&mut self) -> Result<(), SchemaError> { ... }
fn seq_end(&mut self) -> Result<(), SchemaError> { ... }
}Expand description
The encode half of a schema-driven format: the walk pushes typed values in, the implementor writes its wire.
Every structural hook has a no-op default, so a flat format like the
reference packed provider implements only the primitives. A self-describing
format (one that writes field names, or a per-struct length) overrides the
hooks it needs.
Required Methods§
Provided Methods§
Sourcefn struct_begin(&mut self, type_name: &str) -> Result<(), SchemaError>
fn struct_begin(&mut self, type_name: &str) -> Result<(), SchemaError>
Entering a struct — the top-level message, or a nested member.
Sourcefn struct_end(&mut self) -> Result<(), SchemaError>
fn struct_end(&mut self) -> Result<(), SchemaError>
Leaving the struct opened by the matching Self::struct_begin.
Sourcefn field_begin(&mut self, field: &'static Field) -> Result<(), SchemaError>
fn field_begin(&mut self, field: &'static Field) -> Result<(), SchemaError>
Entering one field. Carries the whole Field, so a format that writes
names or types has them without a second lookup.
Sourcefn field_end(&mut self, field: &'static Field) -> Result<(), SchemaError>
fn field_end(&mut self, field: &'static Field) -> Result<(), SchemaError>
Leaving the field opened by the matching Self::field_begin.
Sourcefn array_begin(&mut self, len: usize) -> Result<(), SchemaError>
fn array_begin(&mut self, len: usize) -> Result<(), SchemaError>
A fixed-size array of len elements is about to be written. No length
is on the wire unless the format chooses to put one there — len comes
from the schema on both sides.
Sourcefn array_end(&mut self) -> Result<(), SchemaError>
fn array_end(&mut self) -> Result<(), SchemaError>
Leaving the array opened by the matching Self::array_begin.
Sourcefn seq_end(&mut self) -> Result<(), SchemaError>
fn seq_end(&mut self) -> Result<(), SchemaError>
Leaving the sequence opened by the matching Self::seq_begin.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".