compris/annotate/traits/
dyn_annotated.rs

1use super::{super::annotations::*, annotated::*};
2
3//
4// DynAnnotated
5//
6
7/// A reduced `dyn`-compatible version of [Annotated](super::annotated::Annotated).
8pub trait DynAnnotated {
9    /// The annotations.
10    fn dyn_annotations(&self) -> Option<&Annotations>;
11
12    /// The annotations as mutable.
13    fn dyn_annotations_mut(&mut self) -> Option<&mut Annotations>;
14}
15
16impl<AnnotatedT> DynAnnotated for AnnotatedT
17where
18    AnnotatedT: Annotated,
19{
20    fn dyn_annotations(&self) -> Option<&Annotations> {
21        self.annotations()
22    }
23
24    fn dyn_annotations_mut(&mut self) -> Option<&mut Annotations> {
25        self.annotations_mut()
26    }
27}