[][src]Struct libra_proptest_helpers::Index

pub struct Index(_);

Wrapper for proptest's [Index][proptest::sample::Index] that allows AsRef to work.

There is no blanket impl<T> AsRef<T> for T, so &[PropIndex] doesn't work with &[impl AsRef<PropIndex>] (unless an impl gets added upstream). Index does.

Methods from Deref<Target = PropIndex>

pub fn index(&self, size: usize) -> usize

Return the real index that would be used to index a collection of size size.

Panics

Panics if size == 0.

pub fn get<T>(&self, slice: &'a [T]) -> &'a T

Return a reference to the element in slice that this Index refers to.

A shortcut for &slice[index.index(slice.len())].

pub fn get_mut<T>(&self, slice: &'a mut [T]) -> &'a mut T

Return a mutable reference to the element in slice that this Index refers to.

A shortcut for &mut slice[index.index(slice.len())].

Trait Implementations

impl Arbitrary for Index[src]

type Parameters = <PropIndex as Arbitrary>::Parameters

The type of parameters that [arbitrary_with] accepts for configuration of the generated [Strategy]. Parameters must implement [Default]. Read more

type Strategy = Map<(<PropIndex as Arbitrary>::Strategy,), fn(_: (PropIndex,)) -> Self>

The type of [Strategy] used to generate values of type Self. Read more

impl AsRef<Index> for Index[src]

impl Clone for Index[src]

impl Copy for Index[src]

impl Debug for Index[src]

impl Deref for Index[src]

type Target = PropIndex

The resulting type after dereferencing.

Auto Trait Implementations

impl RefUnwindSafe for Index

impl Send for Index

impl Sync for Index

impl Unpin for Index

impl UnwindSafe for Index

Blanket Implementations

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

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

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

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

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

impl<T> Pointable for T

type Init = T

The type for initializers.

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

type Owned = T

The resulting type after obtaining ownership.

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<V, T> VZip<V> for T where
    V: MultiLane<T>,