pub struct UuidMapTensorLibrary<B: Backend> { /* private fields */ }Expand description
A TensorLibrary backed by a uuid::Uuid keyed HashMap.
Implementations§
Source§impl<B: Backend> UuidMapTensorLibrary<B>
impl<B: Backend> UuidMapTensorLibrary<B>
Sourcepub fn hash_map_mut(&mut self) -> &mut HashMap<Uuid, DynTensor<B>>
pub fn hash_map_mut(&mut self) -> &mut HashMap<Uuid, DynTensor<B>>
Get a mutable reference to the internal map.
Sourcepub fn insert<T: Into<DynTensor<B>>>(
&mut self,
key: Uuid,
value: T,
) -> Option<DynTensor<B>>
pub fn insert<T: Into<DynTensor<B>>>( &mut self, key: Uuid, value: T, ) -> Option<DynTensor<B>>
Insert a tensor into the library. If a tensor with the same UUID already exists, it will be replaced.
§Returns
The previous value, if any.
Sourcepub fn bind<T: Into<DynTensor<B>>>(&mut self, value: T) -> Uuid
pub fn bind<T: Into<DynTensor<B>>>(&mut self, value: T) -> Uuid
Bind a tensor into the library. Returns the generated UUID.
Sourcepub fn remove(&mut self, key: &Uuid) -> Option<DynTensor<B>>
pub fn remove(&mut self, key: &Uuid) -> Option<DynTensor<B>>
Remove a tensor from the library.
Returns None if the tensor was not found.
Sourcepub fn size_estimate(&self) -> usize
pub fn size_estimate(&self) -> usize
Returns the size estimate of the library in bytes.
Trait Implementations§
Source§impl<B: Clone + Backend> Clone for UuidMapTensorLibrary<B>
impl<B: Clone + Backend> Clone for UuidMapTensorLibrary<B>
Source§fn clone(&self) -> UuidMapTensorLibrary<B>
fn clone(&self) -> UuidMapTensorLibrary<B>
Returns a duplicate 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 moreSource§impl<B: Backend> Default for UuidMapTensorLibrary<B>
impl<B: Backend> Default for UuidMapTensorLibrary<B>
Source§impl<B: Backend> TensorLibrary<B> for UuidMapTensorLibrary<B>
impl<B: Backend> TensorLibrary<B> for UuidMapTensorLibrary<B>
Auto Trait Implementations§
impl<B> Freeze for UuidMapTensorLibrary<B>
impl<B> !RefUnwindSafe for UuidMapTensorLibrary<B>
impl<B> Send for UuidMapTensorLibrary<B>
impl<B> Sync for UuidMapTensorLibrary<B>
impl<B> Unpin for UuidMapTensorLibrary<B>
impl<B> !UnwindSafe for UuidMapTensorLibrary<B>
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