pub trait ByteConverter {
// Required methods
fn append_to_bytes(
&self,
bytes: &mut Vec<u8>,
) -> Result<(), Box<dyn Error + Send + Sync + 'static>>;
fn extract_from_bytes<'a, TBytes: AsRef<[u8]>>(
bytes: &'a TBytes,
index: &mut usize,
) -> Result<Self, Box<dyn Error + Send + Sync + 'static>>
where Self: Sized;
// Provided methods
fn to_vec_bytes(
&self,
) -> Result<Vec<u8>, Box<dyn Error + Send + Sync + 'static>> { ... }
fn to_vec_bytes_with_capacity(
&self,
capacity: usize,
) -> Result<Vec<u8>, Box<dyn Error + Send + Sync + 'static>> { ... }
fn clone_via_bytes(
&self,
) -> Result<Self, Box<dyn Error + Send + Sync + 'static>>
where Self: Sized { ... }
fn deserialize_from_bytes<'a, TBytes: AsRef<[u8]>>(
bytes: &'a TBytes,
) -> Result<Self, Box<dyn Error + Send + Sync + 'static>>
where Self: Sized { ... }
fn cast_via_bytes<TByteConverter>(
&self,
) -> Result<TByteConverter, Box<dyn Error + Send + Sync + 'static>>
where TByteConverter: ByteConverter { ... }
}Required Methods§
fn append_to_bytes( &self, bytes: &mut Vec<u8>, ) -> Result<(), Box<dyn Error + Send + Sync + 'static>>
fn extract_from_bytes<'a, TBytes: AsRef<[u8]>>(
bytes: &'a TBytes,
index: &mut usize,
) -> Result<Self, Box<dyn Error + Send + Sync + 'static>>where
Self: Sized,
Provided Methods§
fn to_vec_bytes( &self, ) -> Result<Vec<u8>, Box<dyn Error + Send + Sync + 'static>>
fn to_vec_bytes_with_capacity( &self, capacity: usize, ) -> Result<Vec<u8>, Box<dyn Error + Send + Sync + 'static>>
fn clone_via_bytes(
&self,
) -> Result<Self, Box<dyn Error + Send + Sync + 'static>>where
Self: Sized,
fn deserialize_from_bytes<'a, TBytes: AsRef<[u8]>>(
bytes: &'a TBytes,
) -> Result<Self, Box<dyn Error + Send + Sync + 'static>>where
Self: Sized,
fn cast_via_bytes<TByteConverter>(
&self,
) -> Result<TByteConverter, Box<dyn Error + Send + Sync + 'static>>where
TByteConverter: ByteConverter,
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.