Trait Value

Source
pub trait Value: DynClone {
Show 43 methods // Required methods fn literal(&self) -> String; fn equals(&self, other: &Box<dyn Value>) -> bool; fn compare(&self, other: &Box<dyn Value>) -> Option<Ordering>; fn data_type(&self) -> Box<dyn DataType>; fn as_any(&self) -> &dyn Any; // Provided methods fn add_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String> { ... } fn sub_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String> { ... } fn mul_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String> { ... } fn div_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String> { ... } fn rem_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String> { ... } fn caret_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String> { ... } fn or_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String> { ... } fn and_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String> { ... } fn xor_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String> { ... } fn logical_or_op( &self, other: &Box<dyn Value>, ) -> Result<Box<dyn Value>, String> { ... } fn logical_and_op( &self, other: &Box<dyn Value>, ) -> Result<Box<dyn Value>, String> { ... } fn logical_xor_op( &self, other: &Box<dyn Value>, ) -> Result<Box<dyn Value>, String> { ... } fn shl_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String> { ... } fn shr_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String> { ... } fn index_op(&self, index: &Box<dyn Value>) -> Result<Box<dyn Value>, String> { ... } fn slice_op( &self, start: &Option<Box<dyn Value>>, end: &Option<Box<dyn Value>>, ) -> Result<Box<dyn Value>, String> { ... } fn eq_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String> { ... } fn group_eq_op( &self, other: &Box<dyn Value>, group_op: &GroupComparisonOperator, ) -> Result<Box<dyn Value>, String> { ... } fn bang_eq_op( &self, other: &Box<dyn Value>, ) -> Result<Box<dyn Value>, String> { ... } fn group_bang_eq_op( &self, other: &Box<dyn Value>, group_op: &GroupComparisonOperator, ) -> Result<Box<dyn Value>, String> { ... } fn null_safe_eq_op( &self, other: &Box<dyn Value>, ) -> Result<Box<dyn Value>, String> { ... } fn group_null_safe_eq_op( &self, other: &Box<dyn Value>, group_op: &GroupComparisonOperator, ) -> Result<Box<dyn Value>, String> { ... } fn gt_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String> { ... } fn group_gt_op( &self, other: &Box<dyn Value>, group_op: &GroupComparisonOperator, ) -> Result<Box<dyn Value>, String> { ... } fn gte_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String> { ... } fn group_gte_op( &self, other: &Box<dyn Value>, group_op: &GroupComparisonOperator, ) -> Result<Box<dyn Value>, String> { ... } fn lt_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String> { ... } fn group_lt_op( &self, other: &Box<dyn Value>, group_op: &GroupComparisonOperator, ) -> Result<Box<dyn Value>, String> { ... } fn lte_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String> { ... } fn group_lte_op( &self, other: &Box<dyn Value>, group_op: &GroupComparisonOperator, ) -> Result<Box<dyn Value>, String> { ... } fn not_op(&self) -> Result<Box<dyn Value>, String> { ... } fn neg_op(&self) -> Result<Box<dyn Value>, String> { ... } fn bang_op(&self) -> Result<Box<dyn Value>, String> { ... } fn contains_op( &self, other: &Box<dyn Value>, ) -> Result<Box<dyn Value>, String> { ... } fn like_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String> { ... } fn glob_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String> { ... } fn regexp_op( &self, other: &Box<dyn Value>, ) -> Result<Box<dyn Value>, String> { ... } fn cast_op( &self, target_type: &Box<dyn DataType>, ) -> Result<Box<dyn Value>, String> { ... }
}
Expand description

The in memory representation of the Values in the GitQL query engine

Required Methods§

Source

fn literal(&self) -> String

Return the literal representation for this Value

Source

fn equals(&self, other: &Box<dyn Value>) -> bool

Return if other Value is equal or not to current value

Source

fn compare(&self, other: &Box<dyn Value>) -> Option<Ordering>

Return the order between Value and the current value, or None if they can’t be ordered

Source

fn data_type(&self) -> Box<dyn DataType>

Return the DataType for the current Value

Source

fn as_any(&self) -> &dyn Any

Return the current value as dynamic Any

Provided Methods§

Source

fn add_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String>

Perform unary = operator and return new Value represent the result or Exception message as String

