[−][src]Struct ichen_openprotocol::ID
A 32-bit numeric ID that cannot be zero or negative.
This type is usually used for specifying a unique identification number.
Methods
impl ID
[src]
pub fn new(value: u32) -> Result<Self, &'static str>
[src]
Create a new ID from a u32
value.
Errors
Returns Err(&'static str)
if value
is zero.
Examples
let id = ID::new(42).unwrap(); assert_eq!(42, u32::from(id)); assert!(ID::new(0).is_err());
pub fn from_u32(value: u32) -> Self
[src]
Trait Implementations
impl Clone for ID
[src]
fn clone(&self) -> ID
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Ord for ID
[src]
fn cmp(&self, other: &ID) -> Ordering
[src]
fn max(self, other: Self) -> Self
1.21.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
Compares and returns the minimum of two values. Read more
fn clamp(self, min: Self, max: Self) -> Self
[src]
clamp
)Restrict a value to a certain interval. Read more
impl AsRef<NonZeroU32> for ID
[src]
fn as_ref(&self) -> &NonZeroU32
[src]
impl From<NonZeroU32> for ID
[src]
fn from(original: NonZeroU32) -> ID
[src]
impl From<ID> for NonZeroU32
[src]
fn from(original: ID) -> NonZeroU32
[src]
impl From<ID> for u32
[src]
impl PartialOrd<ID> for ID
[src]
fn partial_cmp(&self, other: &ID) -> Option<Ordering>
[src]
fn lt(&self, other: &ID) -> bool
[src]
fn le(&self, other: &ID) -> bool
[src]
fn gt(&self, other: &ID) -> bool
[src]
fn ge(&self, other: &ID) -> bool
[src]
impl PartialOrd<u32> for ID
[src]
fn partial_cmp(&self, other: &u32) -> Option<Ordering>
[src]
#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests less than (for self
and other
) and is used by the <
operator. Read more
#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl PartialOrd<ID> for u32
[src]
fn partial_cmp(&self, other: &ID) -> Option<Ordering>
[src]
#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests less than (for self
and other
) and is used by the <
operator. Read more
#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl PartialEq<ID> for ID
[src]
impl PartialEq<u32> for ID
[src]
fn eq(&self, other: &u32) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl PartialEq<ID> for u32
[src]
fn eq(&self, other: &ID) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl AsMut<NonZeroU32> for ID
[src]
fn as_mut(&mut self) -> &mut NonZeroU32
[src]
impl Copy for ID
[src]
impl Eq for ID
[src]
impl Display for ID
[src]
impl Debug for ID
[src]
impl Hash for ID
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl TryFrom<u32> for ID
[src]
type Error = &'static str
The type returned in the event of a conversion error.
fn try_from(value: u32) -> Result<Self, Self::Error>
[src]
impl FromStr for ID
[src]
type Err = <NonZeroU32 as FromStr>::Err
The associated error which can be returned from parsing.
fn from_str(src: &str) -> Result<Self, Self::Err>
[src]
impl Serialize for ID
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl<'de> Deserialize<'de> for ID
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
Auto Trait Implementations
Blanket Implementations
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> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,