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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
use super::*;
#[repr(C)]
#[derive(Copy, Clone, StableAbi)]
pub struct MonoTLPrefixType {
pub first_suffix_field:u8,
pub conditional_prefix_fields:FieldConditionality,
pub fields: CompTLFields,
}
impl MonoTLPrefixType{
pub fn expand(self,other:GenericTLPrefixType,shared_vars:&'static SharedVars)->TLPrefixType{
TLPrefixType{
first_suffix_field:self.first_suffix_field,
conditional_prefix_fields:self.conditional_prefix_fields,
fields:self.fields.expand(shared_vars),
accessible_fields:other.accessible_fields,
}
}
}
#[repr(C)]
#[derive(Copy, Clone, StableAbi)]
pub struct GenericTLPrefixType {
pub accessible_fields:FieldAccessibility,
}
#[repr(C)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, StableAbi)]
pub struct TLPrefixType {
pub first_suffix_field:u8,
pub conditional_prefix_fields:FieldConditionality,
pub fields: TLFields,
pub accessible_fields:FieldAccessibility,
}
impl Display for TLPrefixType {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
writeln!(f,"first_suffix_field:{}",self.first_suffix_field)?;
writeln!(
f,
"conditional_prefix_fields:\n {:b}",
self.conditional_prefix_fields.bits(),
)?;
writeln!(f,"fields:\n{}",self.fields.to_string().left_padder(4))?;
write!(f,"accessible_fields:\n ")?;
f.debug_list()
.entries(self.accessible_fields.iter_count(self.fields.len()))
.finish()?;
Ok(())
}
}