pub struct DeviceSignatureTable { /* private fields */ }Expand description
Collection of signatures loaded from a directory.
Implementations§
Source§impl DeviceSignatureTable
impl DeviceSignatureTable
Sourcepub fn builtins() -> Result<Self, String>
pub fn builtins() -> Result<Self, String>
Load the signatures compiled into this crate.
This reads NO files. It parses the DeviceSignature::BUILTIN_BLACKWELL_120
string that include_str! baked into the binary, sorts by id, and
wraps. Self::load_dir is the filesystem path; this is the
no-filesystem fallback used by backend projections before external
Tier-B directories are available.
The parse is memoized process-wide, because it is a pure function of
compile-time constants and backend projections call it on every
dispatch. Prefer Self::builtins_ref on a hot path: this clones the
memoized table so callers that need an owned value keep working.
§Errors
Returns an actionable error when the compiled-in signature is invalid.
Sourcepub fn builtins_ref() -> Result<&'static Self, String>
pub fn builtins_ref() -> Result<&'static Self, String>
Borrow the process-wide memoized builtin signature table.
§Errors
Returns an actionable error when the compiled-in signature is invalid.
Sourcepub fn load_dir(dir: impl AsRef<Path>) -> Result<Self, String>
pub fn load_dir(dir: impl AsRef<Path>) -> Result<Self, String>
Load every *.toml signature file in dir.
§Errors
Returns an actionable error when the directory cannot be read, a file cannot be read, or any signature is invalid.
Sourcepub fn signatures(&self) -> &[DeviceSignature]
pub fn signatures(&self) -> &[DeviceSignature]
Borrow all loaded signatures in stable id order.
Sourcepub fn get(&self, id: &str) -> Option<&DeviceSignature>
pub fn get(&self, id: &str) -> Option<&DeviceSignature>
Find a signature by id.
Sourcepub fn find_architecture_generation(
&self,
generation: u32,
) -> Option<&DeviceSignature>
pub fn find_architecture_generation( &self, generation: u32, ) -> Option<&DeviceSignature>
Find the best signature for a backend-reported architecture generation.
Sourcepub fn find_device_name(&self, device_name: &str) -> Option<&DeviceSignature>
pub fn find_device_name(&self, device_name: &str) -> Option<&DeviceSignature>
Find the best signature for a backend-reported device name.
Sourcepub fn apply_generation_to_profile(
&self,
generation: u32,
profile: DeviceProfile,
) -> DeviceProfile
pub fn apply_generation_to_profile( &self, generation: u32, profile: DeviceProfile, ) -> DeviceProfile
Apply a generation signature to profile when one is known.
Sourcepub fn apply_device_name_to_profile(
&self,
device_name: &str,
profile: DeviceProfile,
) -> DeviceProfile
pub fn apply_device_name_to_profile( &self, device_name: &str, profile: DeviceProfile, ) -> DeviceProfile
Apply a device-name signature to profile when one is known.
Trait Implementations§
Source§impl Clone for DeviceSignatureTable
impl Clone for DeviceSignatureTable
Source§fn clone(&self) -> DeviceSignatureTable
fn clone(&self) -> DeviceSignatureTable
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more