aldrin_parser/ast/
lit_uuid.rs

1use crate::grammar::Rule;
2use crate::Span;
3use pest::iterators::Pair;
4use uuid::Uuid;
5
6#[derive(Debug, Clone)]
7pub struct LitUuid {
8    span: Span,
9    value: Uuid,
10}
11
12impl LitUuid {
13    pub(crate) fn parse(pair: Pair<Rule>) -> Self {
14        assert_eq!(pair.as_rule(), Rule::lit_uuid);
15
16        Self {
17            span: Span::from_pair(&pair),
18            value: pair.as_str().parse().unwrap(),
19        }
20    }
21
22    pub fn span(&self) -> Span {
23        self.span
24    }
25
26    pub fn value(&self) -> Uuid {
27        self.value
28    }
29}