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: SocketAddr
Implementations§
source§impl PeerAddr
impl PeerAddr
sourcepub fn into_inner(self) -> SocketAddr
pub fn into_inner(self) -> SocketAddr
Unwrap into inner SocketAddr
value.
Trait Implementations§
source§impl FromRequest for PeerAddr
impl FromRequest for PeerAddr
§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 moresource§fn from_request(req: &HttpRequest, _: &mut Payload) -> Self::Future
fn from_request(req: &HttpRequest, _: &mut Payload) -> Self::Future
Create a
Self
from request parts asynchronously.source§impl Ord for PeerAddr
impl Ord for PeerAddr
source§impl PartialEq<PeerAddr> for PeerAddr
impl PartialEq<PeerAddr> for PeerAddr
source§impl PartialOrd<PeerAddr> for PeerAddr
impl PartialOrd<PeerAddr> for PeerAddr
1.0.0 · source§fn 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§
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> CallHasher for Twhere
T: Hash + ?Sized,
impl<T> CallHasher for Twhere T: Hash + ?Sized,
source§impl<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,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.