pub struct AgentId { /* private fields */ }
Expand description
Agent identifier.
It consists of a string label
and AccountId and must be unique.
Multiple agents may use the same AccountId, e.g. multiple instances
of the same service or multiple devices or browser tabs of an end user, but the label
must be different across them. An agent identifier has to be unique, otherwise it gets
disconnected by the broker. You can safely use the same label
if
AccountId is different.
Implementations§
source§impl AgentId
impl AgentId
sourcepub fn new<S: Into<String>>(label: S, account_id: AccountId) -> Self
pub fn new<S: Into<String>>(label: S, account_id: AccountId) -> Self
Builds an AgentId.
Arguments
-
label
– a unique string to identify the particular agent. For example the name of a service instance or a user device. -
account_id
– the account identifier of an agent.
Example
let agent_id1 = AgentId::new("instance01", AccountId::new("service_name", "svc.example.org"));
let agent_id2 = AgentId::new("web", AccountId::new("user_name", "usr.example.org"));
pub fn label(&self) -> &str
Trait Implementations§
source§impl Addressable for AgentId
impl Addressable for AgentId
source§fn as_agent_id(&self) -> &Self
fn as_agent_id(&self) -> &Self
Returns the AgentId reference of the addressable object.
source§impl Authenticable for AgentId
impl Authenticable for AgentId
fn as_account_id(&self) -> &AccountId
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
source§impl PartialEq<AgentId> for AgentId
impl PartialEq<AgentId> for AgentId
impl Eq for AgentId
impl StructuralEq for AgentId
impl StructuralPartialEq for AgentId
Auto Trait Implementations§
impl RefUnwindSafe for AgentId
impl Send for AgentId
impl Sync for AgentId
impl Unpin 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