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>
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>
impl<B> Sync for Renderer<B>
impl<B> Unpin for Renderer<B>
impl<B> UnsafeUnpin for Renderer<B>
impl<B> UnwindSafe for Renderer<B>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more