Skip to main content

RenderSender

Struct RenderSender 

Source
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>

Source

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).

Source

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.

Source

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.

Source

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.

Trait Implementations§

Source§

impl<S: Debug, W: Debug> Debug for RenderSender<S, W>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<S, W> Drop for RenderSender<S, W>

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§

§

impl<S, W> Freeze for RenderSender<S, W>
where Arc<Channel<S, W>>: Freeze,

§

impl<S, W> RefUnwindSafe for RenderSender<S, W>
where Arc<Channel<S, W>>: RefUnwindSafe,

§

impl<S, W> Send for RenderSender<S, W>
where Arc<Channel<S, W>>: Send,

§

impl<S, W> Sync for RenderSender<S, W>
where Arc<Channel<S, W>>: Sync,

§

impl<S, W> Unpin for RenderSender<S, W>
where Arc<Channel<S, W>>: Unpin,

§

impl<S, W> UnsafeUnpin for RenderSender<S, W>
where Arc<Channel<S, W>>: UnsafeUnpin,

§

impl<S, W> UnwindSafe for RenderSender<S, W>
where Arc<Channel<S, W>>: UnwindSafe,

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> ErasedDestructor for T
where T: 'static,

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> StorageAccess<T> for T

Source§

fn as_borrowed(&self) -> &T

Borrows the value.
Source§

fn into_taken(self) -> T

Takes the value.
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.