pub struct Entity {
pub name: String,
pub entity_type: String,
pub attributes: HashMap<String, String>,
pub created_at: u64,
pub updated_at: u64,
pub confidence: f32,
pub relations: Vec<(String, String)>,
}Expand description
An entity with attributes
Fields§
§name: StringEntity name/identifier
entity_type: StringEntity type (person, place, concept, etc.)
attributes: HashMap<String, String>Attributes as key-value pairs
created_at: u64When the entity was first seen
updated_at: u64When the entity was last updated
confidence: f32Confidence in the entity’s existence (0.0 to 1.0)
relations: Vec<(String, String)>Related entity names
Implementations§
Source§impl Entity
impl Entity
pub fn new(name: impl Into<String>, entity_type: impl Into<String>) -> Self
pub fn set_attribute( &mut self, key: impl Into<String>, value: impl Into<String>, )
pub fn get_attribute(&self, key: &str) -> Option<&String>
pub fn add_relation( &mut self, relation_type: impl Into<String>, target: impl Into<String>, )
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Entity
impl<'de> Deserialize<'de> for Entity
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 Entity
impl RefUnwindSafe for Entity
impl Send for Entity
impl Sync for Entity
impl Unpin for Entity
impl UnsafeUnpin for Entity
impl UnwindSafe for Entity
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