pub struct AgentId(pub String);Expand description
Stable identifier for an agent instance.
Tuple Fields§
§0: StringImplementations§
Source§impl AgentId
impl AgentId
Sourcepub fn new(id: impl Into<String>) -> Self
pub fn new(id: impl Into<String>) -> Self
Create a new AgentId 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 AgentId, returning an error if id is empty.
Prefer this constructor in user-facing code where empty IDs must be rejected explicitly rather than silently warned about.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Return true if the inner ID string is empty.
Note: AgentId::new warns (debug: asserts) against empty IDs.
This predicate is provided for defensive checks.
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 AgentId
impl<'de> Deserialize<'de> for AgentId
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 AgentId
impl StructuralPartialEq for AgentId
Auto Trait Implementations§
impl Freeze for AgentId
impl RefUnwindSafe for AgentId
impl Send for AgentId
impl Sync for AgentId
impl Unpin for AgentId
impl UnsafeUnpin for AgentId
impl UnwindSafe for AgentId
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