[][src]Struct len_constraints::slice::Relative

pub struct Relative<'a, T, Op: Operator, By: TypeNum> { /* fields omitted */ }

An immutable slice with a relative length as length constraint

Note: Unlike the other constrained slices, this type does not validate the constraint on construction but on deconstruction (self.try_into())

Methods

impl<'a, T, Op: Operator, By: TypeNum> Relative<'a, T, Op, By>[src]

pub fn get_slice(
    self,
    relative_to: usize
) -> Result<&'a [T], Box<dyn Error + 'static>>
[src]

Computes the expected relative length from relative_to, validates the wrapped slice against in and returns it on success

Trait Implementations

impl<'a, T: Copy, Op: Copy + Operator, By: Copy + TypeNum> Copy for Relative<'a, T, Op, By>[src]

impl<'a, T: Clone, Op: Clone + Operator, By: Clone + TypeNum> Clone for Relative<'a, T, Op, By>[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl<'a, T, Op: Operator, By: TypeNum> From<&'a [T]> for Relative<'a, T, Op, By>[src]

fn from(slice: &'a [T]) -> Self[src]

Creates a new relative constrained slice

impl<'a, T: Debug, Op: Debug + Operator, By: Debug + TypeNum> Debug for Relative<'a, T, Op, By>[src]

Auto Trait Implementations

impl<'a, T, Op, By> Send for Relative<'a, T, Op, By> where
    By: Send,
    Op: Send,
    T: Sync

impl<'a, T, Op, By> Sync for Relative<'a, T, Op, By> where
    By: Sync,
    Op: Sync,
    T: Sync

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]