pub struct ClientIp(pub Option<IpAddr>);Expand description
The client’s IP address, read as crate::Request::client_ip reads it:
the first X-Forwarded-For entry when [server] trust_proxy is on, the
peer address otherwise. None when neither is known (tests, pre-rendering).
ⓘ
pub async fn load(ClientIp(ip): ClientIp) -> Result<Quota> { quota_for(ip).await }Tuple Fields§
§0: Option<IpAddr>Trait Implementations§
impl Copy for ClientIp
impl Eq for ClientIp
Source§impl FromContext for ClientIp
impl FromContext for ClientIp
fn from_context(ctx: &Arc<RequestContext>) -> Result<ClientIp, Error>
impl StructuralPartialEq for ClientIp
Auto Trait Implementations§
impl Forget for ClientIp
impl Freeze for ClientIp
impl Move for ClientIp
impl RefUnwindSafe for ClientIp
impl Send for ClientIp
impl Sync for ClientIp
impl Unpin for ClientIp
impl UnsafeUnpin for ClientIp
impl UnwindSafe for ClientIp
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: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.