pub trait CatalogProvider: Send + Sync {
// Required method
fn lookup(&self, code: &str) -> Option<&ErrorCodeInfo>;
}Expand description
A source of error-code metadata, supplied by the embedding product.
Implementors return metadata for a given code, or None if the code is not
in their catalog. The returned reference is tied to &self, which lets the
installed-global path (see install_catalog) hand out &'static
references — the installed provider lives for the rest of the process.
Send + Sync is required so the provider can live in a process-wide
OnceLock; it costs nothing for the data-only providers in practice.
Required Methods§
Sourcefn lookup(&self, code: &str) -> Option<&ErrorCodeInfo>
fn lookup(&self, code: &str) -> Option<&ErrorCodeInfo>
Look up an error code’s metadata, or None if it is not in this catalog.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".