11use crate :: coding:: { Decode , DecodeError , Encode , EncodeError } ;
2+ use crate :: message:: GroupOrder ;
23
34/// Sent by the publisher to accept a Subscribe.
45#[ derive( Clone , Debug ) ]
@@ -9,6 +10,9 @@ pub struct SubscribeOk {
910 /// The subscription will expire in this many milliseconds.
1011 pub expires : Option < u64 > ,
1112
13+ // Order groups will be delivered in
14+ pub group_order : GroupOrder ,
15+
1216 /// The latest group and object for the track.
1317 pub latest : Option < ( u64 , u64 ) > ,
1418}
@@ -21,6 +25,8 @@ impl Decode for SubscribeOk {
2125 expires => Some ( expires) ,
2226 } ;
2327
28+ let group_order = GroupOrder :: decode ( r) ?;
29+
2430 Self :: decode_remaining ( r, 1 ) ?;
2531
2632 let latest = match r. get_u8 ( ) {
@@ -29,7 +35,12 @@ impl Decode for SubscribeOk {
2935 _ => return Err ( DecodeError :: InvalidValue ) ,
3036 } ;
3137
32- Ok ( Self { id, expires, latest } )
38+ Ok ( Self {
39+ id,
40+ expires,
41+ group_order,
42+ latest,
43+ } )
3344 }
3445}
3546
@@ -38,6 +49,8 @@ impl Encode for SubscribeOk {
3849 self . id . encode ( w) ?;
3950 self . expires . unwrap_or ( 0 ) . encode ( w) ?;
4051
52+ self . group_order . encode ( w) ?;
53+
4154 Self :: encode_remaining ( w, 1 ) ?;
4255
4356 match self . latest {
0 commit comments