pub struct RawTags<'a> { /* private fields */ }
Expand description
A wrapper over raw tags in their unprocessed form.
This type is meant to handle raw tags that have been extracted from network payloads, such as DogStatsD, where the
input byte slice contains the tags – whether bare or key/value – packed together and separated by commas (,
,
0x2C) character.
RawTags
supports iteration over these tags in an efficient, zero-copy fashion and returns string references to
each individual tag. It supports configuration to control how many tags can be returned, and the maximum allowable
length for a tag. This allows easy usage where limits must be enforced, without having to write additional code to
filter the resulting iterator.
§Cloning
RawTags
can be cloned to create a new iterator with its own iteration state. The same underlying input byte slice
is retained.
Implementations§
Source§impl<'a> RawTags<'a>
impl<'a> RawTags<'a>
Sourcepub const fn new(
raw_tags: &'a str,
max_tag_count: usize,
max_tag_len: usize,
) -> Self
pub const fn new( raw_tags: &'a str, max_tag_count: usize, max_tag_len: usize, ) -> Self
Creates a new RawTags
from the given input byte slice.
The maximum tag count and maximum tag length control how many tags are returned from the iterator and their length. If the iterator encounters more tags than the maximum count, it will simply stop returning tags. If the iterator encounters any tag that is longer than the maximum length, it will truncate the tag to configured length, or to a smaller length, whichever is closer to a valid UTF-8 character boundary.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for RawTags<'a>
impl<'a> RefUnwindSafe for RawTags<'a>
impl<'a> Send for RawTags<'a>
impl<'a> Sync for RawTags<'a>
impl<'a> Unpin for RawTags<'a>
impl<'a> UnwindSafe for RawTags<'a>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Track for T
impl<T> Track for T
§fn track_allocations(self, token: AllocationGroupToken) -> Tracked<Self>
fn track_allocations(self, token: AllocationGroupToken) -> Tracked<Self>
Tracked
wrapper. Read more§fn in_current_allocation_group(self) -> Tracked<Self>
fn in_current_allocation_group(self) -> Tracked<Self>
Tracked
wrapper. Read more