pub trait VectoredWrite {
// Required method
fn write_vectored<const E: bool>(
&self,
curs: &mut VectoredCursorMut<'_>,
) -> Result<(), WireError>;
}
Expand description
Serialization from a data type to the vectored wire.
A type that implements this trait guarantees that it can be serialized into a
number of bytes that will be written to the provided VectoredCursorMut
. If the
bytes cannot be written to the vectored wire, an error will be returned.
Required Methods§
Sourcefn write_vectored<const E: bool>(
&self,
curs: &mut VectoredCursorMut<'_>,
) -> Result<(), WireError>
fn write_vectored<const E: bool>( &self, curs: &mut VectoredCursorMut<'_>, ) -> Result<(), WireError>
Serializes the data type into a number of bytes on the vectored wire, or returns a WireError
on failure.
The generic boolean E
designates the intended endianness of the data being written. If E
is set to
true
, then the data will be serialized in big endian format; if false
, it will be serialized
in little endian.
§Errors
WireError::InsufficientBytes
- not enough bytes remained on the cursor to write the type to the wire.
WireError::Internal
- an internal error occurred in the wire-rs
library
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.