Struct CardFilterBuilder

Source
pub struct CardFilterBuilder { /* private fields */ }
Expand description

Builder for filtered card requests

Implementations§

Source§

impl CardFilterBuilder

Source

pub fn build(self) -> CardFilter

Creates a CardFilter with the specified filter parameters

let builder = CardFilter::builder();
let filter = builder
    .color(CardColor::Red)
    .converted_mana_cost(2)
    .cardtype(CardType::Instant)
    .build();
assert!(filter == CardFilter("colors=Red&cmc=2&types=Instant".to_string()))
Source

pub fn custom<'a, T>(self, key: T, value: T) -> CardFilterBuilder
where T: Into<&'a str>,

Create a custom filter

let builder = CardFilter::builder();
let filter = builder.custom("name", "Shock|Mountain")
    .build();
assert!(filter == CardFilter("name=Shock|Mountain".to_string()))
Source

pub fn name<'a, T>(self, name: T) -> CardFilterBuilder
where T: Into<&'a str>,

Every card that (partially) matches the specified name will match the filter

let builder = CardFilter::builder();
let filter = builder.name("Shock")
    .build();
assert!(filter == CardFilter("name=Shock".to_string()))
Source

pub fn names<T>(self, names: &[T]) -> CardFilterBuilder
where T: Display,

Every card that (partially) matches one of the specified names will match the filter

let builder = CardFilter::builder();
let filter = builder.names(&vec!["Shock", "Mountain"])
    .build();
assert!(filter == CardFilter("name=Shock|Mountain".to_string()));
Source

pub fn name_with_language<'a, T>( self, name: T, language: CardLanguage, ) -> CardFilterBuilder
where T: Into<&'a str>,

Every card that (partially) matches the specified name will match the filter

let builder = CardFilter::builder();
let filter = builder.name_with_language("Schock", CardLanguage::German)
    .build();
assert!(filter == CardFilter("name=Schock&language=German".to_string()))
Source

pub fn names_with_language<T>( self, names: &[T], language: CardLanguage, ) -> CardFilterBuilder
where T: Display,

Every card that (partially) matches one of the specified names will match the filter

let builder = CardFilter::builder();
let filter = builder.names_with_language(&vec!["Schock", "Gebirge"], CardLanguage::German)
    .build();
assert!(filter == CardFilter("name=Schock|Gebirge&language=German".to_string()));
Source

pub fn layout(self, layout: CardLayout) -> CardFilterBuilder

Every card name that has the specified layout will match the filter

let builder = CardFilter::builder();
let filter = builder.layout(CardLayout::DoubleFaced)
    .build();
assert!(filter == CardFilter("layout=Double-Faced".to_string()));
Source

pub fn layouts(self, layouts: &[CardLayout]) -> CardFilterBuilder

Every card that has one of the specified layouts will match the filter

let builder = CardFilter::builder();
let filter = builder.layouts(&vec![CardLayout::Normal, CardLayout::DoubleFaced])
    .build();
assert!(filter == CardFilter("layout=Normal|Double-Faced".to_string()));
Source

pub fn converted_mana_cost(self, cmc: u8) -> CardFilterBuilder

Every card name that has the specified converted mana cost will match the filter

let builder = CardFilter::builder();
let filter = builder.converted_mana_cost(3)
    .build();
assert!(filter == CardFilter("cmc=3".to_string()));
Source

pub fn color(self, color: CardColor) -> CardFilterBuilder

Every card that includes the specified color will match the filter

let builder = CardFilter::builder();
let filter = builder.color(CardColor::Red)
    .build();
assert!(filter == CardFilter("colors=Red".to_string()));
Source

pub fn colors_or(self, colors: &[CardColor]) -> CardFilterBuilder

Every card that includes one the specified colors will match the filter

let builder = CardFilter::builder();
let filter = builder.colors_or(&vec![CardColor::Red, CardColor::Blue])
    .build();
assert!(filter == CardFilter("colors=Red|Blue".to_string()));
Source

pub fn colors_and(self, colors: &[CardColor]) -> CardFilterBuilder

Every card that includes all the specified colors will match the filter

