mirror of
https://github.com/logos-messaging/logos-messaging-rust-bindings.git
synced 2026-01-02 22:13:07 +00:00
Impl Display for topics
This commit is contained in:
parent
ed0c9ea19c
commit
6a427280bb
@ -201,6 +201,16 @@ impl FromStr for WakuContentTopic {
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for WakuContentTopic {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
write!(
|
||||
f,
|
||||
"/{}/{}/{}/{}",
|
||||
self.application_name, self.version, self.content_topic_name, self.encoding
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
pub struct WakuPubSubTopic {
|
||||
topic_name: String,
|
||||
encoding: Encoding,
|
||||
@ -218,10 +228,16 @@ impl FromStr for WakuPubSubTopic {
|
||||
} else {
|
||||
Err(
|
||||
format!(
|
||||
"Wrong pub-sub topic format. Should be `/{{application-name}}/{{version-of-the-application}}/{{content-topic-name}}/{{encoding}}`. Got: {}",
|
||||
"Wrong pub-sub topic format. Should be `/waku/2/{{topic-name}}/{{encoding}}`. Got: {}",
|
||||
s
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for WakuPubSubTopic {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "/waku/2/{}/{}", self.topic_name, self.encoding)
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user