[][src]Struct seed::dom_types::El

pub struct El<Ms: 'static> {
    pub tag: Tag,
    pub attrs: Attrs,
    pub style: Style,
    pub listeners: Vec<Listener<Ms>>,
    pub text: Option<String>,
    pub children: Vec<El<Ms>>,
    pub el_ws: Option<Node>,
    pub namespace: Option<Namespace>,
    pub hooks: LifecycleHooks<Ms>,
    pub empty: bool,
    // some fields omitted
}

An component in our virtual DOM.

Fields

tag: Tagattrs: Attrsstyle: Stylelisteners: Vec<Listener<Ms>>text: Option<String>children: Vec<El<Ms>>el_ws: Option<Node>

The actual web element/node

namespace: Option<Namespace>hooks: LifecycleHooks<Ms>empty: bool

Methods

impl<Ms> El<Ms>[src]

pub fn empty(tag: Tag) -> Self[src]

Create an empty element, specifying only the tag

pub fn map_message<OtherMs, F>(self, f: F) -> El<OtherMs> where
    F: Fn(Ms) -> OtherMs + Copy + 'static, 
[src]

Maps an element's message to have another message.

This allows third party components to integrate with your application without having to know about your Msg type beforehand.

Note

There is an overhead to calling this versus keeping all messages under one type. The deeper the nested structure of children, the more time this will take to run.

pub fn new_text(text: &str) -> Self[src]

pub fn empty_svg(tag: Tag) -> Self[src]

Create an empty SVG element, specifying only the tag

pub fn from_markdown(markdown: &str) -> Vec<Self>[src]

Create elements from a markdown string.

pub fn from_html(html: &str) -> Vec<Self>[src]

Create elements from an HTML string.

pub fn add_child(&mut self, element: El<Ms>)[src]

Add a new child to the element

pub fn add_attr(&mut self, key: String, val: String)[src]

Add an attribute (eg class, or href)

pub fn add_style(&mut self, key: String, val: String)[src]

Add a new style (eg display, or height)

pub fn set_text(&mut self, text: &str)[src]

Replace the element's text node. (ie between the HTML tags)

pub fn key(&self) -> Option<u32>[src]

Shortcut for finding the key, if one exists

pub fn get_text(&self) -> String[src]

pub fn walk_tree_mut<F>(&mut self, f: F) where
    F: FnMut(&mut Self), 
[src]

Call f(&mut el) for this El and each of its descendants

Trait Implementations

impl<Ms> UpdateEl<El<Ms>> for Attrs[src]

impl<Ms, '_> UpdateEl<El<Ms>> for &'_ Attrs[src]

impl<Ms> UpdateEl<El<Ms>> for Style[src]

impl<Ms, '_> UpdateEl<El<Ms>> for &'_ Style[src]

impl<Ms> UpdateEl<El<Ms>> for Listener<Ms>[src]

impl<Ms> UpdateEl<El<Ms>> for Vec<Listener<Ms>>[src]

impl<Ms> UpdateEl<El<Ms>> for DidMount<Ms>[src]

impl<Ms> UpdateEl<El<Ms>> for DidUpdate<Ms>[src]

impl<Ms> UpdateEl<El<Ms>> for WillUnmount<Ms>[src]

impl<Ms, '_> UpdateEl<El<Ms>> for &'_ str[src]

impl<Ms> UpdateEl<El<Ms>> for Vec<El<Ms>>[src]

impl<Ms> UpdateEl<El<Ms>> for El<Ms>[src]

impl<Ms> UpdateEl<El<Ms>> for Tag[src]

This is intended only to be used for the custom! element macro.

impl<Ms> UpdateEl<El<Ms>> for Optimize[src]

impl<Ms> ElContainer<Ms> for El<Ms>[src]

impl<Ms> Clone for El<Ms>[src]

Allow the user to clone their Els. Note that there's no easy way to clone the closures within listeners or lifestyle hooks, so we omit them.

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<Ms> PartialEq<El<Ms>> for El<Ms>[src]

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl<Ms: Debug + 'static> Debug for El<Ms>[src]

Auto Trait Implementations

impl<Ms> !Send for El<Ms>

impl<Ms> !Sync for El<Ms>

Blanket Implementations

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

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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<T> Borrow<T> for T where
    T: ?Sized
[src]

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

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