pub struct HexUsize(/* private fields */);Expand description
Pointer-sized unsigned hexadecimal numbers.
use hex_wrapper::HexUsize;
// from random value
let rand = HexUsize::rand();
let inner = rand.get();
assert_eq!(rand.to_string(), format!("{:x}", inner));
// from given value
let given = HexUsize::new(0xa3);
assert_eq!(given.to_string(), String::from("a3"));
// from string
let from_str = "a3".parse::<HexUsize>();
assert_eq!(from_str.unwrap(), HexUsize::new(0xa3));Implementations§
Source§impl HexUsize
impl HexUsize
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_ref_mut(&mut self) -> &mut usize
pub const fn get_ref_mut(&mut self) -> &mut usize
Gets the mutable reference to the interior value.
Sourcepub const fn from(n: usize) -> Self
pub const fn from(n: usize) -> Self
The converse of Self::get(). This is same as the implementation of From.
Trait Implementations§
Source§impl<'a, T> AsExpression<T> for &'a HexUsize
impl<'a, T> AsExpression<T> for &'a HexUsize
Source§type Expression = <&'a usize as AsExpression<T>>::Expression
type Expression = <&'a usize 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 HexUsize
impl<T> AsExpression<T> for HexUsize
Source§type Expression = <usize as AsExpression<T>>::Expression
type Expression = <usize 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<'de> Deserialize<'de> for HexUsize
impl<'de> Deserialize<'de> for HexUsize
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 Ord for HexUsize
impl Ord for HexUsize
Source§impl PartialOrd for HexUsize
impl PartialOrd for HexUsize
impl Copy for HexUsize
impl Eq for HexUsize
impl SingleValue for HexUsize
impl StructuralPartialEq for HexUsize
Auto Trait Implementations§
impl Freeze for HexUsize
impl RefUnwindSafe for HexUsize
impl Send for HexUsize
impl Sync for HexUsize
impl Unpin for HexUsize
impl UnwindSafe for HexUsize
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoNotNullable for T
impl<T> IntoNotNullable for T
Source§type NotNullable = T
type NotNullable = T
The not nullable representation of this type. Read more
Source§impl<T> IntoNullable for T
impl<T> IntoNullable for T
Source§impl<T> IntoSql for T
impl<T> IntoSql for T
Source§fn into_sql<T>(self) -> Self::Expression
fn into_sql<T>(self) -> Self::Expression
Convert
self to an expression for Diesel’s query builder. Read moreSource§fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
Convert
&self to an expression for Diesel’s query builder. Read more