Wrap

Trait Wrap 

Source
pub trait Wrap<T: AsRef<[u8]>>: Sized + Size {
    // Required method
    unsafe fn wrap_unchecked(data: T) -> Self;

    // Provided method
    fn wrap(data: T) -> Self { ... }
}
Expand description

This trait represents any structure type.

Required Methods§

Source

unsafe fn wrap_unchecked(data: T) -> Self

Wraps the given data buffer.

§Arguments
  • data: the data buffer to wrap as this structure type.

returns: Self

§Safety

This function assumes the size of the buffer passed in is always at least the size of this structure.

Provided Methods§

Source

fn wrap(data: T) -> Self

Wraps the given data buffer.

§Arguments
  • data: the data buffer to wrap as this structure.

returns: Self

§Panics

This function will panic if the passed data buffer is too small to store the entire structure.

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.

Implementors§