[−][src]Type Definition ndarray::
type RawArrayView<A, D> = ArrayBase<RawViewRepr<*const A>, D>;
A read-only array view without a lifetime.
This is similar to
ArrayView but does not carry any lifetime or
ownership information, and its data cannot be read without an unsafe
conversion into an
ArrayView. The relationship between
ArrayView is somewhat analogous to the relationship between
*const T and
RawArrayView has additional requirements that
does not, such as alignment and non-nullness.
RawArrayView<A, D> is parameterized by
A for the element type and
D for the dimensionality.
Raw array views have all the methods of an array (see
You can't use this type wih an arbitrary raw pointer; see
from_shape_ptr for details.
impl<A, D> RawArrayView<A, D> where[src]
pub unsafe fn from_shape_ptr<Sh>(shape: Sh, ptr: *const A) -> Self where[src]
RawArrayView<A, D> from shape information and a raw pointer
to the elements.
Unsafe because caller is responsible for ensuring all of the following:
ptrmust be non-null and aligned, and it must be safe to
It must be safe to
.offset()the pointer repeatedly along all axes and calculate the
counts for the
.offset()calls without overflow, even if the array is empty or the elements are zero-sized.
In other words,
All possible pointers generated by moving along all axes must be in bounds or one byte past the end of a single allocation with element type
A. The only exceptions are if the array is empty or the element type is zero-sized. In these cases,
ptrmay be dangling, but it must still be safe to
.offset()the pointer along the axes.
The offset in units of bytes between the least address and greatest address by moving along all axes must not exceed
isize::MAX. This constraint prevents the computed offset, in bytes, from overflowing
isizeregardless of the starting point due to past offsets.
The offset in units of
Abetween the least address and greatest address by moving along all axes must not exceed
isize::MAX. This constraint prevents overflow when calculating the
.offset()regardless of the starting point due to past offsets.
The product of non-zero axis lengths must not exceed
pub unsafe fn deref_into_view<'a>(self) -> ArrayView<'a, A, D>[src]
Converts to a read-only view of the array.
Warning from a safety standpoint, this is equivalent to dereferencing a raw pointer for every element in the array. You must ensure that all of the data is valid and choose the correct lifetime.
Split the array view along
axis and return one array pointer strictly
before the split and one array pointer after the split.
index is out of bounds.