1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use teo_teon::Value;
use crate::pipeline::Ctx;

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

impl ExtractFromPipelineCtx for Value {
    fn extract(ctx: &Ctx) -> Self {
        if let Some(teon) = ctx.value().as_teon() {
            teon.clone()
        } else {
            panic!("cannot extract value from pipeline ctx")
        }
    }
}