Trait ndarray_npy::ViewMutElement [−][src]
pub trait ViewMutElement: Sized {
fn bytes_as_mut_slice<'a>(
bytes: &'a mut [u8],
type_desc: &PyValue,
len: usize
) -> Result<&'a mut [Self], ViewDataError>;
}Expand description
An array element type that can be mutably viewed (without copying) in an
.npy file.
Required methods
fn bytes_as_mut_slice<'a>(
bytes: &'a mut [u8],
type_desc: &PyValue,
len: usize
) -> Result<&'a mut [Self], ViewDataError>
fn bytes_as_mut_slice<'a>(
bytes: &'a mut [u8],
type_desc: &PyValue,
len: usize
) -> Result<&'a mut [Self], ViewDataError>
Casts bytes into a mutable slice of elements of length len.
Returns Err(_) in at least the following cases:
- if the
type_descdoes not matchSelfwith native endianness - if the
bytesslice is misaligned for elements of typeSelf - if the
bytesslice is too short forlenelements - if the
bytesslice has extra bytes afterlenelements
May panic if len * size_of::<Self>() overflows.