ReadUnchecked

Trait ReadUnchecked 

Source
pub trait ReadUnchecked {
    type HostType: Sized;

    const SIZE: usize;

    // Required method
    unsafe fn read_unchecked<'a>(ctxt: &mut ReadCtxt<'a>) -> Self::HostType;
}
Expand description

Read will always succeed if sufficient bytes are available.

Required Associated Constants§

Source

const SIZE: usize

The number of bytes consumed by read_unchecked.

Required Associated Types§

Required Methods§

Source

unsafe fn read_unchecked<'a>(ctxt: &mut ReadCtxt<'a>) -> Self::HostType

Must read exactly SIZE bytes. Unsafe as it avoids prohibitively expensive per-byte bounds checking.

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<T1, T2> ReadUnchecked for (T1, T2)

Source§

const SIZE: usize

Source§

type HostType = (<T1 as ReadUnchecked>::HostType, <T2 as ReadUnchecked>::HostType)

Source§

unsafe fn read_unchecked<'a>(ctxt: &mut ReadCtxt<'a>) -> Self::HostType

Source§

impl<T1, T2, T3> ReadUnchecked for (T1, T2, T3)

Source§

const SIZE: usize

Source§

type HostType = (<T1 as ReadUnchecked>::HostType, <T2 as ReadUnchecked>::HostType, <T3 as ReadUnchecked>::HostType)

Source§

unsafe fn read_unchecked<'a>(ctxt: &mut ReadCtxt<'a>) -> Self::HostType

Implementors§