pub struct Annotation {
pub val: SmolStr,
pub loc: Option<Loc>,
}
Expand description
Struct which holds the value of a particular annotation
Fields§
§val: SmolStr
Annotation value
loc: Option<Loc>
Source location. Note this is the location of the entire key-value
pair for the annotation, not just val
above
Implementations§
Source§impl Annotation
impl Annotation
Sourcepub fn with_optional_value(val: Option<SmolStr>, loc: Option<Loc>) -> Self
pub fn with_optional_value(val: Option<SmolStr>, loc: Option<Loc>) -> Self
Construct an Annotation with an optional value. This function is used
to construct annotations from the CST and EST representation where a
value is not required, but an absent value is equivalent to ""
.
Here, a None
constructs an annotation containing the value ""
.`
Trait Implementations§
Source§impl AsRef<str> for Annotation
impl AsRef<str> for Annotation
Source§impl Clone for Annotation
impl Clone for Annotation
Source§fn clone(&self) -> Annotation
fn clone(&self) -> Annotation
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for Annotation
impl Debug for Annotation
Source§impl<'de> Deserialize<'de> for Annotation
impl<'de> Deserialize<'de> for Annotation
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Hash for Annotation
impl Hash for Annotation
Source§impl Ord for Annotation
impl Ord for Annotation
Source§fn cmp(&self, other: &Annotation) -> Ordering
fn cmp(&self, other: &Annotation) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for Annotation
impl PartialEq for Annotation
Source§impl PartialOrd for Annotation
impl PartialOrd for Annotation
Source§impl Serialize for Annotation
impl Serialize for Annotation
impl Eq for Annotation
impl StructuralPartialEq for Annotation
Auto Trait Implementations§
impl Freeze for Annotation
impl RefUnwindSafe for Annotation
impl Send for Annotation
impl Sync for Annotation
impl Unpin for Annotation
impl UnwindSafe for Annotation
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more