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.
Source§impl ValueCodecRegistry<ValueBytesCodecDescriptor>
impl ValueCodecRegistry<ValueBytesCodecDescriptor>
Sourcepub fn try_global() -> Result<&'static Self, ValueCodecRegistryError>
pub fn try_global() -> Result<&'static Self, ValueCodecRegistryError>
Trait Implementations§
Auto Trait Implementations§
impl<D> Freeze for ValueCodecRegistry<D>
impl<D> RefUnwindSafe for ValueCodecRegistry<D>
impl<D> Send for ValueCodecRegistry<D>
impl<D> Sync for ValueCodecRegistry<D>
impl<D> Unpin for ValueCodecRegistry<D>
impl<D> UnsafeUnpin for ValueCodecRegistry<D>
impl<D> UnwindSafe for ValueCodecRegistry<D>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more