The in memory representation of the Values in the GitQL query engine
| 24 | |
| 25 | /// The in memory representation of the Values in the GitQL query engine |
| 26 | pub trait Value: DynClone { |
| 27 | /// Return the literal representation for this [`Value`] |
| 28 | fn literal(&self) -> String; |
| 29 | |
| 30 | /// Return if other [`Value`] is equal or not to current value |
| 31 | #[allow(clippy::borrowed_box)] |
| 32 | fn equals(&self, other: &Box<dyn Value>) -> bool; |
| 33 | |
| 34 | /// Return the order between [`Value`] and the current value, |
| 35 | /// or None if they can't be ordered |
| 36 | #[allow(clippy::borrowed_box)] |
| 37 | fn compare(&self, other: &Box<dyn Value>) -> Option<Ordering>; |
| 38 | |
| 39 | /// Return the [`DataType`] for the current [`Value`] |
| 40 | fn data_type(&self) -> Box<dyn DataType>; |
| 41 | |
| 42 | /// Return the current value as dynamic [`Any`] |
| 43 | fn as_any(&self) -> &dyn Any; |
| 44 | |
| 45 | /// Perform unary `=` operator and return new [`Value`] represent the result or Exception message as [`String`] |
| 46 | #[allow(unused_variables)] |
| 47 | #[allow(clippy::borrowed_box)] |
| 48 | fn add_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String> { |
| 49 | Err("Unsupported operator for this type".to_string()) |
| 50 | } |
| 51 | |
| 52 | /// Perform unary `-` operator and return new [`Value`] represent the result or Exception message as [`String`] |
| 53 | #[allow(unused_variables)] |
| 54 | #[allow(clippy::borrowed_box)] |
| 55 | fn sub_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String> { |
| 56 | Err("Unsupported operator for this type".to_string()) |
| 57 | } |
| 58 | |
| 59 | /// Perform unary `*` operator and return new [`Value`] represent the result or Exception message as [`String`] |
| 60 | #[allow(unused_variables)] |
| 61 | #[allow(clippy::borrowed_box)] |
| 62 | fn mul_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String> { |
| 63 | Err("Unsupported operator for this type".to_string()) |
| 64 | } |
| 65 | |
| 66 | /// Perform unary `/` operator and return new [`Value`] represent the result or Exception message as [`String`] |
| 67 | #[allow(unused_variables)] |
| 68 | #[allow(clippy::borrowed_box)] |
| 69 | fn div_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String> { |
| 70 | Err("Unsupported operator for this type".to_string()) |
| 71 | } |
| 72 | |
| 73 | /// Perform unary `%` operator and return new [`Value`] represent the result or Exception message as [`String`] |
| 74 | #[allow(unused_variables)] |
| 75 | #[allow(clippy::borrowed_box)] |
| 76 | fn rem_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String> { |
| 77 | Err("Unsupported operator for this type".to_string()) |
| 78 | } |
| 79 | |
| 80 | /// Perform unary `^` operator and return new [`Value`] represent the result or Exception message as [`String`] |
| 81 | #[allow(unused_variables)] |
| 82 | #[allow(clippy::borrowed_box)] |
| 83 | fn caret_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String> { |
no outgoing calls
no test coverage detected
searching dependent graphs…