httlib_protos/encoder/
lit.rs

1/// Provides encoder input format options.
2/// 
3/// This is a list of all binary formats supported by the encoder.
4#[derive(Debug)]
5pub enum EncoderLit<'a> {
6    /// Represents `binary` format of wire type `2`.
7    Bytes(&'a Vec<u8>),
8
9    /// Represents `bool` format of wire type `0`.
10    Bool(&'a bool),
11
12    /// Represents `bool` format of wire type `2` for packed repeated fields.
13    BoolVec(&'a Vec<bool>),
14
15    /// Represents `int32` format of wire type `0`.
16    Int32(&'a i32),
17
18    /// Represents `int32` format of wire type `0` for packed repeated fields.
19    Int32Vec(&'a Vec<i32>),
20
21    /// Represents `int64` format of wire type `0`.
22    Int64(&'a i64),
23
24    /// Represents `int64` format of wire type `0` for packed repeated fields.
25    Int64Vec(&'a Vec<i64>),
26
27    /// Represents `uint32` format of wire type `0`.
28    UInt32(&'a u32),
29
30    /// Represents `uint32` format of wire type `0` for packed repeated fields.
31    UInt32Vec(&'a Vec<u32>),
32
33    /// Represents `uint64` format of wire type `0`.
34    UInt64(&'a u64),
35
36    /// Represents `uint64` format of wire type `0` for packed repeated fields.
37    UInt64Vec(&'a Vec<u64>),
38
39    /// Represents `float` format of wire type `5`.
40    Float(&'a f32),
41
42    /// Represents `float` format of wire type `5` for packed repeated fields.
43    FloatVec(&'a Vec<f32>),
44
45    /// Represents `uint32` format of wire type `1`.
46    Double(&'a f64),
47
48    /// Represents `double` format of wire type `1` for packed repeated fields.
49    DoubleVec(&'a Vec<f64>),
50
51    /// Represents `sint32` format of wire type `0`. Use it when the value is
52    /// likely to be negative.
53    SInt32(&'a i32),
54
55    /// Represents `sint32` format of wire type `0` for packed repeated fields.
56    /// Use it when the values are likely to be negative.
57    SInt32Vec(&'a Vec<i32>),
58
59    /// Represents `sint64` format of wire type `0`. Use it when the value is
60    /// likely to be negative.
61    SInt64(&'a i64),
62
63    /// Represents `sint64` format of wire type `0` for packed repeated fields.
64    /// Use it when the values are likely to be negative.
65    SInt64Vec(&'a Vec<i64>),
66
67    /// Represents `fixed32` format of wire type `5`.
68    Fixed32(&'a u32),
69
70    /// Represents `fixed32` format of wire type `5` for packed repeated fields.
71    Fixed32Vec(&'a Vec<u32>),
72
73    /// Represents `fixed64` format of wire type `1`.
74    Fixed64(&'a u64),
75
76    /// Represents `fixed64` format of wire type `1` for packed repeated fields.
77    Fixed64Vec(&'a Vec<u64>),
78
79    /// Represents `sfixed32` format of wire type `5`.
80    SFixed32(&'a i32),
81
82    /// Represents `sfixed32` format of wire type `5` for packed repeated
83    /// fields.
84    SFixed32Vec(&'a Vec<i32>),
85
86    /// Represents `sfixed64` format of wire type `1`.
87    SFixed64(&'a i64),
88
89    /// Represents `sfixed64` format of wire type `1` for packed repeated
90    /// fields.
91    SFixed64Vec(&'a Vec<i64>),
92}
93
94impl<'a> From<&'a bool> for EncoderLit<'a> {
95    fn from(v: &'a bool) -> Self {
96        Self::Bool(v)
97    }
98}
99
100impl<'a> From<&'a Vec<bool>> for EncoderLit<'a> {
101    fn from(v: &'a Vec<bool>) -> Self {
102        Self::BoolVec(v)
103    }
104}
105
106impl<'a> From<&'a i32> for EncoderLit<'a> {
107    fn from(v: &'a i32) -> Self {
108        Self::Int32(v)
109    }
110}
111
112impl<'a> From<&'a Vec<i32>> for EncoderLit<'a> {
113    fn from(v: &'a Vec<i32>) -> Self {
114        Self::Int32Vec(v)
115    }
116}
117
118impl<'a> From<&'a i64> for EncoderLit<'a> {
119    fn from(v: &'a i64) -> Self {
120        Self::Int64(v)
121    }
122}
123
124impl<'a> From<&'a Vec<i64>> for EncoderLit<'a> {
125    fn from(v: &'a Vec<i64>) -> Self {
126        Self::Int64Vec(v)
127    }
128}
129
130impl<'a> From<&'a u32> for EncoderLit<'a> {
131    fn from(v: &'a u32) -> Self {
132        Self::UInt32(v)
133    }
134}
135
136impl<'a> From<&'a Vec<u32>> for EncoderLit<'a> {
137    fn from(v: &'a Vec<u32>) -> Self {
138        Self::UInt32Vec(v)
139    }
140}
141
142impl<'a> From<&'a u64> for EncoderLit<'a> {
143    fn from(v: &'a u64) -> Self {
144        Self::UInt64(v)
145    }
146}
147
148impl<'a> From<&'a Vec<u64>> for EncoderLit<'a> {
149    fn from(v: &'a Vec<u64>) -> Self {
150        Self::UInt64Vec(v)
151    }
152}
153
154impl<'a> From<&'a f32> for EncoderLit<'a> {
155    fn from(v: &'a f32) -> Self {
156        Self::Float(v)
157    }
158}
159
160impl<'a> From<&'a Vec<f32>> for EncoderLit<'a> {
161    fn from(v: &'a Vec<f32>) -> Self {
162        Self::FloatVec(v)
163    }
164}
165
166impl<'a> From<&'a f64> for EncoderLit<'a> {
167    fn from(v: &'a f64) -> Self {
168        Self::Double(v)
169    }
170}
171
172impl<'a> From<&'a Vec<f64>> for EncoderLit<'a> {
173    fn from(v: &'a Vec<f64>) -> Self {
174        Self::DoubleVec(v)
175    }
176}
177
178impl<'a> From<&'a Vec<u8>> for EncoderLit<'a> {
179    fn from(v: &'a Vec<u8>) -> Self {
180        Self::Bytes(v)
181    }
182}