Struct parsoid::image::Image

source ·
pub struct Image(/* private fields */);
Expand description

Represents an image ([[File:Foobar.jpg]])

See the spec for more details.

Implementations§

source§

impl Image

source

pub fn error(&self) -> Option<Vec<ImageError>>

Get the errors, if any, that apply to this image. For example, if an image is missing.

source

pub fn title(&self) -> String

Get the MediaWiki page title corresponding to the image being embedded, including File: namespace prefix.

source

pub fn horizontal_alignment(&self) -> HorizontalAlignment

Get the horizontal alignment of the image, see the documentation for more details.

source

pub fn set_horizontal_alignment(&self, halign: HorizontalAlignment)

Set the horizontal alignment of the image, see the documentation for more details.

Methods from Deref<Target = NodeRef>§

pub fn inclusive_ancestors(&self) -> Ancestors

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

pub fn ancestors(&self) -> Ancestors

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

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

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

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

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

pub fn inclusive_following_siblings(&self) -> Siblings

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

pub fn following_siblings(&self) -> Siblings

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

pub fn children(&self) -> Siblings

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

pub fn inclusive_descendants(&self) -> Descendants

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

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

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

pub fn traverse(&self) -> Traverse

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

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

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

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,

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

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

pub fn text_contents(&self) -> String

Return the concatenation of all text nodes in this subtree.

pub fn append(&self, new_child: NodeRef)

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)

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)

Insert a new sibling after this node.

The new sibling is detached from its previous position.

pub fn insert_before(&self, new_sibling: NodeRef)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pub fn detach(&self)

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§

source§

impl Clone for Image

source§

fn clone(&self) -> Image

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 Image

source§

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

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

impl From<Image> for Wikinode

source§

fn from(node: Image) -> Self

Converts to this type from the input type.
source§

impl WikinodeIterator for Image

source§

fn as_node(&self) -> &NodeRef

source§

fn append<N: WikiMultinode>(&self, code: &N)

Append a node as a child
source§

fn prepend<N: WikiMultinode>(&self, code: &N)

Prepend a node as a child
source§

fn insert_after<N: WikiMultinode>(&self, code: &N)

Insert a node after the current node, as a sibling
source§

fn insert_before<N: WikiMultinode>(&self, code: &N)

Insert a node before the current node, as a sibling
source§

fn select(&self, selector: &str) -> Vec<Wikinode>

Select some wiki nodes
source§

fn select_first(&self, selector: &str) -> Option<Wikinode>

Get the first element that matches the selector, if possible
Get a list of all wikilinks ([[Foo|bar]])
Get a list of all external links ([https://example.org/ Example])
source§

fn filter_categories(&self) -> Vec<Category>

Get a list of all categories
source§

fn filter_comments(&self) -> Vec<Comment>

Get a list of all comments (<!-- example -->)
source§

fn filter_images(&self) -> Vec<Image>

Get a list of all iamges
source§

fn filter_templates(&self) -> Result<Vec<Template>>

Get a list of templates
source§

fn filter_parser_functions(&self) -> Result<Vec<Template>>

Get a list of parser functions.
Get a list of all reference links on the page, e.g. [1]. Read more
source§

fn filter_reference_lists(&self) -> Vec<ReferenceList>

Get a list of all reference lists on the page, e.g. <references>
source§

fn filter_references(&self) -> Vec<Reference>

Get all references on the page. Read more
source§

fn iter_sections(&self) -> Vec<Section>

source§

fn filter_noinclude(&self) -> Vec<NoInclude>

source§

fn filter_onlyinclude(&self) -> Vec<OnlyInclude>

source§

fn parent(&self) -> Option<Wikinode>

Return the parent node, if it has one
source§

fn next_sibling(&self) -> Option<Wikinode>

Return the next sibling node, if it has one
source§

fn previous_sibling(&self) -> Option<Wikinode>

Return the previous sibling node, if it has one
source§

fn inclusive_ancestors(&self) -> WikinodeMap<Ancestors>

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

fn ancestors(&self) -> WikinodeMap<Ancestors>

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

fn inclusive_preceding_siblings(&self) -> WikinodeMap<Rev<Siblings>>

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

fn preceding_siblings(&self) -> WikinodeMap<Rev<Siblings>>

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

fn inclusive_following_siblings(&self) -> WikinodeMap<Siblings>

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

fn following_siblings(&self) -> WikinodeMap<Siblings>

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

fn children(&self) -> WikinodeMap<Siblings>

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

fn inclusive_descendants(&self) -> WikinodeMap<Descendants>

Return an iterator of references to this node and its descendants, in tree order. Parent nodes appear before the descendants.
source§

fn descendants(&self) -> WikinodeMap<Descendants>

Return an iterator of references to this node’s descendants, in tree order. Parent nodes appear before the descendants.
source§

impl Deref for Image

§

type Target = NodeRef

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.

Auto Trait Implementations§

§

impl Freeze for Image

§

impl !RefUnwindSafe for Image

§

impl !Send for Image

§

impl !Sync for Image

§

impl Unpin for Image

§

impl !UnwindSafe for Image

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§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

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

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.
source§

impl<T> WikiMultinode for T

source§

fn as_nodes(&self) -> Vec<NodeRef>

source§

fn as_wikinodes(&self) -> WikinodeMap<IntoIter<NodeRef>>

source§

fn detach(&self)

Remove this from the document
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more