Skip to main content

JsEvent

Enum JsEvent 

Source
pub enum JsEvent {
    Event(NodeId, EventKind, EventPayload),
    Component {
        host: NodeId,
        event: Box<dyn EventToJs>,
    },
    Children {
        host: NodeId,
        wanted: bool,
    },
    Render {
        host: NodeId,
        prop: &'static str,
        key: SharedString,
        value: Rc<dyn RenderValue>,
        func: Option<Rc<dyn CallbackHandle>>,
    },
    Unrender {
        host: NodeId,
        prop: &'static str,
        key: SharedString,
    },
    Reply {
        call: u32,
        result: JsResult,
    },
    // some variants omitted
}
Expand description

What the core hands JS after a commit, in order: the platform’s and the core’s events, and the Rust values for JS (a Rust component’s events, whether its lazy children are placed, calls’ results).

Variants§

§

Event(NodeId, EventKind, EventPayload)

An event of a node (layout, scroll, a platform component’s).

§

Component

An event of the Rust component hosted by host.

Fields

§host: NodeId

The component’s host node.

§event: Box<dyn EventToJs>

The event.

§

Children

Whether the Rust component hosted by host places its lazy children now.

Fields

§host: NodeId

The component’s host node.

§wanted: bool

Placed.

§

Render

The Rust component hosted by host places the content of its render prop prop (Option<Renderer<T>>) for key with value, which JS did not render yet: JS calls the app’s function with it and inserts what it returns into the host in a holder view of its own (componentRender: the prop, U+001F, the key), replacing the one it made for the key before. The core places the holder.

Fields

§host: NodeId

The component’s host node.

§prop: &'static str

The prop holding the app’s function.

§key: SharedString

The key, unique among the component’s renders of the prop.

§value: Rc<dyn RenderValue>

The value to render.

§func: Option<Rc<dyn CallbackHandle>>

The function to render with instead of the prop’s, which the component holds itself: JS calls it once for the key, with props reading the latest value, and a later Render of the key sets that value in place (no new holder).

§

Unrender

No element of the component’s render (prop, key) is placed any more (Self::Render): JS removes its holder and disposes what it rendered.

Fields

§host: NodeId

The component’s host node.

§prop: &'static str

The prop holding the app’s function.

§key: SharedString

The key.

§

Reply

The result of call call (its promise settles).

Fields

§call: u32

The call number.

§result: JsResult

The value or the rejection’s message.

Trait Implementations§

Source§

impl Debug for JsEvent

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for JsEvent

§

impl !Send for JsEvent

§

impl !Sync for JsEvent

§

impl !UnwindSafe for JsEvent

§

impl Forget for JsEvent

§

impl Freeze for JsEvent
where *const u8 is !null: Freeze, PhantomData<u8>: Freeze, PhantomData<(&'static str, PayloadValue)>: Freeze, *const TouchEvent is !null: Freeze, PhantomData<TouchEvent>: Freeze, &'static str: Freeze, *const ArcInner<str> is !null: Freeze, PhantomData<ArcInner<str>>: Freeze, PhantomData<String>: Freeze, *const FileContents is !null: Freeze, PhantomData<FileContents>: Freeze, *const PasteEvent is !null: Freeze, PhantomData<PasteEvent>: Freeze, *const TextDrop is !null: Freeze, PhantomData<TextDrop>: Freeze, PhantomData<TextLine>: Freeze, PhantomData<PickedFile>: Freeze, *const WindowEvent is !null: Freeze, PhantomData<WindowEvent>: Freeze, PhantomData<PathBuf>: Freeze, PhantomData<Value>: Freeze, *const LeafNode<String, Value> is !null: Freeze, PhantomData<(Owned, LeafOrInternal)>: Freeze, PhantomData<Box<(String, Value)>>: Freeze, *const RcInner<dyn Fn(&EventPayload)> is !null: Freeze, PhantomData<RcInner<dyn Fn(&EventPayload)>>: Freeze, *const dyn EventToJs is !null: Freeze, PhantomData<dyn EventToJs>: Freeze, *const RcInner<dyn RenderValue> is !null: Freeze, PhantomData<RcInner<dyn RenderValue>>: Freeze, *const RcInner<dyn CallbackHandle> is !null: Freeze, PhantomData<RcInner<dyn CallbackHandle>>: Freeze, PhantomData<u32>: Freeze, *const dyn ToJs is !null: Freeze, PhantomData<dyn ToJs>: Freeze, *const ErrorFields is !null: Freeze, PhantomData<ErrorFields>: Freeze,

§

impl Move for JsEvent

§

impl Unpin for JsEvent
where *const u8 is !null: Unpin, &'static str: Unpin, Box<TouchEvent>: Unpin, Arc<str>: Unpin, Box<FileContents>: Unpin, Box<PasteEvent>: Unpin, Box<TextDrop>: Unpin, Arc<dyn AsRef<[u8]> + Sync + Send>: Unpin, Arc<Rgba>: Unpin, Box<WindowEvent>: Unpin, *const LeafNode<String, Value> is !null: Unpin, Box<(String, Value)>: Unpin, Rc<dyn Fn(&EventPayload)>: Unpin, Box<dyn EventToJs>: Unpin, Rc<dyn RenderValue>: Unpin, Rc<dyn CallbackHandle>: Unpin, Box<dyn ToJs>: Unpin, Box<ErrorFields>: Unpin,

§

impl UnsafeUnpin for JsEvent
where *const u8 is !null: UnsafeUnpin, PhantomData<u8>: UnsafeUnpin, PhantomData<(&'static str, PayloadValue)>: UnsafeUnpin, *const TouchEvent is !null: UnsafeUnpin, PhantomData<TouchEvent>: UnsafeUnpin, &'static str: UnsafeUnpin, *const ArcInner<str> is !null: UnsafeUnpin, PhantomData<ArcInner<str>>: UnsafeUnpin, PhantomData<String>: UnsafeUnpin, *const FileContents is !null: UnsafeUnpin, PhantomData<FileContents>: UnsafeUnpin, *const PasteEvent is !null: UnsafeUnpin, PhantomData<PasteEvent>: UnsafeUnpin, *const TextDrop is !null: UnsafeUnpin, PhantomData<TextDrop>: UnsafeUnpin, PhantomData<TextLine>: UnsafeUnpin, PhantomData<PickedFile>: UnsafeUnpin, *const WindowEvent is !null: UnsafeUnpin, PhantomData<WindowEvent>: UnsafeUnpin, PhantomData<PathBuf>: UnsafeUnpin, PhantomData<Value>: UnsafeUnpin, *const LeafNode<String, Value> is !null: UnsafeUnpin, PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin, PhantomData<Box<(String, Value)>>: UnsafeUnpin, *const RcInner<dyn Fn(&EventPayload)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&EventPayload)>>: UnsafeUnpin, *const dyn EventToJs is !null: UnsafeUnpin, PhantomData<dyn EventToJs>: UnsafeUnpin, *const RcInner<dyn RenderValue> is !null: UnsafeUnpin, PhantomData<RcInner<dyn RenderValue>>: UnsafeUnpin, *const RcInner<dyn CallbackHandle> is !null: UnsafeUnpin, PhantomData<RcInner<dyn CallbackHandle>>: UnsafeUnpin, PhantomData<u32>: UnsafeUnpin, *const dyn ToJs is !null: UnsafeUnpin, PhantomData<dyn ToJs>: UnsafeUnpin, *const ErrorFields is !null: UnsafeUnpin, PhantomData<ErrorFields>: 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> Same for T

Source§

type Output = T

Should always be Self
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.