rbatis_codegen/
ops_string.rs

1use rbs::Value;
2use crate::ops::StrMethods;
3
4impl StrMethods for Value {
5    fn contains_str(self, s: &str) -> bool {
6        self.as_str().unwrap_or_default().contains(s)
7    }
8
9    fn starts_with(self, other: &str) -> bool {
10        self.as_str().unwrap_or_default().starts_with(other)
11    }
12
13    fn ends_with(self, other: &str) -> bool {
14        self.as_str().unwrap_or_default().ends_with(other)
15    }
16}
17
18impl StrMethods for &Value {
19    fn contains_str(self, s: &str) -> bool {
20        self.as_str().unwrap_or_default().contains(s)
21    }
22
23    fn starts_with(self, other: &str) -> bool {
24        self.as_str().unwrap_or_default().starts_with(other)
25    }
26
27    fn ends_with(self, other: &str) -> bool {
28        self.as_str().unwrap_or_default().ends_with(other)
29    }
30}
31
32impl StrMethods for &&Value {
33    fn contains_str(self, s: &str) -> bool {
34        self.as_str().unwrap_or_default().contains(s)
35    }
36
37    fn starts_with(self, other: &str) -> bool {
38        self.as_str().unwrap_or_default().starts_with(other)
39    }
40
41    fn ends_with(self, other: &str) -> bool {
42        self.as_str().unwrap_or_default().ends_with(other)
43    }
44}