Struct microformats::types::Item

source ·
pub struct Item {
    pub type: Vec<Class>,
    pub id: ThreadSafeProperty<Option<String>>,
    pub value: ThreadSafeProperty<Option<ValueKind>>,
    /* private fields */
}
Expand description

Represents the structured form of an ‘object’ in Microformats.

Fields§

§type: Vec<Class>§id: ThreadSafeProperty<Option<String>>

The ID string of this item, if any is resolved.

§value: ThreadSafeProperty<Option<ValueKind>>

Represents the precise value of this item (if it’s defined as a property to another).

Implementations§

source§

impl Item

source

pub fn parent(&self) -> ParentRelationship

Provides the parent item of this item.

source

pub fn properties(&self) -> HashMap<String, Vec<PropertyValue>>

Provides a copy of the properties.

source

pub fn into_dangling(&self) -> Self

Returns this Item without a reference to the document.

source

pub fn new(parent: ParentRelationship, types: Vec<Class>) -> Self

Creates a new item with the provided ItemParent as its parent.

source

pub fn append_child(&mut self, item: &Self)

Adds a Item to this Item as a child.

source

pub fn is_empty(&self) -> bool

Determines if this item is undefined - an empty one.

source

pub fn remove_child(&mut self, problem_child: &Self)

source

pub fn remove_whole_property(&mut self, property_name: &str)

source

pub fn content(&self) -> Option<Vec<PropertyValue>>

source

pub fn append_property( &mut self, property_name: &str, property_value: PropertyValue )

source

pub fn has_nested_microformats(&self) -> bool

Checks if this item has any properties with a nested item.

source

pub fn children(&self) -> Vec<Item>

Obtains a list of the immediate children.

source

pub fn nested_children(&self) -> Vec<Item>

source

pub fn has_id(&self, id: &str) -> Option<Item>

source

pub fn has_url(&self, url: &Url) -> Option<PropertyValue>

source

pub fn set_parent(&mut self, property_relationship: ParentRelationship)

source

pub fn properties_with_matching_value( &self, property_value: PropertyValue ) -> Vec<String>

source

pub fn concatenate_times(&mut self)

Resolve full date time values for those missing them. This is an implementation of https://microformats.org/wiki/value-class-pattern#microformats2_parsers_implied_date.

source

pub fn get_property(&self, arg: &str) -> Option<Vec<PropertyValue>>

Obtains a list of values for a property.

source

pub fn set_id(&mut self, id_value: Option<String>)

source

pub fn set_value(&mut self, value: Option<ValueKind>)

source

pub fn value(&self) -> Option<ValueKind>

source

pub fn id(&self) -> Option<String>

source

pub fn properties_mut(&self) -> RefMut<'_, HashMap<String, Vec<PropertyValue>>>

Trait Implementations§

source§

impl Clone for Item

source§

fn clone(&self) -> Item

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 Item

source§

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

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

impl Default for Item

source§

fn default() -> Item

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

impl<'de> Deserialize<'de> for Item

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 From<Item> for PropertyValue

source§

fn from(item: Item) -> Self

Converts to this type from the input type.
source§

impl IntoIterator for Item

§

type Item = Item

The type of the elements being iterated over.
§

type IntoIter = IntoIter<<Item 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 Ord for Item

source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl PartialEq for Item

source§

fn eq(&self, other: &Item) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for Item

source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Serialize for Item

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 TryFrom<Map<String, Value>> for Item

§

type Error = Error

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

fn try_from(obj: Map<String, Value>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Value> for Item

§

type Error = Error

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

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

Performs the conversion.
source§

impl TryInto<Value> for Item

§

type Error = Error

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

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

Performs the conversion.
source§

impl Eq for Item

source§

impl StructuralEq for Item

source§

impl StructuralPartialEq for Item

Auto Trait Implementations§

§

impl !RefUnwindSafe for Item

§

impl !Send for Item

§

impl !Sync for Item

§

impl Unpin for Item

§

impl !UnwindSafe for Item

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

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