teo_runtime/pipeline/ctx/
extract.rs

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
use crate::value::Value;
use crate::arguments::Arguments;
use crate::pipeline::Ctx;

pub trait ExtractFromPipelineCtx {
    fn extract(args: &Arguments, ctx: &Ctx) -> Self;
}

impl ExtractFromPipelineCtx for Ctx {
    fn extract(_: &Arguments, ctx: &Ctx) -> Self {
        ctx.clone()
    }
}

impl ExtractFromPipelineCtx for Value {
    fn extract(_: &Arguments, ctx: &Ctx) -> Self {
        ctx.value().clone()
    }
}

impl ExtractFromPipelineCtx for Arguments {
    fn extract(args: &Arguments, _: &Ctx) -> Self {
        args.clone()
    }
}