@@ -771,6 +771,9 @@ impl fmt::Display for NameAndVirtualHost {
771771}
772772
773773pub trait QueueOps {
774+ /// Returns the name of the object.
775+ fn name ( & self ) -> & str ;
776+
774777 /// Returns the [`QueueType`] applicable to the implementation.
775778 fn queue_type ( & self ) -> QueueType ;
776779
@@ -793,15 +796,25 @@ pub trait QueueOps {
793796 . contains_key ( XArguments :: X_MESSAGE_TTL_KEY )
794797 }
795798
799+ /// Returns true if one of the optional arguments
800+ /// of the implementation is [`XArguments::X_MAX_LENGTH_KEY`] ("x-max-length")
796801 fn has_length_limit_in_messages ( & self ) -> bool {
797802 self . x_arguments ( )
798803 . contains_key ( XArguments :: X_MAX_LENGTH_KEY )
799804 }
800805
806+ /// Returns true if one of the optional arguments
807+ /// of the implementation is [`XArguments::X_MAX_LENGTH_BYTES_KEY`] ("x-max-length-bytes")
801808 fn has_length_limit_in_bytes ( & self ) -> bool {
802809 self . x_arguments ( )
803810 . contains_key ( XArguments :: X_MAX_LENGTH_BYTES_KEY )
804811 }
812+
813+ /// Returns true if the name of the queue starts with `amq.`,
814+ /// that is, the queue is server-named.
815+ fn is_server_named ( & self ) -> bool {
816+ self . name ( ) . starts_with ( "amq." )
817+ }
805818}
806819
807820#[ derive( Debug , Deserialize , Clone ) ]
@@ -875,6 +888,10 @@ pub struct QueueInfo {
875888}
876889
877890impl QueueOps for QueueInfo {
891+ fn name ( & self ) -> & str {
892+ & self . name
893+ }
894+
878895 fn queue_type ( & self ) -> QueueType {
879896 QueueType :: from ( self . queue_type . as_str ( ) )
880897 }
@@ -937,6 +954,10 @@ impl NamedPolicyTargetObject for QueueDefinition {
937954}
938955
939956impl QueueOps for QueueDefinition {
957+ fn name ( & self ) -> & str {
958+ & self . name
959+ }
960+
940961 fn queue_type ( & self ) -> QueueType {
941962 if let Some ( ( _, val) ) = self . arguments . 0 . get_key_value ( X_ARGUMENT_KEY_X_QUEUE_TYPE ) {
942963 val. as_str ( )
@@ -1048,6 +1069,10 @@ pub struct QueueDefinitionWithoutVirtualHost {
10481069}
10491070
10501071impl QueueOps for QueueDefinitionWithoutVirtualHost {
1072+ fn name ( & self ) -> & str {
1073+ & self . name
1074+ }
1075+
10511076 fn queue_type ( & self ) -> QueueType {
10521077 if let Some ( ( _, val) ) = self . arguments . 0 . get_key_value ( X_ARGUMENT_KEY_X_QUEUE_TYPE ) {
10531078 val. as_str ( )
0 commit comments