Skip to main content

HotAppInstance

Struct HotAppInstance 

Source
pub struct HotAppInstance { /* private fields */ }

Implementations§

Source§

impl HotAppInstance

Source

pub fn load( dylib_path: &Path, surface_id: SurfaceId, generation: u64, prior_state: Option<&[u8]>, ) -> Result<Self, LoaderError>

Loads a compiled app cdylib via a unique staged filename so dlopen never returns a stale cached image (and Windows never hits DLL lock collisions during hot-swap), resolves nv_get_interface, and optionally restores state.

Source

pub fn from_module( module: &NvAppModule, surface_id: SurfaceId, prior_state: Option<&[u8]>, ) -> Result<Self, LoaderError>

Instantiates a surface handle backed by a shared NvAppModule without staging or dlopening the library again ([INV:multi-surface-shared-dylib]).

Source

pub fn module(&self) -> Option<&NvAppModule>

Borrows the shared NvAppModule backing this surface instance.

Source

pub fn surface_id(&self) -> SurfaceId

Source

pub fn generation(&self) -> u64

Source

pub fn loaded_copy_path(&self) -> &Path

Source

pub fn render(&mut self, frame_id: FrameId) -> &[u8] ⓘ

Renders a frame and borrows the binary NV02 wire frame slice directly from the loaded app module’s internal frame buffer (zero heap allocation / zero .to_vec() copy per frame).

The borrowed slice remains valid until the next &mut self call on this HotAppInstance.

Source

pub fn dispatch_events(&mut self, events: ValidatedEvents<'_>) -> bool

Forwards a validated zero-copy event batch directly across the C FFI boundary; returns NV_DISPATCH_RESULT_DIRTY and latches NV_DISPATCH_RESULT_CLOSE_REQUEST for Self::take_close_request.

Source

pub fn take_close_request(&mut self) -> bool

Takes the close request of the last Self::dispatch_events.

Source

pub fn take_unconsumed_key(&mut self) -> bool

Takes whether the last Self::dispatch_events left a KeyDown unconsumed.

Source

pub fn drain_pointer_capture_requests( &mut self, sink: &mut dyn FnMut(PointerCaptureRequest), )

Drains the pointer-capture requests of the last Self::dispatch_events (NvPointerApi).

Source

pub fn measure( &mut self, constraints: NvSizeConstraints, ) -> Option<NvIntrinsicSize>

Source

pub fn hit_test( &mut self, x: f32, y: f32, pointer_phase: u8, ) -> NvGestureDisposition

Source

pub fn set_props(&mut self, entries: &[NvMapEntry]) -> bool

Source

pub fn drain_emitted_events(&mut self) -> ValidatedEvents<'_>

Drains outbound component events as an ingress-validated zero-copy ValidatedEvents.

Source

pub fn apply_hot_patch(&mut self, patch: &[u8]) -> bool

Forwards one binary NV_HOT_PATCH frame (as received from nv dev) to the module.

Source

pub fn snapshot_state(&mut self) -> &[u8] ⓘ

Captures serialized app state and borrows the slice directly from the loaded app module’s internal snapshot buffer without copying.

Source

pub fn has_host_interface(&self) -> bool

Source

pub fn bind_host(&mut self, callbacks: Option<NvHostCallbacks>) -> bool

Binds (or unbinds when None) host capability callbacks via NV_IFACE_HOST = 5. Returns true if the loaded module exposes NvHostApi.

Source

pub fn dispatch_host_events(&mut self, batch: &[u8]) -> bool

Dispatches a host-event payload buffer via NvHostApi::dispatch_host_events.

Source

pub fn has_direct_host_interface(&self) -> bool

Returns true if the loaded module exports NV_IFACE_DIRECT_HOST = 6.

Source

pub fn bind_direct_host(&mut self, env: Option<NvDirectHostEnv>) -> bool

Binds (or unbinds when None) the non-reloaded Direct-First host environment via NV_IFACE_DIRECT_HOST = 6. Returns true if the loaded module exposes NvDirectHostApi.

Source

pub fn dispatch_direct_completion( &mut self, local_req_id: u64, status: i32, payload: &[u8], ) -> bool

Dispatches one completed direct-FFI async reply on the owner thread via NvDirectHostApi::dispatch_direct_completion.

Source

pub fn dispatch_direct_event( &mut self, service_id: HostServiceId, event_id: u32, flags: u32, payload: &[u8], ) -> bool

Dispatches one direct-FFI push event on the owner thread via NvDirectHostApi::dispatch_direct_event.

Source

pub fn reload( &mut self, new_dylib_path: &Path, ) -> Result<ReloadOutcome, LoaderError>

Transactionally hot-swaps this live instance to a freshly compiled dylib while preserving app state.

Snapshots state from the live app, then stages (under a unique filename to avoid Windows DLL lock collisions), loads, validates (nv_get_interface + NV_IFACE_SURFACE), instantiates, and restores state on the candidate dylib BEFORE swapping out and unloading the existing instance. If any step fails, self stays 100% alive and untouched.

Source

pub fn reload_with_host( &mut self, new_dylib_path: &Path, next_host: Option<NvHostCallbacks>, ) -> Result<ReloadOutcome, LoaderError>

Transactional reload binding next_host onto the candidate dylib once before swapping out and unbinding the previous generation (so a failed reload leaves generation N untouched, generation N is unbound BEFORE destroy, and generation N+1 is never double-bound).

Source

pub fn reload_with_hosts( &mut self, new_dylib_path: &Path, next_host: Option<NvHostCallbacks>, next_direct: Option<NvDirectHostEnv>, ) -> Result<ReloadOutcome, LoaderError>

Transactional reload binding both next_host (NV_IFACE_HOST = 5) and next_direct (NV_IFACE_DIRECT_HOST = 6) onto the candidate dylib once before swapping out old gen.

Source

pub fn reload_with_host_and_state( &mut self, new_dylib_path: &Path, next_host: Option<NvHostCallbacks>, prior_state: Option<&[u8]>, on_old_unbound: impl FnOnce(), ) -> Result<ReloadOutcome, LoaderError>

Transactional reload using caller-captured prior_state (avoiding redundant double snapshot_state() calls) and invoking on_old_unbound strictly AFTER old.bind_host(None) and BEFORE old’s destroy runs.

Source

pub fn reload_with_hosts_and_state( &mut self, new_dylib_path: &Path, next_host: Option<NvHostCallbacks>, next_direct: Option<NvDirectHostEnv>, prior_state: Option<&[u8]>, on_old_direct_deactivate: impl FnOnce(), on_old_unbound: impl FnOnce(), ) -> Result<ReloadOutcome, LoaderError>

Full transactional reload binding both lean next_host and next_direct onto the candidate dylib once, invoking on_old_direct_deactivate (deactivating old DirectSurfaceBinding and cancelling in-flight direct async calls) strictly BEFORE old.bind_direct_host(None), invoking on_old_unbound strictly AFTER unbinding and BEFORE old’s destroy + dlclose.

Trait Implementations§

Source§

impl Drop for HotAppInstance

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. 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> 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, 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.