1#[derive(Debug, Clone, PartialEq, Eq, Default)]
9pub struct LinoLink {
10 pub id: Option<String>,
12 pub values: Option<Vec<LinoLink>>,
14}
15
16impl LinoLink {
17 pub fn new(id: Option<String>) -> Self {
19 Self { id, values: None }
20 }
21
22 pub fn with_values(id: Option<String>, values: Vec<LinoLink>) -> Self {
24 Self {
25 id,
26 values: Some(values),
27 }
28 }
29
30 pub fn is_empty(&self) -> bool {
32 self.id.is_none() && self.values.as_ref().is_none_or(|v| v.is_empty())
33 }
34
35 pub fn has_values(&self) -> bool {
37 self.values.as_ref().is_some_and(|v| !v.is_empty())
38 }
39
40 pub fn values_count(&self) -> usize {
42 self.values.as_ref().map_or(0, |v| v.len())
43 }
44
45 pub fn is_variable(&self) -> bool {
47 self.id.as_ref().is_some_and(|id| id.starts_with('$'))
48 }
49
50 pub fn is_wildcard(&self) -> bool {
52 self.id.as_ref().is_some_and(|id| id == "*")
53 }
54
55 pub fn is_numeric(&self) -> bool {
57 self.id.as_ref().is_some_and(|id| id.parse::<u32>().is_ok())
58 }
59}