Struct flatcontainer::impls::slice::ReadSlice

source ·
pub struct ReadSlice<'a, C: Region, O: OffsetContainer<C::Index> = Vec<<C as Region>::Index>>(/* private fields */);
Expand description

A helper to read data out of a slice region.

Implementations§

source§

impl<C: Region, O: OffsetContainer<C::Index>> ReadSlice<'_, C, O>

source

pub fn get(&self, index: usize) -> C::ReadItem<'_>

Read the n-th item from the underlying region.

§Panics

Panics if the index is out of bounds, i.e., it is larger than the length of this slice representation.

source

pub fn len(&self) -> usize

The number of elements in this slice.

source

pub fn is_empty(&self) -> bool

Returns true if the slice is empty.

source

pub fn iter(&self) -> <Self as IntoIterator>::IntoIter

Returns an iterator over all contained items.

Trait Implementations§

source§

impl<C: Region, O: OffsetContainer<C::Index>> Clone for ReadSlice<'_, C, O>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<C: Region, O: OffsetContainer<C::Index>> Debug for ReadSlice<'_, C, O>
where for<'a> C::ReadItem<'a>: Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a, C: Region, O: OffsetContainer<C::Index>> IntoIterator for ReadSlice<'a, C, O>

§

type Item = <C as Region>::ReadItem<'a>

The type of the elements being iterated over.
§

type IntoIter = ReadSliceIter<'a, C, O>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl<'a, C, O> IntoOwned<'a> for ReadSlice<'a, C, O>
where C: Region, O: OffsetContainer<C::Index>,

§

type Owned = Vec<<C as Region>::Owned>

Owned type into which this type can be converted.
source§

fn into_owned(self) -> Self::Owned

Conversion from an instance of this type to the owned type.
source§

fn clone_onto(self, other: &mut Self::Owned)

Clones self onto an existing instance of the owned type.
source§

fn borrow_as(owned: &'a Self::Owned) -> Self

Borrows an owned instance as oneself.
source§

impl<'a, C, O> Push<ReadSlice<'a, C, O>> for SliceRegion<C, O>
where C: Region + Push<<C as Region>::ReadItem<'a>>, O: OffsetContainer<C::Index>,

source§

fn push( &mut self, item: ReadSlice<'a, C, O> ) -> <SliceRegion<C, O> as Region>::Index

Push item into self, returning an index that allows to look up the corresponding read item.
source§

impl<'a, R, O> ReserveItems<ReadSlice<'a, R, O>> for SliceRegion<R, O>
where R: Region + ReserveItems<<R as Region>::ReadItem<'a>> + 'a, O: OffsetContainer<R::Index>,

source§

fn reserve_items<I>(&mut self, items: I)
where I: Iterator<Item = ReadSlice<'a, R, O>> + Clone,

Ensure that the region can absorb items without reallocation.
source§

impl<C: Region, O: OffsetContainer<C::Index>> Copy for ReadSlice<'_, C, O>

Auto Trait Implementations§

§

impl<'a, C, O> Freeze for ReadSlice<'a, C, O>

§

impl<'a, C, O> RefUnwindSafe for ReadSlice<'a, C, O>

§

impl<'a, C, O> Send for ReadSlice<'a, C, O>
where <C as Region>::Owned: Sync, O: Sync, C: Sync,

§

impl<'a, C, O> Sync for ReadSlice<'a, C, O>
where <C as Region>::Owned: Sync, O: Sync, C: Sync,

§

impl<'a, C, O> Unpin for ReadSlice<'a, C, O>

§

impl<'a, C, O> UnwindSafe for ReadSlice<'a, C, O>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.