pub struct OuiDb { /* private fields */ }Expand description
In-memory OUI database backed by locally cached IEEE CSV files.
Implementations§
Source§impl OuiDb
impl OuiDb
Sourcepub fn new(data_dir: &Path) -> Self
pub fn new(data_dir: &Path) -> Self
Creates a new OuiDb pointing at data_dir for cached CSV files.
Sourcepub fn age(&self) -> Option<SystemTime>
pub fn age(&self) -> Option<SystemTime>
Returns the modification time of the oldest cached CSV file,
or None if any file is missing or its mtime is unavailable.
Trait Implementations§
Source§impl Oui for OuiDb
impl Oui for OuiDb
Source§fn lookup(&self, mac: MacAddr) -> Option<OuiData>
fn lookup(&self, mac: MacAddr) -> Option<OuiData>
Retrieve the OUI record for a given MAC address.
IEEE assigns OUI prefixes at three granularities:
- MA-L (MAC Address Large,
oui.csv): 24-bit prefix → 6 hex chars - MA-M (MAC Address Medium,
mam.csv): 28-bit prefix → 7 hex chars - MA-S (MAC Address Small,
oui36.csv/iab.csv): 36-bit prefix → 9 hex chars
We try the most-specific prefix first so that a narrower assignment (e.g. MA-S) takes precedence over a broader one (e.g. MA-L) for the same MAC address.
Auto Trait Implementations§
impl Freeze for OuiDb
impl RefUnwindSafe for OuiDb
impl Send for OuiDb
impl Sync for OuiDb
impl Unpin for OuiDb
impl UnsafeUnpin for OuiDb
impl UnwindSafe for OuiDb
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> 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