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
use crate::{GValue, ToGValue};

#[derive(Debug, PartialEq, Clone)]
pub struct TextP {
    pub(crate) operator: String,
    pub(crate) value: Box<GValue>,
}

impl TextP {
    pub fn operator(&self) -> &String {
        &self.operator
    }

    pub fn value(&self) -> &GValue {
        &self.value
    }

    pub(crate) fn new<T>(operator: T, value: GValue) -> TextP
    where
        T: Into<String>,
    {
        TextP {
            operator: operator.into(),
            value: Box::new(value),
        }
    }
    pub fn containing<V>(value: V) -> TextP
    where
        V: ToGValue,
    {
        TextP::new("containing", value.to_gvalue())
    }
}