pub struct NetTransportOptions<I, A: AddressResolver<ResolvedAddress = SocketAddr>, S: StreamLayer> { /* private fields */ }
Expand description
Used to configure a net transport.
Implementations§
Source§impl<I, A: AddressResolver<ResolvedAddress = SocketAddr>, S: StreamLayer> NetTransportOptions<I, A, S>
impl<I, A: AddressResolver<ResolvedAddress = SocketAddr>, S: StreamLayer> NetTransportOptions<I, A, S>
Sourcepub const fn bind_addresses(&self) -> &IndexSet<A::Address>
pub const fn bind_addresses(&self) -> &IndexSet<A::Address>
Get a set of addresses to bind to for both TCP and UDP communications.
Sourcepub const fn stream_layer(&self) -> &S::Options
pub const fn stream_layer(&self) -> &S::Options
Get the stream layer options.
Sourcepub const fn cidrs_policy(&self) -> &CIDRsPolicy
pub const fn cidrs_policy(&self) -> &CIDRsPolicy
Get the policy for Classless Inter-Domain Routing (CIDR).
Sourcepub const fn max_packet_size(&self) -> usize
pub const fn max_packet_size(&self) -> usize
Get the maximum payload size can be sent by UDP. Default is 1472
bytes.
Sourcepub const fn recv_buffer_size(&self) -> usize
pub const fn recv_buffer_size(&self) -> usize
Get the UDP receive window. Default is 2MB
.
Sourcepub fn metric_labels(&self) -> Option<&MetricLabels>
Available on crate feature metrics
only.
pub fn metric_labels(&self) -> Option<&MetricLabels>
metrics
only.Get the metrics labels.
Sourcepub fn with_bind_addresses(self, val: IndexSet<A::Address>) -> Self
pub fn with_bind_addresses(self, val: IndexSet<A::Address>) -> Self
Set the set of addresses to bind to for both TCP and UDP communications. (Builder pattern)
Sourcepub fn with_resolver(self, val: A::Options) -> Self
pub fn with_resolver(self, val: A::Options) -> Self
Set the address resolver options. (Builder pattern)
Sourcepub fn with_stream_layer(self, val: S::Options) -> Self
pub fn with_stream_layer(self, val: S::Options) -> Self
Set the stream layer options. (Builder pattern)
Sourcepub fn with_cidrs_policy(self, val: CIDRsPolicy) -> Self
pub fn with_cidrs_policy(self, val: CIDRsPolicy) -> Self
Set the policy for Classless Inter-Domain Routing (CIDR). (Builder pattern)
Sourcepub fn with_max_packet_size(self, val: usize) -> Self
pub fn with_max_packet_size(self, val: usize) -> Self
Set the maximum payload size can be sent by UDP. Default is 1472
bytes. (Builder pattern)
Sourcepub fn with_recv_buffer_size(self, val: usize) -> Self
pub fn with_recv_buffer_size(self, val: usize) -> Self
Set the UDP receive window. Default is 2MB
. (Builder pattern)
Sourcepub fn with_metric_labels(self, val: Option<Arc<MetricLabels>>) -> Self
Available on crate feature metrics
only.
pub fn with_metric_labels(self, val: Option<Arc<MetricLabels>>) -> Self
metrics
only.Set the metrics labels. (Builder pattern)
Source§impl<I, A: AddressResolver<ResolvedAddress = SocketAddr>, S: StreamLayer> NetTransportOptions<I, A, S>
impl<I, A: AddressResolver<ResolvedAddress = SocketAddr>, S: StreamLayer> NetTransportOptions<I, A, S>
Source§impl<I, A: AddressResolver<ResolvedAddress = SocketAddr>, S: StreamLayer> NetTransportOptions<I, A, S>
impl<I, A: AddressResolver<ResolvedAddress = SocketAddr>, S: StreamLayer> NetTransportOptions<I, A, S>
Sourcepub fn with_resolver_options(id: I, resolver_options: A::Options) -> Self
pub fn with_resolver_options(id: I, resolver_options: A::Options) -> Self
Creates a new net transport options by id and resolver options, other configurations are left default.
Source§impl<I, A: AddressResolver<ResolvedAddress = SocketAddr>, S: StreamLayer> NetTransportOptions<I, A, S>
impl<I, A: AddressResolver<ResolvedAddress = SocketAddr>, S: StreamLayer> NetTransportOptions<I, A, S>
Sourcepub fn with_stream_layer_options(
id: I,
stream_layer_options: S::Options,
) -> Self
pub fn with_stream_layer_options( id: I, stream_layer_options: S::Options, ) -> Self
Creates a new net transport options by id and stream layer options, other configurations are left default.
Source§impl<I, A: AddressResolver<ResolvedAddress = SocketAddr>, S: StreamLayer> NetTransportOptions<I, A, S>
impl<I, A: AddressResolver<ResolvedAddress = SocketAddr>, S: StreamLayer> NetTransportOptions<I, A, S>
Sourcepub fn with_resolver_options_and_stream_layer_options(
id: I,
resolver_options: A::Options,
stream_layer_opts: S::Options,
) -> Self
pub fn with_resolver_options_and_stream_layer_options( id: I, resolver_options: A::Options, stream_layer_opts: S::Options, ) -> Self
Creates a new net transport options by id, resolver options and stream layer options, other configurations are left default.
Sourcepub fn add_bind_address(&mut self, addr: A::Address) -> &mut Self
pub fn add_bind_address(&mut self, addr: A::Address) -> &mut Self
Add bind address
Trait Implementations§
Source§impl<I, A: AddressResolver<ResolvedAddress = SocketAddr>, S: StreamLayer> Clone for NetTransportOptions<I, A, S>
impl<I, A: AddressResolver<ResolvedAddress = SocketAddr>, S: StreamLayer> Clone for NetTransportOptions<I, A, S>
Source§impl<I: Debug, A: Debug + AddressResolver<ResolvedAddress = SocketAddr>, S: Debug + StreamLayer> Debug for NetTransportOptions<I, A, S>
impl<I: Debug, A: Debug + AddressResolver<ResolvedAddress = SocketAddr>, S: Debug + StreamLayer> Debug for NetTransportOptions<I, A, S>
Source§impl<'de, I, A, S: StreamLayer> Deserialize<'de> for NetTransportOptions<I, A, S>where
I: Deserialize<'de>,
A: AddressResolver + AddressResolver<ResolvedAddress = SocketAddr>,
A::Address: Deserialize<'de>,
A::ResolvedAddress: Deserialize<'de>,
A::Options: Deserialize<'de>,
S::Options: Deserialize<'de>,
impl<'de, I, A, S: StreamLayer> Deserialize<'de> for NetTransportOptions<I, A, S>where
I: Deserialize<'de>,
A: AddressResolver + AddressResolver<ResolvedAddress = SocketAddr>,
A::Address: Deserialize<'de>,
A::ResolvedAddress: Deserialize<'de>,
A::Options: Deserialize<'de>,
S::Options: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<I, A: AddressResolver<ResolvedAddress = SocketAddr>, S: StreamLayer> From<NetTransportOptions<I, A, S>> for (A::Options, S::Options, Options<I, A>)
impl<I, A: AddressResolver<ResolvedAddress = SocketAddr>, S: StreamLayer> From<NetTransportOptions<I, A, S>> for (A::Options, S::Options, Options<I, A>)
Source§impl<I, A, S: StreamLayer> Serialize for NetTransportOptions<I, A, S>where
I: Serialize,
A: AddressResolver + AddressResolver<ResolvedAddress = SocketAddr>,
A::Address: Serialize,
A::ResolvedAddress: Serialize,
A::Options: Serialize,
S::Options: Serialize,
impl<I, A, S: StreamLayer> Serialize for NetTransportOptions<I, A, S>where
I: Serialize,
A: AddressResolver + AddressResolver<ResolvedAddress = SocketAddr>,
A::Address: Serialize,
A::ResolvedAddress: Serialize,
A::Options: Serialize,
S::Options: Serialize,
Auto Trait Implementations§
impl<I, A, S> Freeze for NetTransportOptions<I, A, S>
impl<I, A, S> RefUnwindSafe for NetTransportOptions<I, A, S>where
I: RefUnwindSafe,
<A as AddressResolver>::Options: RefUnwindSafe,
<S as StreamLayer>::Options: RefUnwindSafe,
<A as AddressResolver>::Address: RefUnwindSafe,
impl<I, A, S> Send for NetTransportOptions<I, A, S>
impl<I, A, S> Sync for NetTransportOptions<I, A, S>
impl<I, A, S> Unpin for NetTransportOptions<I, A, S>
impl<I, A, S> UnwindSafe for NetTransportOptions<I, A, S>where
I: UnwindSafe,
<A as AddressResolver>::Options: UnwindSafe,
<S as StreamLayer>::Options: UnwindSafe,
<A as AddressResolver>::Address: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
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> ⓘ
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