tracing_forest/tree/
field.rs

1#[cfg(feature = "smallvec")]
2pub(crate) type FieldSet = smallvec::SmallVec<[Field; 3]>;
3#[cfg(not(feature = "smallvec"))]
4pub(crate) type FieldSet = Vec<Field>;
5
6/// A key-value pair recorded from trace data.
7#[derive(Clone, Debug, Hash, PartialEq, Eq)]
8pub struct Field {
9    key: &'static str,
10    value: String,
11}
12
13impl Field {
14    pub(crate) fn new(key: &'static str, value: String) -> Self {
15        Field { key, value }
16    }
17
18    /// Returns the field's key.
19    pub fn key(&self) -> &'static str {
20        self.key
21    }
22
23    /// Returns the field's value.
24    pub fn value(&self) -> &str {
25        &self.value
26    }
27}