pub enum Annotation {
Marker(MarkerAnnotation),
OType(TypeId),
Exception(ExceptionAnnotation),
}
Expand description
Types of annotations we support.
Usually you’d expect one of those annotation types in any given situation.
For convenience the match methods Self::as_marker
, Self::as_otype
and Self::as_exception
are provided. These are particularly useful in
conjunction with e.g. Iterator::filter_map
Variants§
Implementations§
Source§impl Annotation
impl Annotation
Sourcepub const fn is_marker(&self) -> bool
pub const fn is_marker(&self) -> bool
Returns true if the enum is Annotation::Marker otherwise false
Sourcepub const fn is_o_type(&self) -> bool
pub const fn is_o_type(&self) -> bool
Returns true if the enum is Annotation::OType otherwise false
Sourcepub const fn is_exception(&self) -> bool
pub const fn is_exception(&self) -> bool
Returns true if the enum is Annotation::Exception otherwise false
Source§impl Annotation
impl Annotation
Sourcepub fn as_marker(&self) -> Option<&MarkerAnnotation>
pub fn as_marker(&self) -> Option<&MarkerAnnotation>
If this is an Annotation::Marker
, returns the underlying MarkerAnnotation
.
Sourcepub fn as_otype(&self) -> Option<TypeId>
pub fn as_otype(&self) -> Option<TypeId>
If this is an Annotation::OType
, returns the underlying TypeId
.
Sourcepub fn as_exception(&self) -> Option<&ExceptionAnnotation>
pub fn as_exception(&self) -> Option<&ExceptionAnnotation>
If this is an Annotation::Exception
, returns the underlying ExceptionAnnotation
.
Trait Implementations§
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<__D: SpanDecoder> Decodable<__D> for Annotation
impl<__D: SpanDecoder> Decodable<__D> 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<__E: SpanEncoder> Encodable<__E> for Annotation
impl<__E: SpanEncoder> Encodable<__E> for Annotation
Source§impl PartialEq for Annotation
impl PartialEq 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§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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