gremlin_client/structure/
text_p.rs

1use crate::{GValue, ToGValue};
2
3#[derive(Debug, PartialEq, Clone)]
4pub struct TextP {
5    pub(crate) operator: String,
6    pub(crate) value: Box<GValue>,
7}
8
9impl TextP {
10    pub fn operator(&self) -> &String {
11        &self.operator
12    }
13
14    pub fn value(&self) -> &GValue {
15        &self.value
16    }
17
18    pub(crate) fn new<T>(operator: T, value: GValue) -> TextP
19    where
20        T: Into<String>,
21    {
22        TextP {
23            operator: operator.into(),
24            value: Box::new(value),
25        }
26    }
27    pub fn containing<V>(value: V) -> TextP
28    where
29        V: ToGValue,
30    {
31        TextP::new("containing", value.to_gvalue())
32    }
33
34    pub fn starting_with<V>(value: V) -> TextP
35    where
36        V: ToGValue,
37    {
38        TextP::new("startingWith", value.to_gvalue())
39    }
40
41    pub fn ending_with<V>(value: V) -> TextP
42    where
43        V: ToGValue,
44    {
45        TextP::new("endingWith", value.to_gvalue())
46    }
47
48    pub fn not_starting_with<V>(value: V) -> TextP
49    where
50        V: ToGValue,
51    {
52        TextP::new("notStartingWith", value.to_gvalue())
53    }
54
55    pub fn not_ending_with<V>(value: V) -> TextP
56    where
57        V: ToGValue,
58    {
59        TextP::new("notEndingWith", value.to_gvalue())
60    }
61
62    pub fn not_containing<V>(value: V) -> TextP
63    where
64        V: ToGValue,
65    {
66        TextP::new("notContaining", value.to_gvalue())
67    }
68}