pub struct EntityId(pub String);Expand description
Stable identifier for a graph entity.
Tuple Fields§
§0: StringImplementations§
Source§impl EntityId
impl EntityId
Sourcepub fn new(id: impl Into<String>) -> Self
pub fn new(id: impl Into<String>) -> Self
Create a new EntityId 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 EntityId, returning an error if id is empty.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Return true if the inner ID string is empty.
Note: EntityId::new warns (debug: asserts) against empty IDs.
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 EntityId
impl<'de> Deserialize<'de> for EntityId
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 Ord for EntityId
impl Ord for EntityId
Source§impl PartialOrd for EntityId
impl PartialOrd for EntityId
impl Eq for EntityId
impl StructuralPartialEq for EntityId
Auto Trait Implementations§
impl Freeze for EntityId
impl RefUnwindSafe for EntityId
impl Send for EntityId
impl Sync for EntityId
impl Unpin for EntityId
impl UnsafeUnpin for EntityId
impl UnwindSafe for EntityId
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