[−][src]Struct sauron_vdom::Element
Represents the element of the virtual node
Fields
tag: T
the element tag, such as div, a, button
attrs: Vec<Attribute<ATT, EVENT, MSG>>
attributes for this element
children: Vec<Node<T, ATT, EVENT, MSG>>
children elements of this element
namespace: Option<&'static str>
namespace of this element, svg elements requires namespace to render correcly in the browser
Implementations
impl<T, ATT, EVENT, MSG> Element<T, ATT, EVENT, MSG> where
EVENT: 'static,
MSG: 'static,
ATT: PartialEq + Ord + ToString + Clone,
[src]
EVENT: 'static,
MSG: 'static,
ATT: PartialEq + Ord + ToString + Clone,
pub fn with_tag(tag: T) -> Self
[src]
creates an element node with the supplied tag
pub fn get_children(&self) -> &[Node<T, ATT, EVENT, MSG>]
[src]
returns a refernce to the children of this node
pub fn events(&self) -> Vec<&Attribute<ATT, EVENT, MSG>>
[src]
get the attributes that are events
pub fn get_event(&self, name: &ATT) -> Option<&Attribute<ATT, EVENT, MSG>>
[src]
return the event as an attribute which matches the event name.
pub fn attributes(&self) -> Vec<Attribute<ATT, EVENT, MSG>>
[src]
returns the only the attributes of this element
Note: This does not include the events.
If you need to access the events, use the attrs
field directly.
pub fn get_attr_value(&self, key: &ATT) -> Option<Value>
[src]
get all the attributes with the same name and merge their value
pub fn add_attributes(&mut self, attrs: Vec<Attribute<ATT, EVENT, MSG>>)
[src]
add attributes to this element
pub fn add_children(&mut self, children: Vec<Node<T, ATT, EVENT, MSG>>)
[src]
add children virtual node to this element
pub fn add_event_listener(&mut self, event: ATT, cb: Callback<EVENT, MSG>)
[src]
attach a callback to this element
pub fn eldest_child_text(&self) -> Option<&str>
[src]
returns the text if this node has only one child and is a text. includes: h1, h2..h6, p,
pub fn is_children_a_node_text(&self) -> bool
[src]
check if the children of this node is only 1 and it is a text node
Trait Implementations
impl<T: Clone, ATT: Clone, EVENT: Clone, MSG: Clone> Clone for Element<T, ATT, EVENT, MSG> where
MSG: 'static,
EVENT: 'static,
ATT: Clone,
[src]
MSG: 'static,
EVENT: 'static,
ATT: Clone,
fn clone(&self) -> Element<T, ATT, EVENT, MSG>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T: Debug, ATT: Debug, EVENT: Debug, MSG: Debug> Debug for Element<T, ATT, EVENT, MSG> where
MSG: 'static,
EVENT: 'static,
ATT: Clone,
[src]
MSG: 'static,
EVENT: 'static,
ATT: Clone,
impl<T: Default, ATT: Default, EVENT: Default, MSG: Default> Default for Element<T, ATT, EVENT, MSG> where
MSG: 'static,
EVENT: 'static,
ATT: Clone,
[src]
MSG: 'static,
EVENT: 'static,
ATT: Clone,
impl<T, ATT, EVENT, MSG> From<Element<T, ATT, EVENT, MSG>> for Node<T, ATT, EVENT, MSG> where
ATT: Clone,
[src]
ATT: Clone,
impl<T: PartialEq, ATT: PartialEq, EVENT: PartialEq, MSG: PartialEq> PartialEq<Element<T, ATT, EVENT, MSG>> for Element<T, ATT, EVENT, MSG> where
MSG: 'static,
EVENT: 'static,
ATT: Clone,
[src]
MSG: 'static,
EVENT: 'static,
ATT: Clone,
fn eq(&self, other: &Element<T, ATT, EVENT, MSG>) -> bool
[src]
fn ne(&self, other: &Element<T, ATT, EVENT, MSG>) -> bool
[src]
impl<T, ATT, EVENT, MSG> StructuralPartialEq for Element<T, ATT, EVENT, MSG> where
MSG: 'static,
EVENT: 'static,
ATT: Clone,
[src]
MSG: 'static,
EVENT: 'static,
ATT: Clone,
Auto Trait Implementations
impl<T, ATT, EVENT, MSG> !RefUnwindSafe for Element<T, ATT, EVENT, MSG>
impl<T, ATT, EVENT, MSG> !Send for Element<T, ATT, EVENT, MSG>
impl<T, ATT, EVENT, MSG> !Sync for Element<T, ATT, EVENT, MSG>
impl<T, ATT, EVENT, MSG> Unpin for Element<T, ATT, EVENT, MSG> where
ATT: Unpin,
T: Unpin,
ATT: Unpin,
T: Unpin,
impl<T, ATT, EVENT, MSG> !UnwindSafe for Element<T, ATT, EVENT, MSG>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,