Struct nostr::message::subscription::Filter
source · pub struct Filter {Show 13 fields
pub ids: Vec<String>,
pub authors: Vec<String>,
pub kinds: Vec<Kind>,
pub events: Vec<EventId>,
pub pubkeys: Vec<XOnlyPublicKey>,
pub hashtags: Vec<String>,
pub references: Vec<String>,
pub identifiers: Vec<String>,
pub search: Option<String>,
pub since: Option<Timestamp>,
pub until: Option<Timestamp>,
pub limit: Option<usize>,
pub generic_tags: HashMap<Alphabet, Vec<String>>,
}Expand description
Subscription filters
Fields§
§ids: Vec<String>List of event ids or prefixes
List of pubkeys or prefixes
kinds: Vec<Kind>List of a kind numbers
events: Vec<EventId>#e tag
pubkeys: Vec<XOnlyPublicKey>#p tag
#t tag
references: Vec<String>#r tag
identifiers: Vec<String>#d tag
search: Option<String>It’s a string describing a query in a human-readable form, i.e. “best nostr apps”
since: Option<Timestamp>An integer unix timestamp, events must be newer than this to pass
until: Option<Timestamp>An integer unix timestamp, events must be older than this to pass
limit: Option<usize>Maximum number of events to be returned in the initial query
Generic tag queries (NIP12)
Implementations§
source§impl Filter
impl Filter
sourcepub fn from_json<S>(json: S) -> Result<Self, Error>where
S: Into<String>,
pub fn from_json<S>(json: S) -> Result<Self, Error>where S: Into<String>,
Deserialize from JSON string
sourcepub fn remove_ids<S>(self, ids: Vec<S>) -> Selfwhere
S: Into<String>,
pub fn remove_ids<S>(self, ids: Vec<S>) -> Selfwhere S: Into<String>,
Remove event ids or prefixes
Add author
Add authors
Remove authors
sourcepub fn remove_kinds(self, kinds: Vec<Kind>) -> Self
pub fn remove_kinds(self, kinds: Vec<Kind>) -> Self
Remove kinds
sourcepub fn remove_events<S>(self, events: Vec<EventId>) -> Self
pub fn remove_events<S>(self, events: Vec<EventId>) -> Self
Remove events
sourcepub fn pubkey(self, pubkey: XOnlyPublicKey) -> Self
pub fn pubkey(self, pubkey: XOnlyPublicKey) -> Self
Add pubkey
sourcepub fn pubkeys(self, pubkeys: Vec<XOnlyPublicKey>) -> Self
pub fn pubkeys(self, pubkeys: Vec<XOnlyPublicKey>) -> Self
Add pubkeys
sourcepub fn remove_pubkeys<S>(self, pubkeys: Vec<XOnlyPublicKey>) -> Self
pub fn remove_pubkeys<S>(self, pubkeys: Vec<XOnlyPublicKey>) -> Self
Remove pubkeys
Remove hashtags
sourcepub fn references<S>(self, references: Vec<S>) -> Selfwhere
S: Into<String>,
pub fn references<S>(self, references: Vec<S>) -> Selfwhere S: Into<String>,
Add references
sourcepub fn remove_references<S>(self, references: Vec<S>) -> Selfwhere
S: Into<String>,
pub fn remove_references<S>(self, references: Vec<S>) -> Selfwhere S: Into<String>,
Remove references
sourcepub fn identifier<S>(self, identifier: S) -> Selfwhere
S: Into<String>,
pub fn identifier<S>(self, identifier: S) -> Selfwhere S: Into<String>,
Add identifier
sourcepub fn identifiers<S>(self, identifiers: Vec<S>) -> Selfwhere
S: Into<String>,
pub fn identifiers<S>(self, identifiers: Vec<S>) -> Selfwhere S: Into<String>,
Add identifiers
sourcepub fn remove_identifiers<S>(self, identifiers: Vec<S>) -> Selfwhere
S: Into<String>,
pub fn remove_identifiers<S>(self, identifiers: Vec<S>) -> Selfwhere S: Into<String>,
Remove identifiers
sourcepub fn remove_search(self) -> Self
pub fn remove_search(self) -> Self
Remove search
sourcepub fn remove_since(self) -> Self
pub fn remove_since(self) -> Self
Remove since
sourcepub fn remove_until(self) -> Self
pub fn remove_until(self) -> Self
Remove until
sourcepub fn remove_limit(self) -> Self
pub fn remove_limit(self) -> Self
Remove limit
Trait Implementations§
source§impl<'de> Deserialize<'de> for Filter
impl<'de> Deserialize<'de> for Filter
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl PartialEq<Filter> for Filter
impl PartialEq<Filter> for Filter
impl Eq for Filter
impl StructuralEq for Filter
impl StructuralPartialEq for Filter
Auto Trait Implementations§
impl RefUnwindSafe for Filter
impl Send for Filter
impl Sync for Filter
impl Unpin for Filter
impl UnwindSafe for Filter
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.