pub enum Query {
And(Vec<Query>),
Or(Vec<Query>),
Not(Box<Query>),
Param(Param),
Custom(String),
}Expand description
A search query, composed of search parameters and boolean operations.
Query is an expression tree, supporting AND, OR, and NOT operations,
with the And, Or, and Not
variants respectively. Leaf variants are Param and
Custom.
Examples
use scryfall::card::Rarity;
let one_odd_eldrazi = Query::And(vec![
Query::Or(vec![power(9), toughness(9)]),
Query::Custom("t:eldrazi".to_string()),
set("bfz"), // A `Param` variant.
rarity(Rarity::Mythic), // A `Param` variant.
CardIs::OddCmc.into(),
])
.search()
.await?
.next()
.await
.unwrap()?;
assert_eq!(one_odd_eldrazi.name, "Void Winnower");For information on search parameters, see the
param module.
Variants§
And(Vec<Query>)
The returned cards must match all of the sub-queries.
Or(Vec<Query>)
The returned cards must match at least one of the sub-queries.
Not(Box<Query>)
The returned cards must not match the sub-query.
Param(Param)
The returned cards must match the specified search Param.
Custom(String)
A custom query, in valid Scryfall syntax.
Note: This variant is provided so that users of this crate can use the latest search features on scryfall.com without waiting for the crate to be updated. If you encounter a situation where this must be used, please file an issue.
Implementations§
Trait Implementations§
source§impl From<PrintingIs> for Query
impl From<PrintingIs> for Query
source§fn from(printing: PrintingIs) -> Self
fn from(printing: PrintingIs) -> Self
source§impl PartialEq<Query> for Query
impl PartialEq<Query> for Query
source§impl Search for Query
impl Search for Query
source§fn write_query(&self, url: &mut Url) -> Result<()>
fn write_query(&self, url: &mut Url) -> Result<()>
Url.source§fn search<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<ListIter<Card>>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn search<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Result<ListIter<Card>>> + Send + 'async_trait>>where Self: Sync + 'async_trait, 'life0: 'async_trait,
Card::search.