forked from rust-nostr/nostr
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes rust-nostr#775 Pull-Request: rust-nostr#777 Reviewed-by: Yuki Kishimoto <yukikishimoto@protonmail.com> Co-authored-by: Yuki Kishimoto <yukikishimoto@protonmail.com> Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com> Signed-off-by: Awiteb <a@4rs.nl> Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
- Loading branch information
Showing
11 changed files
with
150 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright (c) 2022-2023 Yuki Kishimoto | ||
// Copyright (c) 2023-2025 Rust Nostr Developers | ||
// Distributed under the MIT software license | ||
|
||
//! NIP-62: Request to Vanish | ||
//! | ||
//! https://github.com/nostr-protocol/nips/blob/master/62.md | ||
use alloc::vec::Vec; | ||
|
||
use crate::RelayUrl; | ||
|
||
/// Request to Vanish target | ||
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] | ||
pub enum VanishTarget { | ||
/// Request to vanish from all relays | ||
AllRelays, | ||
/// Request to vanish from a specific list of relays. | ||
Relays(Vec<RelayUrl>), | ||
} | ||
|
||
impl VanishTarget { | ||
/// Vanish from a single relay | ||
#[inline] | ||
pub fn relay(relay: RelayUrl) -> Self { | ||
Self::Relays(vec![relay]) | ||
} | ||
|
||
/// Vanish from multiple relays | ||
#[inline] | ||
pub fn relays<I>(relays: I) -> Self | ||
where | ||
I: IntoIterator<Item = RelayUrl>, | ||
{ | ||
Self::Relays(relays.into_iter().collect()) | ||
} | ||
|
||
/// Vanish from all relays | ||
pub fn all_relays() -> Self { | ||
Self::AllRelays | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters