pub struct HotAppInstance { /* private fields */ }Implementations§
Source§impl HotAppInstance
impl HotAppInstance
Sourcepub fn load(
dylib_path: &Path,
surface_id: SurfaceId,
generation: u64,
prior_state: Option<&[u8]>,
) -> Result<Self, LoaderError>
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.
Sourcepub fn from_module(
module: &NvAppModule,
surface_id: SurfaceId,
prior_state: Option<&[u8]>,
) -> Result<Self, LoaderError>
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]).
Sourcepub fn module(&self) -> Option<&NvAppModule>
pub fn module(&self) -> Option<&NvAppModule>
Borrows the shared NvAppModule backing this surface instance.
pub fn surface_id(&self) -> SurfaceId
pub fn generation(&self) -> u64
pub fn loaded_copy_path(&self) -> &Path
Sourcepub fn render(&mut self, frame_id: FrameId) -> &[u8] ⓘ
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.
Sourcepub fn dispatch_events(&mut self, events: ValidatedEvents<'_>) -> bool
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.
Sourcepub fn take_close_request(&mut self) -> bool
pub fn take_close_request(&mut self) -> bool
Takes the close request of the last Self::dispatch_events.
Sourcepub fn take_unconsumed_key(&mut self) -> bool
pub fn take_unconsumed_key(&mut self) -> bool
Takes whether the last Self::dispatch_events left a KeyDown unconsumed.
Sourcepub fn drain_pointer_capture_requests(
&mut self,
sink: &mut dyn FnMut(PointerCaptureRequest),
)
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).
pub fn measure( &mut self, constraints: NvSizeConstraints, ) -> Option<NvIntrinsicSize>
pub fn hit_test( &mut self, x: f32, y: f32, pointer_phase: u8, ) -> NvGestureDisposition
pub fn set_props(&mut self, entries: &[NvMapEntry]) -> bool
Sourcepub fn drain_emitted_events(&mut self) -> ValidatedEvents<'_>
pub fn drain_emitted_events(&mut self) -> ValidatedEvents<'_>
Drains outbound component events as an ingress-validated zero-copy ValidatedEvents.
Sourcepub fn apply_hot_patch(&mut self, patch: &[u8]) -> bool
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.
Sourcepub fn snapshot_state(&mut self) -> &[u8] ⓘ
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.
pub fn has_host_interface(&self) -> bool
Sourcepub fn bind_host(&mut self, callbacks: Option<NvHostCallbacks>) -> bool
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.
Sourcepub fn dispatch_host_events(&mut self, batch: &[u8]) -> bool
pub fn dispatch_host_events(&mut self, batch: &[u8]) -> bool
Dispatches a host-event payload buffer via NvHostApi::dispatch_host_events.
Sourcepub fn has_direct_host_interface(&self) -> bool
pub fn has_direct_host_interface(&self) -> bool
Returns true if the loaded module exports NV_IFACE_DIRECT_HOST = 6.
Sourcepub fn bind_direct_host(&mut self, env: Option<NvDirectHostEnv>) -> bool
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.
Sourcepub fn dispatch_direct_completion(
&mut self,
local_req_id: u64,
status: i32,
payload: &[u8],
) -> bool
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.
Sourcepub fn dispatch_direct_event(
&mut self,
service_id: HostServiceId,
event_id: u32,
flags: u32,
payload: &[u8],
) -> bool
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.
Sourcepub fn reload(
&mut self,
new_dylib_path: &Path,
) -> Result<ReloadOutcome, LoaderError>
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.
Sourcepub fn reload_with_host(
&mut self,
new_dylib_path: &Path,
next_host: Option<NvHostCallbacks>,
) -> Result<ReloadOutcome, LoaderError>
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).
Sourcepub fn reload_with_hosts(
&mut self,
new_dylib_path: &Path,
next_host: Option<NvHostCallbacks>,
next_direct: Option<NvDirectHostEnv>,
) -> Result<ReloadOutcome, LoaderError>
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.
Sourcepub 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>
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.
Sourcepub 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>
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.