[][src]Struct len_constraints::slice_mut::RelativeMut

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

A mutable 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> RelativeMut<'a, T, Op, By>[src]

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

Validates slice against the length constraint and creates the constrained slice with it

pub fn 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

pub fn slice_mut(
    self,
    relative_to: usize
) -> Result<&'a mut [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, Op: Operator, By: TypeNum> From<&'a mut [T]> for RelativeMut<'a, T, Op, By>[src]

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

Creates a new relative constrained slice

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

Auto Trait Implementations

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

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

Blanket Implementations

impl<T> From<T> for T[src]

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

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

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> 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> BorrowMut<T> for T where
    T: ?Sized
[src]

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

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