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 for PeerAddr
impl PartialEq for PeerAddr
source§impl PartialOrd for PeerAddr
impl PartialOrd 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 StructuralPartialEq for PeerAddr
Auto Trait Implementations§
impl Freeze for PeerAddr
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> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.