pub struct Item {
pub id: ItemId,
pub item_type: ItemType,
pub name: String,
pub description: Option<String>,
pub source: SourceLocation,
pub relationships: Vec<Relationship>,
pub attributes: ItemAttributes,
}Expand description
Represents a single document/node in the knowledge graph.
Fields§
§id: ItemIdUnique identifier.
item_type: ItemTypeType of this item.
name: StringHuman-readable name.
description: Option<String>Optional description.
source: SourceLocationSource file location.
relationships: Vec<Relationship>All relationships from this item to other items.
attributes: ItemAttributesType-specific attributes.
Implementations§
Source§impl Item
impl Item
Sourcepub fn relationship_ids(
&self,
rel_type: RelationshipType,
) -> impl Iterator<Item = &ItemId>
pub fn relationship_ids( &self, rel_type: RelationshipType, ) -> impl Iterator<Item = &ItemId>
Returns an iterator over target IDs for a specific relationship type.
Sourcepub fn has_relationship_type(&self, rel_type: RelationshipType) -> bool
pub fn has_relationship_type(&self, rel_type: RelationshipType) -> bool
Returns true if this item has any relationships of the given type.
Sourcepub fn has_upstream(&self) -> bool
pub fn has_upstream(&self) -> bool
Returns true if this item has any upstream relationships.
Sourcepub fn all_references(&self) -> impl Iterator<Item = &ItemId>
pub fn all_references(&self) -> impl Iterator<Item = &ItemId>
Returns an iterator over all referenced item IDs (relationships and peer refs from attributes).
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
Auto Trait Implementations§
impl Freeze for Item
impl RefUnwindSafe for Item
impl Send for Item
impl Sync for Item
impl Unpin for Item
impl UnsafeUnpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more