witchcraft_server/logging/api/
annotation.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
///A Zipkin-compatible Annotation object.
#[derive(
    Debug,
    Clone,
    conjure_object::serde::Serialize,
    conjure_object::serde::Deserialize,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash
)]
#[serde(crate = "conjure_object::serde")]
#[conjure_object::private::staged_builder::staged_builder]
#[builder(crate = conjure_object::private::staged_builder, update, inline)]
pub struct Annotation {
    #[serde(rename = "timestamp")]
    timestamp: conjure_object::SafeLong,
    #[builder(into)]
    #[serde(rename = "value")]
    value: String,
    #[builder(custom(type = super::Endpoint, convert = Box::new))]
    #[serde(rename = "endpoint")]
    endpoint: Box<super::Endpoint>,
}
impl Annotation {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new(
        timestamp: conjure_object::SafeLong,
        value: impl Into<String>,
        endpoint: super::Endpoint,
    ) -> Self {
        Self::builder().timestamp(timestamp).value(value).endpoint(endpoint).build()
    }
    ///Time annotation was created (epoch microsecond value)
    #[inline]
    pub fn timestamp(&self) -> conjure_object::SafeLong {
        self.timestamp
    }
    ///Value encapsulated by this annotation
    #[inline]
    pub fn value(&self) -> &str {
        &*self.value
    }
    #[inline]
    pub fn endpoint(&self) -> &super::Endpoint {
        &*self.endpoint
    }
}