Struct svc_agent::AgentId[][src]

pub struct AgentId { /* fields omitted */ }
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

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]

fn as_agent_id(&self) -> &Self[src]

Returns the AgentId reference of the addressable object.

impl Authenticable for AgentId[src]

impl Clone for AgentId[src]

fn clone(&self) -> AgentId[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for AgentId[src]

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

Formats the value using the given formatter. Read more

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

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
    D: Deserializer<'de>, 
[src]

Deserialize this value from the given Serde deserializer. Read more

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 FromStr for AgentId[src]

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"));

type Err = Error

The associated error which can be returned from parsing.

impl Hash for AgentId[src]

fn hash<__H: Hasher>(&self, state: &mut __H)[src]

Feeds this value into the given Hasher. Read more

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

Feeds a slice of this type into the given Hasher. Read more

impl PartialEq<AgentId> for AgentId[src]

fn eq(&self, other: &AgentId) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &AgentId) -> bool[src]

This method tests for !=.

impl Serialize for AgentId[src]

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where
    S: Serializer
[src]

Serialize this value into the given Serde serializer. Read more

impl Eq 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]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

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

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

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

pub default fn to_string(&self) -> String[src]

Converts the given value to a String. Read more

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

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