@@ -153,6 +153,39 @@ impl From<String> for SupportedProtocol {
153153 }
154154}
155155
156+ impl AsRef < str > for SupportedProtocol {
157+ fn as_ref ( & self ) -> & str {
158+ match self {
159+ SupportedProtocol :: Clustering => SUPPORTED_PROTOCOL_CLUSTERING ,
160+ SupportedProtocol :: AMQP => SUPPORTED_PROTOCOL_AMQP ,
161+ SupportedProtocol :: AMQPWithTLS => SUPPORTED_PROTOCOL_AMQP_WITH_TLS ,
162+ SupportedProtocol :: Stream => SUPPORTED_PROTOCOL_STREAM ,
163+ SupportedProtocol :: StreamWithTLS => SUPPORTED_PROTOCOL_STREAM_WITH_TLS ,
164+ SupportedProtocol :: MQTT => SUPPORTED_PROTOCOL_MQTT ,
165+ SupportedProtocol :: MQTTWithTLS => SUPPORTED_PROTOCOL_MQTT_WITH_TLS ,
166+ SupportedProtocol :: STOMP => SUPPORTED_PROTOCOL_STOMP ,
167+ SupportedProtocol :: STOMPWithTLS => SUPPORTED_PROTOCOL_STOMP_WITH_TLS ,
168+ SupportedProtocol :: AMQPOverWebSockets => SUPPORTED_PROTOCOL_AMQP_OVER_WEBSOCKETS ,
169+ SupportedProtocol :: AMQPOverWebSocketsWithTLS => {
170+ SUPPORTED_PROTOCOL_AMQP_OVER_WEBSOCKETS_WITH_TLS
171+ }
172+ SupportedProtocol :: MQTTOverWebSockets => SUPPORTED_PROTOCOL_MQTT_OVER_WEBSOCKETS ,
173+ SupportedProtocol :: MQTTOverWebSocketsWithTLS => {
174+ SUPPORTED_PROTOCOL_MQTT_OVER_WEBSOCKETS_WITH_TLS
175+ }
176+ SupportedProtocol :: STOMPOverWebsockets => SUPPORTED_PROTOCOL_STOMP_OVER_WEBSOCKETS ,
177+ SupportedProtocol :: STOMPOverWebsocketsWithTLS => {
178+ SUPPORTED_PROTOCOL_STOMP_OVER_WEBSOCKETS_WITH_TLS
179+ }
180+ SupportedProtocol :: Prometheus => SUPPORTED_PROTOCOL_PROMETHEUS ,
181+ SupportedProtocol :: PrometheusWithTLS => SUPPORTED_PROTOCOL_PROMETHEUS_WITH_TLS ,
182+ SupportedProtocol :: HTTP => SUPPORTED_PROTOCOL_HTTP ,
183+ SupportedProtocol :: HTTPWithTLS => SUPPORTED_PROTOCOL_HTTP_WITH_TLS ,
184+ SupportedProtocol :: Other ( s) => s. as_str ( ) ,
185+ }
186+ }
187+ }
188+
156189impl From < SupportedProtocol > for String {
157190 fn from ( value : SupportedProtocol ) -> String {
158191 match value {
@@ -290,6 +323,26 @@ impl From<String> for ExchangeType {
290323 }
291324}
292325
326+ impl AsRef < str > for ExchangeType {
327+ fn as_ref ( & self ) -> & str {
328+ match self {
329+ ExchangeType :: Fanout => EXCHANGE_TYPE_FANOUT ,
330+ ExchangeType :: Topic => EXCHANGE_TYPE_TOPIC ,
331+ ExchangeType :: Direct => EXCHANGE_TYPE_DIRECT ,
332+ ExchangeType :: Headers => EXCHANGE_TYPE_HEADERS ,
333+ ExchangeType :: ConsistentHashing => EXCHANGE_TYPE_CONSISTENT_HASHING ,
334+ ExchangeType :: ModulusHash => EXCHANGE_TYPE_MODULUS_HASH ,
335+ ExchangeType :: Random => EXCHANGE_TYPE_RANDOM ,
336+ ExchangeType :: LocalRandom => EXCHANGE_TYPE_LOCAL_RANDOM ,
337+ ExchangeType :: JmsTopic => EXCHANGE_TYPE_JMS_TOPIC ,
338+ ExchangeType :: RecentHistory => EXCHANGE_TYPE_RECENT_HISTORY ,
339+ ExchangeType :: DelayedMessage => EXCHANGE_TYPE_DELAYED_MESSAGE ,
340+ ExchangeType :: MessageDeduplication => EXCHANGE_TYPE_MESSAGE_DEDUPLICATION ,
341+ ExchangeType :: Plugin ( s) => s,
342+ }
343+ }
344+ }
345+
293346impl From < ExchangeType > for String {
294347 fn from ( value : ExchangeType ) -> String {
295348 match value {
@@ -355,6 +408,18 @@ impl From<String> for QueueType {
355408 }
356409}
357410
411+ impl AsRef < str > for QueueType {
412+ fn as_ref ( & self ) -> & str {
413+ match self {
414+ QueueType :: Classic => "classic" ,
415+ QueueType :: Quorum => "quorum" ,
416+ QueueType :: Stream => "stream" ,
417+ QueueType :: Delayed => "delayed" ,
418+ QueueType :: Unsupported ( s) => s. as_str ( ) ,
419+ }
420+ }
421+ }
422+
358423impl From < QueueType > for String {
359424 fn from ( value : QueueType ) -> Self {
360425 match value {
@@ -412,6 +477,15 @@ impl From<String> for BindingDestinationType {
412477 }
413478}
414479
480+ impl AsRef < str > for BindingDestinationType {
481+ fn as_ref ( & self ) -> & str {
482+ match self {
483+ BindingDestinationType :: Queue => "queue" ,
484+ BindingDestinationType :: Exchange => "exchange" ,
485+ }
486+ }
487+ }
488+
415489impl From < BindingDestinationType > for String {
416490 fn from ( value : BindingDestinationType ) -> Self {
417491 match value {
@@ -532,6 +606,19 @@ impl From<String> for PolicyTarget {
532606 }
533607}
534608
609+ impl AsRef < str > for PolicyTarget {
610+ fn as_ref ( & self ) -> & str {
611+ match self {
612+ PolicyTarget :: Queues => "queues" ,
613+ PolicyTarget :: ClassicQueues => "classic_queues" ,
614+ PolicyTarget :: QuorumQueues => "quorum_queues" ,
615+ PolicyTarget :: Streams => "streams" ,
616+ PolicyTarget :: Exchanges => "exchanges" ,
617+ PolicyTarget :: All => "all" ,
618+ }
619+ }
620+ }
621+
535622impl From < PolicyTarget > for String {
536623 fn from ( value : PolicyTarget ) -> Self {
537624 match value {
@@ -649,6 +736,16 @@ impl From<String> for MessageTransferAcknowledgementMode {
649736 }
650737}
651738
739+ impl AsRef < str > for MessageTransferAcknowledgementMode {
740+ fn as_ref ( & self ) -> & str {
741+ match self {
742+ MessageTransferAcknowledgementMode :: Immediate => "no-ack" ,
743+ MessageTransferAcknowledgementMode :: WhenPublished => "on-publish" ,
744+ MessageTransferAcknowledgementMode :: WhenConfirmed => "on-confirm" ,
745+ }
746+ }
747+ }
748+
652749impl Display for MessageTransferAcknowledgementMode {
653750 fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
654751 match self {
0 commit comments