Enum parsoid::node::Wikinode[][src]

pub enum Wikinode {
    BehaviorSwitch(BehaviorSwitch),
    Category(Category),
    Comment(Comment),
    ExtLink(ExtLink),
    Heading(Heading),
    HtmlEntity(HtmlEntity),
    InterwikiLink(InterwikiLink),
    LanguageLink(LanguageLink),
    Nowiki(Nowiki),
    Redirect(Redirect),
    Section(Section),
    WikiLink(WikiLink),
    Generic(Wikicode),
}

Enum that represents all the different types of nodes

Variants

BehaviorSwitch(BehaviorSwitch)
Category(Category)
Comment(Comment)

HTML comment

External link

Heading(Heading)
HtmlEntity(HtmlEntity)
Nowiki(Nowiki)
Redirect(Redirect)
Section(Section)

Wiki (internal) link

Generic(Wikicode)

A generic HTML node that we haven't implemented a specific type for yet or doesn't need one.

Implementations

impl Wikinode[src]

pub fn as_behavior_switch(&self) -> Option<BehaviorSwitch>[src]

pub fn as_category(&self) -> Option<Category>[src]

pub fn as_comment(&self) -> Option<Comment>[src]

If this node is a comment, get a clone of it

If this node is an external link, get a clone of it

pub fn as_generic(&self) -> Option<Wikicode>[src]

If this node is generic, get a clone of it

pub fn as_heading(&self) -> Option<Heading>[src]

pub fn as_html_entity(&self) -> Option<HtmlEntity>[src]

pub fn as_nowiki(&self) -> Option<Nowiki>[src]

pub fn as_redirect(&self) -> Option<Redirect>[src]

pub fn as_section(&self) -> Option<Section>[src]

If this node is a wiki link, get a clone of it

Methods from Deref<Target = NodeRef>

pub fn inclusive_ancestors(&self) -> Ancestors[src]

Return an iterator of references to this node and its ancestors.

pub fn ancestors(&self) -> Ancestors[src]

Return an iterator of references to this node’s ancestors.

pub fn inclusive_preceding_siblings(&self) -> Rev<Siblings>[src]

Return an iterator of references to this node and the siblings before it.

pub fn preceding_siblings(&self) -> Rev<Siblings>[src]

Return an iterator of references to this node’s siblings before it.

pub fn inclusive_following_siblings(&self) -> Siblings[src]

Return an iterator of references to this node and the siblings after it.

pub fn following_siblings(&self) -> Siblings[src]

Return an iterator of references to this node’s siblings after it.

pub fn children(&self) -> Siblings[src]

Return an iterator of references to this node’s children.

pub fn inclusive_descendants(&self) -> Descendants[src]

Return an iterator of references to this node and its descendants, in tree order.

Parent nodes appear before the descendants.

Note: this is the NodeEdge::Start items from traverse().

pub fn descendants(&self) -> Descendants[src]

Return an iterator of references to this node’s descendants, in tree order.

Parent nodes appear before the descendants.

Note: this is the NodeEdge::Start items from traverse().

pub fn traverse_inclusive(&self) -> Traverse[src]

Return an iterator of the start and end edges of this node and its descendants, in tree order.

pub fn traverse(&self) -> Traverse[src]

Return an iterator of the start and end edges of this node’s descendants, in tree order.

pub fn select(
    &self,
    selectors: &str
) -> Result<Select<Elements<Descendants>, Selectors>, ()>
[src]

Return an iterator of the inclusive descendants element that match the given selector list.

pub fn select_first(
    &self,
    selectors: &str
) -> Result<NodeDataRef<ElementData>, ()>
[src]

Return the first inclusive descendants element that match the given selector list.

pub fn serialize<W>(&self, writer: &mut W) -> Result<(), Error> where
    W: Write
[src]

Serialize this node and its descendants in HTML syntax to the given stream.

pub fn serialize_to_file<P>(&self, path: P) -> Result<(), Error> where
    P: AsRef<Path>, 
[src]

Serialize this node and its descendants in HTML syntax to a new file at the given path.

pub fn text_contents(&self) -> String[src]

Return the concatenation of all text nodes in this subtree.

pub fn append(&self, new_child: NodeRef)[src]

Append a new child to this node, after existing children.

The new child is detached from its previous position.

pub fn prepend(&self, new_child: NodeRef)[src]

Prepend a new child to this node, before existing children.

The new child is detached from its previous position.

pub fn insert_after(&self, new_sibling: NodeRef)[src]

Insert a new sibling after this node.

The new sibling is detached from its previous position.

pub fn insert_before(&self, new_sibling: NodeRef)[src]

Insert a new sibling before this node.

The new sibling is detached from its previous position.

Methods from Deref<Target = Node>

pub fn data(&self) -> &NodeData[src]

Return a reference to this node’s node-type-specific data.

pub fn as_element(&self) -> Option<&ElementData>[src]

If this node is an element, return a reference to element-specific data.

pub fn as_text(&self) -> Option<&RefCell<String>>[src]

If this node is a text node, return a reference to its contents.

pub fn as_comment(&self) -> Option<&RefCell<String>>[src]

If this node is a comment, return a reference to its contents.

pub fn as_doctype(&self) -> Option<&Doctype>[src]

If this node is a document, return a reference to doctype-specific data.

pub fn as_document(&self) -> Option<&DocumentData>[src]

If this node is a document, return a reference to document-specific data.

pub fn parent(&self) -> Option<NodeRef>[src]

Return a reference to the parent node, unless this node is the root of the tree.

pub fn first_child(&self) -> Option<NodeRef>[src]

Return a reference to the first child of this node, unless it has no child.

pub fn last_child(&self) -> Option<NodeRef>[src]

Return a reference to the last child of this node, unless it has no child.

pub fn previous_sibling(&self) -> Option<NodeRef>[src]

Return a reference to the previous sibling of this node, unless it is a first child.

pub fn next_sibling(&self) -> Option<NodeRef>[src]

Return a reference to the next sibling of this node, unless it is a last child.

pub fn detach(&self)[src]

Detach a node from its parent and siblings. Children are not affected.

To remove a node and its descendants, detach it and drop any strong reference to it.

Trait Implementations

impl Clone for Wikinode[src]

impl Debug for Wikinode[src]

impl Deref for Wikinode[src]

type Target = NodeRef

The resulting type after dereferencing.

impl From<BehaviorSwitch> for Wikinode[src]

impl From<Category> for Wikinode[src]

impl From<Comment> for Wikinode[src]

impl From<ExtLink> for Wikinode[src]

impl From<Heading> for Wikinode[src]

impl From<HtmlEntity> for Wikinode[src]

impl From<InterwikiLink> for Wikinode[src]

impl From<LanguageLink> for Wikinode[src]

impl From<Nowiki> for Wikinode[src]

impl From<Redirect> for Wikinode[src]

impl From<Section> for Wikinode[src]

impl From<WikiLink> for Wikinode[src]

impl From<Wikinode> for Wikicode[src]

impl WikinodeIterator for Wikinode[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.