Skip to content

Commit

Permalink
nostr: add RelayMetadata::Discovery variant
Browse files Browse the repository at this point in the history
Signed-off-by: Yuki Kishimoto <[email protected]>
  • Loading branch information
yukibtc committed Apr 14, 2024
1 parent c153513 commit 67f2056
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions crates/nostr/src/event/tag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,13 +330,16 @@ pub enum RelayMetadata {
Read,
/// Write
Write,
/// Discovery
Discovery,
}

impl fmt::Display for RelayMetadata {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::Read => write!(f, "read"),
Self::Write => write!(f, "write"),
Self::Discovery => write!(f, "discovery"),
}
}
}
Expand All @@ -348,6 +351,7 @@ impl FromStr for RelayMetadata {
match s {
"read" => Ok(Self::Read),
"write" => Ok(Self::Write),
"discovery" => Ok(Self::Discovery),
s => Err(Error::InvalidRelayMetadata(s.to_string())),
}
}
Expand Down

0 comments on commit 67f2056

Please sign in to comment.