[][src]Struct asn_db::Db

pub struct 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

impl Debug for Db[src]

Auto Trait Implementations

impl RefUnwindSafe for Db

impl Send for Db

impl Sync for Db

impl Unpin for Db

impl UnwindSafe for Db

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToErrorNoContext<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<E, C> WrapContext<C> for E[src]

type ContextError = ErrorContext<E, C>