pub struct RenderSender<S, W> { /* private fields */ }Expand description
The UI-thread handle to the render channel: sends scenes
(latest-wins) and lifecycle commands (FIFO). Single-producer by design (the
UI thread), so it is deliberately not Clone.
Implementations§
Source§impl<S, W> RenderSender<S, W>
impl<S, W> RenderSender<S, W>
Sourcepub fn send_scene(&self, frame: SceneFrame<S>) -> Option<SceneFrame<S>>
pub fn send_scene(&self, frame: SceneFrame<S>) -> Option<SceneFrame<S>>
Hand a finished frame to the render thread (depth-1 latest-wins): if
an un-taken scene is still in the slot it is replaced (the drop counter
still increments — see [Inbox::dropped]) and returned to the
caller instead of being silently dropped in the lock — a shell can
reclaim the stale frame’s scene buffer the same way
it reclaims one off scene_return_channel. None if the slot was
empty. A pure widening of the original fire-and-forget signature — a
caller that doesn’t care may still ignore the return value. Wakes the
render thread’s RenderReceiver::wait_next.
Also picks up any benchmark scenario markers this thread raised
since the last send ([Inbox::pending_markers]), so they cross with
this handoff instead of being stamped with a frame number guessed on
this side of the split (perf-trace builds only; see the module
docs’ scenario-marker section).
Sourcepub fn send_command(&self, command: RenderCommand<W>)
pub fn send_command(&self, command: RenderCommand<W>)
Queue a lifecycle command (FIFO) and wake the render thread. For the
ack-carrying RenderCommand::Pause/RenderCommand::SurfaceDestroyed
prefer Self::pause/Self::destroy_surface, which build the barrier
pair and return the AckWaiter to block on.
Sourcepub fn pause(&self) -> AckWaiter
pub fn pause(&self) -> AckWaiter
Send a RenderCommand::Pause and return the AckWaiter the UI
thread must wait on before letting the app
background — the iOS process-kill barrier.
Sourcepub fn destroy_surface(&self) -> AckWaiter
pub fn destroy_surface(&self) -> AckWaiter
Send a RenderCommand::SurfaceDestroyed and return the AckWaiter
the UI thread must wait on before releasing the
window — the Android ANativeWindow-release barrier.