pub enum CowShape {
Borrowed(&'static [usize]),
Owned(Shape),
}Expand description
Copy-on-write shape wrapper for deferred allocation
Variants§
Borrowed(&'static [usize])
Borrowed reference to existing shape (zero-copy)
Owned(Shape)
Owned shape data
Implementations§
Source§impl CowShape
impl CowShape
Sourcepub const fn from_static(dims: &'static [usize]) -> Self
pub const fn from_static(dims: &'static [usize]) -> Self
Create from static slice (zero allocation)
Sourcepub fn from_owned(shape: Shape) -> Self
pub fn from_owned(shape: Shape) -> Self
Create from owned shape
Sourcepub fn into_owned(self) -> Shape
pub fn into_owned(self) -> Shape
Convert to owned shape (allocates if borrowed)
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for CowShape
impl RefUnwindSafe for CowShape
impl Send for CowShape
impl Sync for CowShape
impl Unpin for CowShape
impl UnsafeUnpin for CowShape
impl UnwindSafe for CowShape
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