Skip to main content

gix_trace/forest/tree/
field.rs

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