pub struct PyBufferFlags<const FORMAT: bool = false, const SHAPE: bool = false, const STRIDE: bool = false, const WRITABLE: bool = false, const CONTIGUITY: u8 = CONTIGUITY_UNDEFINED>(/* private fields */);Expand description
Type-safe buffer request flags. The const parameters encode which fields the exporter is required to fill.
Implementations§
Source§impl<const SHAPE: bool, const STRIDE: bool, const WRITABLE: bool, const CONTIGUITY: u8> PyBufferFlags<false, SHAPE, STRIDE, WRITABLE, CONTIGUITY>
impl<const SHAPE: bool, const STRIDE: bool, const WRITABLE: bool, const CONTIGUITY: u8> PyBufferFlags<false, SHAPE, STRIDE, WRITABLE, CONTIGUITY>
Sourcepub const fn format(
self,
) -> PyBufferFlags<true, SHAPE, STRIDE, WRITABLE, CONTIGUITY>
pub const fn format( self, ) -> PyBufferFlags<true, SHAPE, STRIDE, WRITABLE, CONTIGUITY>
Request format information.
Source§impl<const FORMAT: bool, const STRIDE: bool, const WRITABLE: bool, const CONTIGUITY: u8> PyBufferFlags<FORMAT, false, STRIDE, WRITABLE, CONTIGUITY>
impl<const FORMAT: bool, const STRIDE: bool, const WRITABLE: bool, const CONTIGUITY: u8> PyBufferFlags<FORMAT, false, STRIDE, WRITABLE, CONTIGUITY>
Sourcepub const fn nd(
self,
) -> PyBufferFlags<FORMAT, true, STRIDE, WRITABLE, CONTIGUITY>
pub const fn nd( self, ) -> PyBufferFlags<FORMAT, true, STRIDE, WRITABLE, CONTIGUITY>
Request shape information.
Source§impl<const FORMAT: bool, const SHAPE: bool, const WRITABLE: bool, const CONTIGUITY: u8> PyBufferFlags<FORMAT, SHAPE, false, WRITABLE, CONTIGUITY>
impl<const FORMAT: bool, const SHAPE: bool, const WRITABLE: bool, const CONTIGUITY: u8> PyBufferFlags<FORMAT, SHAPE, false, WRITABLE, CONTIGUITY>
Sourcepub const fn strides(
self,
) -> PyBufferFlags<FORMAT, true, true, WRITABLE, CONTIGUITY>
pub const fn strides( self, ) -> PyBufferFlags<FORMAT, true, true, WRITABLE, CONTIGUITY>
Request strides information. Implies shape.
Sourcepub const fn indirect(
self,
) -> PyBufferFlags<FORMAT, true, true, WRITABLE, CONTIGUITY>
pub const fn indirect( self, ) -> PyBufferFlags<FORMAT, true, true, WRITABLE, CONTIGUITY>
Request suboffsets (indirect). Implies shape and strides.
Source§impl<const FORMAT: bool, const SHAPE: bool, const STRIDE: bool, const CONTIGUITY: u8> PyBufferFlags<FORMAT, SHAPE, STRIDE, false, CONTIGUITY>
impl<const FORMAT: bool, const SHAPE: bool, const STRIDE: bool, const CONTIGUITY: u8> PyBufferFlags<FORMAT, SHAPE, STRIDE, false, CONTIGUITY>
Sourcepub const fn writable(
self,
) -> PyBufferFlags<FORMAT, SHAPE, STRIDE, true, CONTIGUITY>
pub const fn writable( self, ) -> PyBufferFlags<FORMAT, SHAPE, STRIDE, true, CONTIGUITY>
Request a writable buffer.
Source§impl<const FORMAT: bool, const SHAPE: bool, const STRIDE: bool, const WRITABLE: bool> PyBufferFlags<FORMAT, SHAPE, STRIDE, WRITABLE, CONTIGUITY_UNDEFINED>
impl<const FORMAT: bool, const SHAPE: bool, const STRIDE: bool, const WRITABLE: bool> PyBufferFlags<FORMAT, SHAPE, STRIDE, WRITABLE, CONTIGUITY_UNDEFINED>
Sourcepub const fn c_contiguous(
self,
) -> PyBufferFlags<FORMAT, true, true, WRITABLE, CONTIGUITY_C>
pub const fn c_contiguous( self, ) -> PyBufferFlags<FORMAT, true, true, WRITABLE, CONTIGUITY_C>
Require C-contiguous layout. Implies shape and strides.
Sourcepub const fn f_contiguous(
self,
) -> PyBufferFlags<FORMAT, true, true, WRITABLE, CONTIGUITY_F>
pub const fn f_contiguous( self, ) -> PyBufferFlags<FORMAT, true, true, WRITABLE, CONTIGUITY_F>
Require Fortran-contiguous layout. Implies shape and strides.
Sourcepub const fn any_contiguous(
self,
) -> PyBufferFlags<FORMAT, true, true, WRITABLE, CONTIGUITY_ANY>
pub const fn any_contiguous( self, ) -> PyBufferFlags<FORMAT, true, true, WRITABLE, CONTIGUITY_ANY>
Require contiguous layout (C or Fortran). Implies shape and strides.
The specific contiguity order is not known at compile time, so this does not unlock non-Option slice accessors.
Source§impl PyBufferFlags
impl PyBufferFlags
Sourcepub const fn simple() -> PyBufferFlags
pub const fn simple() -> PyBufferFlags
Create a base buffer request. Chain builder methods to add flags.
Sourcepub const fn full() -> PyBufferFlags<true, true, true, true>
pub const fn full() -> PyBufferFlags<true, true, true, true>
Create a writable request for all buffer information including suboffsets.
Sourcepub const fn full_ro() -> PyBufferFlags<true, true, true>
pub const fn full_ro() -> PyBufferFlags<true, true, true>
Create a read-only request for all buffer information including suboffsets.
Sourcepub const fn records() -> PyBufferFlags<true, true, true, true>
pub const fn records() -> PyBufferFlags<true, true, true, true>
Create a writable request for format, shape, and strides.
Sourcepub const fn records_ro() -> PyBufferFlags<true, true, true>
pub const fn records_ro() -> PyBufferFlags<true, true, true>
Create a read-only request for format, shape, and strides.
Sourcepub const fn strided() -> PyBufferFlags<false, true, true, true>
pub const fn strided() -> PyBufferFlags<false, true, true, true>
Create a writable request for shape and strides.
Sourcepub const fn strided_ro() -> PyBufferFlags<false, true, true>
pub const fn strided_ro() -> PyBufferFlags<false, true, true>
Create a read-only request for shape and strides.
Sourcepub const fn contig() -> PyBufferFlags<false, true, false, true, CONTIGUITY_C>
pub const fn contig() -> PyBufferFlags<false, true, false, true, CONTIGUITY_C>
Create a writable C-contiguous request.
Sourcepub const fn contig_ro() -> PyBufferFlags<false, true, false, false, CONTIGUITY_C>
pub const fn contig_ro() -> PyBufferFlags<false, true, false, false, CONTIGUITY_C>
Create a read-only C-contiguous request.
Trait Implementations§
Source§impl<const FORMAT: bool, const SHAPE: bool, const STRIDE: bool, const WRITABLE: bool, const CONTIGUITY_REQ: u8> PyBufferFlagsType for PyBufferFlags<FORMAT, SHAPE, STRIDE, WRITABLE, CONTIGUITY_REQ>
impl<const FORMAT: bool, const SHAPE: bool, const STRIDE: bool, const WRITABLE: bool, const CONTIGUITY_REQ: u8> PyBufferFlagsType for PyBufferFlags<FORMAT, SHAPE, STRIDE, WRITABLE, CONTIGUITY_REQ>
Source§const CONTIGUITY: u8 = CONTIGUITY_REQ
const CONTIGUITY: u8 = CONTIGUITY_REQ
Auto Trait Implementations§
impl<const FORMAT: bool, const SHAPE: bool, const STRIDE: bool, const WRITABLE: bool, const CONTIGUITY: u8> Freeze for PyBufferFlags<FORMAT, SHAPE, STRIDE, WRITABLE, CONTIGUITY>
impl<const FORMAT: bool, const SHAPE: bool, const STRIDE: bool, const WRITABLE: bool, const CONTIGUITY: u8> RefUnwindSafe for PyBufferFlags<FORMAT, SHAPE, STRIDE, WRITABLE, CONTIGUITY>
impl<const FORMAT: bool, const SHAPE: bool, const STRIDE: bool, const WRITABLE: bool, const CONTIGUITY: u8> Send for PyBufferFlags<FORMAT, SHAPE, STRIDE, WRITABLE, CONTIGUITY>
impl<const FORMAT: bool, const SHAPE: bool, const STRIDE: bool, const WRITABLE: bool, const CONTIGUITY: u8> Sync for PyBufferFlags<FORMAT, SHAPE, STRIDE, WRITABLE, CONTIGUITY>
impl<const FORMAT: bool, const SHAPE: bool, const STRIDE: bool, const WRITABLE: bool, const CONTIGUITY: u8> Unpin for PyBufferFlags<FORMAT, SHAPE, STRIDE, WRITABLE, CONTIGUITY>
impl<const FORMAT: bool, const SHAPE: bool, const STRIDE: bool, const WRITABLE: bool, const CONTIGUITY: u8> UnsafeUnpin for PyBufferFlags<FORMAT, SHAPE, STRIDE, WRITABLE, CONTIGUITY>
impl<const FORMAT: bool, const SHAPE: bool, const STRIDE: bool, const WRITABLE: bool, const CONTIGUITY: u8> UnwindSafe for PyBufferFlags<FORMAT, SHAPE, STRIDE, WRITABLE, CONTIGUITY>
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
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>
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>
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