Enum assembly_fdb::value::Value
source · pub enum Value<T>where
T: Context,{
Nothing,
Integer(i32),
Float(f32),
Text(<T as Context>::String),
Boolean(bool),
BigInt(<T as Context>::I64),
VarChar(<T as Context>::XML),
}
Expand description
A single field value in the database
This is a generic enum that is the template for all
other Field
types in this crate.
Variants§
Nothing
The NULL value
Integer(i32)
A 32 bit integer
Float(f32)
A 32 bit IEEE floating point number
Text(<T as Context>::String)
A string
Boolean(bool)
A boolean
BigInt(<T as Context>::I64)
A 64 bit integer
VarChar(<T as Context>::XML)
A (XML?) string
Implementations§
source§impl<T> Value<T>where
T: Context,
impl<T> Value<T>where
T: Context,
sourcepub fn map<O, M>(&self, mapper: &mut M) -> Value<O>where
O: Context,
M: ValueMapperMut<T, O>,
pub fn map<O, M>(&self, mapper: &mut M) -> Value<O>where
O: Context,
M: ValueMapperMut<T, O>,
Creates a value of a different context using the given mapper
sourcepub fn into_opt_integer(self) -> Option<i32>
pub fn into_opt_integer(self) -> Option<i32>
Returns Some
with the value if the field contains an Value::Integer
.
sourcepub fn into_opt_float(self) -> Option<f32>
pub fn into_opt_float(self) -> Option<f32>
Returns Some
with the value if the field contains a Value::Float
.
sourcepub fn into_opt_text(self) -> Option<<T as Context>::String>
pub fn into_opt_text(self) -> Option<<T as Context>::String>
Returns Some
with the value if the field contains a Value::Text
.
sourcepub fn into_opt_boolean(self) -> Option<bool>
pub fn into_opt_boolean(self) -> Option<bool>
Returns Some
with the value if the field contains a Value::Boolean
.
sourcepub fn into_opt_big_int(self) -> Option<<T as Context>::I64>
pub fn into_opt_big_int(self) -> Option<<T as Context>::I64>
Returns Some
with the value if the field contains a Value::BigInt
.
sourcepub fn into_opt_varchar(self) -> Option<<T as Context>::XML>
pub fn into_opt_varchar(self) -> Option<<T as Context>::XML>
Returns Some
with the value if the field contains a Value::VarChar
.
Trait Implementations§
source§impl<T> Serialize for Value<T>
impl<T> Serialize for Value<T>
source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
source§impl<'a> ToSql for Value<MemContext<'a>>
impl<'a> ToSql for Value<MemContext<'a>>
source§impl ToSql for Value<OwnedContext>
impl ToSql for Value<OwnedContext>
source§impl TryFrom<FDBFieldData> for Value<FileContext>
impl TryFrom<FDBFieldData> for Value<FileContext>
§type Error = UnknownValueType
type Error = UnknownValueType
The type returned in the event of a conversion error.
source§fn try_from(
value: FDBFieldData,
) -> Result<Value<FileContext>, <Value<FileContext> as TryFrom<FDBFieldData>>::Error>
fn try_from( value: FDBFieldData, ) -> Result<Value<FileContext>, <Value<FileContext> as TryFrom<FDBFieldData>>::Error>
Performs the conversion.
source§impl<'a> TryFromHandle<'a, Value<FileContext>> for Field<'a>
impl<'a> TryFromHandle<'a, Value<FileContext>> for Field<'a>
§type Error = Infallible
type Error = Infallible
Error type
impl<T> Copy for Value<T>
Auto Trait Implementations§
impl<T> Freeze for Value<T>
impl<T> RefUnwindSafe for Value<T>where
<T as Context>::String: RefUnwindSafe,
<T as Context>::I64: RefUnwindSafe,
<T as Context>::XML: RefUnwindSafe,
impl<T> Send for Value<T>
impl<T> Sync for Value<T>
impl<T> Unpin for Value<T>
impl<T> UnwindSafe for Value<T>where
<T as Context>::String: UnwindSafe,
<T as Context>::I64: UnwindSafe,
<T as Context>::XML: UnwindSafe,
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)