pub struct Filter {Show 13 fields
pub ids: Vec<String, Global>,
pub authors: Vec<String, Global>,
pub kinds: Vec<Kind, Global>,
pub events: Vec<EventId, Global>,
pub pubkeys: Vec<XOnlyPublicKey, Global>,
pub hashtags: Vec<String, Global>,
pub references: Vec<String, Global>,
pub identifiers: Vec<String, Global>,
pub search: Option<String>,
pub since: Option<Timestamp>,
pub until: Option<Timestamp>,
pub limit: Option<usize>,
pub generic_tags: BTreeMap<Alphabet, Vec<String, Global>, Global>,
}
Expand description
Subscription filters
Fields§
§ids: Vec<String, Global>
List of event ids or prefixes
List of pubkeys or prefixes
kinds: Vec<Kind, Global>
List of a kind numbers
events: Vec<EventId, Global>
#e tag
pubkeys: Vec<XOnlyPublicKey, Global>
#p tag
#t tag
references: Vec<String, Global>
#r tag
identifiers: Vec<String, Global>
#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<Filter, Error>where
S: Into<String>,
pub fn from_json<S>(json: S) -> Result<Filter, Error>where S: Into<String>,
Deserialize from JSON
string
sourcepub fn ids<S>(self, ids: Vec<S, Global>) -> Filterwhere
S: Into<String>,
pub fn ids<S>(self, ids: Vec<S, Global>) -> Filterwhere S: Into<String>,
Add event ids or prefixes
sourcepub fn remove_ids<S>(self, ids: Vec<S, Global>) -> Filterwhere
S: Into<String>,
pub fn remove_ids<S>(self, ids: Vec<S, Global>) -> Filterwhere S: Into<String>,
Remove event ids or prefixes
Add author
Add authors
Remove authors
sourcepub fn pubkey(self, pubkey: XOnlyPublicKey) -> Filter
pub fn pubkey(self, pubkey: XOnlyPublicKey) -> Filter
Add pubkey
sourcepub fn remove_pubkeys<S>(self, pubkeys: Vec<XOnlyPublicKey, Global>) -> Filter
pub fn remove_pubkeys<S>(self, pubkeys: Vec<XOnlyPublicKey, Global>) -> Filter
Remove pubkeys
Remove hashtags
sourcepub fn references<S>(self, references: Vec<S, Global>) -> Filterwhere
S: Into<String>,
pub fn references<S>(self, references: Vec<S, Global>) -> Filterwhere S: Into<String>,
Add references
sourcepub fn remove_references<S>(self, references: Vec<S, Global>) -> Filterwhere
S: Into<String>,
pub fn remove_references<S>(self, references: Vec<S, Global>) -> Filterwhere S: Into<String>,
Remove references
sourcepub fn identifier<S>(self, identifier: S) -> Filterwhere
S: Into<String>,
pub fn identifier<S>(self, identifier: S) -> Filterwhere S: Into<String>,
Add identifier
sourcepub fn identifiers<S>(self, identifiers: Vec<S, Global>) -> Filterwhere
S: Into<String>,
pub fn identifiers<S>(self, identifiers: Vec<S, Global>) -> Filterwhere S: Into<String>,
Add identifiers
sourcepub fn remove_identifiers<S>(self, identifiers: Vec<S, Global>) -> Filterwhere
S: Into<String>,
pub fn remove_identifiers<S>(self, identifiers: Vec<S, Global>) -> Filterwhere S: Into<String>,
Remove identifiers
sourcepub fn remove_search(self) -> Filter
pub fn remove_search(self) -> Filter
Remove search
sourcepub fn remove_since(self) -> Filter
pub fn remove_since(self) -> Filter
Remove since
sourcepub fn remove_until(self) -> Filter
pub fn remove_until(self) -> Filter
Remove until
sourcepub fn remove_limit(self) -> Filter
pub fn remove_limit(self) -> Filter
Remove limit
Trait Implementations§
source§impl<'de> Deserialize<'de> for Filter
impl<'de> Deserialize<'de> for Filter
source§fn deserialize<__D>(
__deserializer: __D
) -> Result<Filter, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>( __deserializer: __D ) -> Result<Filter, <__D as Deserializer<'de>>::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
source§impl Serialize for Filter
impl Serialize for Filter
source§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>( &self, __serializer: __S ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where __S: Serializer,
Serialize this value into the given Serde serializer. Read more
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.