Struct tracing_tunnel::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>

§

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>

§

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

The type of the elements being iterated over.
§

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>

§

type Item = (S, TracedValue)

The type of the elements being iterated over.
§

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> 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,

§

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>,

§

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>,

§

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>,