[−][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) -> Option<Self>
[src]
Create a new ID
from a u32
value.
Errors
Returns None
if value
is zero.
Examples
let id = ID::new(42).unwrap(); assert_eq!(42, u32::from(id)); assert_eq!(None, ID::new(0));
pub fn from_u32(value: u32) -> Self
[src]
Create a new ID
from a u32
value.
Panics
Panics if value
is zero.
Error Examples
let id = ID::from_u32(0); // This will panic.
Examples
let id = ID::from_u32(42); assert_eq!(42, id.get());
pub fn get(self) -> u32
[src]
Methods from Deref<Target = NonZeroU32>
Trait Implementations
impl AsMut<NonZeroU32> for ID
[src]
fn as_mut(&mut self) -> &mut NonZeroU32
[src]
impl AsRef<NonZeroU32> for ID
[src]
fn as_ref(&self) -> &NonZeroU32
[src]
impl Clone for ID
[src]
impl Copy for ID
[src]
impl Debug for ID
[src]
impl Deref for ID
[src]
type Target = NonZeroU32
The resulting type after dereferencing.
fn deref(&self) -> &Self::Target
[src]
impl DerefMut for ID
[src]
impl<'de> Deserialize<'de> for ID
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Display for ID
[src]
impl Eq for ID
[src]
impl From<ID> for NonZeroU32
[src]
fn from(original: ID) -> NonZeroU32
[src]
impl From<ID> for u32
[src]
impl From<NonZeroU32> for ID
[src]
fn from(original: NonZeroU32) -> ID
[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 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,
impl Ord for ID
[src]
fn cmp(&self, other: &ID) -> Ordering
[src]
#[must_use]
fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]
fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]
fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<ID> for ID
[src]
impl PartialEq<ID> for u32
[src]
impl PartialEq<u32> for ID
[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<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]
#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[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]
#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl Serialize for ID
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl StructuralEq for ID
[src]
impl StructuralPartialEq for ID
[src]
impl TryFrom<u32> for ID
[src]
Auto Trait Implementations
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>,
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> Typeable for T where
T: Any,
T: Any,