pub struct PeerAddr(pub SocketAddr);Expand description
Extractor for peer’s socket address.
Also see HttpRequest::peer_addr and ConnectionInfo::peer_addr.
Examples
use actix_web::dev::PeerAddr;
async fn handler(peer_addr: PeerAddr) -> impl Responder {
let socket_addr = peer_addr.0;
socket_addr.to_string()
}Tuple Fields
0: SocketAddrImplementations
sourceimpl PeerAddr
impl PeerAddr
sourcepub fn into_inner(self) -> SocketAddr
pub fn into_inner(self) -> SocketAddr
Unwrap into inner SocketAddr value.
Trait Implementations
sourceimpl FromRequest for PeerAddr
impl FromRequest for PeerAddr
type Error = MissingPeerAddr
type Error = MissingPeerAddr
The associated error which can be returned.
type Future = Ready<Result<PeerAddr, <PeerAddr as FromRequest>::Error>>
type Future = Ready<Result<PeerAddr, <PeerAddr as FromRequest>::Error>>
Future that resolves to a
Self. Read moresourcefn from_request(req: &HttpRequest, _: &mut Payload) -> Self::Future
fn from_request(req: &HttpRequest, _: &mut Payload) -> Self::Future
Create a
Self from request parts asynchronously.sourcefn extract(req: &HttpRequest) -> Self::Future
fn extract(req: &HttpRequest) -> Self::Future
Create a
Self from request head asynchronously. Read moresourceimpl Ord for PeerAddr
impl Ord for PeerAddr
1.21.0 · sourcefn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 · sourcefn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl PartialOrd<PeerAddr> for PeerAddr
impl PartialOrd<PeerAddr> for PeerAddr
sourcefn partial_cmp(&self, other: &PeerAddr) -> Option<Ordering>
fn partial_cmp(&self, other: &PeerAddr) -> Option<Ordering>
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self and other) and is used by the <=
operator. Read moreimpl Copy for PeerAddr
impl Eq for PeerAddr
impl StructuralEq for PeerAddr
impl StructuralPartialEq for PeerAddr
Auto Trait Implementations
impl RefUnwindSafe for PeerAddr
impl Send for PeerAddr
impl Sync for PeerAddr
impl Unpin for PeerAddr
impl UnwindSafe for PeerAddr
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> CallHasher for Twhere
T: Hash + ?Sized,
impl<T> CallHasher for Twhere
T: Hash + ?Sized,
sourceimpl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.