Trait Data

Source
pub trait Data<'a>: Sized + 'a {
    type Output<T: Flat + ?Sized + 'a>: Sized;

    // Required methods
    fn bytes(&self) -> &[u8] ;
    fn split(self, pos: usize) -> (Self, Self);
    fn value<T: Flat + ?Sized + 'a>(self) -> Self::Output<T>;
}

Required Associated Types§

Source

type Output<T: Flat + ?Sized + 'a>: Sized

Required Methods§

Source

fn bytes(&self) -> &[u8]

Source

fn split(self, pos: usize) -> (Self, Self)

Source

fn value<T: Flat + ?Sized + 'a>(self) -> Self::Output<T>

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<'a> Data<'a> for &'a [u8]

Source§

type Output<T: Flat + ?Sized + 'a> = &'a [u8]

Source§

fn bytes(&self) -> &[u8]

Source§

fn split(self, pos: usize) -> (Self, Self)

Source§

fn value<T: Flat + ?Sized + 'a>(self) -> Self::Output<T>

Source§

impl<'a> Data<'a> for &'a mut [u8]

Source§

type Output<T: Flat + ?Sized + 'a> = &'a mut [u8]

Source§

fn bytes(&self) -> &[u8]

Source§

fn split(self, pos: usize) -> (Self, Self)

Source§

fn value<T: Flat + ?Sized + 'a>(self) -> Self::Output<T>

Implementors§

Source§

impl<'a> Data<'a> for MutData<'a>

Source§

type Output<T: Flat + ?Sized + 'a> = &'a mut T

Source§

impl<'a> Data<'a> for RefData<'a>

Source§

type Output<T: Flat + ?Sized + 'a> = &'a T