[−][src]Struct disjoint_borrow::DisjointSlice
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]
impl<'a, T, Borrows, MutBorrows> DisjointSlice<'a, T, Borrows, MutBorrows> where
Borrows: RangeSet,
MutBorrows: RangeSet,
[src]
Borrows: RangeSet,
MutBorrows: RangeSet,
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]
&'b mut self,
index: R
) -> (DisjointSlice<'b, T, RangeLink<&'b Borrows>, &'b MutBorrows>, &'b [T]) where
R: RangeBounds<usize>,
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]
&'b mut self,
range: R
) -> Result<(DisjointSlice<'b, T, RangeLink<&'b Borrows>, &'b MutBorrows>, &'b [T]), Error> where
R: RangeBounds<usize>,
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]
&'b mut self,
index: R
) -> (DisjointSlice<'b, T, &'b Borrows, RangeLink<&'b MutBorrows>>, &'b mut [T]) where
R: RangeBounds<usize>,
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]
&'b mut self,
range: R
) -> Result<(DisjointSlice<'b, T, &'b Borrows, RangeLink<&'b MutBorrows>>, &'b mut [T]), Error> where
R: RangeBounds<usize>,
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]
Borrows: RangeSet,
MutBorrows: RangeSet,
impl<'a, T, Borrows, MutBorrows> Sync for DisjointSlice<'a, T, Borrows, MutBorrows> where
T: Sync,
[src]
T: Sync,
impl<'a, T, Borrows, MutBorrows> Send for DisjointSlice<'a, T, Borrows, MutBorrows> where
T: Send,
[src]
T: Send,
Auto Trait Implementations
impl<'a, T, Borrows, MutBorrows> Unpin for DisjointSlice<'a, T, Borrows, MutBorrows> where
Borrows: Unpin,
MutBorrows: Unpin,
Borrows: Unpin,
MutBorrows: Unpin,
Blanket Implementations
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> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[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> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,