pub struct DbIpDatabase<V> { /* private fields */ }Expand description
A map of ip range to data derived from a country code.
Implementations§
Source§impl<V> DbIpDatabase<V>where
V: IpData,
impl<V> DbIpDatabase<V>where
V: IpData,
Sourcepub fn get(&self, ip: &IpAddr) -> Option<V>
pub fn get(&self, ip: &IpAddr) -> Option<V>
Gets the value associated with an ip address, if any.
Sourcepub fn get_v4(&self, v4: &Ipv4Addr) -> Option<V>
pub fn get_v4(&self, v4: &Ipv4Addr) -> Option<V>
Gets the value associated with an Ipv4 address, if any.
Sourcepub fn get_v6(&self, v6: &Ipv6Addr) -> Option<V>
pub fn get_v6(&self, v6: &Ipv6Addr) -> Option<V>
Gets the value associated with an Ipv6 address, if any.
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns number of ranges/values stored for both Ipv4 and Ipv6 addresses.
Sourcepub fn from_csv_str(csv: &str) -> Result<DbIpDatabase<V>, FromCsvError>
pub fn from_csv_str(csv: &str) -> Result<DbIpDatabase<V>, FromCsvError>
Load from CSV file contained in string.
Sourcepub fn from_csv_reader<R>(reader: R) -> Result<DbIpDatabase<V>, FromCsvError>where
R: Read,
pub fn from_csv_reader<R>(reader: R) -> Result<DbIpDatabase<V>, FromCsvError>where
R: Read,
Load from CSV file reader.
Sourcepub fn from_csv_file(path: &str) -> Result<DbIpDatabase<V>, FromCsvError>
pub fn from_csv_file(path: &str) -> Result<DbIpDatabase<V>, FromCsvError>
Load from CSV file contained in file.
Trait Implementations§
Source§impl<V> Debug for DbIpDatabase<V>where
V: Debug,
impl<V> Debug for DbIpDatabase<V>where
V: Debug,
Source§impl<'de, V> Deserialize<'de> for DbIpDatabase<V>where
V: Deserialize<'de>,
impl<'de, V> Deserialize<'de> for DbIpDatabase<V>where
V: Deserialize<'de>,
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<DbIpDatabase<V>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<DbIpDatabase<V>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<V> Serialize for DbIpDatabase<V>where
V: Serialize,
impl<V> Serialize for DbIpDatabase<V>where
V: Serialize,
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl<V> Freeze for DbIpDatabase<V>
impl<V> RefUnwindSafe for DbIpDatabase<V>where
V: RefUnwindSafe,
impl<V> Send for DbIpDatabase<V>where
V: Send,
impl<V> Sync for DbIpDatabase<V>where
V: Sync,
impl<V> Unpin for DbIpDatabase<V>where
V: Unpin,
impl<V> UnwindSafe for DbIpDatabase<V>where
V: UnwindSafe,
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