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§
Source§impl 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
Source§impl<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§
Source§impl<'de, T> Deserialize<'de> for Tagged<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for Tagged<T>where
T: Deserialize<'de>,
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<T: Ord> Ord for Tagged<T>
impl<T: Ord> Ord for Tagged<T>
Source§impl<T: PartialOrd> PartialOrd for Tagged<T>
impl<T: PartialOrd> PartialOrd for Tagged<T>
impl<T: Eq> Eq for Tagged<T>
impl<T> StructuralPartialEq for Tagged<T>
Auto Trait Implementations§
impl<T> Freeze for Tagged<T>where
T: Freeze,
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§
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