1use mz_proto::{RustType, TryFromProtoError};
11use timely::progress::Antichain;
12
13use crate::Timestamp;
14
15include!(concat!(env!("OUT_DIR"), "/mz_repr.antichain.rs"));
16
17impl RustType<ProtoU64Antichain> for Antichain<Timestamp> {
18 fn into_proto(&self) -> ProtoU64Antichain {
19 ProtoU64Antichain {
20 elements: self.elements().iter().map(Into::into).collect(),
21 }
22 }
23
24 fn from_proto(proto: ProtoU64Antichain) -> Result<Self, TryFromProtoError> {
25 Ok(Antichain::from_iter(
26 proto.elements.into_iter().map(Timestamp::from),
27 ))
28 }
29}