@@ -163,7 +163,6 @@ pub enum JsonBinaryEncoding {
163
163
164
164
#[ derive( Debug , Clone , Copy , PartialEq , Eq , Hash , PartialOrd , Ord ) ]
165
165
pub enum Channel {
166
- RealTime ,
167
166
FixedRate ( FixedRate ) ,
168
167
}
169
168
@@ -173,8 +172,10 @@ impl Serialize for Channel {
173
172
S : serde:: Serializer ,
174
173
{
175
174
match self {
176
- Channel :: RealTime => serializer. serialize_str ( "real_time" ) ,
177
175
Channel :: FixedRate ( fixed_rate) => {
176
+ if * fixed_rate == FixedRate :: MIN {
177
+ return serializer. serialize_str ( "real_time" ) ;
178
+ }
178
179
serializer. serialize_str ( & format ! ( "fixed_rate@{}ms" , fixed_rate. value_ms( ) ) )
179
180
}
180
181
}
@@ -184,16 +185,14 @@ impl Serialize for Channel {
184
185
mod channel_ids {
185
186
use super :: ChannelId ;
186
187
187
- pub const REAL_TIME : ChannelId = ChannelId ( 1 ) ;
188
+ pub const FIXED_RATE_1 : ChannelId = ChannelId ( 1 ) ;
188
189
pub const FIXED_RATE_50 : ChannelId = ChannelId ( 2 ) ;
189
190
pub const FIXED_RATE_200 : ChannelId = ChannelId ( 3 ) ;
190
- pub const FIXED_RATE_1 : ChannelId = ChannelId ( 4 ) ;
191
191
}
192
192
193
193
impl Channel {
194
194
pub fn id ( & self ) -> ChannelId {
195
195
match self {
196
- Channel :: RealTime => channel_ids:: REAL_TIME ,
197
196
Channel :: FixedRate ( fixed_rate) => match fixed_rate. value_ms ( ) {
198
197
1 => channel_ids:: FIXED_RATE_1 ,
199
198
50 => channel_ids:: FIXED_RATE_50 ,
@@ -213,7 +212,7 @@ fn id_supports_all_fixed_rates() {
213
212
214
213
fn parse_channel ( value : & str ) -> Option < Channel > {
215
214
if value == "real_time" {
216
- Some ( Channel :: RealTime )
215
+ Some ( Channel :: FixedRate ( FixedRate :: MIN ) )
217
216
} else if let Some ( rest) = value. strip_prefix ( "fixed_rate@" ) {
218
217
let ms_value = rest. strip_suffix ( "ms" ) ?;
219
218
Some ( Channel :: FixedRate ( FixedRate :: from_ms (
0 commit comments