let builder = CardFilter::builder();
let filter = builder.colors_and(&vec![CardColor::Red, CardColor::Blue])
    .build();
assert!(filter == CardFilter("colors=Red,Blue".to_string()));
Source

pub fn color_identity( self, color_identity: CardColorIdentity, ) -> CardFilterBuilder

Every card that includes the specified color code will match the filter

let builder = CardFilter::builder();
let filter = builder.color_identity(CardColorIdentity::R)
    .build();
assert!(filter == CardFilter("colorIdentity=R".to_string()));
Source

pub fn color_identities_or( self, color_identities: &[CardColorIdentity], ) -> CardFilterBuilder

Every card that includes one of the specified color codes will match the filter

let builder = CardFilter::builder();
let filter = builder.color_identities_or(&vec![CardColorIdentity::R, CardColorIdentity::U])
    .build();
assert!(filter == CardFilter("colorIdentity=R|U".to_string()));
Source

pub fn color_identities_and( self, color_identities: &[CardColorIdentity], ) -> CardFilterBuilder

Every card that includes all of the specified color codes will match the filter

let builder = CardFilter::builder();
let filter = builder.color_identities_and(&vec![CardColorIdentity::R, CardColorIdentity::U])
    .build();
assert!(filter == CardFilter("colorIdentity=R,U".to_string()));
Source

pub fn fulltype<'a, T>(self, fulltype: T) -> CardFilterBuilder
where T: Into<&'a str>,

Every card that (partially) matches the specified types will match the filter

let builder = CardFilter::builder();
let filter = builder.fulltype("Legendary Creature")
    .build();
assert!(filter == CardFilter("types=Legendary Creature".to_string()));
Source

pub fn fulltypes_or<T>(self, fulltypes: &[T]) -> CardFilterBuilder
where T: Display,

Every card that (partially) matches one of the specified types will match the filter

let builder = CardFilter::builder();
let filter = builder.fulltypes_or(&vec!["Legendary Creature", "Human"])
    .build();
assert!(filter == CardFilter("types=Legendary Creature|Human".to_string()));
Source

pub fn fulltypes_and<T>(self, fulltypes: &[T]) -> CardFilterBuilder
where T: Display,

Every card that (partially) matches all of the specified types will match the filter

let builder = CardFilter::builder();
let filter = builder.fulltypes_and(&vec!["Legendary", "Creature", "Human"])
    .build();
assert!(filter == CardFilter("types=Legendary,Creature,Human".to_string()));
Source

pub fn supertype(self, supertype: CardSuperType) -> CardFilterBuilder

Every card that is of the specified supertype will match the filter

let builder = CardFilter::builder();
let filter = builder.supertype(CardSuperType::Legendary)
    .build();
assert!(filter == CardFilter("supertypes=Legendary".to_string()));
Source

pub fn supertypes_or(self, supertypes: &[CardSuperType]) -> CardFilterBuilder

Every card that is one of the specified supertypes will match the filter

let builder = CardFilter::builder();
let filter = builder.supertypes_or(&vec![CardSuperType::Basic, CardSuperType::Legendary])
    .build();
assert!(filter == CardFilter("supertypes=Basic|Legendary".to_string()));
Source

pub fn supertypes_and(self, supertypes: &[CardSuperType]) -> CardFilterBuilder

Every card that is all of the specified supertypes will match the filter

let builder = CardFilter::builder();
let filter = builder.supertypes_and(&vec![CardSuperType::Basic, CardSuperType::Legendary])
    .build();
assert!(filter == CardFilter("supertypes=Basic,Legendary".to_string()));
Source

pub fn cardtype(self, cardtype: CardType) -> CardFilterBuilder

Every card that is of the specified types will match the filter

let builder = CardFilter::builder();
let filter = builder.cardtype(CardType::Creature)
    .build();
assert!(filter == CardFilter("types=Creature".to_string()));
Source

pub fn cardtypes_or(self, cardtypes: &[CardType]) -> CardFilterBuilder

Every card that is of one of the specified types will match the filter

let builder = CardFilter::builder();
let filter = builder.cardtypes_or(&vec![CardType::Creature, CardType::Artifact])
    .build();
assert!(filter == CardFilter("types=Creature|Artifact".to_string()));
Source

