Trait VectoredWrite

Source
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§

Source

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.

Implementations on Foreign Types§

Source§

impl VectoredWrite for f32

Source§

fn write_vectored<const E: bool>( &self, curs: &mut VectoredCursorMut<'_>, ) -> Result<(), WireError>

Source§

impl VectoredWrite for f64

Source§

fn write_vectored<const E: bool>( &self, curs: &mut VectoredCursorMut<'_>, ) -> Result<(), WireError>

Source§

impl VectoredWrite for i8

Source§

fn write_vectored<const E: bool>( &self, curs: &mut VectoredCursorMut<'_>, ) -> Result<(), WireError>

Source§

impl VectoredWrite for i16

Source§

fn write_vectored<const E: bool>( &self, curs: &mut VectoredCursorMut<'_>, ) -> Result<(), WireError>

Source§

impl VectoredWrite for i32

Source§

fn write_vectored<const E: bool>( &self, curs: &mut VectoredCursorMut<'_>, ) -> Result<(), WireError>

Source§

impl VectoredWrite for i64

Source§

fn write_vectored<const E: bool>( &self, curs: &mut VectoredCursorMut<'_>, ) -> Result<(), WireError>

Source§

impl VectoredWrite for i128

Source§

fn write_vectored<const E: bool>( &self, curs: &mut VectoredCursorMut<'_>, ) -> Result<(), WireError>

Source§

impl VectoredWrite for isize

Source§

fn write_vectored<const E: bool>( &self, curs: &mut VectoredCursorMut<'_>, ) -> Result<(), WireError>

Source§

impl VectoredWrite for str

Source§

fn write_vectored<'a, const E: bool>( &self, curs: &mut VectoredCursorMut<'a>, ) -> Result<(), WireError>

Source§

impl VectoredWrite for u8

Source§

fn write_vectored<const E: bool>( &self, curs: &mut VectoredCursorMut<'_>, ) -> Result<(), WireError>

Source§

impl VectoredWrite for u16

Source§

fn write_vectored<const E: bool>( &self, curs: &mut VectoredCursorMut<'_>, ) -> Result<(), WireError>

Source§

impl VectoredWrite for u32

Source§

fn write_vectored<const E: bool>( &self, curs: &mut VectoredCursorMut<'_>, ) -> Result<(), WireError>

Source§

impl VectoredWrite for u64

Source§

fn write_vectored<const E: bool>( &self, curs: &mut VectoredCursorMut<'_>, ) -> Result<(), WireError>

Source§

impl VectoredWrite for u128

Source§

fn write_vectored<const E: bool>( &self, curs: &mut VectoredCursorMut<'_>, ) -> Result<(), WireError>

Source§

impl VectoredWrite for usize

Source§

fn write_vectored<const E: bool>( &self, curs: &mut VectoredCursorMut<'_>, ) -> Result<(), WireError>

Source§

impl VectoredWrite for [u8]

Source§

fn write_vectored<'a, const E: bool>( &self, curs: &mut VectoredCursorMut<'a>, ) -> Result<(), WireError>

Implementors§