Enum Interface
pub enum Interface {
Address(SocketAddress),
Device(DeviceName),
Socket(Arc<SocketOptions>),
}
Expand description
The interface to bind a Socket
to.
Variants§
Address(SocketAddress)
Bind to a Socket
address (ip + port), the most common choice
Device(DeviceName)
Bind to a network device interface name, using IPv4/TCP.
Use SocketOptions
if you want more finegrained control,
or make a raw Socket
yourself.
Socket(Arc<SocketOptions>)
Bind to a socket with the following options.
Implementations§
§impl Interface
impl Interface
pub fn new_address(addr: impl Into<SocketAddress>) -> Interface
pub fn new_address(addr: impl Into<SocketAddress>) -> Interface
creates a new Interface
from a SocketAddress
§impl Interface
impl Interface
pub const fn new_device(name: &'static str) -> Interface
§impl Interface
impl Interface
pub const fn local_ipv4(port: u16) -> Interface
pub const fn local_ipv4(port: u16) -> Interface
pub const fn local_ipv6(port: u16) -> Interface
pub const fn local_ipv6(port: u16) -> Interface
pub const fn default_ipv4(port: u16) -> Interface
pub const fn default_ipv4(port: u16) -> Interface
pub const fn default_ipv6(port: u16) -> Interface
pub const fn default_ipv6(port: u16) -> Interface
pub const fn broadcast_ipv4(port: u16) -> Interface
pub const fn broadcast_ipv4(port: u16) -> Interface
Trait Implementations§
§impl<'de> Deserialize<'de> for Interface
impl<'de> Deserialize<'de> for Interface
§fn deserialize<D>(
deserializer: D,
) -> Result<Interface, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<Interface, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
§impl From<&SocketAddr> for Interface
impl From<&SocketAddr> for Interface
§fn from(addr: &SocketAddr) -> Interface
fn from(addr: &SocketAddr) -> Interface
Converts to this type from the input type.
§impl From<&SocketAddress> for Interface
impl From<&SocketAddress> for Interface
§fn from(addr: &SocketAddress) -> Interface
fn from(addr: &SocketAddress) -> Interface
Converts to this type from the input type.
§impl From<Arc<SocketOptions>> for Interface
impl From<Arc<SocketOptions>> for Interface
§fn from(value: Arc<SocketOptions>) -> Interface
fn from(value: Arc<SocketOptions>) -> Interface
Converts to this type from the input type.
§impl From<SocketAddr> for Interface
impl From<SocketAddr> for Interface
§fn from(addr: SocketAddr) -> Interface
fn from(addr: SocketAddr) -> Interface
Converts to this type from the input type.
§impl From<SocketAddrV4> for Interface
impl From<SocketAddrV4> for Interface
§fn from(addr: SocketAddrV4) -> Interface
fn from(addr: SocketAddrV4) -> Interface
Converts to this type from the input type.
§impl From<SocketAddrV6> for Interface
impl From<SocketAddrV6> for Interface
§fn from(addr: SocketAddrV6) -> Interface
fn from(addr: SocketAddrV6) -> Interface
Converts to this type from the input type.
§impl From<SocketAddress> for Interface
impl From<SocketAddress> for Interface
§fn from(addr: SocketAddress) -> Interface
fn from(addr: SocketAddress) -> Interface
Converts to this type from the input type.
§impl From<SocketOptions> for Interface
impl From<SocketOptions> for Interface
§fn from(value: SocketOptions) -> Interface
fn from(value: SocketOptions) -> Interface
Converts to this type from the input type.
§impl Serialize for Interface
impl Serialize for Interface
§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
§impl Service<Interface> for DefaultAcceptorFactory
impl Service<Interface> for DefaultAcceptorFactory
§type Response = (TcpListener, Context)
type Response = (TcpListener, Context)
The type of response returned by the service.
§async fn serve(
&self,
ctx: Context,
interface: Interface,
) -> Result<<DefaultAcceptorFactory as Service<Interface>>::Response, <DefaultAcceptorFactory as Service<Interface>>::Error>
async fn serve( &self, ctx: Context, interface: Interface, ) -> Result<<DefaultAcceptorFactory as Service<Interface>>::Response, <DefaultAcceptorFactory as Service<Interface>>::Error>
Serve a response or error for the given request,
using the given context.
§fn boxed(self) -> BoxService<Request, Self::Response, Self::Error>
fn boxed(self) -> BoxService<Request, Self::Response, Self::Error>
Box this service to allow for dynamic dispatch.
§impl Service<Interface> for DefaultUdpBinder
impl Service<Interface> for DefaultUdpBinder
§async fn serve(
&self,
ctx: Context,
interface: Interface,
) -> Result<<DefaultUdpBinder as Service<Interface>>::Response, <DefaultUdpBinder as Service<Interface>>::Error>
async fn serve( &self, ctx: Context, interface: Interface, ) -> Result<<DefaultUdpBinder as Service<Interface>>::Response, <DefaultUdpBinder as Service<Interface>>::Error>
Serve a response or error for the given request,
using the given context.
§fn boxed(self) -> BoxService<Request, Self::Response, Self::Error>
fn boxed(self) -> BoxService<Request, Self::Response, Self::Error>
Box this service to allow for dynamic dispatch.
Auto Trait Implementations§
impl Freeze for Interface
impl RefUnwindSafe for Interface
impl Send for Interface
impl Sync for Interface
impl Unpin for Interface
impl UnwindSafe for Interface
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§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§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Create a new
Policy
that returns Action::Follow
only if self
and other
return
Action::Follow
. Read more§impl<T, U> RamaTryInto<U> for Twhere
U: RamaTryFrom<T>,
impl<T, U> RamaTryInto<U> for Twhere
U: RamaTryFrom<T>,
type Error = <U as RamaTryFrom<T>>::Error
fn rama_try_into(self) -> Result<U, <U as RamaTryFrom<T>>::Error>
§impl<T, U> RamaTryInto<U> for Twhere
U: RamaTryFrom<T>,
impl<T, U> RamaTryInto<U> for Twhere
U: RamaTryFrom<T>,
type Error = <U as RamaTryFrom<T>>::Error
fn rama_try_into(self) -> Result<U, <U as RamaTryFrom<T>>::Error>
§impl<T> ToSmolStr for T
impl<T> ToSmolStr for T
fn to_smolstr(&self) -> SmolStr
§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string
, but without panic on OOM.