Skip to main content

datex_core/values/value_container/
apply.rs

1use crate::{
2    traits::apply::{Apply, ApplyError},
3    values::value_container::ValueContainer,
4};
5impl Apply for ValueContainer {
6    fn try_apply(
7        &self,
8        args: &[ValueContainer],
9    ) -> Result<Option<ValueContainer>, ApplyError> {
10        match self {
11            ValueContainer::Local(value) => value.try_apply(args),
12            ValueContainer::Shared(reference) => reference.try_apply(args),
13        }
14    }
15
16    fn try_apply_single(
17        &self,
18        arg: &ValueContainer,
19    ) -> Result<Option<ValueContainer>, ApplyError> {
20        match self {
21            ValueContainer::Local(value) => value.try_apply_single(arg),
22            ValueContainer::Shared(reference) => {
23                reference.try_apply_single(arg)
24            }
25        }
26    }
27}