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>

source

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.

source

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.

source

pub fn is_loaded() -> bool

Checks if the overlay is loaded.

source

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.

source

pub unsafe fn unload(self)

Unloads the overlay.

Safety

This will render all still existing leases on the overlay invalid. You need to make sure that all leases are dropped.

source

pub fn group_id() -> u32

Returns the group ID of the overlay. This supports all game builtin overlays. Panics if no mapping is known.

Trait Implementations§

source§

impl<const N: u32> Clone for OverlayLoadLease<N>

source§

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

Returns a copy of the value. Read more
1.0.0§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl<const N: u32> RefUnwindSafe for OverlayLoadLease<N>

§

impl<const N: u32> Send for OverlayLoadLease<N>

§

impl<const N: u32> Sync for OverlayLoadLease<N>

§

impl<const N: u32> Unpin for OverlayLoadLease<N>

§

impl<const N: u32> UnwindSafe for OverlayLoadLease<N>

Blanket Implementations§

§

impl<T> Any for Twhere T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Az for T

source§

fn az<Dst>(self) -> Dstwhere T: Cast<Dst>,

Casts the value.
§

impl<T> Borrow<T> for Twhere T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<Src, Dst> CastFrom<Src> for Dstwhere Src: Cast<Dst>,

source§

fn cast_from(src: Src) -> Dst

Casts the value.
source§

impl<T> CheckedAs for T

source§

fn checked_as<Dst>(self) -> Option<Dst>where T: CheckedCast<Dst>,

Casts the value.
source§

impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere Src: CheckedCast<Dst>,

source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for Twhere U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

source§

impl<Src, Dst> LosslessTryInto<Dst> for Srcwhere Dst: LosslessTryFrom<Src>,

source§

fn lossless_try_into(self) -> Option<Dst>

Performs the conversion.
source§

impl<Src, Dst> LossyInto<Dst> for Srcwhere Dst: LossyFrom<Src>,

source§

fn lossy_into(self) -> Dst

Performs the conversion.
source§

impl<T> OverflowingAs for T

source§

fn overflowing_as<Dst>(self) -> (Dst, bool)where T: OverflowingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere Src: OverflowingCast<Dst>,

source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> SaturatingAs for T

source§

fn saturating_as<Dst>(self) -> Dstwhere T: SaturatingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere Src: SaturatingCast<Dst>,

source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> UnwrappedAs for T

source§

fn unwrapped_as<Dst>(self) -> Dstwhere T: UnwrappedCast<Dst>,

Casts the value.
source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere Src: UnwrappedCast<Dst>,

source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
source§

impl<T> WrappingAs for T

source§

fn wrapping_as<Dst>(self) -> Dstwhere T: WrappingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere Src: WrappingCast<Dst>,

source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.