pub struct MemLease { /* private fields */ }Expand description
A memory lease that auto-frees on drop.
Wraps a FabricMem handle with RAII lifecycle management. When the
MemLease is dropped, the underlying resource will be released (once
the host provides an explicit fbmu_free() call).
Created via MemBuilder::acquire.
§Examples
use grafos_std::mem::MemBuilder;
let lease = MemBuilder::new().min_bytes(4096).acquire()?;
lease.mem().write(0, b"leased memory")?;
// lease is freed when it goes out of scopeImplementations§
Source§impl MemLease
impl MemLease
Sourcepub fn info(&self) -> LeaseInfo
pub fn info(&self) -> LeaseInfo
Lease metadata snapshot (id, creation time, expiry, and status).
Sourcepub fn created_at_unix_secs(&self) -> u64
pub fn created_at_unix_secs(&self) -> u64
Lease creation timestamp (unix seconds).
Sourcepub fn expires_at_unix_secs(&self) -> u64
pub fn expires_at_unix_secs(&self) -> u64
Lease expiry timestamp (unix seconds).
Sourcepub fn status(&self) -> LeaseStatus
pub fn status(&self) -> LeaseStatus
Current lease status.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MemLease
impl !RefUnwindSafe for MemLease
impl !Send for MemLease
impl !Sync for MemLease
impl Unpin for MemLease
impl !UnwindSafe for MemLease
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