pub fn cardtypes_and(self, cardtypes: &[CardType]) -> CardFilterBuilder

Every card that is of all of the specified types will match the filter

let builder = CardFilter::builder();
let filter = builder.cardtypes_and(&vec![CardType::Creature, CardType::Artifact])
    .build();
assert!(filter == CardFilter("types=Creature,Artifact".to_string()));
Source

pub fn subtype<'a, T>(self, subtype: T) -> CardFilterBuilder
where T: Into<&'a str>,

Every card that is of the specified subtype will match the filter

let builder = CardFilter::builder();
let filter = builder.subtype("Human")
    .build();
assert!(filter == CardFilter("subtypes=Human".to_string()));
Source

pub fn subtypes_or<T>(self, subtypes: &[T]) -> CardFilterBuilder
where T: Display,

Every card that is of one of the specified subtypes will match the filter

let builder = CardFilter::builder();
let filter = builder.subtypes_or(&vec!["Human", "Soldier"])
    .build();
assert!(filter == CardFilter("subtypes=Human|Soldier".to_string()));
Source

pub fn subtypes_and<T>(self, subtypes: &[T]) -> CardFilterBuilder
where T: Display,

Every card that is of all of the specified subtypes will match the filter

let builder = CardFilter::builder();
let filter = builder.subtypes_and(&vec!["Human", "Soldier"])
    .build();
assert!(filter == CardFilter("subtypes=Human,Soldier".to_string()));
Source

pub fn rarity(self, rarity: CardRarity) -> CardFilterBuilder

Every card that is of the specified rarity will match the filter

let builder = CardFilter::builder();
let filter = builder.rarity(CardRarity::Rare)
    .build();
assert!(filter == CardFilter("rarity=Rare".to_string()));
Source

pub fn rarities(self, rarities: &[CardRarity]) -> CardFilterBuilder

Every card that is of one of the specified rarities will match the filter

let builder = CardFilter::builder();
let filter = builder.rarities(&vec![CardRarity::Rare, CardRarity::MythicRare])
    .build();
assert!(filter == CardFilter("rarity=Rare|Mythic Rare".to_string()));
Source

pub fn set<'a, T>(self, set: T) -> CardFilterBuilder
where T: Into<&'a str>,

Every card that is in the specified set will match the filter

let builder = CardFilter::builder();
let filter = builder.set("AER")
    .build();
assert!(filter == CardFilter("set=AER".to_string()));
Source

pub fn sets<T>(self, sets: &[T]) -> CardFilterBuilder
where T: Display,

Every card that is in one of the specified sets will match the filter

let builder = CardFilter::builder();
let filter = builder.sets(&vec!["AER", "M19"])
    .build();
assert!(filter == CardFilter("set=AER|M19".to_string()));
Source

pub fn set_name<'a, T>(self, set: T) -> CardFilterBuilder
where T: Into<&'a str>,

Every card that (partially) matches the specified set name will match the filter

let builder = CardFilter::builder();
let filter = builder.set_name("Core Set 2019")
    .build();
assert!(filter == CardFilter("setName=Core Set 2019".to_string()));
Source

pub fn set_names<T>(self, sets: &[T]) -> CardFilterBuilder
where T: Display,

Every card that (partially) matches one of the specified set names will match the filter

let builder = CardFilter::builder();
let filter = builder.set_names(&vec!["Core Set 2019", "Aether Revolt"])
    .build();
assert!(filter == CardFilter("setName=Core Set 2019|Aether Revolt".to_string()));
Source

pub fn text<'a, T>(self, text: T) -> CardFilterBuilder
where T: Into<&'a str>,

Every card that (partially) matches the specified oracle text will match the filter

let builder = CardFilter::builder();
let filter = builder.text("deals 2 damage")
    .build();
assert!(filter == CardFilter("text=deals 2 damage".to_string()));
Source

pub fn texts_or<T>(self, texts: &[T]) -> CardFilterBuilder
where T: Display,

Every card that (partially) matches one of the specified oracle texts will match the filter

let builder = CardFilter::builder();
let filter = builder.texts_or(&vec!["deals", "damage"])
    .build();
