[−][src]Enum valid::Value
A Value represents a value of certain type.
The purpose of a Value is to include field values or parameters in
ConstraintViolations in a type that allows to display the value in a
localized format as part of a user facing error message.
It has variants for the basic types that are used in most applications.
Important types of 3rd party crates are supported through optional crate features:
| 3rd party crate | supported type | crate feature |
|---|---|---|
bigdecimal | BigDecimal | bigdecimal |
chrono | NaiveDate | chrono |
chrono | DateTime | chrono |
The From trait is implemented for the underlying types. Additionally
there are implementations of the From trait for the primitive types i8,
i16, i64, u8, u16, u32, u64.
u32 values greater than i32::max_value() are converted to Long(i64).
Panics
Converting u64 values greater than i64::max_value() has an unreliable
behavior and might panic.
Notes
The list of supported types is very opinionated and may not fit all kind of applications. Please file and issue if you feel that support for another type may be useful!
Variants
String(String)a string value
Integer(i32)a 32bit signed integer value
Long(i64)a 64bit signed integer value
Float(f32)a 32bit float value
Double(f64)a 64bit float value
Boolean(bool)a boolean value
Decimal(BigDecimal)a decimal value
Date(NaiveDate)a date value
DateTime(DateTime<Utc>)a value with date, time and timezone
Trait Implementations
impl From<String> for Value[src]
impl From<i32> for Value[src]
impl From<i16> for Value[src]
impl From<u16> for Value[src]
impl From<i8> for Value[src]
impl From<u8> for Value[src]
impl From<u32> for Value[src]
impl From<i64> for Value[src]
impl From<u64> for Value[src]
impl From<f32> for Value[src]
impl From<f64> for Value[src]
impl From<bool> for Value[src]
impl From<BigDecimal> for Value[src]
fn from(value: BigDecimal) -> Self[src]
impl From<NaiveDate> for Value[src]
impl<Z> From<DateTime<Z>> for Value where
Z: TimeZone, [src]
Z: TimeZone,
impl Clone for Value[src]
impl PartialEq<Value> for Value[src]
impl Debug for Value[src]
impl Display for Value[src]
impl Serialize for Value[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer, [src]
__S: Serializer,
impl<'de> Deserialize<'de> for Value[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>, [src]
__D: Deserializer<'de>,
Auto Trait Implementations
impl Unpin for Value
impl Sync for Value
impl Send for Value
impl RefUnwindSafe for Value
impl UnwindSafe for Value
Blanket Implementations
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized, [src]
T: Display + ?Sized,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> DeserializeOwned for T where
T: Deserialize<'de>, [src]
T: Deserialize<'de>,