Skip to main content

AsBytes

Trait AsBytes 

Source
pub trait AsBytes<'a> {
    const SLICE_COUNT: usize;

    // Required method
    fn get_byte_slice(&self, index: usize) -> (u64, &'a [u8]);

    // Provided method
    fn as_bytes(&self) -> impl Iterator<Item = (u64, &'a [u8])> { ... }
}
Expand description

A type that can be viewed as byte slices with lifetime 'a.

Implementors of this trait almost certainly reference the lifetime 'a themselves.

Required Associated Constants§

Source

const SLICE_COUNT: usize

The number of byte slices this type produces.

Required Methods§

Source

fn get_byte_slice(&self, index: usize) -> (u64, &'a [u8])

Returns the index-th byte slice (alignment, data) by random access.

Each composite type dispatches on compile-time-constant SLICE_COUNT boundaries, so LLVM can constant-fold the branch chain when the caller iterates 0..SLICE_COUNT.

Provided Methods§

Source

fn as_bytes(&self) -> impl Iterator<Item = (u64, &'a [u8])>

Presents self as a sequence of byte slices, with their required alignment.

The default implementation iterates 0..SLICE_COUNT calling get_byte_slice. The return type is always Map<Range<usize>, ...> regardless of type complexity.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<'a, A: AsBytes<'a>, B: AsBytes<'a>, C: AsBytes<'a>, D: AsBytes<'a>, E: AsBytes<'a>, F: AsBytes<'a>, G: AsBytes<'a>, H: AsBytes<'a>, I: AsBytes<'a>, J: AsBytes<'a>> AsBytes<'a> for (A, B, C, D, E, F, G, H, I, J)

Source§

const SLICE_COUNT: usize

Source§

fn get_byte_slice(&self, index: usize) -> (u64, &'a [u8])

Source§

impl<'a, A: AsBytes<'a>, B: AsBytes<'a>, C: AsBytes<'a>, D: AsBytes<'a>, E: AsBytes<'a>, F: AsBytes<'a>, G: AsBytes<'a>, H: AsBytes<'a>, I: AsBytes<'a>> AsBytes<'a> for (A, B, C, D, E, F, G, H, I)

Source§

const SLICE_COUNT: usize

Source§

fn get_byte_slice(&self, index: usize) -> (u64, &'a [u8])

Source§

impl<'a, A: AsBytes<'a>, B: AsBytes<'a>, C: AsBytes<'a>, D: AsBytes<'a>, E: AsBytes<'a>, F: AsBytes<'a>, G: AsBytes<'a>, H: AsBytes<'a>> AsBytes<'a> for (A, B, C, D, E, F, G, H)

Source§

const SLICE_COUNT: usize

Source§

fn get_byte_slice(&self, index: usize) -> (u64, &'a [u8])

Source§

impl<'a, A: AsBytes<'a>, B: AsBytes<'a>, C: AsBytes<'a>, D: AsBytes<'a>, E: AsBytes<'a>, F: AsBytes<'a>, G: AsBytes<'a>> AsBytes<'a> for (A, B, C, D, E, F, G)

Source§

const SLICE_COUNT: usize

Source§

fn get_byte_slice(&self, index: usize) -> (u64, &'a [u8])

Source§

impl<'a, A: AsBytes<'a>, B: AsBytes<'a>, C: AsBytes<'a>, D: AsBytes<'a>, E: AsBytes<'a>, F: AsBytes<'a>> AsBytes<'a> for (A, B, C, D, E, F)

Source§

const SLICE_COUNT: usize

Source§

fn get_byte_slice(&self, index: usize) -> (u64, &'a [u8])

Source§

impl<'a, A: AsBytes<'a>, B: AsBytes<'a>, C: AsBytes<'a>, D: AsBytes<'a>, E: AsBytes<'a>> AsBytes<'a> for (A, B, C, D, E)

Source§

const SLICE_COUNT: usize

Source§

fn get_byte_slice(&self, index: usize) -> (u64, &'a [u8])

Source§

impl<'a, A: AsBytes<'a>, B: AsBytes<'a>, C: AsBytes<'a>, D: AsBytes<'a>> AsBytes<'a> for (A, B, C, D)

Source§

const SLICE_COUNT: usize

Source§

fn get_byte_slice(&self, index: usize) -> (u64, &'a [u8])

Source§

impl<'a, A: AsBytes<'a>, B: AsBytes<'a>, C: AsBytes<'a>> AsBytes<'a> for (A, B, C)

Source§

const SLICE_COUNT: usize

Source§

fn get_byte_slice(&self, index: usize) -> (u64, &'a [u8])

Source§

impl<'a, A: AsBytes<'a>, B: AsBytes<'a>> AsBytes<'a> for (A, B)

Source§

const SLICE_COUNT: usize

Source§

fn get_byte_slice(&self, index: usize) -> (u64, &'a [u8])

Source§

impl<'a, A: AsBytes<'a>> AsBytes<'a> for (A,)

Source§

const SLICE_COUNT: usize

Source§

fn get_byte_slice(&self, index: usize) -> (u64, &'a [u8])

Source§

impl<'a, T: AsBytes<'a>> AsBytes<'a> for Arc<T>

Source§

const SLICE_COUNT: usize = T::SLICE_COUNT

Source§

fn get_byte_slice(&self, index: usize) -> (u64, &'a [u8])

Source§

impl<'a, T: AsBytes<'a>> AsBytes<'a> for Rc<T>

Source§

const SLICE_COUNT: usize = T::SLICE_COUNT

Source§

fn get_byte_slice(&self, index: usize) -> (u64, &'a [u8])

Source§

impl<'a, const N: usize> AsBytes<'a> for &'a [[Wrapping<i8>; N]]

Source§

const SLICE_COUNT: usize = 1

Source§

fn get_byte_slice(&self, index: usize) -> (u64, &'a [u8])

Source§

impl<'a, const N: usize> AsBytes<'a> for &'a [[Wrapping<i16>; N]]

Source§

const SLICE_COUNT: usize = 1

Source§

fn get_byte_slice(&self, index: usize) -> (u64, &'a [u8])

Source§

impl<'a, const N: usize> AsBytes<'a> for &'a [[Wrapping<i32>; N]]

Source§

const SLICE_COUNT: usize = 1

Source§

fn get_byte_slice(&self, index: usize) -> (u64, &'a [u8])

Source§

impl<'a, const N: usize> AsBytes<'a> for &'a [[Wrapping<i64>; N]]

Source§

const SLICE_COUNT: usize = 1

Source§

fn get_byte_slice(&self, index: usize) -> (u64, &'a [u8])

Source§

impl<'a, const N: usize> AsBytes<'a> for &'a [[Wrapping<u8>; N]]

Source§

const SLICE_COUNT: usize = 1

Source§

fn get_byte_slice(&self, index: usize) -> (u64, &'a [u8])

Source§

impl<'a, const N: usize> AsBytes<'a> for &'a [[Wrapping<u16>; N]]

Source§

const SLICE_COUNT: usize = 1

Source§

fn get_byte_slice(&self, index: usize) -> (u64, &'a [u8])

Source§

impl<'a, const N: usize> AsBytes<'a> for &'a [[Wrapping<u32>; N]]

Source§

const SLICE_COUNT: usize = 1

Source§

fn get_byte_slice(&self, index: usize) -> (u64, &'a [u8])

Source§

impl<'a, const N: usize> AsBytes<'a> for &'a [[Wrapping<u64>; N]]

Source§

const SLICE_COUNT: usize = 1

Source§

fn get_byte_slice(&self, index: usize) -> (u64, &'a [u8])

Source§

impl<'a, const N: usize> AsBytes<'a> for &'a [[f32; N]]

Source§

const SLICE_COUNT: usize = 1

Source§

fn get_byte_slice(&self, index: usize) -> (u64, &'a [u8])

Source§

impl<'a, const N: usize> AsBytes<'a> for &'a [[f64; N]]

Source§

const SLICE_COUNT: usize = 1

Source§

fn get_byte_slice(&self, index: usize) -> (u64, &'a [u8])

Source§

impl<'a, const N: usize> AsBytes<'a> for &'a [[i8; N]]

Source§

const SLICE_COUNT: usize = 1

Source§

fn get_byte_slice(&self, index: usize) -> (u64, &'a [u8])

Source§

impl<'a, const N: usize> AsBytes<'a> for &'a [[i16; N]]

Source§

const SLICE_COUNT: usize = 1

Source§

fn get_byte_slice(&self, index: usize) -> (u64, &'a [u8])

Source§

impl<'a, const N: usize> AsBytes<'a> for &'a [[i32; N]]

Source§

const SLICE_COUNT: usize = 1

Source§

fn get_byte_slice(&self, index: usize) -> (u64, &'a [u8])

Source§

impl<'a, const N: usize> AsBytes<'a> for &'a [[i64; N]]

Source§

const SLICE_COUNT: usize = 1

Source§

fn get_byte_slice(&self, index: usize) -> (u64, &'a [u8])

Source§

impl<'a, const N: usize> AsBytes<'a> for &'a [[u8; N]]

Source§

const SLICE_COUNT: usize = 1

Source§

fn get_byte_slice(&self, index: usize) -> (u64, &'a [u8])

Source§

impl<'a, const N: usize> AsBytes<'a> for &'a [[u16; N]]

Source§

const SLICE_COUNT: usize = 1

Source§

fn get_byte_slice(&self, index: usize) -> (u64, &'a [u8])

Source§

impl<'a, const N: usize> AsBytes<'a> for &'a [[u32; N]]

Source§

const SLICE_COUNT: usize = 1

Source§

fn get_byte_slice(&self, index: usize) -> (u64, &'a [u8])

Source§

impl<'a, const N: usize> AsBytes<'a> for &'a [[u64; N]]

Source§

const SLICE_COUNT: usize = 1

Source§

fn get_byte_slice(&self, index: usize) -> (u64, &'a [u8])

Source§

impl<'a> AsBytes<'a> for &'a [Wrapping<i8>]

Source§

const SLICE_COUNT: usize = 1

Source§

fn get_byte_slice(&self, index: usize) -> (u64, &'a [u8])

Source§

impl<'a> AsBytes<'a> for &'a [Wrapping<i16>]

Source§

const SLICE_COUNT: usize = 1

Source§

fn get_byte_slice(&self, index: usize) -> (u64, &'a [u8])

Source§

impl<'a> AsBytes<'a> for &'a [Wrapping<i32>]

Source§

const SLICE_COUNT: usize = 1

Source§

fn get_byte_slice(&self, index: usize) -> (u64, &'a [u8])

Source§

impl<'a> AsBytes<'a> for &'a [Wrapping<i64>]

Source§

const SLICE_COUNT: usize = 1

Source§

fn get_byte_slice(&self, index: usize) -> (u64, &'a [u8])

Source§

impl<'a> AsBytes<'a> for &'a [Wrapping<u8>]

Source§

const SLICE_COUNT: usize = 1

Source§

fn get_byte_slice(&self, index: usize) -> (u64, &'a [u8])

Source§

impl<'a> AsBytes<'a> for &'a [Wrapping<u16>]

Source§

const SLICE_COUNT: usize = 1

Source§

fn get_byte_slice(&self, index: usize) -> (u64, &'a [u8])

Source§

impl<'a> AsBytes<'a> for &'a [Wrapping<u32>]

Source§

const SLICE_COUNT: usize = 1

Source§

fn get_byte_slice(&self, index: usize) -> (u64, &'a [u8])

Source§

impl<'a> AsBytes<'a> for &'a [Wrapping<u64>]

Source§

const SLICE_COUNT: usize = 1

Source§

fn get_byte_slice(&self, index: usize) -> (u64, &'a [u8])

Source§

impl<'a> AsBytes<'a> for &'a [f32]

Source§

const SLICE_COUNT: usize = 1

Source§

fn get_byte_slice(&self, index: usize) -> (u64, &'a [u8])

Source§

impl<'a> AsBytes<'a> for &'a [f64]

Source§

const SLICE_COUNT: usize = 1

Source§

fn get_byte_slice(&self, index: usize) -> (u64, &'a [u8])

Source§

impl<'a> AsBytes<'a> for &'a [i8]

Source§

const SLICE_COUNT: usize = 1

Source§

fn get_byte_slice(&self, index: usize) -> (u64, &'a [u8])

Source§

impl<'a> AsBytes<'a> for &'a [i16]

Source§

const SLICE_COUNT: usize = 1

Source§

fn get_byte_slice(&self, index: usize) -> (u64, &'a [u8])

Source§

impl<'a> AsBytes<'a> for &'a [i32]

Source§

const SLICE_COUNT: usize = 1

Source§

fn get_byte_slice(&self, index: usize) -> (u64, &'a [u8])

Source§

impl<'a> AsBytes<'a> for &'a [i64]

Source§

const SLICE_COUNT: usize = 1

Source§

fn get_byte_slice(&self, index: usize) -> (u64, &'a [u8])

Source§

impl<'a> AsBytes<'a> for &'a [u8]

Source§

const SLICE_COUNT: usize = 1

Source§

fn get_byte_slice(&self, index: usize) -> (u64, &'a [u8])

Source§

impl<'a> AsBytes<'a> for &'a [u16]

Source§

const SLICE_COUNT: usize = 1

Source§

fn get_byte_slice(&self, index: usize) -> (u64, &'a [u8])

Source§

impl<'a> AsBytes<'a> for &'a [u32]

Source§

const SLICE_COUNT: usize = 1

Source§

fn get_byte_slice(&self, index: usize) -> (u64, &'a [u8])

Source§

impl<'a> AsBytes<'a> for &'a [u64]

Source§

const SLICE_COUNT: usize = 1

Source§

fn get_byte_slice(&self, index: usize) -> (u64, &'a [u8])

Implementors§

Source§

impl<'a, BC: AsBytes<'a>, VC: AsBytes<'a>> AsBytes<'a> for Strings<BC, VC>

Source§

impl<'a, BC: AsBytes<'a>> AsBytes<'a> for Strides<BC, &'a [u64]>

Source§

impl<'a, C: AsBytes<'a>> AsBytes<'a> for Boxed<C>

Source§

const SLICE_COUNT: usize = C::SLICE_COUNT

Source§

impl<'a, CC: AsBytes<'a>, VC: AsBytes<'a>> AsBytes<'a> for RankSelect<CC, VC, &'a [u64]>

Source§

impl<'a, CV: AsBytes<'a>> AsBytes<'a> for Chars<CV>

Source§

const SLICE_COUNT: usize = CV::SLICE_COUNT

Source§

impl<'a, CV: AsBytes<'a>> AsBytes<'a> for I128s<CV>

Source§

const SLICE_COUNT: usize = CV::SLICE_COUNT

Source§

impl<'a, CV: AsBytes<'a>> AsBytes<'a> for Isizes<CV>

Source§

const SLICE_COUNT: usize = CV::SLICE_COUNT

Source§

impl<'a, CV: AsBytes<'a>> AsBytes<'a> for U128s<CV>

Source§

const SLICE_COUNT: usize = CV::SLICE_COUNT

Source§

impl<'a, CV: AsBytes<'a>> AsBytes<'a> for Usizes<CV>

Source§

const SLICE_COUNT: usize = CV::SLICE_COUNT

Source§

impl<'a, CVar: AsBytes<'a>, COff: AsBytes<'a>> AsBytes<'a> for Discriminant<CVar, COff>

Source§

impl<'a, SC: AsBytes<'a>, NC: AsBytes<'a>> AsBytes<'a> for Durations<SC, NC>

Source§

impl<'a, SC: AsBytes<'a>, TC: AsBytes<'a>, CC: AsBytes<'a>, VC: AsBytes<'a>> AsBytes<'a> for Results<SC, TC, CC, VC, &'a [u64]>

Source§

impl<'a, TC: AsBytes<'a>, BC: AsBytes<'a>> AsBytes<'a> for Trees<TC, BC>

Source§

impl<'a, TC: AsBytes<'a>, BC: AsBytes<'a>> AsBytes<'a> for Vecs<TC, BC>

Source§

impl<'a, TC: AsBytes<'a>, CC: AsBytes<'a>, VC: AsBytes<'a>> AsBytes<'a> for Options<TC, CC, VC, &'a [u64]>

Source§

impl<'a, TC: AsBytes<'a>, CC: AsBytes<'a>, VC: AsBytes<'a>> AsBytes<'a> for Repeats<TC, CC, VC, &'a [u64]>

Source§

impl<'a, TC: AsBytes<'a>, VC: AsBytes<'a>, CC: AsBytes<'a>, RC: AsBytes<'a>> AsBytes<'a> for Lookbacks<TC, VC, CC, RC, &'a [u64]>

Source§

impl<'a, VC: AsBytes<'a>> AsBytes<'a> for Bools<VC, &'a [u64]>

Source§

impl<'a, const K: u64> AsBytes<'a> for Fixeds<K, &'a u64>

Source§

impl<'a> AsBytes<'a> for Empties<&'a u64>