assert!(filter == CardFilter("text=deals|damage".to_string()));
Source

pub fn texts_and<T>(self, texts: &[T]) -> CardFilterBuilder
where T: Display,

Every card that (partially) matches all of the specified oracle texts will match the filter

let builder = CardFilter::builder();
let filter = builder.texts_and(&vec!["deals", "damage"])
    .build();
assert!(filter == CardFilter("text=deals,damage".to_string()));
Source

pub fn flavor<'a, T>(self, flavor: T) -> CardFilterBuilder
where T: Into<&'a str>,

Every card that (partially) matches the specified flavour text will match the filter

let builder = CardFilter::builder();
let filter = builder.flavor("S.N.E.A.K.")
    .build();
assert!(filter == CardFilter("flavor=S.N.E.A.K.".to_string()));
Source

pub fn flavors_or<T>(self, flavors: &[T]) -> CardFilterBuilder
where T: Display,

Every card that (partially) matches one of the specified flavour texts will match the filter

let builder = CardFilter::builder();
let filter = builder.flavors_or(&vec!["Espionage", "Kidnapping"])
    .build();
assert!(filter == CardFilter("flavor=Espionage|Kidnapping".to_string()));
Source

pub fn flavors_and<T>(self, flavors: &[T]) -> CardFilterBuilder
where T: Display,

Every card that (partially) matches all of the specified flavour texts will match the filter

let builder = CardFilter::builder();
let filter = builder.flavors_and(&vec!["Serious", "Nonstop Espionage and Kidnapping"])
    .build();
assert!(filter == CardFilter("flavor=Serious,Nonstop Espionage and Kidnapping".to_string()));
Source

pub fn artist<'a, T>(self, artist: T) -> CardFilterBuilder
where T: Into<&'a str>,

Every card that is drawn by the specified artist will match the filter

let builder = CardFilter::builder();
let filter = builder.artist("Kev Walker")
    .build();
assert!(filter == CardFilter("artist=Kev Walker".to_string()));
Source

pub fn artists<T>(self, artists: &[T]) -> CardFilterBuilder
where T: Display,

Every card that is drawn by one of the specified artists will match the filter

let builder = CardFilter::builder();
let filter = builder.artists(&vec!["Kev Walker", "Pete Venters"])
    .build();
assert!(filter == CardFilter("artist=Kev Walker|Pete Venters".to_string()));
Source

pub fn number<'a, T>(self, number: T) -> CardFilterBuilder
where T: Into<&'a str>,

Every card with the specified card number will match the filter

The card number may contain letters

let builder = CardFilter::builder();
let filter = builder.number("1")
    .build();
assert!(filter == CardFilter("number=1".to_string()));
Source

pub fn numbers<T>(self, numbers: &[T]) -> CardFilterBuilder
where T: Display,

Every card with one of the specified card numbers will match the filter

The card number may contain letters

let builder = CardFilter::builder();
let filter = builder.numbers(&vec!["1", "2"])
    .build();
assert!(filter == CardFilter("number=1|2".to_string()));
Source

pub fn power<'a, T>(self, power: T) -> CardFilterBuilder
where T: Into<&'a str>,

Every card with the specified power will match the filter

Some cards have powers like: “1+*”

let builder = CardFilter::builder();
let filter = builder.power("1")
    .build();
assert!(filter == CardFilter("power=1".to_string()));
Source

pub fn powers<T>(self, powers: &[T]) -> CardFilterBuilder
where T: Display,

Every card with one of the specified powers will match the filter

Some cards have powers like: “1+*”

let builder = CardFilter::builder();
let filter = builder.powers(&vec!["1", "2"])
    .build();
assert!(filter == CardFilter("power=1|2".to_string()));
Source

pub fn toughness<'a, T>(self, toughness: T) -> CardFilterBuilder
where T: Into<&'a str>,

Every card with the specified toughness will match the filter

Some cards have toughness like: “1+*”

let builder = CardFilter::builder();
let filter = builder.toughness("1")
    .build();
assert!(filter == CardFilter("toughness=1".to_string()));
Source

pub fn toughnesses<T>(self, toughnesses: &[T]) -> CardFilterBuilder
where T: Display,

