Trait flatk::Isolate [−][src]
Since we cannot alias mutable references, in order to index a mutable view
of elements, we must consume the original mutable reference. Since we can't
use slices for general composable collections, its impossible to match
against a &mut self
in the getter function to be able to use it with owned
collections, so we opt to have an interface that is designed specifically
for mutably borrowed collections. For composable collections, this is better
described by a subview operator, which is precisely what this trait
represents. Incidentally this can also work for owned collections, which is
why it's called Isolate
instead of SubView
.
Associated Types
Loading content...Required methods
unsafe fn isolate_unchecked(self, idx: I) -> Self::Output
[src]
fn try_isolate(self, idx: I) -> Option<Self::Output>
[src]
Provided methods
fn isolate(self, idx: I) -> Self::Output where
Self: Sized,
[src]
Self: Sized,
Return a value at the given index. This is provided as the checked
version of try_isolate
that will panic if the equivalent try_isolate
call is None
, which typically means that the given index is out of
bounds.
Panics
This function will panic if self.get(idx)
returns None
.
Implementors
impl<S, I> Isolate<I> for S where
I: IsolateIndex<Self>,
[src]
I: IsolateIndex<Self>,
A blanket implementation of Isolate
for any collection which has an implementation for IsolateIndex
.