pub enum TypeMeta {
Static {
size: usize,
zero_copy: bool,
},
Dynamic,
}Expand description
Indicates what kind of assumptions can be made when encoding or decoding a type.
Readers and writers may use this to optimize their behavior.
Variants§
Static
The type has a statically known serialized size.
Specifying this variant can have significant performance benefits, as it can allow writers to prefetch larger chunks of memory such that subsequent read/write operations in those chunks can be performed at once without intermediate bounds checks.
Specifying this variant incorrectly will almost certainly result in a panic at runtime.
Take care not to specify this on variable length types, like Vec or String, as their
serialized size will vary based on their length.
Fields
Dynamic
The type has a dynamic size, and no optimizations can be made.
Trait Implementations§
impl Copy for TypeMeta
impl Eq for TypeMeta
impl StructuralPartialEq for TypeMeta
Auto Trait Implementations§
impl Freeze for TypeMeta
impl RefUnwindSafe for TypeMeta
impl Send for TypeMeta
impl Sync for TypeMeta
impl Unpin for TypeMeta
impl UnwindSafe for TypeMeta
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