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

pub struct El<Ms: Clone + '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 id: Option<u32>,
    pub nest_level: Option<u32>,
    pub el_ws: Option<Element>,
    pub raw_html: bool,
    pub namespace: Option<Namespace>,
    pub did_mount: Option<Box<dyn FnMut(&Element)>>,
    pub did_update: Option<Box<dyn FnMut(&Element)>>,
    pub will_unmount: Option<Box<dyn FnMut(&Element)>>,
}

An component in our virtual DOM.

Fields

tag: Tagattrs: Attrsstyle: Stylelisteners: Vec<Listener<Ms>>text: Option<String>children: Vec<El<Ms>>id: Option<u32>nest_level: Option<u32>el_ws: Option<Element>raw_html: boolnamespace: Option<Namespace>did_mount: Option<Box<dyn FnMut(&Element)>>did_update: Option<Box<dyn FnMut(&Element)>>will_unmount: Option<Box<dyn FnMut(&Element)>>

Methods

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

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

Create an empty element, specifying only the tag

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

Create an empty SVG element, specifying only the tag

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

Create an element that will display markdown from the text you pass to it, as HTML

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

Create an element that will display raw HTML

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 quick_clone(&self) -> Self
[src]

This is used to provide access to el_ws while recursively appending children to it.

pub fn is_dummy(&self) -> bool
[src]

Dummy elements are used when logic must return an El due to the type system, but we don't want to render anything.

Trait Implementations

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

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

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

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

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

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

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

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

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

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

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

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

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

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

impl<Ms: Clone + 'static> 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 ommit them.

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

Performs copy-assignment from source. Read more

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

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

This method tests for !=.

Auto Trait Implementations

impl<Ms> !Send for El<Ms>

impl<Ms> !Sync for El<Ms>

Blanket Implementations

impl<T> From for T
[src]

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

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

type Owned = T

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

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.