pub trait CreatableWithLease<const N: u32>where
    Self: Sized,{
    // Required method
    fn lease(&self) -> &OverlayLoadLease<N>;

    // Provided methods
    fn new(lease: OverlayLoadLease<N>) -> Self { ... }
    fn new_checked() -> Self { ... }
    unsafe fn new_unchecked() -> Self { ... }
}
Expand description

Trait for all structs that require a lease to be created (but nothing else).

Required Methods§

source

fn lease(&self) -> &OverlayLoadLease<N>

Returns a reference to the overlay lease.

Provided Methods§

source

fn new(lease: OverlayLoadLease<N>) -> Self

Create a new instance by providing a lease.

Important

Overlay N must not be unloaded during the lifetime of the returned object.

source

fn new_checked() -> Self

Create a new instance by checking if the overlay is loaded and acquiring a lease on it. This will panic if the overlay is not loaded.

Important

Overlay N must not be unloaded during the lifetime of the returned object.

source

unsafe fn new_unchecked() -> Self

Create a new lease.

Safety

This function is unsafe because it does not check if the overlay is loaded. You need to make sure that the overlay is loaded before calling this function, and additionally ensure that during the lifetime of this object the overlay is not unloaded.

Implementors§