[][src]Struct svc_agent::AgentId

pub struct AgentId { /* fields omitted */ }

Agent identifier.

It consists of a strig 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.

Methods

impl AgentId[src]

pub fn new(label: &str, account_id: AccountId) -> Self[src]

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[src]

Trait Implementations

impl Addressable for AgentId[src]

impl Authenticable for AgentId[src]

impl Clone for AgentId[src]

impl Debug for AgentId[src]

impl<'de> Deserialize<'de> for AgentId[src]

impl Display for AgentId[src]

fn fmt(&self, fmt: &mut Formatter) -> Result[src]

Formats AgentId as LABEL.ACCOUNT_ID.

Example

let agent_id = AgentId::new("instance01", AccountId::new("service_name", "svc.example.org"));
format!("{}", agent_id); // => "instance01.service_name.svc.example.org"

impl Eq for AgentId[src]

impl FromStr for AgentId[src]

type Err = Error

The associated error which can be returned from parsing.

fn from_str(val: &str) -> Result<Self, Self::Err>[src]

Parses AgentId from LABEL.ACCOUNT_ID format.

Example

let agent_id = AgentId::from_str("instance01.service_name.svc.example.org"));

impl Hash for AgentId[src]

impl PartialEq<AgentId> for AgentId[src]

impl Serialize for AgentId[src]

impl StructuralEq for AgentId[src]

impl StructuralPartialEq for AgentId[src]

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,