1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/// A literal value.
///
/// Can be used to execute operations over arbitrary values.
///
/// ## Example
/// ```
/// # use paladin::{
/// # RemoteExecute,
/// # operation::{Operation, Result},
/// # directive::{Directive, Literal},
/// # runtime::Runtime,
/// # };
/// # use serde::{Deserialize, Serialize};
/// #
/// # #[derive(Deserialize, Serialize, RemoteExecute)]
/// struct MultiplyBy(i32);
/// impl Operation for MultiplyBy {
/// type Input = i32;
/// type Output = i32;
///
/// fn execute(&self, input: i32) -> Result<i32> {
/// Ok(self.0 * input)
/// }
/// }
///
/// # #[tokio::main]
/// # async fn main() -> anyhow::Result<()> {
/// # let runtime = Runtime::in_memory().await?;
/// let computation = Literal(5).map(&MultiplyBy(2));
/// let result = computation.run(&runtime).await?;
/// assert_eq!(result, Literal(10));
/// # Ok(())
/// # }
/// ```
;
impl_hkt!;
impl_lit!;