pub struct ArrayView<'a, T> where
T: for<'b> Struct<'b>, { /* 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
. The former
provides a method to create an ArrayView
to it. Note that, that an array
view does not hold the data itself.
An archive provides a getter for each vector resource, which returns an
array view.
use flatdata::{ArrayView, Vector};
define_struct!(
A,
RefA,
RefMutA,
"no_schema",
4,
(x, set_x, u32, 0, 16),
(y, set_y, u32, 16, 16)
);
let mut v: Vector<A> = Vector::with_len(1);
{
let mut a = v.at_mut(0);
a.set_x(1);
a.set_y(2);
}
let view: ArrayView<_> = v.as_view();
let a = view.at(0);
assert_eq!(a.x(), 1);
assert_eq!(a.y(), 2);
Creates a new ArrayView
to the data at the given address.
The returned array view does not own the data.
Number of elements in the array.
Return true
if the array is empty.
Returns a read-only handle to the element in the array at position
index
.
Panics if index is greater than or equal to ArrayView::len()
.
Slice this array view by a given range.
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.
Returns a raw bytes representation of the underlying array data.
Performs copy-assignment from source
. Read more
Formats the value using the given formatter. Read more
Creates owned data from borrowed data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static