[−][src]Struct strife::model::user::Discriminator
A 4-digit user discriminator tag.
Methods
impl Discriminator
[src]
pub fn new(value: u16) -> Result<Discriminator, DiscriminatorParseError>
[src]
Creates a 4-digit discriminator tag from the given value.
Examples
Basic usage:
use strife::model::user::Discriminator; let discriminator = Discriminator::new(123)?; assert_eq!("0123".parse::<Discriminator>()?, discriminator);
Invalid:
use strife::model::user::Discriminator; // Value is too large to be a valid discriminator. let discriminator = 12345; assert!(Discriminator::new(discriminator).is_err());
See the docs for DiscriminatorParseError
for more details.
pub unsafe fn new_unchecked(value: u16) -> Discriminator
[src]
Constructs a 4-digit discriminator tag from the given value without checking that the value is a 4-digit base-10 integer.
See the safe function, Discriminator::new
, for more
information.
Safety
This function is unsafe because it does not check that value <= 9999
.
If this constraint is violated, undefined behavior results, as the
rest of the library assumes that discriminator value is a 4-digit
base-10 integer.
Trait Implementations
impl AsRef<u16> for Discriminator
[src]
impl Clone for Discriminator
[src]
fn clone(&self) -> Discriminator
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for Discriminator
[src]
impl Debug for Discriminator
[src]
impl<'de> Deserialize<'de> for Discriminator
[src]
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
[src]
D: Deserializer<'de>,
impl Display for Discriminator
[src]
impl Eq for Discriminator
[src]
impl FromStr for Discriminator
[src]
type Err = DiscriminatorParseError
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Self, Self::Err>
[src]
impl Ord for Discriminator
[src]
fn cmp(&self, other: &Discriminator) -> Ordering
[src]
fn max(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
1.21.0[src]
fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<Discriminator> for Discriminator
[src]
fn eq(&self, other: &Discriminator) -> bool
[src]
fn ne(&self, other: &Discriminator) -> bool
[src]
impl PartialOrd<Discriminator> for Discriminator
[src]
fn partial_cmp(&self, other: &Discriminator) -> Option<Ordering>
[src]
fn lt(&self, other: &Discriminator) -> bool
[src]
fn le(&self, other: &Discriminator) -> bool
[src]
fn gt(&self, other: &Discriminator) -> bool
[src]
fn ge(&self, other: &Discriminator) -> bool
[src]
impl Serialize for Discriminator
[src]
impl StructuralEq for Discriminator
[src]
impl StructuralPartialEq for Discriminator
[src]
Auto Trait Implementations
impl RefUnwindSafe for Discriminator
impl Send for Discriminator
impl Sync for Discriminator
impl Unpin for Discriminator
impl UnwindSafe for Discriminator
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
fn equivalent(&self, key: &K) -> bool
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,