Struct hex_wrapper::NonZeroHexUsize
source · [−]pub struct NonZeroHexUsize(_);Expand description
Pointer-sized unsigned nonzero hexadecimal numbers.
use hex_wrapper::NonZeroHexUsize;
// from random value
let rand = NonZeroHexUsize::rand();
let inner = rand.get();
assert_eq!(rand.to_string(), format!("{:x}", inner));
// from given value
let given = NonZeroHexUsize::new(0xa3).unwrap();
assert_eq!(given.to_string(), String::from("a3"));
// from string
let from_str = "a3".parse::<NonZeroHexUsize>();
assert_eq!(from_str.unwrap(), NonZeroHexUsize::new(0xa3).unwrap());Implementations
sourceimpl NonZeroHexUsize
impl NonZeroHexUsize
sourcepub fn rand() -> Self
pub fn rand() -> Self
Creates a random hex. This is equivalent to
Self::with_rng(rand::thread_rng()).
sourcepub fn get(self) -> NonZeroUsize
pub fn get(self) -> NonZeroUsize
Gets the interior value.
sourcepub fn get_ref(&self) -> &NonZeroUsize
pub fn get_ref(&self) -> &NonZeroUsize
Borrows the interior value.
sourcepub fn get_ref_mut(&mut self) -> &mut NonZeroUsize
pub fn get_ref_mut(&mut self) -> &mut NonZeroUsize
Gets the mutable reference to the interior value.
Trait Implementations
sourceimpl<'a, T> AsExpression<T> for &'a NonZeroHexUsize where
&'a NonZeroUsize: AsExpression<T>,
impl<'a, T> AsExpression<T> for &'a NonZeroHexUsize where
&'a NonZeroUsize: AsExpression<T>,
type Expression = <&'a NonZeroUsize as AsExpression<T>>::Expression
type Expression = <&'a NonZeroUsize as AsExpression<T>>::Expression
The expression being returned
sourcefn as_expression(self) -> Self::Expression
fn as_expression(self) -> Self::Expression
Perform the conversion
sourceimpl<T> AsExpression<T> for NonZeroHexUsize where
NonZeroUsize: AsExpression<T>,
impl<T> AsExpression<T> for NonZeroHexUsize where
NonZeroUsize: AsExpression<T>,
type Expression = <NonZeroUsize as AsExpression<T>>::Expression
type Expression = <NonZeroUsize as AsExpression<T>>::Expression
The expression being returned
sourcefn as_expression(self) -> Self::Expression
fn as_expression(self) -> Self::Expression
Perform the conversion
sourceimpl Clone for NonZeroHexUsize
impl Clone for NonZeroHexUsize
sourcefn clone(&self) -> NonZeroHexUsize
fn clone(&self) -> NonZeroHexUsize
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl Debug for NonZeroHexUsize
impl Debug for NonZeroHexUsize
sourceimpl<'de> Deserialize<'de> for NonZeroHexUsize
impl<'de> Deserialize<'de> for NonZeroHexUsize
sourcefn 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
sourceimpl Display for NonZeroHexUsize
impl Display for NonZeroHexUsize
sourceimpl From<NonZeroHexUsize> for String
impl From<NonZeroHexUsize> for String
sourcefn from(value: NonZeroHexUsize) -> String
fn from(value: NonZeroHexUsize) -> String
Converts to this type from the input type.
sourceimpl From<NonZeroUsize> for NonZeroHexUsize
impl From<NonZeroUsize> for NonZeroHexUsize
sourcefn from(n: NonZeroUsize) -> Self
fn from(n: NonZeroUsize) -> Self
Converts to this type from the input type.
sourceimpl FromStr for NonZeroHexUsize
impl FromStr for NonZeroHexUsize
sourceimpl Hash for NonZeroHexUsize
impl Hash for NonZeroHexUsize
sourceimpl Ord for NonZeroHexUsize
impl Ord for NonZeroHexUsize
sourceimpl PartialEq<NonZeroHexUsize> for NonZeroHexUsize
impl PartialEq<NonZeroHexUsize> for NonZeroHexUsize
sourcefn eq(&self, other: &NonZeroHexUsize) -> bool
fn eq(&self, other: &NonZeroHexUsize) -> bool
This method tests for self and other values to be equal, and is used
by ==. Read more
sourcefn ne(&self, other: &NonZeroHexUsize) -> bool
fn ne(&self, other: &NonZeroHexUsize) -> bool
This method tests for !=.
sourceimpl PartialOrd<NonZeroHexUsize> for NonZeroHexUsize
impl PartialOrd<NonZeroHexUsize> for NonZeroHexUsize
sourcefn partial_cmp(&self, other: &NonZeroHexUsize) -> Option<Ordering>
fn partial_cmp(&self, other: &NonZeroHexUsize) -> Option<Ordering>
This method returns an ordering between self and other values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
sourceimpl<DB, ST> Queryable<ST, DB> for NonZeroHexUsize where
DB: Backend,
NonZeroUsize: Queryable<ST, DB>,
impl<DB, ST> Queryable<ST, DB> for NonZeroHexUsize where
DB: Backend,
NonZeroUsize: Queryable<ST, DB>,
sourceimpl Serialize for NonZeroHexUsize
impl Serialize for NonZeroHexUsize
sourceimpl<T, DB> ToSql<T, DB> for NonZeroHexUsize where
DB: Backend,
NonZeroUsize: ToSql<T, DB>,
impl<T, DB> ToSql<T, DB> for NonZeroHexUsize where
DB: Backend,
NonZeroUsize: ToSql<T, DB>,
sourceimpl TryFrom<&str> for NonZeroHexUsize
impl TryFrom<&str> for NonZeroHexUsize
sourceimpl TryFrom<usize> for NonZeroHexUsize
impl TryFrom<usize> for NonZeroHexUsize
impl Copy for NonZeroHexUsize
impl Eq for NonZeroHexUsize
impl StructuralEq for NonZeroHexUsize
impl StructuralPartialEq for NonZeroHexUsize
Auto Trait Implementations
impl RefUnwindSafe for NonZeroHexUsize
impl Send for NonZeroHexUsize
impl Sync for NonZeroHexUsize
impl Unpin for NonZeroHexUsize
impl UnwindSafe for NonZeroHexUsize
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> IntoSql for T
impl<T> IntoSql for T
sourcefn into_sql<T>(self) -> Self::Expression where
Self: AsExpression<T>,
fn into_sql<T>(self) -> Self::Expression where
Self: AsExpression<T>,
Convert self to an expression for Diesel’s query builder. Read more
sourcefn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression where
&'a Self: AsExpression<T>,
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression where
&'a Self: AsExpression<T>,
Convert &self to an expression for Diesel’s query builder. Read more