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
impl Item
sourcepub fn parent(&self) -> ParentRelationship
pub fn parent(&self) -> ParentRelationship
Provides the parent item of this item.
sourcepub fn properties(&self) -> HashMap<String, Vec<PropertyValue>>
pub fn properties(&self) -> HashMap<String, Vec<PropertyValue>>
Provides a copy of the properties.
sourcepub fn into_dangling(&self) -> Self
pub fn into_dangling(&self) -> Self
Returns this Item without a reference to the document.
sourcepub fn new(parent: ParentRelationship, types: Vec<Class>) -> Self
pub fn new(parent: ParentRelationship, types: Vec<Class>) -> Self
Creates a new item with the provided ItemParent as its parent.
sourcepub fn append_child(&mut self, item: &Self)
pub fn append_child(&mut self, item: &Self)
Adds a Item to this Item as a child.
pub fn remove_child(&mut self, problem_child: &Self)
pub fn remove_whole_property(&mut self, property_name: &str)
pub fn content(&self) -> Option<Vec<PropertyValue>>
pub fn append_property( &mut self, property_name: &str, property_value: PropertyValue )
sourcepub fn has_nested_microformats(&self) -> bool
pub fn has_nested_microformats(&self) -> bool
Checks if this item has any properties with a nested item.
pub fn nested_children(&self) -> Vec<Item>
pub fn has_id(&self, id: &str) -> Option<Item>
pub fn has_url(&self, url: &Url) -> Option<PropertyValue>
pub fn set_parent(&mut self, property_relationship: ParentRelationship)
pub fn properties_with_matching_value( &self, property_value: PropertyValue ) -> Vec<String>
sourcepub fn concatenate_times(&mut self)
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.
sourcepub fn get_property(&self, arg: &str) -> Option<Vec<PropertyValue>>
pub fn get_property(&self, arg: &str) -> Option<Vec<PropertyValue>>
Obtains a list of values for a property.
pub fn set_id(&mut self, id_value: Option<String>)
pub fn set_value(&mut self, value: Option<ValueKind>)
pub fn value(&self) -> Option<ValueKind>
pub fn id(&self) -> Option<String>
pub fn properties_mut(&self) -> RefMut<'_, HashMap<String, Vec<PropertyValue>>>
Trait Implementations§
source§impl<'de> Deserialize<'de> for Item
impl<'de> Deserialize<'de> for Item
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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
impl From<Item> for PropertyValue
source§impl IntoIterator for Item
impl IntoIterator for Item
source§impl Ord for Item
impl Ord for Item
source§impl PartialEq for Item
impl PartialEq for Item
source§impl PartialOrd for Item
impl PartialOrd for Item
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
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 moreimpl Eq for Item
impl StructuralEq for Item
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more