Enum NodeAccess

Source
pub enum NodeAccess {
    Owned(Node),
    Sharable(Arc<Node>),
}
Expand description

How node is being stored and accessed.

Variants§

§

Owned(Node)

§

Sharable(Arc<Node>)

Implementations§

Source§

impl NodeAccess

Source

pub fn try_mut(&mut self) -> Option<&mut Node>

Try to access node mutably. If this node is owned then this is possible. For sharable nodes they can be accessed mutable only if they still were not shared.

Source

pub fn to_sharable(&self) -> Arc<Node>

Convert this node to a sharable by cloning.

Source

pub fn to_owned(&self) -> Node

Convert this node to an owned by cloning.

Source

pub fn wrap_to_root(self) -> Result<Self, Self>

Wrap this leaf node into root node. See wrap_to_root from Node for details.

Methods from Deref<Target = Node>§

Source

pub fn start(&self) -> &Option<OpeningTag>

Start tag information.

Source

pub fn end(&self) -> Option<&str>

End tag information.

Source

pub fn text(&self) -> Option<&str>

Text that appears between opening and closing tags.

Source

pub fn children(&self) -> &Children

Children tags of this node.

Source

pub fn tag_name(&self) -> Option<&str>

The name of the tag that is represented by the node.

Source

pub fn attributes(&self) -> Option<&Vec<Attribute>>

Start tag attributes.

Source

pub fn attribute_by_name(&self, key: &str) -> Option<&Attribute>

Find attribute by it’s name.

Source

pub fn children_fetch(&self) -> ChildrenFetch<'_>

Get children fetcher for this node to find children that apply to some criteria.

Source

pub fn to_string(&self) -> String

Convert this node and all it’s children into HTML string.

Source

pub fn clone_without_children(&self) -> Self

Clone this node without cloning children leaving new node with empty children list.

Source

pub fn is_root(&self) -> bool

Check whether this node is the root of the tree.

Trait Implementations§

Source§

impl Clone for NodeAccess

Source§

fn clone(&self) -> NodeAccess

Returns a copy 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 NodeAccess

Source§

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

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

impl Deref for NodeAccess

Source§

type Target = Node

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Node

Dereferences the value.
Source§

impl From<Arc<Node>> for NodeAccess

Source§

fn from(sn: Arc<Node>) -> Self

Converts to this type from the input type.
Source§

impl From<Node> for NodeAccess

Source§

fn from(node: Node) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for NodeAccess

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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.