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
use crate::process::traversal::TraversalBuilder;
use crate::structure::{GValue, Vertex};

pub struct FromStep {
    params: Vec<GValue>,
}

impl FromStep {
    fn new(params: Vec<GValue>) -> Self {
        FromStep { params }
    }
}

impl FromStep {
    pub fn take_params(self) -> Vec<GValue> {
        self.params
    }
}

pub trait IntoFromStep {
    fn into_step(self) -> FromStep;
}

impl IntoFromStep for &str {
    fn into_step(self) -> FromStep {
        FromStep::new(vec![self.into()])
    }
}

impl IntoFromStep for &Vertex {
    fn into_step(self) -> FromStep {
        FromStep::new(vec![self.into()])
    }
}

impl IntoFromStep for TraversalBuilder {
    fn into_step(self) -> FromStep {
        FromStep::new(vec![self.bytecode.into()])
    }
}