pub struct Tagged<T> {
pub tag: Tag,
pub item: T,
}
Expand description
A wrapper type that attaches a Tag to a value
Fields
tag: Tag
item: T
Implementations
sourceimpl Tagged<String>
impl Tagged<String>
sourcepub fn borrow_spanned(&self) -> Spanned<&str>
pub fn borrow_spanned(&self) -> Spanned<&str>
Allows borrowing the contained string slice as a spanned value
sourcepub fn borrow_tagged(&self) -> Tagged<&str>
pub fn borrow_tagged(&self) -> Tagged<&str>
Allows borrowing the contained string slice as a tagged value
sourceimpl<T> Tagged<T>
impl<T> Tagged<T>
pub fn map<U>(self, input: impl FnOnce(T) -> U) -> Tagged<U>
pub fn map_anchored(self, anchor: &Option<AnchorLocation>) -> Tagged<T>
pub fn transpose(&self) -> Tagged<&T>
sourcepub fn anchor(&self) -> Option<AnchorLocation>
pub fn anchor(&self) -> Option<AnchorLocation>
Returns the AnchorLocation
of the Tag
if there is one.
sourcepub fn anchor_name(&self) -> Option<String>
pub fn anchor_name(&self) -> Option<String>
Returns the underlying AnchorLocation
variant type as a string.
sourcepub fn into_parts(self) -> (T, Tag)
pub fn into_parts(self) -> (T, Tag)
Returns a tuple of the Tagged
item and Tag
.
Trait Implementations
sourceimpl<'de, T> Deserialize<'de> for Tagged<T> where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for Tagged<T> where
T: Deserialize<'de>,
sourcefn 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
sourceimpl<T: Ord> Ord for Tagged<T>
impl<T: Ord> Ord for Tagged<T>
sourceimpl<T: PartialOrd> PartialOrd<Tagged<T>> for Tagged<T>
impl<T: PartialOrd> PartialOrd<Tagged<T>> for Tagged<T>
sourcefn partial_cmp(&self, other: &Tagged<T>) -> Option<Ordering>
fn partial_cmp(&self, other: &Tagged<T>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl<T: Eq> Eq for Tagged<T>
impl<T> StructuralEq for Tagged<T>
impl<T> StructuralPartialEq for Tagged<T>
Auto Trait Implementations
impl<T> RefUnwindSafe for Tagged<T> where
T: RefUnwindSafe,
impl<T> Send for Tagged<T> where
T: Send,
impl<T> Sync for Tagged<T> where
T: Sync,
impl<T> Unpin for Tagged<T> where
T: Unpin,
impl<T> UnwindSafe for Tagged<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more