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
use std::io::Result as Res;
use endio::Serialize;
use endio_bit::BEBitWriter;
use lu_packets_derive::{BitVariantTests, ReplicaSerde};
use super::{ComponentConstruction, ComponentProtocol, ComponentSerialization};
use super::vendor::VendorInfo;
#[derive(Debug, PartialEq, ReplicaSerde)]
pub struct DonationVendorInfo {
pub percent_complete: f32,
pub total_donated: u32,
pub total_remaining: u32,
}
#[derive(BitVariantTests, Debug, PartialEq, ReplicaSerde)]
pub struct DonationVendorConstruction {
pub vendor_info: Option<VendorInfo>,
pub donation_vendor_info: Option<DonationVendorInfo>,
}
impl ComponentConstruction for DonationVendorConstruction {
fn ser(&self, writer: &mut BEBitWriter<Vec<u8>>) -> Res<()> {
self.serialize(writer)
}
}
pub type DonationVendorSerialization = DonationVendorConstruction;
impl ComponentSerialization for DonationVendorSerialization {
fn ser(&self, writer: &mut BEBitWriter<Vec<u8>>) -> Res<()> {
self.serialize(writer)
}
}
pub struct DonationVendorProtocol;
impl ComponentProtocol for DonationVendorProtocol {
type Construction = DonationVendorConstruction;
type Serialization = DonationVendorSerialization;
}