Struct rants::Address [−][src]
pub struct Address { /* fields omitted */ }
Expand description
An address used to connect to a NATS server
An Address
consists of a domain, a port number, and an optional
Authorization
. The domain can simply be the string representation
of an IP address or a true domain name that will be resolved through DNS.
The string representation of an Address
can take the following forms:
nats://<username>:<password>@<domain>:<port>
nats://<token>@<domain>:<port>
The only required part of the address string is the <domain>
. This makes the simplest
address solely an IP address (eg 127.0.0.1
). If no port is specified the default, port 4222
,
is used.
Note: When a client attempts to connect to the server at an address, the authorization
specified by the address will always override the client’s Connect
default
authorization
.
Example
use rants::Address;
let address = "nats://username:password@127.0.0.1:8080".parse::<Address>();
assert!(address.is_ok());
let address = "auth_token@1.2.3.4".parse::<Address>();
assert!(address.is_ok());
let address = "nats://auth_token@1.2.3.4:5780".parse::<Address>();
assert!(address.is_ok());
Implementations
Create a new Address
Get the Address
’s Authorization
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Address
impl UnwindSafe for Address
Blanket Implementations
Mutably borrows from an owned value. Read more