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

Method try_from

cel/src/objects.rs:275–283  ·  view source on GitHub ↗
(value: &'a Value)

Source from the content-addressed store, hash-verified

273 type Error = Value;
274
275 fn try_from(value: &'a Value) -> Result<Self, Self::Error> {
276 match value {
277 Value::Int(v) => Ok(KeyRef::Int(*v)),
278 Value::UInt(v) => Ok(KeyRef::Uint(*v)),
279 Value::String(v) => Ok(KeyRef::String(v.as_str())),
280 Value::Bool(v) => Ok(KeyRef::Bool(*v)),
281 _ => Err(value.clone()),
282 }
283 }
284}
285
286// Implement conversion from HashMap<K, V> into CelMap

Callers

nothing calls this directly

Calls 15

IntClass · 0.85
StringClass · 0.85
BoolClass · 0.85
UIntClass · 0.85
BytesClass · 0.85
MapClass · 0.85
OpaqueInterface · 0.85
StructClass · 0.85
cloneMethod · 0.80
runtime_type_nameMethod · 0.80
type_ofMethod · 0.80
kindMethod · 0.80

Tested by

no test coverage detected