pub struct Server {
pub addr: ServerAddr,
pub failed_attempts: usize,
pub did_connect: bool,
pub is_discovered: bool,
pub last_error: Option<String>,
}Expand description
Metadata about a server in the connection pool.
This is a snapshot of the server’s state at the time it was queried. Modifying this struct has no effect on the connection.
§Examples
let client = async_nats::connect("demo.nats.io").await?;
let pool = client.server_pool().await?;
for server in &pool {
println!(
"{:?}: {} failed attempts, connected: {}",
server.addr, server.failed_attempts, server.did_connect
);
}Fields§
§addr: ServerAddrThe server address.
failed_attempts: usizeNumber of consecutive failed connection attempts to this server. Reset to zero on a successful connection.
did_connect: boolWhether the client has ever successfully connected to this server.
is_discovered: boolWhether this server was discovered from a cluster INFO message rather than explicitly configured by the user.
last_error: Option<String>The last connection error for this server, if any.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Server
impl RefUnwindSafe for Server
impl Send for Server
impl Sync for Server
impl Unpin for Server
impl UnsafeUnpin for Server
impl UnwindSafe for Server
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