pub struct SocketSpecification { /* private fields */ }Expand description
Specification for a general-purpose network listener.
Creates a Listener, which handles both connection-oriented and connectionless address families.
Only the listen address identifies the resource. Tuning – the UDP socket count, the receive buffer size, the accept backoff – is applied when the listener is first created and has no effect on a later acquisition of the same address, since the sockets are already bound. The registry logs a warning if a subsequent specification disagrees.
Implementations§
Source§impl SocketSpecification
impl SocketSpecification
Sourcepub fn new(address: ListenAddress) -> Self
pub fn new(address: ListenAddress) -> Self
Creates a specification for the given listen address.
Sourcepub fn with_udp_streams(self, udp_streams: Option<NonZeroUsize>) -> Self
pub fn with_udp_streams(self, udp_streams: Option<NonZeroUsize>) -> Self
Sets how many UDP sockets to bind to the address.
Each socket is bound independently with SO_REUSEPORT so the kernel load-balances incoming datagrams across
them, and the listener yields one stream per socket. Ignored for non-UDP addresses. See
Listener::from_listen_address for the platform caveats.
Sourcepub fn with_receive_buffer_size(
self,
receive_buffer_size: Option<usize>,
) -> Self
pub fn with_receive_buffer_size( self, receive_buffer_size: Option<usize>, ) -> Self
Sets the receive buffer size applied to streams accepted from this listener.
None keeps the operating system default.
Sourcepub fn with_accept_backoff(
self,
accept_backoff: Option<ExponentialBackoff>,
) -> Self
pub fn with_accept_backoff( self, accept_backoff: Option<ExponentialBackoff>, ) -> Self
Sets how long the listener waits between accepts when the system is out of resources.
None keeps the listener’s default. See Listener::with_accept_backoff.
Sourcepub fn listen_address(&self) -> &ListenAddress
pub fn listen_address(&self) -> &ListenAddress
Returns the listen address this specification names.
Trait Implementations§
Source§impl Clone for SocketSpecification
impl Clone for SocketSpecification
Source§fn clone(&self) -> SocketSpecification
fn clone(&self) -> SocketSpecification
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SocketSpecification
impl Debug for SocketSpecification
Source§impl From<ListenAddress> for SocketSpecification
impl From<ListenAddress> for SocketSpecification
Source§fn from(address: ListenAddress) -> Self
fn from(address: ListenAddress) -> Self
Source§impl ResourceSpecification for SocketSpecification
impl ResourceSpecification for SocketSpecification
Source§const KIND: ResourceKind = ResourceKind::Socket
const KIND: ResourceKind = ResourceKind::Socket
Source§fn key(&self) -> MetaString
fn key(&self) -> MetaString
Auto Trait Implementations§
impl Freeze for SocketSpecification
impl RefUnwindSafe for SocketSpecification
impl Send for SocketSpecification
impl Sync for SocketSpecification
impl Unpin for SocketSpecification
impl UnwindSafe for SocketSpecification
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> Track for T
impl<T> Track for T
Source§fn track_resources(self, token: ResourceGroupToken) -> Tracked<Self>
fn track_resources(self, token: ResourceGroupToken) -> Tracked<Self>
Tracked wrapper. Read moreSource§fn in_current_resource_group(self) -> Tracked<Self>
fn in_current_resource_group(self) -> Tracked<Self>
Tracked wrapper. Read more