#[non_exhaustive]pub enum LengthMetric {
Bytes,
UnicodeScalars,
Elements,
}Expand description
Identifies how an observed string or collection length was measured.
The metric is retained in structured errors so equal numeric lengths and constraints remain distinguishable across strings and collections. This enum is non-exhaustive; downstream matches must include a wildcard arm.
ⓘ
use qubit_argument::LengthMetric;
fn label(metric: LengthMetric) -> &'static str {
match metric {
LengthMetric::Bytes => "bytes",
LengthMetric::UnicodeScalars => "Unicode scalars",
LengthMetric::Elements => "elements",
}
}Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Bytes
The number of bytes in a UTF-8 string.
UnicodeScalars
The number of Unicode scalar values in a string.
Elements
The number of elements in a collection.
Trait Implementations§
Source§impl Clone for LengthMetric
impl Clone for LengthMetric
Source§fn clone(&self) -> LengthMetric
fn clone(&self) -> LengthMetric
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for LengthMetric
Source§impl Debug for LengthMetric
impl Debug for LengthMetric
impl Eq for LengthMetric
Source§impl PartialEq for LengthMetric
impl PartialEq for LengthMetric
impl StructuralPartialEq for LengthMetric
Auto Trait Implementations§
impl Freeze for LengthMetric
impl RefUnwindSafe for LengthMetric
impl Send for LengthMetric
impl Sync for LengthMetric
impl Unpin for LengthMetric
impl UnsafeUnpin for LengthMetric
impl UnwindSafe for LengthMetric
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