datex_core/values/value/
apply.rs1use crate::{
2 traits::apply::{Apply, ApplyError},
3 values::{
4 core_value::CoreValue, value::Value, value_container::ValueContainer,
5 },
6};
7
8impl Apply for Value {
9 fn try_apply(
10 &self,
11 args: &[ValueContainer],
12 ) -> Result<Option<ValueContainer>, ApplyError> {
13 match self.inner {
14 CoreValue::Callable(ref callable) => callable.try_apply(args),
15 _ => Err(ApplyError::UnsupportedApply),
16 }
17 }
18 fn try_apply_single(
19 &self,
20 arg: &ValueContainer,
21 ) -> Result<Option<ValueContainer>, ApplyError> {
22 match self.inner {
23 CoreValue::Callable(ref callable) => callable.try_apply_single(arg),
24 _ => Err(ApplyError::UnsupportedApply),
25 }
26 }
27}