compose_lens/model/
annotation.rs1use crate::source::SourceSpan;
4
5use super::{ComposeScalar, KeyValueEntry, Located};
6
7#[derive(Debug, Clone, PartialEq, Eq)]
9#[non_exhaustive]
10pub enum AnnotationsForm {
11 Map(Vec<KeyValueEntry>),
13 List(Vec<Located<ComposeScalar>>),
15}
16
17#[derive(Debug, Clone, PartialEq, Eq)]
19pub struct Annotations {
20 span: SourceSpan,
21 form: AnnotationsForm,
22}
23
24impl Annotations {
25 pub(crate) const fn new(span: SourceSpan, form: AnnotationsForm) -> Self {
26 Self { span, form }
27 }
28
29 #[must_use]
31 pub const fn span(&self) -> SourceSpan {
32 self.span
33 }
34
35 #[must_use]
37 pub const fn form(&self) -> &AnnotationsForm {
38 &self.form
39 }
40}