pub enum LocaleValue {
String(String),
Uint(usize),
Int(isize),
Float(f64),
}
Expand description
Represents various types of values associated with a locale.
LocaleValue
is an enum that allows for storage and handling of multiple data types.
This can be useful in scenarios where locale-specific values need to support different kinds of data.
Variants:
String(String)
: Stores a UTF-8 encoded string value.Uint(usize)
: Stores an unsigned integer value.Int(isize)
: Stores a signed integer value.Float(f64)
: Stores a floating-point number value.
The Clone
trait is implemented for LocaleValue
, allowing instances of this enum to be duplicated.
Example:
use cjtoolkit_structured_validator::common::locale::LocaleValue;
let string_locale = LocaleValue::String(String::from("Hello"));
let unsigned_locale = LocaleValue::Uint(42);
let signed_locale = LocaleValue::Int(-7);
let float_locale = LocaleValue::Float(3.14);
match string_locale {
LocaleValue::String(s) => println!("String value: {}", s),
_ => println!("Not a string"),
}
Variants§
Trait Implementations§
Source§impl Clone for LocaleValue
impl Clone for LocaleValue
Source§fn clone(&self) -> LocaleValue
fn clone(&self) -> LocaleValue
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl From<&str> for LocaleValue
impl From<&str> for LocaleValue
Source§impl From<String> for LocaleValue
impl From<String> for LocaleValue
Source§impl From<f64> for LocaleValue
impl From<f64> for LocaleValue
Source§impl From<isize> for LocaleValue
impl From<isize> for LocaleValue
Auto Trait Implementations§
impl Freeze for LocaleValue
impl RefUnwindSafe for LocaleValue
impl Send for LocaleValue
impl Sync for LocaleValue
impl Unpin for LocaleValue
impl UnwindSafe for LocaleValue
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