MCPcopy Create free account
hub / github.com/cel-rust/cel-rust / to_val

Method to_val

cel/src/common/ast/mod.rs:55–66  ·  view source on GitHub ↗
(&'a self)

Source from the content-addressed store, hash-verified

53
54impl 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)]

Callers 1

resolve_valMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected