Skip to main content

Document

Struct Document 

Source
pub struct Document {
    pub items: Vec<Item>,
    pub url: Option<Url>,
    pub rels: Relations,
    pub lang: Option<String>,
}
Expand description

A parsed Microformats2 document.

Fields§

§items: Vec<Item>

The top-level items in the document.

§url: Option<Url>

The URL of the document being parsed.

§rels: Relations

The rel-values defined in the document.

§lang: Option<String>

The language of the document.

Implementations§

Source§

impl Document

Source

pub fn new(url: Option<Url>) -> Self

Creates a new document with the given URL.

Source

pub fn add_relation(&mut self, url: Url, relation: Relation)

Adds a relation to the document, merging with existing relations for the same URL.

Trait Implementations§

Source§

impl Clone for Document

Source§

fn clone(&self) -> Document

Returns a duplicate 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 Document

Source§

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

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

impl Default for Document

Source§

fn default() -> Document

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

impl<'de> Deserialize<'de> for Document

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl FindItemById for Document

Source§

fn find_item_by_id(&self, expected_id: &str) -> Option<Item>

Finds an item with the given ID.
Source§

impl FindItemByProperty for Document

Source§

fn find_items_with_matching_property_value_by<F>( &self, predicate: F, ) -> Vec<(String, Item)>
where F: Fn(String, PropertyValue) -> bool + Copy,

Finds all items with properties matching the predicate.
Source§

fn find_items_with_matching_property_value( &self, needle: PropertyValue, ) -> Vec<(String, Item)>

Finds all items with a property matching the given value.
Source§

impl FindItemByUrl for Document

Source§

fn find_item_by_url(&self, expected_url: &Url) -> Option<Item>

Finds an item with a url property matching the expected URL.
Source§

impl IntoIterator for Document

Source§

type Item = Item

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<<Document as IntoIterator>::Item>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl LanguageFilter for Document

Source§

fn matches_languages(&self, languages: &HashSet<&str>) -> bool

Returns true if this item or any of its children match the given languages.
Source§

fn filter_by_languages_set(&self, languages: &HashSet<&str>) -> Option<Self>

Returns a new instance with only items matching the given languages.
Source§

impl PartialEq for Document

Source§

fn eq(&self, other: &Document) -> 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.
Source§

impl Serialize for Document

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for Document

Source§

impl StructuralPartialEq for Document

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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,

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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,