pub struct VElement { /* private fields */ }Expand description
Represents Element in DOM.
Implementations§
Source§impl VElement
impl VElement
Sourcepub fn new(
tag_name: String,
attr: HashMap<String, String>,
event_handlers: Vec<EventHandler>,
key: Option<String>,
children: Vec<VNode>,
) -> VElement
pub fn new( tag_name: String, attr: HashMap<String, String>, event_handlers: Vec<EventHandler>, key: Option<String>, children: Vec<VNode>, ) -> VElement
Creates VElement out of provided arguments. Optional key is a way of easy comparison, if key is some and keys match, old element is used.
§Example
let element = VElement::new(
String::from("div") // tag_name,
[(String::from("id"),String::from("example"))].into(), // attr,
vec![], // event_handlers,
None, // key,
vec![VNode::Text(VText::new("child"))] // children
);Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for VElement
impl !Send for VElement
impl !Sync for VElement
impl !UnwindSafe for VElement
impl Freeze for VElement
impl Unpin for VElement
impl UnsafeUnpin for VElement
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more