pub struct MemoryId(pub String);Expand description
Stable identifier for a memory item.
Tuple Fields§
§0: StringImplementations§
Source§impl MemoryId
impl MemoryId
Sourcepub fn new(id: impl Into<String>) -> Self
pub fn new(id: impl Into<String>) -> Self
Create a new MemoryId from any string-like value.
§Panics (debug only)
Triggers a debug_assert! if id is empty. In release builds a
tracing::warn! is emitted instead so that the misconfiguration is
surfaced in production logs without aborting the process.
Sourcepub fn try_new(id: impl Into<String>) -> Result<Self, AgentRuntimeError>
pub fn try_new(id: impl Into<String>) -> Result<Self, AgentRuntimeError>
Create a validated MemoryId, returning an error if id is empty.
Sourcepub fn starts_with(&self, prefix: &str) -> bool
pub fn starts_with(&self, prefix: &str) -> bool
Return true if the inner ID string starts with prefix.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for MemoryId
impl<'de> Deserialize<'de> for MemoryId
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
impl Eq for MemoryId
impl StructuralPartialEq for MemoryId
Auto Trait Implementations§
impl Freeze for MemoryId
impl RefUnwindSafe for MemoryId
impl Send for MemoryId
impl Sync for MemoryId
impl Unpin for MemoryId
impl UnsafeUnpin for MemoryId
impl UnwindSafe for MemoryId
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