Skip to main content

Renderer

Struct Renderer 

Source
pub struct Renderer<B: Toolkit> {
    pub kind: PieceKind,
    pub make: fn(&mut B, &dyn Any, NodeId) -> B::Handle,
    pub update: fn(&mut B, &B::Handle, &dyn Any),
    pub measure: Option<MeasureFn<B>>,
    pub release: Option<fn(&mut B, &B::Handle)>,
}
Expand description

A third-party piece’s per-toolkit implementation. make receives the concrete backend (public helper surface) and returns a native handle the backend then owns like any built-in.

Fields§

§kind: PieceKind§make: fn(&mut B, &dyn Any, NodeId) -> B::Handle§update: fn(&mut B, &B::Handle, &dyn Any)§measure: Option<MeasureFn<B>>§release: Option<fn(&mut B, &B::Handle)>

Teardown, run from the release queue just before Toolkit::release frees the handle.

A piece that keeps per-view state (a retained delegate, a session map, a native observer) has no other place to drop it: make/update are the only other hooks, and a disposed node never calls them again. Without this a piece leaks one entry per realized view, and any map keyed by the handle’s address can go on to answer for a later view that the allocator hands the same address.

None for the pieces that own nothing (most of them).

Auto Trait Implementations§

§

impl<B> Freeze for Renderer<B>
where fn(&mut B, &(dyn Any + 'static), NodeId) -> <B as Toolkit>::Handle: Freeze, fn(&mut B, &<B as Toolkit>::Handle, &(dyn Any + 'static)): Freeze, Option<fn(&mut B, &<B as Toolkit>::Handle, Proposal) -> Size>: Freeze, Option<fn(&mut B, &<B as Toolkit>::Handle)>: Freeze,

§

impl<B> RefUnwindSafe for Renderer<B>
where fn(&mut B, &(dyn Any + 'static), NodeId) -> <B as Toolkit>::Handle: RefUnwindSafe, fn(&mut B, &<B as Toolkit>::Handle, &(dyn Any + 'static)): RefUnwindSafe, Option<fn(&mut B, &<B as Toolkit>::Handle, Proposal) -> Size>: RefUnwindSafe, Option<fn(&mut B, &<B as Toolkit>::Handle)>: RefUnwindSafe,

§

impl<B> Send for Renderer<B>
where fn(&mut B, &(dyn Any + 'static), NodeId) -> <B as Toolkit>::Handle: Send, fn(&mut B, &<B as Toolkit>::Handle, &(dyn Any + 'static)): Send, Option<fn(&mut B, &<B as Toolkit>::Handle, Proposal) -> Size>: Send, Option<fn(&mut B, &<B as Toolkit>::Handle)>: Send,

§

impl<B> Sync for Renderer<B>
where fn(&mut B, &(dyn Any + 'static), NodeId) -> <B as Toolkit>::Handle: Sync, fn(&mut B, &<B as Toolkit>::Handle, &(dyn Any + 'static)): Sync, Option<fn(&mut B, &<B as Toolkit>::Handle, Proposal) -> Size>: Sync, Option<fn(&mut B, &<B as Toolkit>::Handle)>: Sync,

§

impl<B> Unpin for Renderer<B>
where fn(&mut B, &(dyn Any + 'static), NodeId) -> <B as Toolkit>::Handle: Unpin, fn(&mut B, &<B as Toolkit>::Handle, &(dyn Any + 'static)): Unpin, Option<fn(&mut B, &<B as Toolkit>::Handle, Proposal) -> Size>: Unpin, Option<fn(&mut B, &<B as Toolkit>::Handle)>: Unpin,

§

impl<B> UnsafeUnpin for Renderer<B>
where fn(&mut B, &(dyn Any + 'static), NodeId) -> <B as Toolkit>::Handle: UnsafeUnpin, fn(&mut B, &<B as Toolkit>::Handle, &(dyn Any + 'static)): UnsafeUnpin, Option<fn(&mut B, &<B as Toolkit>::Handle, Proposal) -> Size>: UnsafeUnpin, Option<fn(&mut B, &<B as Toolkit>::Handle)>: UnsafeUnpin,

§

impl<B> UnwindSafe for Renderer<B>
where fn(&mut B, &(dyn Any + 'static), NodeId) -> <B as Toolkit>::Handle: UnwindSafe, fn(&mut B, &<B as Toolkit>::Handle, &(dyn Any + 'static)): UnwindSafe, Option<fn(&mut B, &<B as Toolkit>::Handle, Proposal) -> Size>: UnwindSafe, Option<fn(&mut B, &<B as Toolkit>::Handle)>: 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> 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.