Skip to main content

WritableBytes

Trait WritableBytes 

Source
pub trait WritableBytes: Debug {
    // Required methods
    fn len(&self) -> u64;
    fn write_at(
        &mut self,
        offset: u64,
        source: &[u8],
    ) -> Result<(), ByteAccessError>;

    // Provided methods
    fn is_empty(&self) -> bool { ... }
    fn as_contiguous_mut(&mut self) -> Option<&mut [u8]> { ... }
}
Expand description

Bounded writable bytes exposed by a transport implementation.

Implementations may be segmented. Every operation is nonblocking and allocation-free.

Required Methods§

Source

fn len(&self) -> u64

Stable logical byte length.

Source

fn write_at( &mut self, offset: u64, source: &[u8], ) -> Result<(), ByteAccessError>

Write source to the exact logical range beginning at offset.

Provided Methods§

Source

fn is_empty(&self) -> bool

Whether this destination contains no bytes.

Source

fn as_contiguous_mut(&mut self) -> Option<&mut [u8]>

Borrow the complete destination when the concrete mapping is contiguous and stable.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl WritableBytes for [u8]

Source§

fn len(&self) -> u64

Source§

fn write_at( &mut self, offset: u64, source: &[u8], ) -> Result<(), ByteAccessError>

Source§

fn as_contiguous_mut(&mut self) -> Option<&mut [u8]>

Implementors§