pub trait Value {
type Database: Database;
// Required methods
fn as_ref(&self) -> <Self::Database as HasValueRef<'_>>::ValueRef;
fn type_info(&self) -> Cow<'_, <Self::Database as Database>::TypeInfo>;
fn is_null(&self) -> bool;
// Provided methods
fn decode<'r, T>(&'r self) -> T
where T: Decode<'r, Self::Database> + Type<Self::Database> { ... }
fn decode_unchecked<'r, T>(&'r self) -> T
where T: Decode<'r, Self::Database> { ... }
fn try_decode<'r, T>(&'r self) -> Result<T, Error>
where T: Decode<'r, Self::Database> + Type<Self::Database> { ... }
fn try_decode_unchecked<'r, T>(&'r self) -> Result<T, Error>
where T: Decode<'r, Self::Database> { ... }
}
Expand description
An owned value from the database.
Required Associated Types§
Required Methods§
sourcefn as_ref(&self) -> <Self::Database as HasValueRef<'_>>::ValueRef
fn as_ref(&self) -> <Self::Database as HasValueRef<'_>>::ValueRef
Get this value as a reference.
Provided Methods§
sourcefn decode<'r, T>(&'r self) -> Twhere
T: Decode<'r, Self::Database> + Type<Self::Database>,
fn decode<'r, T>(&'r self) -> Twhere T: Decode<'r, Self::Database> + Type<Self::Database>,
Decode this single value into the requested type.
Panics
Panics if the value cannot be decoded into the requested type.
See try_decode
for a non-panicking version.
sourcefn decode_unchecked<'r, T>(&'r self) -> Twhere
T: Decode<'r, Self::Database>,
fn decode_unchecked<'r, T>(&'r self) -> Twhere T: Decode<'r, Self::Database>,
Decode this single value into the requested type.
Unlike decode
, this method does not check that the type of this
value is compatible with the Rust type and blindly tries to decode the value.
Panics
Panics if the value cannot be decoded into the requested type.
See try_decode_unchecked
for a non-panicking version.
sourcefn try_decode<'r, T>(&'r self) -> Result<T, Error>where
T: Decode<'r, Self::Database> + Type<Self::Database>,
fn try_decode<'r, T>(&'r self) -> Result<T, Error>where T: Decode<'r, Self::Database> + Type<Self::Database>,
sourcefn try_decode_unchecked<'r, T>(&'r self) -> Result<T, Error>where
T: Decode<'r, Self::Database>,
fn try_decode_unchecked<'r, T>(&'r self) -> Result<T, Error>where T: Decode<'r, Self::Database>,
Decode this single value into the requested type.
Unlike try_decode
, this method does not check that the type of this
value is compatible with the Rust type and blindly tries to decode the value.
Errors
Decode
if the value could not be decoded into the requested type.