Skip to main content

NvAppModule

Struct NvAppModule 

Source
pub struct NvAppModule { /* private fields */ }
Expand description

Ref-counted handle to one loaded app module generation (Arc<StagedDylib> or static NvGetInterfaceFn).

Cloning is an O(1) atomic refcount bump that shares the single mapped cdylib across all surfaces attached to the same generation ([INV:multi-surface-shared-dylib]).

Implementations§

Source§

impl NvAppModule

Source

pub fn load( dylib_path: &Path, subdir: &str, label: &str, ) -> Result<Self, LoaderError>

Stages and dlopens dylib_path once (generation 1) into a shared NvAppModule.

Source

pub fn load_generation( dylib_path: &Path, subdir: &str, generation: u64, ) -> Result<Self, LoaderError>

Stages and dlopens dylib_path once for reload generation into a shared NvAppModule.

Source

pub fn from_staged_dylib(staged: Arc<StagedDylib>, generation: u64) -> Self

Wraps an already-loaded StagedDylib as generation generation (staged_loads == 1).

Source

pub fn from_get_interface(get_interface: NvGetInterfaceFn) -> Self

Wraps a statically linked or in-process nv_get_interface entry point (zero dylib staging; works on every target including wasm32).

Source

pub fn from_get_interface_generation( get_interface: NvGetInterfaceFn, generation: u64, ) -> Self

Wraps a statically linked nv_get_interface entry point tagged with generation.

Source

pub fn get_interface(&self) -> NvGetInterfaceFn

Returns the resolved nv_get_interface entry point backed by this module.

Source

pub fn generation(&self) -> u64

Reload generation of this module (1 for initial load, incremented per atomic reload).

Source

pub fn staged_loads(&self) -> u64

Number of staged cdylib loads performed to produce this generation (1 for dylib loads, 0 for statically linked nv_get_interface).

Source

pub fn loaded_copy_path(&self) -> Option<&Path>

Path of the private staged copy (or resolved in-place file on mobile), or None for statically linked modules.

Source

pub fn strong_count(&self) -> usize

Strong reference count of the underlying Arc<StagedDylib> (1 for static modules).

Source

pub fn same_backing(&self, other: &Self) -> bool

Returns true when both handles share the exact same underlying mapped StagedDylib allocation (or identical static nv_get_interface function pointer).

Trait Implementations§

Source§

impl Clone for NvAppModule

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for NvAppModule

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

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<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

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

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

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.