Skip to main content

Value

Enum Value 

Source
pub enum Value {
    Null,
    Numeric(Numeric),
    Text(Text),
    Blob(Vec<u8>),
}

Variants§

§

Null

§

Numeric(Numeric)

§

Text(Text)

§

Blob(Vec<u8>)

Implementations§

Source§

impl Value

Source

pub const fn from_f64(f: f64) -> Self

Source

pub const fn from_i64(i: i64) -> Self

Source

pub fn as_ref<'a>(&'a self) -> ValueRef<'a>

Source

pub fn build_text(text: impl Into<Cow<'static, str>>) -> Self

Source

pub fn to_blob(&self) -> Option<&[u8]>

Source

pub fn from_blob(data: Vec<u8>) -> Self

Source

pub fn to_text(&self) -> Option<&str>

Source

pub const fn as_blob(&self) -> &Vec<u8>

Source

pub const fn as_blob_mut(&mut self) -> &mut Vec<u8>

Source

pub fn as_float(&self) -> f64

Source

pub fn to_float_or_zero(&self) -> f64

Source

pub const fn as_int(&self) -> Option<i64>

Source

pub const fn as_uint(&self) -> u64

Source

pub fn from_text(text: impl Into<Cow<'static, str>>) -> Self

Source

pub const fn value_type(&self) -> ValueType

Source

pub fn serialize_serial(&self, out: &mut Vec<u8>)

Source

pub fn cast_text(&self) -> Option<String>

Cast Value to String, if Value is NULL returns None

Source§

impl Value

Source

pub fn to_ffi(&self) -> ExtValue

Source

pub fn from_ffi(v: ExtValue) -> Result<Self>

Source§

impl Value

Source

pub const MAX_BLOB_LENGTH: i64 = 1_000_000_000

SQLite default max blob/string size (1GB)

Source

pub fn exec_lower(&self) -> Option<Self>

Source

pub fn exec_length(&self) -> Self

Source

pub fn exec_octet_length(&self) -> Self

Source

pub fn exec_upper(&self) -> Option<Self>

Source

pub fn exec_sign(&self) -> Option<Value>

Source

pub fn exec_soundex(&self) -> Value

Generates the Soundex code for a given word

Source

pub fn exec_abs(&self) -> Result<Self>

Source

pub fn exec_random<F>(generate_random_number: F) -> Self
where F: Fn() -> i64,

Source

pub fn exec_randomblob<F>(&self, fill_bytes: F) -> Result<Value>
where F: Fn(&mut [u8]),

Source

pub fn exec_quote(&self) -> Self

Source

pub fn exec_unistr_quote(&self) -> Self

Source

pub fn exec_nullif(&self, second_value: &Self) -> Self

Source

pub fn exec_substring( value: &Value, start_value: &Value, length_value: Option<&Value>, ) -> Value

Source

pub fn exec_instr(&self, pattern: &Value) -> Value

Source

pub fn exec_typeof(&self) -> Value

Source

pub fn exec_hex(&self) -> Value

Source

pub fn exec_unhex(&self, ignored_chars: Option<&Value>) -> Value

Source

pub fn exec_unicode(&self) -> Value

Source

pub fn exec_unistr(&self) -> Result<Value>

Source

pub fn exec_round(&self, precision: Option<&Value>) -> Value

Source

pub fn exec_trim(&self, pattern: Option<&Value>) -> Value

Source

pub fn exec_rtrim(&self, pattern: Option<&Value>) -> Value

Source

pub fn exec_ltrim(&self, pattern: Option<&Value>) -> Value

Source

pub fn exec_zeroblob(&self) -> Result<Value>

Source

pub fn exec_if(&self, jump_if_null: bool, not: bool) -> bool

Source

pub fn exec_cast(&self, datatype: &str) -> Value

Source

pub fn exec_replace( source: &Value, pattern: &Value, replacement: &Value, ) -> Value

Source

pub fn exec_math_unary(&self, function: &MathFunc) -> Value

Source

pub fn exec_math_binary(&self, rhs: &Value, function: &MathFunc) -> Value

Source

pub fn exec_math_log(&self, base: Option<&Value>) -> Value

Source

pub fn exec_add(&self, rhs: &Value) -> Value

Source

pub fn exec_subtract(&self, rhs: &Value) -> Value

Source

pub fn exec_multiply(&self, rhs: &Value) -> Value

Source

pub fn exec_divide(&self, rhs: &Value) -> Value

Source

pub fn exec_bit_and(&self, rhs: &Value) -> Value

Source

pub fn exec_bit_or(&self, rhs: &Value) -> Value

Source

pub fn exec_remainder(&self, rhs: &Value) -> Value

Source

pub fn exec_bit_not(&self) -> Value

Source

pub fn exec_shift_left(&self, rhs: &Value) -> Value

Source

pub fn exec_shift_right(&self, rhs: &Value) -> Value

Source

pub fn exec_boolean_not(&self) -> Value

Source

pub fn exec_concat(&self, rhs: &Value) -> Value

Source

pub fn exec_and(&self, rhs: &Value) -> Value

Source

pub fn exec_or(&self, rhs: &Value) -> Value

Source

pub fn exec_like( pattern: &str, text: &str, escape: Option<char>, ) -> Result<bool, LimboError>

Source

pub fn exec_glob(pattern: &str, text: &str) -> Result<bool, LimboError>

Source

pub fn exec_min<'a, T: Iterator<Item = &'a Value>>(regs: T) -> Value

Source

pub fn exec_max<'a, T: Iterator<Item = &'a Value>>(regs: T) -> Value

Source

pub fn exec_group_concat(&mut self, other: &Value)

Concatenate another value onto this Text value, converting both to strings. Used by GROUP_CONCAT/STRING_AGG to properly handle all value types. Panics if self is not a Text value.

Source

pub fn exec_concat_strings<'a, T: Iterator<Item = &'a Self>>( registers: T, ) -> Self

Source

pub fn exec_concat_ws<'a, T: ExactSizeIterator<Item = &'a Self>>( registers: T, ) -> Self

Source

pub fn exec_char<'a, T: Iterator<Item = &'a Self>>(values: T) -> Self

Trait Implementations§

Source§

impl Add for Value

Source§

type Output = Value

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Self) -> Self::Output

Performs the + operation. Read more
Source§

impl Add<f64> for Value

Source§

type Output = Value

The resulting type after applying the + operator.
Source§

fn add(self, rhs: f64) -> Self::Output

Performs the + operation. Read more
Source§

impl Add<i64> for Value

Source§

type Output = Value

The resulting type after applying the + operator.
Source§

fn add(self, rhs: i64) -> Self::Output

Performs the + operation. Read more
Source§

impl AddAssign for Value

Source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
Source§

impl AddAssign<f64> for Value

Source§

fn add_assign(&mut self, rhs: f64)

Performs the += operation. Read more
Source§

impl AddAssign<i64> for Value

Source§

fn add_assign(&mut self, rhs: i64)

Performs the += operation. Read more
Source§

impl AsValueRef for Value

Source§

fn as_value_ref<'a>(&'a self) -> ValueRef<'a>

