solomon_gremlin/process/traversal/step/
by.rs

1use crate::process::traversal::{Order, TraversalBuilder};
2use crate::structure::{GValue, T};
3
4pub struct ByStep {
5	params: Vec<GValue>,
6}
7
8impl ByStep {
9	fn new(params: Vec<GValue>) -> Self {
10		ByStep {
11			params,
12		}
13	}
14}
15
16impl From<ByStep> for Vec<GValue> {
17	fn from(step: ByStep) -> Self {
18		step.params
19	}
20}
21
22impl From<()> for ByStep {
23	fn from(_: ()) -> Self {
24		ByStep::new(vec![])
25	}
26}
27
28impl From<&str> for ByStep {
29	fn from(param: &str) -> Self {
30		ByStep::new(vec![String::from(param).into()])
31	}
32}
33
34impl From<Order> for ByStep {
35	fn from(param: Order) -> Self {
36		ByStep::new(vec![param.into()])
37	}
38}
39
40impl From<T> for ByStep {
41	fn from(param: T) -> Self {
42		ByStep::new(vec![param.into()])
43	}
44}
45
46impl From<(&str, Order)> for ByStep {
47	fn from(param: (&str, Order)) -> Self {
48		ByStep::new(vec![param.0.into(), param.1.into()])
49	}
50}
51
52impl From<(String, Order)> for ByStep {
53	fn from(param: (String, Order)) -> Self {
54		ByStep::new(vec![param.0.into(), param.1.into()])
55	}
56}
57
58impl From<(TraversalBuilder, Order)> for ByStep {
59	fn from(param: (TraversalBuilder, Order)) -> Self {
60		ByStep::new(vec![param.0.bytecode.into(), param.1.into()])
61	}
62}
63
64impl From<TraversalBuilder> for ByStep {
65	fn from(param: TraversalBuilder) -> Self {
66		ByStep::new(vec![param.bytecode.into()])
67	}
68}