pub enum Addr {
SocketAddr(SocketAddr),
Unix(Arc<SocketAddr>),
Custom(&'static str, Cow<'static, str>),
}
Expand description
An network address.
Variants§
SocketAddr(SocketAddr)
Internet socket address
Unix(Arc<SocketAddr>)
Available on Unix only.
Unix domain socket address
Custom(&'static str, Cow<'static, str>)
Custom address
Implementations§
source§impl Addr
impl Addr
sourcepub fn socket(addr: SocketAddr) -> Self
pub fn socket(addr: SocketAddr) -> Self
Create a internet socket address.
sourcepub fn unix(addr: SocketAddr) -> Self
Available on Unix only.
pub fn unix(addr: SocketAddr) -> Self
Create a unix socket address.
sourcepub fn custom(scheme: &'static str, addr: impl Into<Cow<'static, str>>) -> Self
pub fn custom(scheme: &'static str, addr: impl Into<Cow<'static, str>>) -> Self
Create a custom address.
sourcepub fn as_socket_addr(&self) -> Option<&SocketAddr>
pub fn as_socket_addr(&self) -> Option<&SocketAddr>
If the address is a internet socket address, returns it. Returns None otherwise.
sourcepub fn as_unix_socket_addr(&self) -> Option<&SocketAddr>
Available on Unix only.
pub fn as_unix_socket_addr(&self) -> Option<&SocketAddr>
If the address is a unix socket address, returns it. Returns None otherwise.
Trait Implementations§
source§impl From<SocketAddr> for Addr
impl From<SocketAddr> for Addr
source§fn from(addr: SocketAddr) -> Self
fn from(addr: SocketAddr) -> Self
Converts to this type from the input type.
source§impl From<SocketAddr> for Addr
impl From<SocketAddr> for Addr
source§fn from(addr: SocketAddr) -> Self
fn from(addr: SocketAddr) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for Addr
impl RefUnwindSafe for Addr
impl Send for Addr
impl Sync for Addr
impl Unpin for Addr
impl UnwindSafe for Addr
Blanket Implementations§
source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
source§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> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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> TowerCompatExt for T
impl<T> TowerCompatExt for T
source§fn compat<ResBody, Err, Fut>(self) -> TowerCompatEndpoint<Self>where
ResBody: Body + Send + Sync + 'static,
ResBody::Data: Into<Bytes> + Send + 'static,
ResBody::Error: StdError + Send + Sync + 'static,
Err: Into<Error>,
Self: Service<Request<BoxBody<Bytes, Error>>, Response = Response<ResBody>, Error = Err, Future = Fut> + Clone + Send + Sync + Sized + 'static,
Fut: Future<Output = Result<Response<ResBody>, Err>> + Send + 'static,
fn compat<ResBody, Err, Fut>(self) -> TowerCompatEndpoint<Self>where
ResBody: Body + Send + Sync + 'static,
ResBody::Data: Into<Bytes> + Send + 'static,
ResBody::Error: StdError + Send + Sync + 'static,
Err: Into<Error>,
Self: Service<Request<BoxBody<Bytes, Error>>, Response = Response<ResBody>, Error = Err, Future = Fut> + Clone + Send + Sync + Sized + 'static,
Fut: Future<Output = Result<Response<ResBody>, Err>> + Send + 'static,
Available on crate feature
tower-compat
only.Converts a tower service to a poem endpoint.