Enum yrs::types::xml::XmlNode

source ·
pub enum XmlNode {
    Element(XmlElementRef),
    Fragment(XmlFragmentRef),
    Text(XmlTextRef),
}
Expand description

An return type from XML elements retrieval methods. It’s an enum of all supported values, that can be nested inside of XmlElementRef. These are other XmlElementRefs, XmlFragmentRefs or XmlTextRef values.

Variants§

Implementations§

source§

impl XmlNode

source

pub fn as_ptr(&self) -> BranchPtr

source

pub fn id(&self) -> BranchID

source

pub fn into_xml_element(self) -> Option<XmlElementRef>

If current underlying XmlNode is wrapping a XmlElementRef, it will be returned. Otherwise, a None will be returned.

source

pub fn into_xml_fragment(self) -> Option<XmlFragmentRef>

If current underlying XmlNode is wrapping a XmlFragmentRef, it will be returned. Otherwise, a None will be returned.

source

pub fn into_xml_text(self) -> Option<XmlTextRef>

If current underlying XmlNode is wrapping a XmlTextRef, it will be returned. Otherwise, a None will be returned.

Trait Implementations§

source§

impl AsRef<Branch> for XmlNode

source§

fn as_ref(&self) -> &Branch

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Clone for XmlNode

source§

fn clone(&self) -> XmlNode

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 XmlNode

source§

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

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

impl TryFrom<BranchPtr> for XmlNode

§

type Error = BranchPtr

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

fn try_from(value: BranchPtr) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Value> for XmlNode

§

type Error = Value

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

fn try_from(value: Value) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryInto<XmlElementRef> for XmlNode

§

type Error = XmlNode

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

fn try_into(self) -> Result<XmlElementRef, Self::Error>

Performs the conversion.
source§

impl TryInto<XmlFragmentRef> for XmlNode

§

type Error = XmlNode

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

fn try_into(self) -> Result<XmlFragmentRef, Self::Error>

Performs the conversion.
source§

impl TryInto<XmlTextRef> for XmlNode

§

type Error = XmlNode

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

fn try_into(self) -> Result<XmlTextRef, Self::Error>

Performs the conversion.

Auto Trait Implementations§

§

impl Freeze for XmlNode

§

impl !RefUnwindSafe for XmlNode

§

impl !Send for XmlNode

§

impl !Sync for XmlNode

§

impl Unpin for XmlNode

§

impl !UnwindSafe for XmlNode

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

§

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

§

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

§

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.