pub struct GeoIpLookup(/* private fields */);
Expand description
A geo ip lookup helper based on maxmind db files.
The helper is internally reference counted and can be cloned cheaply.
Implementations§
Source§impl GeoIpLookup
impl GeoIpLookup
Sourcepub fn open<P>(path: P) -> Result<Self, GeoIpError>
pub fn open<P>(path: P) -> Result<Self, GeoIpError>
Opens a maxminddb file by path.
Sourcepub fn empty() -> Self
pub fn empty() -> Self
Creates a new GeoIpLookup
instance without any data loaded.
Sourcepub fn try_lookup(&self, ip_address: IpAddr) -> Result<Option<Geo>, GeoIpError>
pub fn try_lookup(&self, ip_address: IpAddr) -> Result<Option<Geo>, GeoIpError>
Looks up an IP address.
Trait Implementations§
Source§impl Clone for GeoIpLookup
impl Clone for GeoIpLookup
Source§fn clone(&self) -> GeoIpLookup
fn clone(&self) -> GeoIpLookup
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for GeoIpLookup
impl Debug for GeoIpLookup
Source§impl Default for GeoIpLookup
impl Default for GeoIpLookup
Source§fn default() -> GeoIpLookup
fn default() -> GeoIpLookup
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for GeoIpLookup
impl RefUnwindSafe for GeoIpLookup
impl Send for GeoIpLookup
impl Sync for GeoIpLookup
impl Unpin for GeoIpLookup
impl UnwindSafe for GeoIpLookup
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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more