sinf 0.1.0

Library for obtaining in-depth system information at both the hardware and software levels
Documentation
pub(super) type VendorId = (u32, &'static str);

mod below_1000;
mod range_1000_13ff;
mod range_1400_17ff;
mod range_1800_1bff;
mod range_1c00_1fff;
mod range_2000_3fff;
mod range_4000_7fff;
mod range_8000_ffff;

fn find(table: &'static [VendorId], vendor_id: u32) -> Option<&'static str> {
    table
        .binary_search_by_key(&vendor_id, |&(id, _)| id)
        .ok()
        .map(|index| table[index].1)
}

pub(super) fn lookup(vendor_id: u32) -> Option<&'static str> {
    let table = match vendor_id {
        0x0000..=0x0fff => below_1000::VENDOR_IDS,
        0x1000..=0x13ff => range_1000_13ff::VENDOR_IDS,
        0x1400..=0x17ff => range_1400_17ff::VENDOR_IDS,
        0x1800..=0x1bff => range_1800_1bff::VENDOR_IDS,
        0x1c00..=0x1fff => range_1c00_1fff::VENDOR_IDS,
        0x2000..=0x3fff => range_2000_3fff::VENDOR_IDS,
        0x4000..=0x7fff => range_4000_7fff::VENDOR_IDS,
        _ => range_8000_ffff::VENDOR_IDS,
    };
    find(table, vendor_id)
}