Skip to main content

SchemaSink

Trait SchemaSink 

Source
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§

Source

fn seq_begin(&mut self, len: usize) -> Result<(), SchemaError>

A sequence of len elements is about to be written. Unlike an array this length is DATA, so a format must record it.

Source

fn put_bool(&mut self, v: bool) -> Result<(), SchemaError>

Write an IDL boolean.

Source

fn put_u8(&mut self, v: u8) -> Result<(), SchemaError>

Write an IDL octet / uint8.

Source

fn put_i8(&mut self, v: i8) -> Result<(), SchemaError>

Write an IDL int8.

Source

fn put_u16(&mut self, v: u16) -> Result<(), SchemaError>

Write an IDL uint16.

Source

fn put_i16(&mut self, v: i16) -> Result<(), SchemaError>

Write an IDL int16.

Source

fn put_u32(&mut self, v: u32) -> Result<(), SchemaError>

Write an IDL uint32.

Source

fn put_i32(&mut self, v: i32) -> Result<(), SchemaError>

Write an IDL int32.

Source

fn put_u64(&mut self, v: u64) -> Result<(), SchemaError>

Write an IDL uint64.

Source

fn put_i64(&mut self, v: i64) -> Result<(), SchemaError>

Write an IDL int64.

Source

fn put_f32(&mut self, v: f32) -> Result<(), SchemaError>

Write an IDL float.

Source

fn put_f64(&mut self, v: f64) -> Result<(), SchemaError>

Write an IDL double.

Source

fn put_str(&mut self, v: &str) -> Result<(), SchemaError>

Write an IDL narrow string. The NUL CDR appends is a CDR concern and is already stripped — v is the payload.

Provided Methods§

Source

fn struct_begin(&mut self, type_name: &str) -> Result<(), SchemaError>

Entering a struct — the top-level message, or a nested member.

Source

fn struct_end(&mut self) -> Result<(), SchemaError>

Leaving the struct opened by the matching Self::struct_begin.

Source

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.

Source

fn field_end(&mut self, field: &'static Field) -> Result<(), SchemaError>

Leaving the field opened by the matching Self::field_begin.

Source

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.

Source

fn array_end(&mut self) -> Result<(), SchemaError>

Leaving the array opened by the matching Self::array_begin.

Source

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".

Implementors§