Every card with one of the specified toughnesses will match the filter

Some cards have toughnesses like: “1+*”

let builder = CardFilter::builder();
let filter = builder.toughnesses(&vec!["1", "2"])
    .build();
assert!(filter == CardFilter("toughness=1|2".to_string()));
Source

pub fn loyality<'a, T>(self, loyality: T) -> CardFilterBuilder
where T: Into<&'a str>,

Every card with the specified loyality will match the filter

This is only present for planeswalkers

let builder = CardFilter::builder();
let filter = builder.loyality("3")
    .build();
assert!(filter == CardFilter("loyality=3".to_string()));
Source

pub fn loyalities<T>(self, loyalities: &[T]) -> CardFilterBuilder
where T: Display,

Every card with one of the specified loyalities will match the filter

This is only present for planeswalkers

let builder = CardFilter::builder();
let filter = builder.loyalities(&vec!["3", "5"])
    .build();
assert!(filter == CardFilter("loyality=3|5".to_string()));
Source

pub fn game_format(self, format: GameFormat) -> CardFilterBuilder

Every card that is legal in the specified game format will match the filter

let builder = CardFilter::builder();
let filter = builder.game_format(GameFormat::Standard)
    .build();
assert!(filter == CardFilter("gameFormat=Standard".to_string()));
Source

pub fn game_formats(self, formats: &[GameFormat]) -> CardFilterBuilder

Every card that is legal in the specified game formats will match the filter

let builder = CardFilter::builder();
let filter = builder.game_format(GameFormat::Standard)
    .build();
assert!(filter == CardFilter("gameFormat=Standard".to_string()));
Source

pub fn game_format_with_legality( self, format: GameFormat, legality: CardLegality, ) -> CardFilterBuilder

Every card that is of the specified legality in the specified game format will match the filter

let builder = CardFilter::builder();
let filter = builder.game_format_with_legality(GameFormat::Commander, CardLegality::Banned)
    .build();
assert!(filter == CardFilter("gameFormat=Commander&legality=Banned".to_string()));
Source

pub fn game_formats_with_legality( self, formats: &[GameFormat], legality: CardLegality, ) -> CardFilterBuilder

Every card that is of the specified legality in the specified game formats will match the filter

let builder = CardFilter::builder();
let filter = builder.game_formats_with_legality(&vec![GameFormat::Standard, GameFormat::Commander], CardLegality::Banned)
    .build();
assert!(filter == CardFilter("gameFormat=Standard|Commander&legality=Banned".to_string()));
Source

pub fn multiverse_id<'a, T>(self, multiverse_id: T) -> CardFilterBuilder
where T: Into<&'a str>,

Every card with the specified multiverse Id will match the filter

This is only present for planeswalkers

let builder = CardFilter::builder();
let filter = builder.multiverse_id("409741")
    .build();
assert!(filter == CardFilter("multiverseid=409741".to_string()));
Source

pub fn multiverse_ids<T>(self, multiverse_ids: &[T]) -> CardFilterBuilder
where T: Display,

Every card with one of the specified multiverse Ids will match the filter

This is only present for planeswalkers

let builder = CardFilter::builder();
let filter = builder.multiverse_ids(&vec!["409741", "409742"])
    .build();
assert!(filter == CardFilter("multiverseid=409741|409742".to_string()));
Source

pub fn contains_field(self, field: CardResponseField) -> CardFilterBuilder

Every card that contains the specified field in the response will match the filter

let builder = CardFilter::builder();
let filter = builder.contains_field(CardResponseField::ImageUrl)
    .build();
assert!(filter == CardFilter("contains=imageUrl".to_string()));
Source

pub fn contains_fields(self, fields: &[CardResponseField]) -> CardFilterBuilder

Every card that contains one of the specified fields in the response will match the filter

let builder = CardFilter::builder();
let filter = builder.contains_fields(&vec![CardResponseField::ImageUrl, CardResponseField::MultiverseId])
    .build();
assert!(filter == CardFilter("contains=imageUrl|multiverseid".to_string()));

Trait Implementations§

Source§

impl Clone for CardFilterBuilder

Source§

fn clone(&self) -> CardFilterBuilder

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CardFilterBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,