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,

source

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

source

pub fn into_opt_integer(self) -> Option<i32>

Returns Some with the value if the field contains an Value::Integer.

source

pub fn into_opt_float(self) -> Option<f32>

Returns Some with the value if the field contains a Value::Float.

source

pub fn into_opt_text(self) -> Option<<T as Context>::String>

Returns Some with the value if the field contains a Value::Text.

source

pub fn into_opt_boolean(self) -> Option<bool>

Returns Some with the value if the field contains a Value::Boolean.

source

pub fn into_opt_big_int(self) -> Option<<T as Context>::I64>

Returns Some with the value if the field contains a Value::BigInt.

source

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> Clone for Value<T>
where T: Context, <T as Context>::String: Clone, <T as Context>::XML: Clone, <T as Context>::I64: Clone,

source§

fn clone(&self) -> Value<T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T> Debug for Value<T>
where T: Debug + Context, <T as Context>::String: Debug, <T as Context>::I64: Debug, <T as Context>::XML: Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl<C> Display for Value<C>
where C: Context, <C as Context>::I64: Debug, <C as Context>::String: Debug, <C as Context>::XML: Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl<C> FdbHash for Value<C>
where C: Context, <C as Context>::I64: FdbHash, <C as Context>::String: FdbHash, <C as Context>::XML: FdbHash,

source§

fn hash(&self) -> u32

Get the hash value
source§

impl<T> From<&Value<T>> for ValueType
where T: Context,

source§

fn from(val: &Value<T>) -> ValueType

Converts to this type from the input type.
source§

impl<C1, C2> PartialEq<Value<C1>> for Value<C2>
where C1: Context, C2: Context, <C1 as Context>::I64: PartialEq<<C2 as Context>::I64>, <C1 as Context>::String: PartialEq<<C2 as Context>::String>, <C1 as Context>::XML: PartialEq<<C2 as Context>::XML>,

source§

fn eq(&self, other: &Value<C1>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T> Serialize for Value<T>
where T: Context, <T as Context>::String: Serialize, <T as Context>::I64: Serialize, <T as Context>::XML: Serialize,

source§

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>>

source§

fn to_sql(&self) -> Result<ToSqlOutput<'_>, Error>

Converts Rust value to SQLite value
source§

impl ToSql for Value<OwnedContext>

source§

fn to_sql(&self) -> Result<ToSqlOutput<'_>, Error>

Converts Rust value to SQLite value
source§

impl TryFrom<FDBFieldData> for Value<FileContext>

§

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>

Performs the conversion.
source§

impl<'a> TryFromHandle<'a, Value<FileContext>> for Field<'a>

§

type Error = Infallible

Error type
source§

fn try_from(value: Handle<'a, FDBFieldValue>) -> Result<Self, Self::Error>

Conversion function
source§

impl<T> Copy for Value<T>
where T: Context, <T as Context>::String: Copy, <T as Context>::XML: Copy, <T as Context>::I64: Copy,

Auto Trait Implementations§

§

impl<T> Freeze for Value<T>
where <T as Context>::String: Freeze, <T as Context>::I64: Freeze, <T as Context>::XML: Freeze,

§

impl<T> RefUnwindSafe for Value<T>

§

impl<T> Send for Value<T>
where <T as Context>::String: Send, <T as Context>::I64: Send, <T as Context>::XML: Send,

§

impl<T> Sync for Value<T>
where <T as Context>::String: Sync, <T as Context>::I64: Sync, <T as Context>::XML: Sync,

§

impl<T> Unpin for Value<T>
where <T as Context>::String: Unpin, <T as Context>::I64: Unpin, <T as Context>::XML: Unpin,

§

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.