[][src]Struct asn_db::Db

pub struct Db(_);

Loaded ASN database that is optimized for looking up ASN by IP address

Methods

impl Db[src]

pub fn form_tsv(data: impl Read) -> Result<Db, DbError>[src]

Load database from TSV file as provided by IPtoASN - only ip2asn-v4.tsv file format is supported a the moment

pub fn load(db_data: impl Read) -> Result<Db, DbError>[src]

Load previously stored database - this method is much faster than loading TSV file

pub fn store(&self, db_data: impl Write) -> Result<(), DbError>[src]

Store database as binary data

pub fn lookup(&self, ip: Ipv4Addr) -> Option<&Record>[src]

Lookup ASN information by IP address where given IP belongs to AS network

Trait Implementations

impl Debug for Db[src]

Auto Trait Implementations

impl Send for Db

impl Unpin for Db

impl Sync for Db

impl UnwindSafe for Db

impl RefUnwindSafe for Db

Blanket Implementations

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

impl<T, U> Into<U> for T where
    U: From<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<T> Borrow<T> for T where
    T: ?Sized
[src]

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

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

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

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

type ContextError = ErrorContext<E, C>