Struct eos_rs::api::overlay::OverlayLoadLease
source · pub struct OverlayLoadLease<const N: u32>(_);
Expand description
This represents a promise to the compiler that while a reference to this struct exists, the overlay N is loaded.
This is used as a parameter in functions that need a given overlay to be loaded.
Dropping the lease does not unload an overlay, but you can use
the Self::unload
method on a lease to do so.
You can clone a lease, but you will have the responsibility to make sure the overlay is not unloaded while clone lease is in use too.
Implementations§
source§impl<const N: u32> OverlayLoadLease<N>
impl<const N: u32> OverlayLoadLease<N>
sourcepub fn acquire() -> Self
pub fn acquire() -> Self
Gets a lease on a loaded overlay.
This is a runtime checked version of acquire_unchecked
.
It will panic if the overlay is not loaded.
Important
Even though this function is marked as safe, since it checks if the overlay is loaded, you still need to make sure the overlay is not unloaded during the lifetime of the returned object.
sourcepub unsafe fn acquire_unchecked() -> Self
pub unsafe fn acquire_unchecked() -> Self
Gets a lease on a loaded overlay.
Safety
You need to make sure the overlay is actually loaded and won’t get unloaded during the lifetime of the returned object.
sourcepub unsafe fn load() -> Self
pub unsafe fn load() -> Self
Loads the given overlay if it isn’t already loaded.
Safety
This will change how memory is mapped. You will need to make sure there are no conflicts with other overlays and that all memory currently referenced will still be valid after this call.
Trait Implementations§
source§impl<const N: u32> Clone for OverlayLoadLease<N>
impl<const N: u32> Clone for OverlayLoadLease<N>
source§fn clone(&self) -> OverlayLoadLease<N>
fn clone(&self) -> OverlayLoadLease<N>
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more