pub struct ValueCodecRegistry<D: 'static> { /* private fields */ }Expand description
An immutable value-codec registry sorted by stable ID.
§Type Parameters
D: Copyable, static descriptor identifying one wire representation.
§Examples
use qubit_codec::ValueCodecRegistry;
use qubit_codec::ValueStringCodecDescriptor;
use qubit_codec::ValueStringCodecRegistry;
let registry: ValueCodecRegistry<ValueStringCodecDescriptor> =
ValueStringCodecRegistry::empty();
assert!(registry.get("missing.example").is_none());Implementations§
Source§impl<D: Copy + 'static> ValueCodecRegistry<D>
impl<D: Copy + 'static> ValueCodecRegistry<D>
Sourcepub fn from_registrations(
registrations: impl IntoIterator<Item = &'static ValueCodecRegistration<D>>,
) -> Result<Self, ValueCodecRegistryError>
pub fn from_registrations( registrations: impl IntoIterator<Item = &'static ValueCodecRegistration<D>>, ) -> Result<Self, ValueCodecRegistryError>
Sourcepub fn get(&self, id: &str) -> Option<&ValueCodecRegistration<D>>
pub fn get(&self, id: &str) -> Option<&ValueCodecRegistration<D>>
Sourcepub fn registrations(&self) -> &[ValueCodecRegistration<D>]
pub fn registrations(&self) -> &[ValueCodecRegistration<D>]
Returns registrations in deterministic ID order.
§Returns
The immutable registration slice borrowed from this registry without allocation.
Source§impl ValueCodecRegistry<ValueStringCodecDescriptor>
impl ValueCodecRegistry<ValueStringCodecDescriptor>
Sourcepub fn try_global() -> Result<&'static Self, ValueCodecRegistryError>
pub fn try_global() -> Result<&'static Self, ValueCodecRegistryError>
Initializes and returns the process-wide linked string registry.
Initialization is synchronized and cached, including construction failures.
§Returns
A shared static registry containing all linked string registrations.
§Errors
Returns the cached construction error when linked registrations conflict. The error identifies the lexically first duplicate ID and all declarations for that ID in source-field order.
Source§impl ValueCodecRegistry<ValueBytesCodecDescriptor>
impl ValueCodecRegistry<ValueBytesCodecDescriptor>
Sourcepub fn try_global() -> Result<&'static Self, ValueCodecRegistryError>
pub fn try_global() -> Result<&'static Self, ValueCodecRegistryError>
Initializes and returns the process-wide linked bytes registry.
Initialization is synchronized and cached, including construction failures.
§Returns
A shared static registry containing all linked bytes registrations.
§Errors
Returns the cached construction error when linked registrations conflict. The error identifies the lexically first duplicate ID and all declarations for that ID in source-field order.