[−][src]Struct len_constraints::slice::Relative
An immutable slice with a relative length as length constraint
Note: Unlike the other constrained slices, this type does not necessarily 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 try_from(
slice: &'a [T],
relative_to: usize
) -> Result<Self, Box<dyn Error + 'static>>
[src]
slice: &'a [T],
relative_to: usize
) -> Result<Self, Box<dyn Error + 'static>>
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]
self,
relative_to: usize
) -> Result<&'a [T], Box<dyn Error + 'static>>
Computes the expected relative length from relative_to
, validates the wrapped slice
against in and returns it on success
Trait Implementations
impl<'a, T: Clone, Op: Clone + Operator, By: Clone + TypeNum> Clone for Relative<'a, T, Op, By>
[src]
fn clone(&self) -> 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]
impl<'a, T: Copy, Op: Copy + Operator, By: Copy + TypeNum> Copy for Relative<'a, T, Op, By>
[src]
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,
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,
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]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,