Struct metatensor::LazyMetadata
source · pub struct LazyMetadata<T> { /* private fields */ }
Expand description
Lazily accessed metadata inside a TensorBlock
This struct provides immutable access to an object of type T
, that is
conceptually a field of a TensorBlock
. The object is initialized on the
first access, potentially saving some computation/allocations if the object
is not needed.
Implementations§
source§impl<T> LazyMetadata<T>
impl<T> LazyMetadata<T>
sourcepub fn new(
init: fn(_: *const mts_block_t) -> T,
block: *const mts_block_t
) -> LazyMetadata<T>
pub fn new( init: fn(_: *const mts_block_t) -> T, block: *const mts_block_t ) -> LazyMetadata<T>
Create a new LazyMetadata
with the given initialization function
Trait Implementations§
source§impl<T: Debug> Debug for LazyMetadata<T>
impl<T: Debug> Debug for LazyMetadata<T>
Auto Trait Implementations§
impl<T> RefUnwindSafe for LazyMetadata<T>where T: UnwindSafe + RefUnwindSafe,
impl<T> !Send for LazyMetadata<T>
impl<T> !Sync for LazyMetadata<T>
impl<T> Unpin for LazyMetadata<T>where T: Unpin,
impl<T> UnwindSafe for LazyMetadata<T>where T: UnwindSafe,
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