1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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
}
}