pub trait MessageData: Sized + Debug {
// Required methods
fn copy_from_user(
data: &mut dyn InputBuffer,
limit: usize,
) -> Result<Self, Errno>;
fn ptr(&self) -> Result<*const u8, Errno>;
fn with_bytes<O, F: FnMut(&[u8]) -> Result<O, Errno>>(
&self,
f: F,
) -> Result<O, Errno>;
fn len(&self) -> usize;
fn split_off(&mut self, index: usize) -> Option<Self>;
fn copy_to_user(&self, data: &mut dyn OutputBuffer) -> Result<usize, Errno>;
fn clone_at_most(&self, limit: usize) -> Self;
fn truncate(&mut self, limit: usize);
}Expand description
Stores an arbitrary sequence of bytes.
Required Methods§
Sourcefn copy_from_user(
data: &mut dyn InputBuffer,
limit: usize,
) -> Result<Self, Errno>
fn copy_from_user( data: &mut dyn InputBuffer, limit: usize, ) -> Result<Self, Errno>
Copies data from user memory into a new MessageData object.
Sourcefn with_bytes<O, F: FnMut(&[u8]) -> Result<O, Errno>>(
&self,
f: F,
) -> Result<O, Errno>
fn with_bytes<O, F: FnMut(&[u8]) -> Result<O, Errno>>( &self, f: F, ) -> Result<O, Errno>
Calls the provided function with this data’s bytes.
Sourcefn split_off(&mut self, index: usize) -> Option<Self>
fn split_off(&mut self, index: usize) -> Option<Self>
Splits the message data at index.
After this call returns, at most at bytes will be stored in this MessageData, and any
remaining bytes will be moved to the returned MessageData.
Sourcefn copy_to_user(&self, data: &mut dyn OutputBuffer) -> Result<usize, Errno>
fn copy_to_user(&self, data: &mut dyn OutputBuffer) -> Result<usize, Errno>
Copies the message out to the output buffer.
Returns the number of bytes that were read into the buffer.
Sourcefn clone_at_most(&self, limit: usize) -> Self
fn clone_at_most(&self, limit: usize) -> Self
Clones this data up to a limit.
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.