pub struct Radix(/* private fields */);Expand description
A validated radix (number base) value between 2 and 255 inclusive.
This type ensures that radix values are always valid for numeric base conversions.
§Examples
// Create from u8 or usize
let radix = Radix::from(10u8);
let radix = Radix::from(16usize);
// Convert to other integer types
let base = usize::from(radix);
let base: u64 = radix.into();Trait Implementations§
Source§impl CompactStorage for Radix
impl CompactStorage for Radix
Source§const CONVERSION_INFALLIBLE: bool = true
const CONVERSION_INFALLIBLE: bool = true
Whether conversion to inline type is guaranteed to never fail
Source§type InlineType = Radix
type InlineType = Radix
The compact storage type used for inline representation
Source§fn to_inline(value: Self) -> Result<Self::InlineType, Self>
fn to_inline(value: Self) -> Result<Self::InlineType, Self>
Attempts to convert the value to its compact inline representation.
Returns
Err(value) if the value cannot fit in the inline type.Source§fn from_inline(value: Self::InlineType) -> Self
fn from_inline(value: Self::InlineType) -> Self
Converts from the compact inline representation back to the original type.
This conversion is always infallible as we’re expanding to a larger type.
Source§fn to_inline_unchecked(value: Self) -> Self::InlineType
fn to_inline_unchecked(value: Self) -> Self::InlineType
Converts to inline representation without bounds checking. Read more
Source§impl<T: AsPrimitive<u8> + From<u8> + PartialOrd> From<T> for Radix
impl<T: AsPrimitive<u8> + From<u8> + PartialOrd> From<T> for Radix
Source§impl Ord for Radix
impl Ord for Radix
Source§impl PartialOrd for Radix
impl PartialOrd for Radix
impl Copy for Radix
impl Eq for Radix
impl StructuralPartialEq for Radix
Auto Trait Implementations§
impl Freeze for Radix
impl RefUnwindSafe for Radix
impl Send for Radix
impl Sync for Radix
impl Unpin for Radix
impl UnwindSafe for Radix
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