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

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

A type for a virtual Element representation.

Fields

reference: Option<Element>
Expand description

A reference to the DOM Element.

listeners: Vec<Rc<dyn Listener>>
Expand description

List of attached listeners.

attributes: Attributes
Expand description

List of attributes.

children: VList
Expand description

List of children nodes

value: Option<AttrValue>
Expand description

Contains a value of an InputElement.

kind: Option<AttrValue>
Expand description

Contains kind value of an InputElement.

checked: bool
Expand description

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
Expand description

A node reference used for DOM access in Component lifecycle methods

key: Option<Key>

Implementations

impl VTag[src]

pub fn new(tag: impl Into<Cow<'static, str>>) -> 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: impl IntoIterator<Item = VNode>)[src]

Add multiple VNode children.

pub fn set_value(&mut self, value: impl IntoOptPropValue<AttrValue>)[src]

Sets value for an InputElement.

pub fn set_kind(&mut self, value: impl IntoOptPropValue<AttrValue>)[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(&mut self, key: &'static str, value: impl Into<AttrValue>)[src]

Adds a key-value pair to attributes

Not every attribute works when it set as an attribute. We use workarounds for: type/kind, value and checked.

pub fn set_attributes(&mut self, attrs: impl Into<Attributes>)[src]

Sets attributes to a virtual node.

Not every attribute works when it set as an 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]

fn clone(&self) -> Self[src]

Returns a copy of the value. Read more

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

Performs copy-assignment from source. Read more

impl Debug for VTag[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl From<VTag> for VNode[src]

fn from(vtag: VTag) -> Self[src]

Performs the conversion.

impl PartialEq<VTag> for VTag[src]

fn eq(&self, other: &VTag) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

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

This method tests for !=.

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]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

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

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

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

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

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

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