pub struct BufferDescriptor {
pub len: usize,
pub readonly: bool,
pub itemsize: usize,
pub format: Cow<'static, str>,
pub dim_desc: Vec<(usize, isize, isize)>,
}
Fields§
§len: usize
product(shape) * itemsize bytes length, but not the length for obj_bytes() even is contiguous
readonly: bool
§itemsize: usize
§format: Cow<'static, str>
§dim_desc: Vec<(usize, isize, isize)>
(shape, stride, suboffset) for each dimension
Implementations§
Source§impl BufferDescriptor
impl BufferDescriptor
pub fn simple(bytes_len: usize, readonly: bool) -> Self
pub fn format( bytes_len: usize, readonly: bool, itemsize: usize, format: Cow<'static, str>, ) -> Self
pub fn validate(self) -> Self
pub fn ndim(&self) -> usize
pub fn is_contiguous(&self) -> bool
Sourcepub fn fast_position(&self, indices: &[usize]) -> isize
pub fn fast_position(&self, indices: &[usize]) -> isize
this function do not check the bound panic if indices.len() != ndim
Sourcepub fn position(
&self,
indices: &[isize],
vm: &VirtualMachine,
) -> PyResult<isize>
pub fn position( &self, indices: &[isize], vm: &VirtualMachine, ) -> PyResult<isize>
panic if indices.len() != ndim
pub fn for_each_segment<F>(&self, try_conti: bool, f: F)
Sourcepub fn zip_eq<F>(&self, other: &Self, try_conti: bool, f: F)
pub fn zip_eq<F>(&self, other: &Self, try_conti: bool, f: F)
zip two BufferDescriptor with the same shape
pub fn is_zero_in_shape(&self) -> bool
Trait Implementations§
Source§impl Clone for BufferDescriptor
impl Clone for BufferDescriptor
Source§fn clone(&self) -> BufferDescriptor
fn clone(&self) -> BufferDescriptor
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for BufferDescriptor
impl RefUnwindSafe for BufferDescriptor
impl Send for BufferDescriptor
impl Sync for BufferDescriptor
impl Unpin for BufferDescriptor
impl UnwindSafe for BufferDescriptor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more