@@ -338,7 +338,7 @@ impl From<ExchangeType> for String {
338
338
}
339
339
}
340
340
341
- #[ derive( Eq , PartialEq , Debug , Serialize , Deserialize , Clone , Copy , Default ) ]
341
+ #[ derive( Eq , PartialEq , Debug , Serialize , Deserialize , Clone , Default ) ]
342
342
#[ serde( rename_all( serialize = "lowercase" , deserialize = "PascalCase" ) ) ]
343
343
pub enum QueueType {
344
344
#[ default]
@@ -348,28 +348,30 @@ pub enum QueueType {
348
348
// Tanzu RabbitMQ-specific
349
349
Delayed ,
350
350
// A type this client is not aware of
351
- Unsupported
351
+ Unsupported ( String ) ,
352
352
}
353
353
354
354
impl From < & str > for QueueType {
355
355
fn from ( value : & str ) -> Self {
356
- match value. to_ascii_lowercase ( ) . as_str ( ) {
356
+ let val = value. to_ascii_lowercase ( ) ;
357
+ match val. as_str ( ) {
357
358
"classic" => QueueType :: Classic ,
358
359
"quorum" => QueueType :: Quorum ,
359
360
"stream" => QueueType :: Stream ,
360
361
"delayed" => QueueType :: Delayed ,
361
- _ => QueueType :: Unsupported ,
362
+ _ => QueueType :: Unsupported ( value . to_owned ( ) ) ,
362
363
}
363
364
}
364
365
}
365
366
366
367
impl From < String > for QueueType {
367
368
fn from ( value : String ) -> Self {
368
- match value. to_ascii_lowercase ( ) . as_str ( ) {
369
+ let val = value. to_ascii_lowercase ( ) ;
370
+ match val. as_str ( ) {
369
371
"classic" => QueueType :: Classic ,
370
372
"quorum" => QueueType :: Quorum ,
371
373
"stream" => QueueType :: Stream ,
372
- _ => QueueType :: Unsupported ,
374
+ _ => QueueType :: Unsupported ( value ) ,
373
375
}
374
376
}
375
377
}
@@ -381,7 +383,7 @@ impl From<QueueType> for String {
381
383
QueueType :: Quorum => "quorum" . to_owned ( ) ,
382
384
QueueType :: Stream => "stream" . to_owned ( ) ,
383
385
QueueType :: Delayed => "delayed" . to_owned ( ) ,
384
- QueueType :: Unsupported => "unsupported" . to_owned ( ) ,
386
+ QueueType :: Unsupported ( val ) => val . to_owned ( ) ,
385
387
}
386
388
}
387
389
}
@@ -459,10 +461,10 @@ impl From<QueueType> for PolicyTarget {
459
461
fn from ( value : QueueType ) -> Self {
460
462
match value {
461
463
QueueType :: Classic => PolicyTarget :: ClassicQueues ,
462
- QueueType :: Quorum => PolicyTarget :: QuorumQueues ,
463
- QueueType :: Stream => PolicyTarget :: Streams ,
464
+ QueueType :: Quorum => PolicyTarget :: QuorumQueues ,
465
+ QueueType :: Stream => PolicyTarget :: Streams ,
464
466
QueueType :: Delayed => PolicyTarget :: Queues ,
465
- QueueType :: Unsupported => PolicyTarget :: Queues ,
467
+ QueueType :: Unsupported ( _ ) => PolicyTarget :: Queues ,
466
468
}
467
469
}
468
470
}
0 commit comments