cel_cxx/values/impls/
struct.rs1use crate::{types::*, values::*};
2
3impl IntoValue for StructValue {
4 fn into_value(self) -> Value {
5 Value::Struct(self)
6 }
7}
8
9impl TypedValue for StructValue {
10 fn value_type() -> ValueType {
14 ValueType::Dyn
15 }
16}
17
18impl FromValue for StructValue {
19 type Output<'a> = StructValue;
20
21 fn from_value<'a>(value: &'a Value) -> Result<Self::Output<'a>, FromValueError> {
22 match value {
23 Value::Struct(s) => Ok(s.clone()),
24 _ => Err(FromValueError::new(value.clone(), "struct")),
25 }
26 }
27}
28
29impl FromValue for &StructValue {
30 type Output<'a> = &'a StructValue;
31
32 fn from_value<'a>(value: &'a Value) -> Result<Self::Output<'a>, FromValueError> {
33 match value {
34 Value::Struct(s) => Ok(s),
35 _ => Err(FromValueError::new(value.clone(), "struct")),
36 }
37 }
38}