pub struct Schema { /* private fields */ }Expand description
A schema handle returned by Encoder::register_schema or created via
Schema::new.
Carries the full schema definition (name + fields) so it can auto-register
itself with any encoder on first use. This means a Schema created on one
encoder can be passed to a different encoder and it will just work.
Schema is cheap to clone (internally Arc-backed).
Implementations§
Source§impl Schema
impl Schema
Sourcepub fn new(name: &str, fields: Vec<FieldDef>) -> Self
pub fn new(name: &str, fields: Vec<FieldDef>) -> Self
Create a schema handle without an encoder.
The schema will be lazily registered the first time it is passed to
Encoder::write_event.
Sourcepub fn from_entry(entry: SchemaEntry) -> Self
pub fn from_entry(entry: SchemaEntry) -> Self
Create a schema handle from a complete SchemaEntry.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Schema
impl RefUnwindSafe for Schema
impl Send for Schema
impl Sync for Schema
impl Unpin for Schema
impl UnsafeUnpin for Schema
impl UnwindSafe for Schema
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more