tracing_tunnel

Struct TracedValues

Source
pub struct TracedValues<S> { /* private fields */ }
Expand description

Collection of named TracedValues.

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>

Source

pub fn from_values(values: &ValueSet<'_>) -> Self

Creates traced values from the specified value set.

Source

pub fn from_record(values: &Record<'_>) -> Self

Creates traced values from the specified record.

Source

pub fn from_event(event: &Event<'_>) -> Self

Creates traced values from the values in the specified event.

Source§

impl<S: AsRef<str>> TracedValues<S>

Source

pub fn new() -> Self

Creates new empty values.

Source

pub fn len(&self) -> usize

Returns the number of stored values.

Source

pub fn is_empty(&self) -> bool

Checks whether this collection of values is empty.

Source

pub fn get(&self, name: &str) -> Option<&TracedValue>

Returns the value with the specified name, or None if it not set.

Source

pub fn iter(&self) -> TracedValuesIter<'_, S>

Iterates over the contained name-value pairs.

Source

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>

Source§

fn clone(&self) -> TracedValues<S>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<S: AsRef<str>> Debug for TracedValues<S>

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<S> Default for TracedValues<S>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for TracedValues<String>

Source§

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>

Source§

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)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

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>

Source§

fn from_iter<I: IntoIterator<Item = (S, TracedValue)>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl<S: AsRef<str>> Index<&str> for TracedValues<S>

Source§

type Output = TracedValue

The returned type after indexing.
Source§

fn index(&self, index: &str) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<'a, S: AsRef<str>> IntoIterator for &'a TracedValues<S>

Source§

type Item = (&'a str, &'a TracedValue)

The type of the elements being iterated over.
Source§

type IntoIter = TracedValuesIter<'a, S>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<S> IntoIterator for TracedValues<S>

Source§

type Item = (S, TracedValue)

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<(S, TracedValue)>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<S: AsRef<str>> Serialize for TracedValues<S>

Source§

fn serialize<Ser: Serializer>( &self, serializer: Ser, ) -> Result<Ser::Ok, Ser::Error>

Serialize this value into the given Serde serializer. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,