pub struct Canvas2DPaintCallback { /* private fields */ }Expand description
Thread-safe payload handle wrapping a UI-thread post-layout on_paint callback
(Rc<dyn Fn(&mut Canvas2DContext, f32, f32)>).
Storing the !Send closure in a thread-local table keyed by an Arc drop-guard token allows
callers to capture reactive Signals and Rc handles freely
while keeping LayoutNode: Send + Sync for parallel layout passes.
Implementations§
Source§impl Canvas2DPaintCallback
impl Canvas2DPaintCallback
Sourcepub fn new(
cb: Rc<dyn Fn(&mut Canvas2DContext, f32, f32)>,
) -> Arc<Canvas2DPaintCallback> ⓘ
pub fn new( cb: Rc<dyn Fn(&mut Canvas2DContext, f32, f32)>, ) -> Arc<Canvas2DPaintCallback> ⓘ
Registers a post-layout on_paint closure on the current thread and returns an Arc
handle suitable for Attribute::scene_payload_arc / ViewportSceneHandle.
Sourcepub fn paint(&self, width: f32, height: f32) -> Vec<CanvasCommand>
pub fn paint(&self, width: f32, height: f32) -> Vec<CanvasCommand>
Invokes the registered paint closure with the resolved post-layout (width, height)
dimensions and returns the recorded CanvasCommand list.
Trait Implementations§
Source§impl Debug for Canvas2DPaintCallback
impl Debug for Canvas2DPaintCallback
Source§impl Drop for Canvas2DPaintCallback
impl Drop for Canvas2DPaintCallback
Auto Trait Implementations§
impl Forget for Canvas2DPaintCallback
impl Freeze for Canvas2DPaintCallback
impl Move for Canvas2DPaintCallback
impl RefUnwindSafe for Canvas2DPaintCallback
impl Send for Canvas2DPaintCallback
impl Sync for Canvas2DPaintCallback
impl Unpin for Canvas2DPaintCallback
impl UnsafeUnpin for Canvas2DPaintCallback
impl UnwindSafe for Canvas2DPaintCallback
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