HtmlDomNode

Enum HtmlDomNode 

Source
pub enum HtmlDomNode {
    DomSpan(Span<HtmlDomNode>),
    Anchor(Anchor),
    Img(Img),
    Symbol(SymbolNode),
    SvgNode(SvgNode),
    MathML(MathNode),
    Fragment(HtmlDomFragment),
}
Expand description

Recursive HTML DOM node enum with tuple variants

Variants§

§

DomSpan(Span<HtmlDomNode>)

Span wrapping other DOM nodes

§

Anchor(Anchor)

Anchor (<a>) element with hyperlink

§

Img(Img)

Image embed (<img>) element

§

Symbol(SymbolNode)

Symbol node containing information about a single symbol

§

SvgNode(SvgNode)

SVG node for rendering stretchy wide elements

§

MathML(MathNode)

MathML node for mathematical expressions

§

Fragment(HtmlDomFragment)

Document fragment containing HTML DOM nodes

Implementations§

Source§

impl HtmlDomNode

Helper methods for HtmlDomNode to maintain API compatibility

These methods provide a unified interface for accessing properties of different HTML DOM node types. Not all node types support all properties - for example, SVG and MathML nodes don’t have traditional CSS classes or dimensions.

Source

pub const fn classes(&self) -> &ClassList

Get the CSS classes applied to this node

Returns an empty class list for node types that don’t support CSS classes (SvgNode, MathML). For other node types, returns their class list.

Source

pub const fn classes_mut(&mut self) -> Option<&mut ClassList>

Try to mutate the CSS classes applied to this node

Returns Some(&mut ClassList) for node types that support mutable CSS classes, or None for node types that don’t support CSS classes (SvgNode, MathML).

Source

pub const fn height(&self) -> f64

Get the height of this node

Returns the vertical height above the baseline in em units. For node types that don’t have a defined height (SvgNode, MathML), returns 0.0.

Source

pub const fn height_mut(&mut self) -> Option<&mut f64>

Try to set the height of this node

Returns Some(&mut f64) for node types that support mutable height, or None for node types that don’t have a defined height (SvgNode, MathML).

Source

pub const fn depth(&self) -> f64

Get the depth of this node

Returns the vertical depth below the baseline in em units. For node types that don’t have a defined depth (SvgNode, MathML), returns 0.0.

Source

pub const fn depth_mut(&mut self) -> Option<&mut f64>

Try to set the depth of this node

Returns Some(&mut f64) for node types that support mutable depth, or None for node types that don’t have a defined depth (SvgNode, MathML).

Source

pub const fn max_font_size(&self) -> f64

Get the maximum font size used in this node

Returns the largest font size used within this node and its children in em units. For node types that don’t have a defined max_font_size (SvgNode, MathML), returns 0.0.

Source

pub const fn max_font_size_mut(&mut self) -> Option<&mut f64>

Try to set the maximum font size of this node

Returns Some(&mut f64) for node types that support mutable max_font_size, or None for node types that don’t have a defined max_font_size (SvgNode, MathML).

Source

pub const fn width(&self) -> Option<f64>

Get the width of this node

Returns the horizontal width in em units, or None if the node doesn’t have a defined width. Most node types don’t have a defined width, with Symbol being the primary exception.

Source

pub const fn style(&self) -> Option<&CssStyle>

Get the inline CSS style object

Returns a reference to the CSS style properties applied to this node. For node types that don’t support inline styles (SvgNode, MathML), returns an empty style object.

Source

pub const fn style_mut(&mut self) -> Option<&mut CssStyle>

Get a mutable reference to the inline CSS style object

Returns a mutable reference to the CSS style properties applied to this node. For node types that don’t support inline styles (SvgNode, MathML), returns an empty style object.

Source

pub fn has_class(&self, class_name: &str) -> bool

Check if this node has a specific CSS class

Returns true if the node contains the specified CSS class in its class list. For node types that don’t support CSS classes (SvgNode, MathML), always returns false.

Source

pub const fn attributes(&self) -> Option<&KeyMap<String, String>>

Get the attributes of this node

Trait Implementations§

Source§

impl Clone for HtmlDomNode

Source§

fn clone(&self) -> HtmlDomNode

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for HtmlDomNode

Source§

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

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

impl From<Anchor> for HtmlDomNode

Source§

fn from(anchor: Anchor) -> Self

Converts to this type from the input type.
Source§

impl From<DocumentFragment<HtmlDomNode>> for HtmlDomNode

Source§

fn from(fragment: HtmlDomFragment) -> Self

Converts to this type from the input type.
Source§

impl From<Span<HtmlDomNode>> for HtmlDomNode

Source§

fn from(span: Span<Self>) -> Self

Converts to this type from the input type.
Source§

impl From<SymbolNode> for HtmlDomNode

Source§

fn from(symbol: SymbolNode) -> Self

Converts to this type from the input type.
Source§

impl VirtualNode for HtmlDomNode

Implement VirtualNode for HtmlDomNode

Source§

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

Convert into HTML markup by writing into the provided formatter.
Source§

fn to_markup(&self) -> Result<String, ParseError>
where Self: Sized,

Convenience helper that renders the node into a String.

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, 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.