Source§

impl AsValueRef for &mut Value

Source§

fn as_value_ref<'a>(&'a self) -> ValueRef<'a>

Source§

impl Clone for Value

Source§

fn clone(&self) -> Value

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Value

Source§

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

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

impl Display for Value

Please use Display trait for all limbo output so we have single origin of truth When you need value as string: —GOOD— format!(“{}”, value); —BAD— match value { Value::Numeric(Numeric::Integer(i)) => i.to_string(), Value::Numeric(Numeric::Float(f)) => f64::from(*f).to_string(), …. }

Source§

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

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

impl Div for Value

Source§

type Output = Value

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Value) -> Self::Output

Performs the / operation. Read more
Source§

impl DivAssign for Value

Source§

fn div_assign(&mut self, rhs: Value)

Performs the /= operation. Read more
Source§

impl Eq for Value

Source§

impl From<&Value> for Option<Numeric>

Source§

fn from(value: &Value) -> Self

Converts to this type from the input type.
Source§

impl From<Numeric> for Value

Source§

fn from(value: Numeric) -> Self

Converts to this type from the input type.
Source§

impl From<Option<Numeric>> for Value

Source§

fn from(value: Option<Numeric>) -> Self

Converts to this type from the input type.
Source§

impl From<Value> for Option<Numeric>

Source§

fn from(value: Value) -> Self

Converts to this type from the input type.
Source§

impl From<Value> for Value

Source§

fn from(val: Value) -> Self

Converts to this type from the input type.
Source§

impl From<ValueRef<'_>> for Value

Source§

fn from(value: ValueRef<'_>) -> Self

Converts to this type from the input type.
Source§

impl FromValue for Value

Source§

fn from_sql(val: Value) -> Result<Self>

Source§

impl<'a> FromValueRow<'a> for &'a Value

Source§

fn from_value(value: &'a Value) -> Result<Self>

Source§

impl Ord for Value

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

fn clamp_to<R>(self, range: R) -> Self
where Self: Sized, R: ClampBounds<Self>,

🔬This is a nightly-only experimental API. (clamp_to)
Restrict a value to a certain range. Read more
Source§

impl PartialEq for Value

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl<'a> PartialEq<Value> for ValueRef<'a>

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl PartialOrd for Value

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Auto Trait Implementations§

§

impl Freeze for Value

§

impl RefUnwindSafe for Value

§

impl Send for Value

§

impl Sync for Value

§

impl Unpin for Value

§

impl UnsafeUnpin for Value

§

impl UnwindSafe for Value

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

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

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<K, Q> Comparable<Q> for K
where K: Borrow<Q> + ?Sized, Q: Ord + ?Sized,

Source§

fn compare(&self, key: &Q) -> Ordering

Compare self to key and return their ordering.
Source§

impl<K, Q> Equivalent<Q> for K
where K: Borrow<Q> + ?Sized, Q: Eq + ?Sized,

Source§

fn equivalent(&self, key: &Q) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> IntoValue for T
where T: TryInto<Value>, <T as TryInto<Value>>::Error: Into<Box<dyn Error + Send + Sync>>,

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

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§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more