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
use otopr::encoding::Encodable;
use otopr::DecodableMessage;
#[derive(Clone, Copy, Default, DecodableMessage, Debug, PartialEq, Eq, Hash)]
pub struct Timestamp {
pub seconds: i64,
pub nanos: i32,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub enum Seal {
Sealed,
NotSealed,
}
impl Encodable for Seal {
type Wire = <bool as Encodable>::Wire;
fn encoded_size<V: otopr::VarInt>(&self, field_number: V) -> usize {
field_number.size() + 1
}
fn encode(&self, s: &mut otopr::encoding::ProtobufSerializer<impl bytes::BufMut>) {
let is_sealed = matches!(self, Seal::Sealed);
is_sealed.encode(s)
}
}