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§
source§impl 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 const fn get(self) -> NonZeroUsize
pub const fn get(self) -> NonZeroUsize
Gets the interior value.
sourcepub const fn get_ref(&self) -> &NonZeroUsize
pub const 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.
sourcepub const fn from(n: NonZeroUsize) -> Self
pub const fn from(n: NonZeroUsize) -> Self
The converse of Self::get(). This is same as the implementation of From.
Trait Implementations§
source§impl<'a, T> AsExpression<T> for &'a NonZeroHexUsizewhere
&'a NonZeroUsize: AsExpression<T>,
impl<'a, T> AsExpression<T> for &'a NonZeroHexUsizewhere
&'a NonZeroUsize: AsExpression<T>,
§type Expression = <&'a NonZeroUsize as AsExpression<T>>::Expression
type Expression = <&'a NonZeroUsize as AsExpression<T>>::Expression
The expression being returned
source§fn as_expression(self) -> Self::Expression
fn as_expression(self) -> Self::Expression
Perform the conversion
source§impl<T> AsExpression<T> for NonZeroHexUsizewhere
NonZeroUsize: AsExpression<T>,
impl<T> AsExpression<T> for NonZeroHexUsizewhere
NonZeroUsize: AsExpression<T>,
§type Expression = <NonZeroUsize as AsExpression<T>>::Expression
type Expression = <NonZeroUsize as AsExpression<T>>::Expression
The expression being returned
source§fn as_expression(self) -> Self::Expression
fn as_expression(self) -> Self::Expression
Perform the conversion
source§impl Clone for NonZeroHexUsize
impl Clone for NonZeroHexUsize
source§fn clone(&self) -> NonZeroHexUsize
fn clone(&self) -> NonZeroHexUsize
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl Debug for NonZeroHexUsize
impl Debug for NonZeroHexUsize
source§impl<'de> Deserialize<'de> for NonZeroHexUsize
impl<'de> Deserialize<'de> for NonZeroHexUsize
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 Display for NonZeroHexUsize
impl Display for NonZeroHexUsize
source§impl From<NonZeroHexUsize> for String
impl From<NonZeroHexUsize> for String
source§fn from(value: NonZeroHexUsize) -> String
fn from(value: NonZeroHexUsize) -> String
Converts to this type from the input type.
source§impl From<NonZeroUsize> for NonZeroHexUsize
impl From<NonZeroUsize> for NonZeroHexUsize
source§fn from(n: NonZeroUsize) -> Self
fn from(n: NonZeroUsize) -> Self
Converts to this type from the input type.
source§impl FromStr for NonZeroHexUsize
impl FromStr for NonZeroHexUsize
source§impl Hash for NonZeroHexUsize
impl Hash for NonZeroHexUsize
source§impl Ord for NonZeroHexUsize
impl Ord for NonZeroHexUsize
source§fn cmp(&self, other: &NonZeroHexUsize) -> Ordering
fn cmp(&self, other: &NonZeroHexUsize) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq<NonZeroHexUsize> for NonZeroHexUsize
impl PartialEq<NonZeroHexUsize> for NonZeroHexUsize
source§fn 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 ==.source§impl PartialOrd<NonZeroHexUsize> for NonZeroHexUsize
impl PartialOrd<NonZeroHexUsize> for NonZeroHexUsize
source§fn partial_cmp(&self, other: &NonZeroHexUsize) -> Option<Ordering>
fn partial_cmp(&self, other: &NonZeroHexUsize) -> Option<Ordering>
1.0.0 · source§fn 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 moresource§impl<DB, ST> Queryable<ST, DB> for NonZeroHexUsizewhere
DB: Backend,
NonZeroUsize: Queryable<ST, DB>,
impl<DB, ST> Queryable<ST, DB> for NonZeroHexUsizewhere
DB: Backend,
NonZeroUsize: Queryable<ST, DB>,
source§impl Serialize for NonZeroHexUsize
impl Serialize for NonZeroHexUsize
source§impl<T, DB> ToSql<T, DB> for NonZeroHexUsizewhere
DB: Backend,
NonZeroUsize: ToSql<T, DB>,
impl<T, DB> ToSql<T, DB> for NonZeroHexUsizewhere
DB: Backend,
NonZeroUsize: ToSql<T, DB>,
source§impl TryFrom<&str> for NonZeroHexUsize
impl TryFrom<&str> for NonZeroHexUsize
source§impl 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§
source§impl<T> IntoSql for T
impl<T> IntoSql for T
source§fn into_sql<T>(self) -> Self::Expressionwhere
Self: AsExpression<T> + Sized,
fn into_sql<T>(self) -> Self::Expressionwhere
Self: AsExpression<T> + Sized,
Convert
self to an expression for Diesel’s query builder. Read moresource§fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expressionwhere
&'a Self: AsExpression<T>,
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expressionwhere
&'a Self: AsExpression<T>,
Convert
&self to an expression for Diesel’s query builder. Read more