Enum poem::Addr

source ·
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

source

pub fn socket(addr: SocketAddr) -> Self

Create a internet socket address.

source

pub fn unix(addr: SocketAddr) -> Self

Available on Unix only.

Create a unix socket address.

source

pub fn custom(scheme: &'static str, addr: impl Into<Cow<'static, str>>) -> Self

Create a custom address.

source

pub fn as_socket_addr(&self) -> Option<&SocketAddr>

If the address is a internet socket address, returns it. Returns None otherwise.

source

pub fn as_unix_socket_addr(&self) -> Option<&SocketAddr>

Available on Unix only.

If the address is a unix socket address, returns it. Returns None otherwise.

Trait Implementations§

source§

impl Clone for Addr

source§

fn clone(&self) -> Addr

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Addr

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Addr

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl Display for Addr

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<SocketAddr> for Addr

source§

fn from(addr: SocketAddr) -> Self

Converts to this type from the input type.
source§

impl From<SocketAddr> for Addr

source§

fn from(addr: SocketAddr) -> Self

Converts to this type from the input type.
source§

impl PartialEq for Addr

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

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<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> AnyEq for T
where T: Any + PartialEq,

source§

fn equals(&self, other: &(dyn Any + 'static)) -> bool

source§

fn as_any(&self) -> &(dyn Any + 'static)

source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

source§

fn implicit( self, class: Class, constructed: bool, tag: u32 ) -> TaggedParser<'a, Implicit, Self, E>

source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> FutureExt for T

source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

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,

Available on crate feature tower-compat only.
Converts a tower service to a poem endpoint.
source§

impl<L> TowerLayerCompatExt for L

source§

fn compat(self) -> TowerCompatMiddleware<Self>
where Self: Sized,

Available on crate feature tower-compat only.
Converts a tower layer to a poem middleware.
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more