pub struct ValueCodecRegistry { /* private fields */ }Expand description
An immutable value-codec registry sorted by stable ID.
§Examples
use qubit_codec::ValueCodecRegistry;
let registry = ValueCodecRegistry::empty();
assert!(registry.get("missing.example").is_none());Implementations§
Source§impl ValueCodecRegistry
impl ValueCodecRegistry
Sourcepub fn from_registrations(
registrations: impl IntoIterator<Item = &'static ValueCodecRegistration>,
) -> Result<Self, ValueCodecRegistryError>
pub fn from_registrations( registrations: impl IntoIterator<Item = &'static ValueCodecRegistration>, ) -> Result<Self, ValueCodecRegistryError>
Builds a local registry from static registrations.
§Errors
Returns a duplicate-ID error when multiple entries claim one ID.
Sourcepub fn try_global() -> Result<&'static Self, ValueCodecRegistryError>
pub fn try_global() -> Result<&'static Self, ValueCodecRegistryError>
Initializes and returns the process-wide linked registry.
§Errors
Returns the cached construction error when linked registrations conflict.
Sourcepub fn global() -> &'static Self
pub fn global() -> &'static Self
Returns the process-wide registry or panics with a stable diagnostic.
§Panics
Panics when linked registrations conflict.
Sourcepub fn get(&self, id: &str) -> Option<&ValueCodecRegistration>
pub fn get(&self, id: &str) -> Option<&ValueCodecRegistration>
Finds a registration by stable ID.
Returns None when id is absent.
Sourcepub fn registrations(&self) -> &[ValueCodecRegistration]
pub fn registrations(&self) -> &[ValueCodecRegistration]
Returns registrations in deterministic ID order.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ValueCodecRegistry
impl RefUnwindSafe for ValueCodecRegistry
impl Send for ValueCodecRegistry
impl Sync for ValueCodecRegistry
impl Unpin for ValueCodecRegistry
impl UnsafeUnpin for ValueCodecRegistry
impl UnwindSafe for ValueCodecRegistry
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