kernel::utilities::copy_slice

Trait CopyOrErr

Source
pub trait CopyOrErr {
    // Required method
    fn copy_from_slice_or_err(&mut self, src: &Self) -> Result<(), ErrorCode>;
}
Expand description

Interface for copying buffers that cannot panic.

Required Methods§

Source

fn copy_from_slice_or_err(&mut self, src: &Self) -> Result<(), ErrorCode>

Copy a non-overlapping slice from src to self.

This is a non-panicking version of slice::copy_from_slice.

Returns Err(ErrorCode) if src and self are not the same length.

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 CopyOrErr for [u8]

Source§

fn copy_from_slice_or_err(&mut self, src: &Self) -> Result<(), ErrorCode>

Source§

impl CopyOrErr for [u16]

Source§

fn copy_from_slice_or_err(&mut self, src: &Self) -> Result<(), ErrorCode>

Source§

impl CopyOrErr for [u32]

Source§

fn copy_from_slice_or_err(&mut self, src: &Self) -> Result<(), ErrorCode>

Source§

impl CopyOrErr for [u64]

Source§

fn copy_from_slice_or_err(&mut self, src: &Self) -> Result<(), ErrorCode>

Source§

impl CopyOrErr for [usize]

Source§

fn copy_from_slice_or_err(&mut self, src: &Self) -> Result<(), ErrorCode>

Implementors§