| 53 | |
| 54 | impl LiteralValue { |
| 55 | pub fn to_val<'a>(&'a self) -> Cow<'a, dyn Val> { |
| 56 | // todo refactor to return Cow::Borrowed |
| 57 | match &self { |
| 58 | LiteralValue::Boolean(b) => Cow::Borrowed(b), |
| 59 | LiteralValue::Bytes(b) => Cow::Borrowed(b), |
| 60 | LiteralValue::Double(f) => Cow::Borrowed(f), |
| 61 | LiteralValue::Int(i) => Cow::Borrowed(i), |
| 62 | LiteralValue::Null => Cow::<dyn Val>::Owned(Box::new(CelNull)), |
| 63 | LiteralValue::String(s) => Cow::Borrowed(s), |
| 64 | LiteralValue::UInt(ui) => Cow::Borrowed(ui), |
| 65 | } |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | #[derive(Clone, Debug, PartialEq)] |