Struct hatmel::Hatmel

source ·
pub struct Hatmel { /* private fields */ }

Implementations§

source§

impl Hatmel

source

pub fn query(&self, selectors: &str) -> Result<Selection<'_>, LoadError>

source

pub fn select(&self, selectors: Vec<Selector>) -> Selection<'_>

source§

impl Hatmel

source

pub fn get(&self, handle: Handle) -> Option<&Content>

source

pub fn children( &self, handle: Handle ) -> impl DoubleEndedIterator<Item = Handle> + '_

get all direct child nodes

source

pub fn parent(&self, handle: Handle) -> Option<Handle>

get the parent node which may be either an element or document root

source

pub fn ancestors(&self, adept: Handle) -> ParentIter<'_>

source

pub fn get_element_name(&self, node: Handle) -> Option<(&str, &str)>

if the node is an element returns the local name and namespace

source

pub fn get_element_attribute( &self, node: Handle, name: &str, ns: &str ) -> Option<&str>

get the last (overriding) attribute value if it’s an element

source

pub fn siblings_after( &self, handle: Handle ) -> impl DoubleEndedIterator<Item = Handle> + '_

get following adjacent nodes, whether or not they are elements

source

pub fn siblings_before( &self, handle: Handle ) -> impl DoubleEndedIterator<Item = Handle> + '_

get preceeding adjacent nodes, whether or not they are elements

source

pub fn get_title(&self) -> StrTendril

get the document title if it exists

source

pub fn get_text(&self, node: Handle) -> StrTendril

get node text including children

source§

impl Hatmel

source

pub fn load_file( &mut self, path: impl AsRef<Path> ) -> Result<&mut Self, LoadError>

source

pub fn load(&mut self, data: impl Read) -> Result<&mut Self, LoadError>

source§

impl Hatmel

source

pub fn revision(&self) -> usize

source

pub fn nodes(&self) -> HandleIter<'_>

Trait Implementations§

source§

impl Clone for Hatmel

source§

fn clone(&self) -> Hatmel

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 Hatmel

source§

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

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

impl Default for Hatmel

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl FashionSubject for Hatmel

Enables selector querying of Hatmel

§

type Adept = usize

§

type AdeptIter<'a> = HandleIter<'a>

§

type ParentIter<'a> = ParentIter<'a> where Self: 'a

source§

fn get_all_adepts(&self) -> Self::AdeptIter<'_>

source§

fn get_element_local_name(&self, adept: &Self::Adept) -> Option<&str>

source§

fn get_element_name_space(&self, adept: &Self::Adept) -> Option<&str>

source§

fn get_ancestors(&self, adept: &Self::Adept) -> Self::ParentIter<'_>

source§

fn get_element_class(&self, adept: &Self::Adept) -> Option<&str>

source§

fn get_element_id(&self, adept: &Self::Adept) -> Option<&str>

source§

fn get_element_attribute( &self, adept: &Self::Adept, name: &str, ns: &str ) -> Option<&str>

source§

fn is_root_element(&self, adept: &Self::Adept) -> bool

§

type OlderSiblingIter<'a> = OlderSiblingIter<'a> where Self: 'a

source§

fn get_older_siblings(&self, adept: &Self::Adept) -> Self::OlderSiblingIter<'_>

Auto Trait Implementations§

§

impl !RefUnwindSafe for Hatmel

§

impl !Send for Hatmel

§

impl !Sync for Hatmel

§

impl Unpin for Hatmel

§

impl UnwindSafe for Hatmel

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere 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 Twhere 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 Twhere 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.