Skip to main content

HtmlElement

Struct HtmlElement 

Source
pub struct HtmlElement { /* private fields */ }
Expand description

An HTML element.

Implementations§

Source§

impl HtmlElement

Source

pub fn new<S: ToString>(tag: S) -> Self

Create a new HTML element with the given tag.

Source

pub fn set_tag<S: ToString>(&mut self, tag: S)

Source

pub fn get_id(&self) -> &str

Source

pub fn set_id<S: ToString>(&mut self, id: S)

Source

pub fn with_id<S: ToString>(self, id: S) -> Self

Source

pub fn get_classes(&self) -> &BTreeSet<String>

Source

pub fn mut_classes(&mut self) -> &mut BTreeSet<String>

Source

pub fn add_class<S: ToString>(&mut self, class: S)

Source

pub fn with_class<S: ToString>(self, class: S) -> Self

Source

pub fn get_attributes(&self) -> &BTreeMap<String, String>

Source

pub fn mut_attributes(&mut self) -> &mut BTreeMap<String, String>

Source

pub fn add_attribute<K: ToString, V: ToString>(&mut self, key: K, value: V)

Source

pub fn with_attribute<K: ToString, V: ToString>(self, key: K, value: V) -> Self

Source

pub fn get_children(&self) -> &[HtmlNode]

Source

pub fn mut_children(&mut self) -> &mut Vec<HtmlNode>

Source

pub fn add_child<H: Into<HtmlNode>>(&mut self, child: H)

Source

pub fn with_child<H: Into<HtmlNode>>(self, child: H) -> Self

Source

pub fn add_safe_text(&mut self, text: Cow<'static, str>)

Add a section of HTML text that does not need to be transferred

Source

pub fn add_text<S: AsRef<str>>(&mut self, text: S)

Add a section of HTML text and make righteousness

Source

pub fn with_safe_text(self, text: Cow<'static, str>) -> Self

Source

pub fn with_text<S: AsRef<str>>(self, text: S) -> Self

Trait Implementations§

Source§

impl Clone for HtmlElement

Source§

fn clone(&self) -> HtmlElement

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for HtmlElement

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Display for HtmlElement

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for HtmlElement

Source§

impl From<HtmlElement> for HtmlNode

Source§

fn from(value: HtmlElement) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for HtmlElement

Source§

fn eq(&self, other: &HtmlElement) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for HtmlElement

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.