Skip to content

Commit 9f4e51e

Browse files
authored
[ISSUE #1261]⚡️TopicFilterType implement Display (#1262)
1 parent 62c274e commit 9f4e51e

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

rocketmq-common/src/common.rs

+21-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
*/
1717

1818
use std::fmt;
19+
use std::fmt::Debug;
20+
use std::fmt::Display;
1921
use std::str::FromStr;
2022

2123
pub use faq::FAQUrl;
@@ -57,13 +59,31 @@ pub mod system_clock;
5759
pub mod thread;
5860
pub mod topic;
5961

60-
#[derive(Debug, Clone, Default, Eq, PartialEq, Copy)]
62+
#[derive(Clone, Default, Eq, PartialEq, Copy)]
6163
pub enum TopicFilterType {
6264
#[default]
6365
SingleTag,
6466
MultiTag,
6567
}
6668

69+
impl Display for TopicFilterType {
70+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
71+
match self {
72+
TopicFilterType::SingleTag => write!(f, "SINGLE_TAG"),
73+
TopicFilterType::MultiTag => write!(f, "MULTI_TAG"),
74+
}
75+
}
76+
}
77+
78+
impl Debug for TopicFilterType {
79+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
80+
match self {
81+
TopicFilterType::SingleTag => write!(f, "SINGLE_TAG"),
82+
TopicFilterType::MultiTag => write!(f, "MULTI_TAG"),
83+
}
84+
}
85+
}
86+
6787
impl From<&str> for TopicFilterType {
6888
fn from(s: &str) -> TopicFilterType {
6989
match s {

0 commit comments

Comments
 (0)