pub trait VarInt: Copy + Sized {
type Unsigned: Copy + VarIntOps;
// Required methods
fn to_unsigned(self) -> Self::Unsigned;
fn from_unsigned(value: Self::Unsigned) -> Self;
fn varint_size(self) -> usize;
}
Expand description
Generic trait for variable-length integer encoding
Required Associated Types§
Required Methods§
Sourcefn to_unsigned(self) -> Self::Unsigned
fn to_unsigned(self) -> Self::Unsigned
Convert to the corresponding unsigned type
Sourcefn from_unsigned(value: Self::Unsigned) -> Self
fn from_unsigned(value: Self::Unsigned) -> Self
Convert from the corresponding unsigned type
Sourcefn varint_size(self) -> usize
fn varint_size(self) -> usize
Determine how many bytes are needed to encode this value
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.