[][src]Struct yew::virtual_dom::VTag

pub struct VTag {
    pub reference: Option<Element>,
    pub listeners: Vec<Rc<dyn Listener>>,
    pub attributes: HashMap<String, String>,
    pub children: VList,
    pub value: Option<String>,
    pub kind: Option<String>,
    pub checked: bool,
    pub node_ref: NodeRef,
    pub key: Option<String>,
    // some fields omitted
}

A type for a virtual Element representation.

Fields

reference: Option<Element>

A reference to the Element.

listeners: Vec<Rc<dyn Listener>>

List of attached listeners.

attributes: HashMap<String, String>

List of attributes.

children: VList

List of children nodes

value: Option<String>

Contains a value of an InputElement.

kind: Option<String>

Contains kind value of an InputElement.

checked: bool

Represents checked attribute of input. It exists to override standard behavior of checked attribute, because in original HTML it sets defaultChecked value of InputElement, but for reactive frameworks it's more useful to control checked value of an InputElement.

node_ref: NodeRef

A node reference used for DOM access in Component lifecycle methods

key: Option<String>

Implementations

impl VTag[src]

pub fn new<S: Into<Cow<'static, str>>>(tag: S) -> Self[src]

Creates a new VTag instance with tag name (cannot be changed later in DOM).

pub fn tag(&self) -> &str[src]

Returns tag of an Element. In HTML tags are always uppercase.

pub fn add_child(&mut self, child: VNode)[src]

Add VNode child.

pub fn add_children(&mut self, children: Vec<VNode>)[src]

Add multiple VNode children.

pub fn set_value<T: ToString>(&mut self, value: &T)[src]

Sets value for an InputElement.

pub fn set_kind<T: ToString>(&mut self, value: &T)[src]

Sets kind property of an InputElement. Same as set type attribute.

pub fn set_checked(&mut self, value: bool)[src]

Sets checked property of an InputElement. (Not a value of node's attribute).

pub fn add_attribute<T: ToString>(&mut self, name: &str, value: &T)[src]

Adds attribute to a virtual node. Not every attribute works when it set as attribute. We use workarounds for: type/kind, value and checked.

If this virtual node has this attribute present, the value is replaced.

pub fn add_attributes(&mut self, attrs: Vec<(String, String)>)[src]

Adds attributes to a virtual node. Not every attribute works when it set as attribute. We use workarounds for: type/kind, value and checked.

pub fn add_listener(&mut self, listener: Rc<dyn Listener>)[src]

Adds new listener to the node. It's boxed because we want to keep it in a single list. Later Listener::attach will attach an actual listener to a DOM node.

pub fn add_listeners(&mut self, listeners: Vec<Rc<dyn Listener>>)[src]

Adds new listeners to the node. They are boxed because we want to keep them in a single list. Later Listener::attach will attach an actual listener to a DOM node.

Trait Implementations

impl Clone for VTag[src]

impl Debug for VTag[src]

impl From<VTag> for VNode[src]

impl PartialEq<VTag> for VTag[src]

impl<'a, T> Transformer<&'a T, T> for VTag where
    T: Clone
[src]

impl<T> Transformer<T, T> for VTag[src]

Auto Trait Implementations

impl !RefUnwindSafe for VTag

impl !Send for VTag

impl !Sync for VTag

impl Unpin for VTag

impl !UnwindSafe for VTag

Blanket Implementations

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

impl<T> Any for T where
    T: Any
[src]

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

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

impl<T> CloneAny for T where
    T: Clone + Any
[src]

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

impl<T, U> Into<U> for T where
    U: From<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.