Skip to main content

EventCtx

Struct EventCtx 

Source
pub struct EventCtx<'a, Ext: 'static> {
    pub event: &'a mut Event,
    pub dom: &'a mut Dom<Ext>,
}
Expand description

Context passed to a handler: mutable Event + mutable Dom.

Fields§

§event: &'a mut Event§dom: &'a mut Dom<Ext>

Implementations§

Source§

impl<Ext: 'static> EventCtx<'_, Ext>

Source

pub fn request_redraw(&mut self)

Ask the rendering host to repaint after this event completes.

Mutations made through ctx.dom are already seen by the host’s mutation tracker. Use this for the case the tracker can’t see: a handler that changed state living outside the DOM that the next paint will read — e.g. a <canvas> whose paint callback reads external application state. Without this, such a change produces no repaint until something else dirties the tree.

Sets a flag on the event (Event::redraw_requested) that the host harvests after dispatch; rdom-core itself does nothing with it.

Auto Trait Implementations§

§

impl<'a, Ext> !RefUnwindSafe for EventCtx<'a, Ext>

§

impl<'a, Ext> !Send for EventCtx<'a, Ext>

§

impl<'a, Ext> !Sync for EventCtx<'a, Ext>

§

impl<'a, Ext> !UnwindSafe for EventCtx<'a, Ext>

§

impl<'a, Ext> Freeze for EventCtx<'a, Ext>
where &'a mut Dom<Ext>: Freeze,

§

impl<'a, Ext> Unpin for EventCtx<'a, Ext>
where &'a mut Dom<Ext>: Unpin,

§

impl<'a, Ext> UnsafeUnpin for EventCtx<'a, Ext>
where &'a mut Dom<Ext>: UnsafeUnpin,

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.