Skip to main content

nominal_api/conjure/objects/persistent/compute/api/
ping.rs

1/// A ping can be sent by both client and server to keep the connection open and check that it is still working.
2/// The receiving end should send back a pong immediately.
3/// We also include the times that pings and pongs are sent so that we can track latency and/or discover clock
4/// drift between server and client.
5#[derive(
6    Debug,
7    Clone,
8    conjure_object::serde::Serialize,
9    conjure_object::serde::Deserialize,
10    PartialEq,
11    Eq,
12    PartialOrd,
13    Ord,
14    Hash,
15    Copy
16)]
17#[serde(crate = "conjure_object::serde")]
18#[conjure_object::private::staged_builder::staged_builder]
19#[builder(crate = conjure_object::private::staged_builder, update, inline)]
20pub struct Ping {
21    #[serde(rename = "sentAt")]
22    sent_at: conjure_object::DateTime<conjure_object::Utc>,
23}
24impl Ping {
25    /// Constructs a new instance of the type.
26    #[inline]
27    pub fn new(sent_at: conjure_object::DateTime<conjure_object::Utc>) -> Self {
28        Self::builder().sent_at(sent_at).build()
29    }
30    #[inline]
31    pub fn sent_at(&self) -> conjure_object::DateTime<conjure_object::Utc> {
32        self.sent_at
33    }
34}