pub trait Serializer {
type Marker;
// Required methods
fn context(&self) -> ProtocolContext;
fn direction(&self) -> CommandDirection;
fn write<F>(&mut self, length: usize, f: F) -> SerializeResult
where F: FnOnce(&mut [u8]);
fn write_bytes(&mut self, fragment: &[u8]) -> SerializeResult;
fn write_marker(
&mut self,
length: usize,
) -> Result<Self::Marker, SerializeError>;
fn set_marker(
&mut self,
marker: Self::Marker,
fragment: &[u8],
) -> SerializeResult;
fn marker_distance(&self, marker: &Self::Marker) -> usize;
}
Required Associated Types§
Required Methods§
fn context(&self) -> ProtocolContext
fn direction(&self) -> CommandDirection
fn write<F>(&mut self, length: usize, f: F) -> SerializeResult
fn write_bytes(&mut self, fragment: &[u8]) -> SerializeResult
fn write_marker( &mut self, length: usize, ) -> Result<Self::Marker, SerializeError>
fn set_marker( &mut self, marker: Self::Marker, fragment: &[u8], ) -> SerializeResult
fn marker_distance(&self, marker: &Self::Marker) -> usize
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.