aci_registry/lib.rs
1#![cfg_attr(not(test), no_std)]
2#![deny(missing_docs)]
3#![doc = include_str!("../README.md")]
4
5mod tables;
6
7#[cfg(feature = "non-authorative")]
8pub mod non_authorative;
9
10pub use tables::*;
11
12/// Generic type for the subclasses of device classes.
13///
14/// This is a new type arround `u16`, no validity checking is performed.
15///
16/// If you are using a well known device class, you may want to use one of the well-known subclass enums.
17#[cfg_attr(feature = "fixed-repr", repr(transparent))]
18#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)]
19pub struct SubclassId(u16);
20
21impl SubclassId {
22 /// Obtains the appropriate [`SubclassId`] from the given numeric id.
23 pub const fn from_id(x: u16) -> Self {
24 Self(x)
25 }
26
27 /// Converts the [`SubclassId`] to the appropriate numeric id
28 pub const fn id(self) -> u16 {
29 self.0
30 }
31}
32
33/// Generic type for the products of registered vendors
34///
35/// This is a new type arround `u16`, no validity checking is performed.
36#[cfg_attr(feature = "fixed-repr", repr(transparent))]
37#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)]
38pub struct ProductId(u16);
39
40impl ProductId {
41 /// Obtains the appropriate [`ProductId`] from the given numeric id.
42 pub const fn from_id(x: u16) -> Self {
43 Self(x)
44 }
45
46 /// Converts the [`ProductId`] to the appropriate numeric id
47 pub const fn id(self) -> u16 {
48 self.0
49 }
50}