File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -283,6 +283,11 @@ fn encode_enum(
283283 let atts = take_field_atts ( & var. attributes ) ?;
284284
285285 let mut rhs = StreamBuilder :: new ( ) ;
286+ if let Some ( val) = & var. value {
287+ // Avoid users expecting enum values to be encoded.
288+ // Could be implemented if needed.
289+ return Err ( Error :: Custom { error : "sunset_sshwire_derive::SSHEncode currently does not encode enum discriminants." . into ( ) , span : Some ( val. span ( ) ) } )
290+ }
286291 match var. fields {
287292 None => {
288293 // Unit enum
@@ -300,7 +305,7 @@ fn encode_enum(
300305 }
301306
302307 }
303- _ => return Err ( Error :: Custom { error : "SSHEncode currently only implements Unit or single value enum variants." . into ( ) , span : None } )
308+ _ => return Err ( Error :: Custom { error : "sunset_sshwire_derive:: SSHEncode currently only implements Unit or single value enum variants." . into ( ) , span : None } )
304309 }
305310
306311 match_arm. puncts ( "=>" ) ;
@@ -372,7 +377,7 @@ fn encode_enum_names(
372377 } ) ?;
373378
374379 }
375- _ => return Err ( Error :: Custom { error : "SSHEncode currently only implements Unit or single value enum variants." . into ( ) , span : None } )
380+ _ => return Err ( Error :: Custom { error : "sunset_sshwire_derive:: SSHEncode currently only implements Unit or single value enum variants." . into ( ) , span : None } )
376381 }
377382
378383 match_arm. puncts ( "=>" ) ;
You can’t perform that action at this time.
0 commit comments