[][src]Enum euca::vdom::DomItem

pub enum DomItem<'a, Message, Command, K> {
    Element {
        name: &'a str,
        key: Option<&'a K>,
    },
    Text(&'a str),
    UnsafeInnerHtml(&'a str),
    Attr {
        name: &'a str,
        value: &'a str,
    },
    Event {
        trigger: &'a str,
        handler: EventHandler<'a, Message>,
    },
    Up,
    Component {
        key: Option<&'a K>,
        msg: Message,
        create: fn(_: Dispatcher<Message, Command>) -> Box<dyn Component<Message>>,
    },
    Key(&'a K),
}

Items representing all of the data in the DOM tree.

This is the struct emitted from the Iterator passed to our diff function. The items emitted should always be in the same order, given the same input. Each entry in the enum represents some aspect of a DOM node. The idea here is the sequence of items will be the same sequence of things seen if we were to walk the DOM tree depth first going through all nodes and their various attributes and events.

Variants

Element

An element in the tree.

Fields of Element

name: &'a str

The element name.

key: Option<&'a K>

An optional key for this element. Should have been generated from a type implementing Hash using a Hasher.

Text(&'a str)

A text node in the tree.

UnsafeInnerHtml(&'a str)

Raw HTML code to be rendered using innerHTML. Use with caution as this can be used as an attack vector to execute arbitrary code in the client's browser.

Attr

An attribute of the last node we saw.

Fields of Attr

name: &'a str

The attribute name.

value: &'a str

The attribute value.

Event

An event handler from the last node we saw.

Fields of Event

trigger: &'a str

The trigger for this event.

handler: EventHandler<'a, Message>

The handler for this event.

Up

We are finished processing children nodes, the next node is a sibling.

Component

A component.

Fields of Component

key: Option<&'a K>

An optional key for this component.

This is necessary if a component has internal state that must be maintained between dom updates.

msg: Message

A message to send to the component.

create: fn(_: Dispatcher<Message, Command>) -> Box<dyn Component<Message>>

A function to create the component if necessary.

Key(&'a K)

For internal use. This is a reference to a keyed item.

Trait Implementations

impl<'a, Message: Debug, Command: Debug, K: Debug> Debug for DomItem<'a, Message, Command, K>[src]

impl<'a, Message: PartialEq, Command: PartialEq, K: PartialEq> PartialEq<DomItem<'a, Message, Command, K>> for DomItem<'a, Message, Command, K>[src]

impl<'a, Message, Command, K> StructuralPartialEq for DomItem<'a, Message, Command, K>[src]

Auto Trait Implementations

impl<'a, Message, Command, K> RefUnwindSafe for DomItem<'a, Message, Command, K> where
    K: RefUnwindSafe,
    Message: RefUnwindSafe

impl<'a, Message, Command, K> Send for DomItem<'a, Message, Command, K> where
    K: Sync,
    Message: Send + Sync

impl<'a, Message, Command, K> Sync for DomItem<'a, Message, Command, K> where
    K: Sync,
    Message: Sync

impl<'a, Message, Command, K> Unpin for DomItem<'a, Message, Command, K> where
    Message: Unpin

impl<'a, Message, Command, K> UnwindSafe for DomItem<'a, Message, Command, K> where
    K: RefUnwindSafe,
    Message: RefUnwindSafe + UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<M> Update<(), ()> for M[src]