[−][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
ConstraintViolation
s 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:
supported type | crate feature | 3rd party crate |
---|---|---|
BigInt | num-bigint | num-bigint |
BigDecimal | bigdecimal | bigdecimal |
NaiveDate | chrono | chrono |
DateTime | chrono | 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
a decimal value
Date(NaiveDate)
a date value
a value with date, time and timezone
BigInteger(BigInt)
a big integer value
Trait Implementations
impl Clone for Value
[src]
impl Debug for Value
[src]
impl<'de> Deserialize<'de> for Value
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Display for Value
[src]
impl From<BigDecimal> for Value
[src]
impl From<BigInt> for Value
[src]
impl<Z> From<DateTime<Z>> for Value where
Z: TimeZone,
[src]
Z: TimeZone,
impl From<NaiveDate> for Value
[src]
impl From<String> for Value
[src]
impl From<bool> for Value
[src]
impl From<f32> for Value
[src]
impl From<f64> for Value
[src]
impl From<i16> for Value
[src]
impl From<i32> for Value
[src]
impl From<i64> for Value
[src]
impl From<i8> for Value
[src]
impl From<u16> for Value
[src]
impl From<u32> for Value
[src]
impl From<u64> for Value
[src]
impl From<u8> for Value
[src]
impl PartialEq<Value> 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 StructuralPartialEq for Value
[src]
impl TryFrom<usize> for Value
[src]
Auto Trait Implementations
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnwindSafe for Value
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
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> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
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>,