pub struct SetCode(/* private fields */);
Expand description
A 3 to 6 letter set code, like ‘war’ for ‘War of the Spark’.
Implementations§
Source§impl SetCode
impl SetCode
Sourcepub fn new(code: &str) -> Result<Self, Option<usize>>
pub fn new(code: &str) -> Result<Self, Option<usize>>
Creates a set code from a str.
Valid set codes are ascii between 3 and 6 letters long. If any of these conditions fails, the conversion fails.
The error value is None if the str
was not ascii, otherwise it holds
the size of the str
.
use scryfall::set::SetCode;
assert_eq!(SetCode::new("war").unwrap().as_ref(), "war")
Trait Implementations§
Source§impl<'de> Deserialize<'de> for SetCode
impl<'de> Deserialize<'de> for SetCode
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 Ord for SetCode
impl Ord for SetCode
Source§impl ParamValue for SetCode
impl ParamValue for SetCode
Source§impl PartialOrd for SetCode
impl PartialOrd for SetCode
impl Copy for SetCode
impl Eq for SetCode
impl SetValue for SetCode
impl StructuralPartialEq for SetCode
Auto Trait Implementations§
impl Freeze for SetCode
impl RefUnwindSafe for SetCode
impl Send for SetCode
impl Sync for SetCode
impl Unpin for SetCode
impl UnwindSafe for SetCode
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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