pub struct PostbagSlim;Available on crate feature
serde only.Expand description
Postbag slim codec for compact, high-performance encoding.
The Slim configuration prioritizes performance and compact size over compatibility.
This codec provides efficient binary encoding but with limited schema evolution
capabilities compared to the full Postbag codec.
ยงKey Features
- Compact encoding: Smaller serialized data size compared to
Fullconfiguration - Fast processing: No string lookups during serialization/deserialization
- High performance: Optimized for speed and minimal overhead
ยงSchema Evolution Limitations
The Slim configuration has limited schema evolution capabilities. Fields and enum
variants must maintain their order for compatibility.
ยงSupported Changes
- Adding fields: New fields can be added to the end of structs only
- Removing fields: Fields can be removed from the end of structs only
- Adding enum variants: New variants can be added at the end of enums only
- Removing enum variants: Variants can be removed from the end of enums only
ยงImportant Compatibility Notes
- Fields and enum variants cannot be reordered
- Fields and enum variants cannot be added or removed from the middle
- Use serde defaults (
#[serde(default)]) for new fields to ensure backward compatibility - Always add new fields at the end of struct definitions
- Always add new enum variants at the end of enum definitions
ยงWhen to Use
Choose PostbagSlim when:
- Maximum performance and minimal serialized size are priorities
- Schema changes are infrequent or controlled
- Data structures have stable field ordering
Choose the full Postbag codec when schema flexibility is more important than
the slight performance overhead.
This serializes and deserializes without field identifiers for maximum efficiency.
Trait Implementationsยง
Sourceยงimpl Clone for PostbagSlim
impl Clone for PostbagSlim
Sourceยงfn clone(&self) -> PostbagSlim
fn clone(&self) -> PostbagSlim
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) ยท Sourceยงfn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSourceยงimpl Codec for PostbagSlim
impl Codec for PostbagSlim
Sourceยงfn serialize<Writer, Item>(
writer: Writer,
item: &Item,
) -> Result<(), SerializationError>
fn serialize<Writer, Item>( writer: Writer, item: &Item, ) -> Result<(), SerializationError>
Serializes the specified item into the data format.
Sourceยงfn deserialize<Reader, Item>(
reader: Reader,
) -> Result<Item, DeserializationError>where
Reader: Read,
Item: DeserializeOwned,
fn deserialize<Reader, Item>(
reader: Reader,
) -> Result<Item, DeserializationError>where
Reader: Read,
Item: DeserializeOwned,
Deserializes the specified data into an item.
Sourceยงimpl<'de> Deserialize<'de> for PostbagSlim
impl<'de> Deserialize<'de> for PostbagSlim
Sourceยงfn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementationsยง
impl Freeze for PostbagSlim
impl RefUnwindSafe for PostbagSlim
impl Send for PostbagSlim
impl Sync for PostbagSlim
impl Unpin for PostbagSlim
impl UnsafeUnpin for PostbagSlim
impl UnwindSafe for PostbagSlim
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