pub struct McClientBuilder { /* private fields */ }Expand description
Builder for McClient.
Obtain via McClient::builder().
All fields are optional — unset fields use sensible defaults.
§Defaults
| Field | Default |
|---|---|
timeout | 10 s |
max_parallel | 10 |
dns_cache_size | 1024 |
response_cache | disabled |
proxy | none |
Implementations§
Source§impl McClientBuilder
impl McClientBuilder
Sourcepub fn timeout(self, timeout: Duration) -> Self
pub fn timeout(self, timeout: Duration) -> Self
Maximum time to wait for a single ping (default: 10 s).
Sourcepub fn max_parallel(self, n: usize) -> Self
pub fn max_parallel(self, n: usize) -> Self
Maximum number of concurrent pings in McClient::ping_many (default: 10).
Sourcepub fn dns_cache_size(self, size: usize) -> Self
pub fn dns_cache_size(self, size: usize) -> Self
LRU capacity for the DNS/SRV cache (default: 1024).
Sourcepub fn response_cache(self, ttl: Duration, size: usize) -> Self
pub fn response_cache(self, ttl: Duration, size: usize) -> Self
Enable the response cache with the given TTL and LRU capacity.
A cached response is returned instantly with latency = 0 and
is_cached() = true.
§Example
use rust_mc_status::McClient;
use std::time::Duration;
let client = McClient::builder()
.response_cache(Duration::from_secs(30), 100)
.build();Sourcepub fn response_cache_ttl(self, ttl: Duration) -> Self
pub fn response_cache_ttl(self, ttl: Duration) -> Self
Enable the response cache with only a TTL (capacity defaults to 256).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for McClientBuilder
impl RefUnwindSafe for McClientBuilder
impl Send for McClientBuilder
impl Sync for McClientBuilder
impl Unpin for McClientBuilder
impl UnsafeUnpin for McClientBuilder
impl UnwindSafe for McClientBuilder
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more