mirror of
https://github.com/logos-messaging/logos-messaging-rust-bindings.git
synced 2026-01-02 14:03:12 +00:00
Fix WakuPubSubTopic parsing
This commit is contained in:
parent
29c9cd9f6c
commit
ed3fa3e0e8
@ -395,7 +395,7 @@ impl FromStr for WakuPubSubTopic {
|
||||
type Err = String;
|
||||
|
||||
fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
|
||||
if let Ok((topic_name, encoding)) = scanf!(s, "/waku/v2/{}/{}", String, Encoding) {
|
||||
if let Ok((topic_name, encoding)) = scanf!(s, "/waku/2/{}/{:/.+?/}", String, Encoding) {
|
||||
Ok(WakuPubSubTopic {
|
||||
topic_name,
|
||||
encoding,
|
||||
@ -487,3 +487,15 @@ where
|
||||
})
|
||||
.transpose()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::WakuPubSubTopic;
|
||||
use sscanf::scanf;
|
||||
#[test]
|
||||
fn parse_waku_topic() {
|
||||
let s = "/waku/2/default-waku/proto";
|
||||
let _: WakuPubSubTopic = s.parse().unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user