[][src]Struct flatdata::ArrayView

pub struct ArrayView<'a, T> where
    T: RefFactory
{ /* fields omitted */ }

A read-only view on a contiguous sequence of flatdata structs of the same type T.

The sequence is written using Vector or ExternalVector. For detailed examples see either of the two.

An archive provides a getter for each vector resource, which returns an array view.

Methods

impl<'a, T> ArrayView<'a, T> where
    T: RefFactory
[src]

pub fn new(data: &'a [u8]) -> Self[src]

Creates a new ArrayView to the data at the given address.

The returned array view does not own the data.

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

Number of elements in the array.

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

Return true if the array is empty.

pub fn at(&self, index: usize) -> <T as Struct<'a>>::Item[src]

Returns a read-only handle to the element in the array at position index.

Panics

Panics if index is greater than or equal to ArrayView::len().

pub fn slice<R: RangeBounds<usize>>(&self, range: R) -> Self[src]

Slice this array view by a given range.

Panics

Panics if the range is outside of bounds of array view.

pub fn iter(&self) -> ArrayViewIter<'a, T>[src]

Returns an iterator to the elements of the array.

pub fn as_bytes(&self) -> &[u8][src]

Returns a raw bytes representation of the underlying array data.

Trait Implementations

impl<'a, T: Clone> Clone for ArrayView<'a, T> where
    T: RefFactory
[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<'a, T> From<&'a Vector<T>> for ArrayView<'a, T> where
    T: RefFactory
[src]

impl<'a, T> IntoIterator for ArrayView<'a, T> where
    T: RefFactory
[src]

type Item = <ArrayViewIter<'a, T> as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = ArrayViewIter<'a, T>

Which kind of iterator are we turning this into?

impl<'a, '_, T> IntoIterator for &'_ ArrayView<'a, T> where
    T: RefFactory
[src]

type Item = <ArrayViewIter<'a, T> as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = ArrayViewIter<'a, T>

Which kind of iterator are we turning this into?

impl<'a, T> AsRef<[u8]> for ArrayView<'a, T> where
    T: RefFactory
[src]

impl<'a, T> Debug for ArrayView<'a, T> where
    T: RefFactory
[src]

Auto Trait Implementations

impl<'a, T> Sync for ArrayView<'a, T> where
    T: Sync

impl<'a, T> Unpin for ArrayView<'a, T> where
    T: Unpin

impl<'a, T> Send for ArrayView<'a, T> where
    T: Send

impl<'a, T> UnwindSafe for ArrayView<'a, T> where
    T: UnwindSafe

impl<'a, T> RefUnwindSafe for ArrayView<'a, T> where
    T: RefUnwindSafe

Blanket Implementations

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

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

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

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

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

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