[−][src]Struct asn_db::Db
ASN record database that is optimized for lookup by an IP address.
Methods
impl Db
[src]
pub fn form_tsv(data: impl Read) -> Result<Db, DbError>
[src]
Loads database from ASN data as provided by IPtoASN - the only supported file format is of ip2asn-v4.tsv
file.
pub fn load(db_data: impl Read) -> Result<Db, DbError>
[src]
Loads database from the binary index that was stored with .store()
- this method is much faster than loading from the TSV file.
pub fn store(&self, db_data: impl Write) -> Result<(), DbError>
[src]
Stores database as a binary index for fast loading with .load()
.
pub fn lookup(&self, ip: Ipv4Addr) -> Option<&Record>
[src]
Performs lookup by an IP address for the ASN Record
of which network this IP belongs to.
Trait Implementations
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToErrorNoContext<T> for T
[src]
fn to_root_cause(self) -> ErrorNoContext<T>
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.