pub struct TracedValues<S> { /* private fields */ }
Expand description
Collection of named TracedValue
s.
Functionally this collection is similar to a HashMap<S, TracedValue>
,
with the key difference being that the order of iteration is the insertion order.
If a value is updated, including via Extend
etc., it preserves its old placement.
Implementations§
Source§impl<S: From<&'static str> + AsRef<str>> TracedValues<S>
impl<S: From<&'static str> + AsRef<str>> TracedValues<S>
Sourcepub fn from_values(values: &ValueSet<'_>) -> Self
pub fn from_values(values: &ValueSet<'_>) -> Self
Creates traced values from the specified value set.
Sourcepub fn from_record(values: &Record<'_>) -> Self
pub fn from_record(values: &Record<'_>) -> Self
Creates traced values from the specified record.
Sourcepub fn from_event(event: &Event<'_>) -> Self
pub fn from_event(event: &Event<'_>) -> Self
Creates traced values from the values in the specified event.
Source§impl<S: AsRef<str>> TracedValues<S>
impl<S: AsRef<str>> TracedValues<S>
Sourcepub fn get(&self, name: &str) -> Option<&TracedValue>
pub fn get(&self, name: &str) -> Option<&TracedValue>
Returns the value with the specified name, or None
if it not set.
Sourcepub fn iter(&self) -> TracedValuesIter<'_, S> ⓘ
pub fn iter(&self) -> TracedValuesIter<'_, S> ⓘ
Iterates over the contained name-value pairs.
Sourcepub fn insert(&mut self, name: S, value: TracedValue) -> Option<TracedValue>
pub fn insert(&mut self, name: S, value: TracedValue) -> Option<TracedValue>
Inserts a value with the specified name. If a value with the same name was present previously, it is overwritten. Returns the previous value with the specified name, if any.
Trait Implementations§
Source§impl<S: Clone> Clone for TracedValues<S>
impl<S: Clone> Clone for TracedValues<S>
Source§fn clone(&self) -> TracedValues<S>
fn clone(&self) -> TracedValues<S>
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<S> Default for TracedValues<S>
impl<S> Default for TracedValues<S>
Source§impl<'de> Deserialize<'de> for TracedValues<String>
impl<'de> Deserialize<'de> for TracedValues<String>
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<S: AsRef<str>> Extend<(S, TracedValue)> for TracedValues<S>
impl<S: AsRef<str>> Extend<(S, TracedValue)> for TracedValues<S>
Source§fn extend<I: IntoIterator<Item = (S, TracedValue)>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = (S, TracedValue)>>(&mut self, iter: I)
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one
)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
Source§impl<S: AsRef<str>> FromIterator<(S, TracedValue)> for TracedValues<S>
impl<S: AsRef<str>> FromIterator<(S, TracedValue)> for TracedValues<S>
Source§fn from_iter<I: IntoIterator<Item = (S, TracedValue)>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = (S, TracedValue)>>(iter: I) -> Self
Creates a value from an iterator. Read more
Source§impl<'a, S: AsRef<str>> IntoIterator for &'a TracedValues<S>
impl<'a, S: AsRef<str>> IntoIterator for &'a TracedValues<S>
Source§impl<S> IntoIterator for TracedValues<S>
impl<S> IntoIterator for TracedValues<S>
Auto Trait Implementations§
impl<S> Freeze for TracedValues<S>
impl<S> RefUnwindSafe for TracedValues<S>where
S: RefUnwindSafe,
impl<S> Send for TracedValues<S>where
S: Send,
impl<S> Sync for TracedValues<S>where
S: Sync,
impl<S> Unpin for TracedValues<S>where
S: Unpin,
impl<S> UnwindSafe for TracedValues<S>where
S: 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)