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

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

Trait Implementations

Returns the AgentId reference of the addressable object.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

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"

Parses AgentId from LABEL.ACCOUNT_ID format.

Example

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

The associated error which can be returned from parsing.

Feeds this value into the given Hasher. Read more

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

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

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

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

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

recently added

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

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.