[][src]Struct disjoint_borrow::DisjointSlice

pub struct DisjointSlice<'a, T, Borrows, MutBorrows> { /* fields omitted */ }

A slice that allows disjoint borrows over its elements. Mutable borrows may not intersect any other borrows, but immutable borrows may intersect other immutable borrows.

Functions that borrow slices returns a new DisjointSlice object as the first parameter and the slice as the second. The returned DisjointSlice object can be used to borrow further slcies.

See the package documentation for more information.

Methods

impl<'a, T> DisjointSlice<'a, T, (), ()>[src]

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

Creates a new DistjointSlice from a mutable slice.

impl<'a, T, Borrows, MutBorrows> DisjointSlice<'a, T, Borrows, MutBorrows> where
    Borrows: RangeSet,
    MutBorrows: RangeSet
[src]

pub fn len(&self) -> usize[src]

Gets the length of the underlying slice.

pub fn is_empty(&self) -> bool[src]

Returns true if the underlying slice is empty.

pub fn get<'b, R>(
    &'b mut self,
    index: R
) -> (DisjointSlice<'b, T, RangeLink<&'b Borrows>, &'b MutBorrows>, &'b [T]) where
    R: RangeBounds<usize>, 
[src]

Rertrieves an immutable subslice, panicking if the range is out of range of the slice or it intersects with any other mutable borrowed slices.

pub fn try_get<'b, R>(
    &'b mut self,
    range: R
) -> Result<(DisjointSlice<'b, T, RangeLink<&'b Borrows>, &'b MutBorrows>, &'b [T]), Error> where
    R: RangeBounds<usize>, 
[src]

Retrieves an immutable subslice, returning Ok if successfull or Err if the range is out of range of the slice or intersects with a mutable borrow.

pub fn get_mut<'b, R>(
    &'b mut self,
    index: R
) -> (DisjointSlice<'b, T, &'b Borrows, RangeLink<&'b MutBorrows>>, &'b mut [T]) where
    R: RangeBounds<usize>, 
[src]

Rertrieves a mutable subslice, panicking if the range is out of range of the slice or it intersects with any other immuitable or mutable borrowed slices.

pub fn try_get_mut<'b, R>(
    &'b mut self,
    range: R
) -> Result<(DisjointSlice<'b, T, &'b Borrows, RangeLink<&'b MutBorrows>>, &'b mut [T]), Error> where
    R: RangeBounds<usize>, 
[src]

Retrieves an immutable subslice, returning Ok if successfull or Err if the range is out of range of the slice or intersects with any other immutable or mutable borrow.

Trait Implementations

impl<'a, T, Borrows, MutBorrows> Debug for DisjointSlice<'a, T, Borrows, MutBorrows> where
    Borrows: RangeSet,
    MutBorrows: RangeSet
[src]

impl<'a, T, Borrows, MutBorrows> Sync for DisjointSlice<'a, T, Borrows, MutBorrows> where
    T: Sync
[src]

impl<'a, T, Borrows, MutBorrows> Send for DisjointSlice<'a, T, Borrows, MutBorrows> where
    T: Send
[src]

Auto Trait Implementations

impl<'a, T, Borrows, MutBorrows> Unpin for DisjointSlice<'a, T, Borrows, MutBorrows> where
    Borrows: Unpin,
    MutBorrows: Unpin

Blanket Implementations

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> Into<U> for T where
    U: From<T>, 
[src]

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

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> Borrow<T> for T where
    T: ?Sized
[src]

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

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