Source

fn sub_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String>

Perform unary - operator and return new Value represent the result or Exception message as String

Source

fn mul_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String>

Perform unary * operator and return new Value represent the result or Exception message as String

Source

fn div_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String>

Perform unary / operator and return new Value represent the result or Exception message as String

Source

fn rem_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String>

Perform unary % operator and return new Value represent the result or Exception message as String

Source

fn caret_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String>

Perform unary ^ operator and return new Value represent the result or Exception message as String

Source

fn or_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String>

Perform unary | operator and return new Value represent the result or Exception message as String

Source

fn and_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String>

Perform unary & operator and return new Value represent the result or Exception message as String

Source

fn xor_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String>

Perform unary # operator and return new Value represent the result or Exception message as String

Source

fn logical_or_op( &self, other: &Box<dyn Value>, ) -> Result<Box<dyn Value>, String>

Perform unary || or OR operator and return new Value represent the result or Exception message as String

Source

fn logical_and_op( &self, other: &Box<dyn Value>, ) -> Result<Box<dyn Value>, String>

Perform unary && or AND operator and return new Value represent the result or Exception message as String

Source

fn logical_xor_op( &self, other: &Box<dyn Value>, ) -> Result<Box<dyn Value>, String>

Perform unary XOR operator and return new Value represent the result or Exception message as String

Source

fn shl_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String>

Perform unary << operator and return new Value represent the result or Exception message as String

Source

fn shr_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String>

Perform unary >> operator and return new Value represent the result or Exception message as String

Source

fn index_op(&self, index: &Box<dyn Value>) -> Result<Box<dyn Value>, String>

Perform unary [I] operator and return new Value represent the result or Exception message as String

Source

fn slice_op( &self, start: &Option<Box<dyn Value>>, end: &Option<Box<dyn Value>>, ) -> Result<Box<dyn Value>, String>

Perform unary [S:E] operator and return new Value represent the result or Exception message as String

Source

fn eq_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String>

Perform unary = operator and return new Value represent the result or Exception message as String

Source

fn group_eq_op( &self, other: &Box<dyn Value>, group_op: &GroupComparisonOperator, ) -> Result<Box<dyn Value>, String>

Perform unary = [ALL|ANY|SOME] operator and return new Value represent the result or Exception message as String

Source

fn bang_eq_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String>

Perform unary != or <> operator and return new Value represent the result or Exception message as String

Source

fn group_bang_eq_op( &self, other: &Box<dyn Value>, group_op: &GroupComparisonOperator, ) -> Result<Box<dyn Value>, String>

Perform unary != or <> [ALL|ANY|SOME] operator and return new Value represent the result or Exception message as String

Source

fn null_safe_eq_op( &self, other: &Box<dyn Value>, ) -> Result<Box<dyn Value>, String>

Perform unary <=> operator and return new Value represent the result or Exception message as String

Source

fn group_null_safe_eq_op( &self, other: &Box<dyn Value>, group_op: &GroupComparisonOperator, ) -> Result<Box<dyn Value>, String>

Perform unary <=> [ALL|ANY|SOME] operator and return new Value represent the result or Exception message as String

Source

fn gt_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String>

Perform unary > operator and return new Value represent the result or Exception message as String

Source

fn group_gt_op( &self, other: &Box<dyn Value>, group_op: &GroupComparisonOperator, ) -> Result<Box<dyn Value>, String>

Perform unary > [ALL|ANY|SOME] operator and return new Value represent the result or Exception message as String

Source

fn gte_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String>

Perform unary >= operator and return new Value represent the result or Exception message as String

Source

fn group_gte_op( &self, other: &Box<dyn Value>, group_op: &GroupComparisonOperator, ) -> Result<Box<dyn Value>, String>

Perform unary >= [ALL|ANY|SOME] operator and return new Value represent the result or Exception message as String

Source

fn lt_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String>

Perform unary < operator and return new Value represent the result or Exception message as String

Source

fn group_lt_op( &self, other: &Box<dyn Value>, group_op: &GroupComparisonOperator, ) -> Result<Box<dyn Value>, String>

Perform unary < [ALL|ANY|SOME] operator and return new Value represent the result or Exception message as String

Source

fn lte_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String>

