datex_core/values/value_container/
apply.rs1use crate::{
2 prelude::*,
3 runtime::Runtime,
4 traits::apply::{Apply, ApplyArgument, ApplyError},
5 values::value_container::ValueContainer,
6};
7
8impl Apply for ValueContainer {
9 fn try_apply_sync(
10 &self,
11 runtime: &Runtime,
12 args: Vec<ApplyArgument>,
13 ) -> Result<(Option<ValueContainer>, Vec<ValueContainer>), ApplyError> {
14 match self {
15 ValueContainer::Local(value) => value.try_apply_sync(runtime, args),
16 ValueContainer::Shared(reference) => {
17 reference.try_apply_sync(runtime, args)
18 }
19 }
20 }
21
22 async fn try_apply_async(
23 &self,
24 runtime: &Runtime,
25 args: Vec<ApplyArgument>,
26 ) -> Result<(Option<ValueContainer>, Vec<ValueContainer>), ApplyError> {
27 match self {
28 ValueContainer::Local(value) => {
29 value.try_apply_async(runtime, args).await
30 }
31 ValueContainer::Shared(shared_container) => {
32 shared_container.try_apply_async(runtime, args).await
33 }
34 }
35 }
36}