pub struct EntityMemory { /* private fields */ }Expand description
Entity memory for tracking knowledge about specific entities
Implementations§
Source§impl EntityMemory
impl EntityMemory
pub fn new(capacity: usize, max_attributes: usize) -> Self
Sourcepub fn get_or_create(&self, name: &str, entity_type: &str) -> Entity
pub fn get_or_create(&self, name: &str, entity_type: &str) -> Entity
Get or create an entity
Sourcepub fn update_attribute(&self, name: &str, key: &str, value: &str) -> bool
pub fn update_attribute(&self, name: &str, key: &str, value: &str) -> bool
Update an entity’s attribute
Sourcepub fn add_relation(
&self,
source: &str,
relation_type: &str,
target: &str,
) -> bool
pub fn add_relation( &self, source: &str, relation_type: &str, target: &str, ) -> bool
Add a relation between entities
Sourcepub fn get_by_type(&self, entity_type: &str) -> Vec<Entity>
pub fn get_by_type(&self, entity_type: &str) -> Vec<Entity>
Get all entities of a specific type
Sourcepub fn search_by_attribute(&self, key: &str, value: &str) -> Vec<Entity>
pub fn search_by_attribute(&self, key: &str, value: &str) -> Vec<Entity>
Search entities by attribute
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn entity_context(&self, name: &str) -> Option<String>
pub fn entity_context(&self, name: &str) -> Option<String>
Get entity as context string
Auto Trait Implementations§
impl !Freeze for EntityMemory
impl !RefUnwindSafe for EntityMemory
impl Send for EntityMemory
impl Sync for EntityMemory
impl Unpin for EntityMemory
impl UnsafeUnpin for EntityMemory
impl UnwindSafe for EntityMemory
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> 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