pub struct Storage { /* private fields */ }Expand description
Thread-safe reference-counted storage for tensor data.
This structure provides a safe wrapper around memory storage with automatic cleanup and reference counting capabilities.
Implementations§
Source§impl Storage
impl Storage
Sourcepub fn strong_count(&self) -> usize
pub fn strong_count(&self) -> usize
Returns the current reference count for this storage.
This shows how many Storage instances are sharing the same underlying memory.
Sourcepub fn from_vec<T: TensorElement>(data: Vec<T>) -> Result<Self>
pub fn from_vec<T: TensorElement>(data: Vec<T>) -> Result<Self>
Creates a new storage from an existing Vec.
Takes ownership of the Vec and manages its memory through the storage system. The Vec’s memory will be properly deallocated when the storage is dropped.
§Parameters
data- The Vec to take ownership of
§Returns
A new Storage instance wrapping the Vec’s memory or an error.
Trait Implementations§
Source§impl StorageTrait for &Storage
impl StorageTrait for &Storage
Source§impl StorageTrait for Storage
impl StorageTrait for Storage
impl Send for Storage
impl Sync for Storage
Auto Trait Implementations§
impl Freeze for Storage
impl RefUnwindSafe for Storage
impl Unpin for Storage
impl UnwindSafe for Storage
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