pub struct Tagged { /* private fields */ }Expand description
A line of text with tags.
Implementations§
Source§impl Tagged
impl Tagged
Sourcepub fn new(text: &[u8]) -> Tagged
pub fn new(text: &[u8]) -> Tagged
Create a new Tagged container for a slice of text.
This container holds the original text and will collect any Tags found within it.
Sourcepub fn tag(self, tag: Tag) -> Self
pub fn tag(self, tag: Tag) -> Self
Adds a tag to this text.
The tag should contain a range that corresponds to its position in self.text().
Get the tags in this text.
Sourcepub fn set_text_data(&mut self, data: TextData)
pub fn set_text_data(&mut self, data: TextData)
Explicitly sets the text data used for JSON serialization.
Sourcepub fn write<W: Write>(&self, wtr: &mut W) -> Result<()>
pub fn write<W: Write>(&self, wtr: &mut W) -> Result<()>
Writes the text to the given writer, replacing tagged IPs with their decorated versions.
If a tag has a decorated() value, that value is written instead of the original
bytes in its range(). If no decoration is present, the original bytes are written.
Tags MUST be sorted by their start position for this to work correctly.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Tagged
impl RefUnwindSafe for Tagged
impl Send for Tagged
impl Sync for Tagged
impl Unpin for Tagged
impl UnsafeUnpin for Tagged
impl UnwindSafe for Tagged
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