pub struct ValueCodecId(/* private fields */);Expand description
A validated, process-independent value-codec identifier.
§Examples
use qubit_codec::ValueCodecId;
let id = ValueCodecId::new("example.u16");
assert_eq!(id.as_str(), "example.u16");Implementations§
Source§impl ValueCodecId
impl ValueCodecId
Sourcepub const fn new(value: &'static str) -> Self
pub const fn new(value: &'static str) -> Self
Creates an ID from a static string.
§Parameters
value: Non-empty dot-separated ASCII segments; each starts with a letter and continues with letters, digits, or underscores.
§Returns
An ID borrowing the validated static string without allocation.
§Panics
Panics when value violates the dot-separated ASCII protocol.
Sourcepub const fn try_new(value: &'static str) -> Result<Self, ValueCodecIdError>
pub const fn try_new(value: &'static str) -> Result<Self, ValueCodecIdError>
Validates and creates an ID.
§Parameters
value: Non-empty dot-separated ASCII segments; each starts with a letter and continues with letters, digits, or underscores.
§Returns
An ID borrowing the validated static string without allocation.
§Errors
Returns Empty for an empty ID, EmptySegment for leading/trailing or consecutive dots, or InvalidSegment for an invalid ASCII segment.
Trait Implementations§
Source§impl Borrow<str> for ValueCodecId
impl Borrow<str> for ValueCodecId
Source§impl Clone for ValueCodecId
impl Clone for ValueCodecId
impl Copy for ValueCodecId
Source§impl Debug for ValueCodecId
impl Debug for ValueCodecId
impl Eq for ValueCodecId
Source§impl Hash for ValueCodecId
impl Hash for ValueCodecId
Source§impl Ord for ValueCodecId
impl Ord for ValueCodecId
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialEq for ValueCodecId
impl PartialEq for ValueCodecId
Source§impl PartialOrd for ValueCodecId
impl PartialOrd for ValueCodecId
impl StructuralPartialEq for ValueCodecId
Auto Trait Implementations§
impl Forget for ValueCodecId
impl Freeze for ValueCodecId
impl RefUnwindSafe for ValueCodecId
impl Send for ValueCodecId
impl Sync for ValueCodecId
impl Unpin for ValueCodecId
impl UnsafeUnpin for ValueCodecId
impl UnwindSafe for ValueCodecId
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