Perform unary <= operator and return new Value represent the result or Exception message as String

Source

fn group_lte_op( &self, other: &Box<dyn Value>, group_op: &GroupComparisonOperator, ) -> Result<Box<dyn Value>, String>

Perform unary <= [ALL|ANY|SOME] operator and return new Value represent the result or Exception message as String

Source

fn not_op(&self) -> Result<Box<dyn Value>, String>

Perform unary NOT operator and return new Value represent the result or Exception message as String

Source

fn neg_op(&self) -> Result<Box<dyn Value>, String>

Perform unary - operator and return new Value represent the result or Exception message as String

Source

fn bang_op(&self) -> Result<Box<dyn Value>, String>

Perform unary ! operator and return new Value represent the result or Exception message as String

Source

fn contains_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String>

Perform @> operator and return new Value represent the result or Exception message as String

Source

fn like_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String>

Perform LIKE operator and return new Value represent the result or Exception message as String

Source

fn glob_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String>

Perform GLOB operator and return new Value represent the result or Exception message as String

Source

fn regexp_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String>

Perform REGEXP operator and return new Value represent the result or Exception message as String

Source

fn cast_op( &self, target_type: &Box<dyn DataType>, ) -> Result<Box<dyn Value>, String>

Perform Cast operator and return new Value represent the result or Exception message as String

Implementations§

Source§

impl dyn Value

Source

pub fn is_text(&self) -> bool

Return true if this value is TextValue

Source

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

Return List of String represent the inner value of IntValue or None if this type it’s called from wrong Value

Source

pub fn is_int(&self) -> bool

Return true if this value is IntValue

Source

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

Return List of i64 represent the inner value of IntValue or None if this type it’s called from wrong Value

Source

pub fn is_float(&self) -> bool

Return true if this value is FloatValue

Source

pub fn as_float(&self) -> Option<f64>

Return List of f64 represent the inner value of FloatValue or None if this type it’s called from wrong Value

Source

pub fn is_number(&self) -> bool

Return true if this value is IntValue or FloatValue

Source

pub fn is_bool(&self) -> bool

Return true if this value is BoolValue

Source

pub fn as_bool(&self) -> Option<bool>

Return List of bool represent the inner value of BoolValue or None if this type it’s called from wrong Value

Source

pub fn is_date(&self) -> bool

Return true if this value is DateValue

Source

pub fn as_date(&self) -> Option<i64>

Return List of i64 represent the inner value of DateValue or None if this type it’s called from wrong Value

Source

pub fn is_time(&self) -> bool

Return true if this value is TimeValue

Source

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

Return List of String represent the inner value of DateValue or None if this type it’s called from wrong Value

Source

pub fn is_date_time(&self) -> bool

Return true if this value is DateTimeValue

Source

pub fn as_date_time(&self) -> Option<i64>

Return List of i64 represent the value of DateTimeValue or None if this type it’s called from wrong Value

Source

pub fn is_interval(&self) -> bool

Return true if this value is IntervalValue

Source

pub fn as_interval(&self) -> Option<Interval>

Return List of Interval represent the value of IntervalValue or None if this type it’s called from wrong Value

Source

pub fn is_array(&self) -> bool

Return true if this value is ArrayValue

Source

pub fn is_array_of(&self, condition: fn(&Box<dyn DataType>) -> bool) -> bool

Return true if this value is ArrayValue and element type match condition

Source

pub fn as_array(&self) -> Option<Vec<Box<dyn Value>>>

Return List of Value represent the inner values of ArrayValue or None if this type it’s called from wrong Value

Source

pub fn is_range(&self) -> bool

Return true if this value is RangeValue

Source

pub fn as_range(&self) -> Option<(Box<dyn Value>, Box<dyn Value>)>

Return Tuple of two Value represent the start and the end of RangeValue or None if this type it’s called from wrong Value

Source

pub fn is_null(&self) -> bool

Return true if this value is NullValue

Source

pub fn is_composite(&self) -> bool

Return true if this value is CompositeValue

Trait Implementations§

Source§

impl Display for Box<dyn Value>

Source§

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

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

impl PartialEq for Box<dyn Value>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Box<dyn 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 · 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 · 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 · 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 · 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

Implementors§