pub struct RangedU128<const MIN: u128, const MAX: u128>(/* private fields */);
Expand description
A u128
that is known to be in the range MIN..=MAX
.
Implementations§
Source§impl RangedU128<0, 0>
impl RangedU128<0, 0>
Sourcepub const fn exact<const VALUE: u128>() -> RangedU128<VALUE, VALUE>
pub const fn exact<const VALUE: u128>() -> RangedU128<VALUE, VALUE>
A RangedU128 that is always VALUE
.
Source§impl RangedU128<1, { u128::MAX }>
impl RangedU128<1, { u128::MAX }>
Sourcepub const fn from_nonzero(value: NonZero<u128>) -> Self
pub const fn from_nonzero(value: NonZero<u128>) -> Self
Creates a ranged integer from a non-zero value.
Sourcepub const fn to_nonzero(self) -> NonZero<u128>
pub const fn to_nonzero(self) -> NonZero<u128>
Creates a non-zero value from a ranged integer.
Source§impl<const MIN: u128, const MAX: u128> RangedU128<MIN, MAX>
impl<const MIN: u128, const MAX: u128> RangedU128<MIN, MAX>
Sourcepub const unsafe fn new_unchecked(value: u128) -> Self
pub const unsafe fn new_unchecked(value: u128) -> Self
Creates a ranged integer without checking the value.
§Safety
The value must be within the range MIN..=MAX
.
Sourcepub const fn get(self) -> u128
pub const fn get(self) -> u128
Returns the value as a primitive type.
A call to this function will output a hint to the compiler that the value is in
range. In general this will help the optimizer to generate better code, but in edge
cases this may lead to worse code generation. To avoid outputting the hint, you can
use RangedU128::get_without_hint
.
Sourcepub const fn get_without_hint(self) -> u128
pub const fn get_without_hint(self) -> u128
Returns the value as a primitive type.
The returned value is identical to RangedU128::get
.
Unlike get
, no hints are output to the compiler indicating the range that the
value is in. Depending on the scenario, this may with be helpful or harmful too
optimization.
Sourcepub const fn new(value: u128) -> Option<Self>
pub const fn new(value: u128) -> Option<Self>
Creates a ranged integer if the given value is in the range MIN..=MAX
.
Sourcepub const fn new_static<const VALUE: u128>() -> Self
pub const fn new_static<const VALUE: u128>() -> Self
Creates a ranged integer with a statically known value. Fails to compile if the value is not in range.
Sourcepub const fn new_saturating(value: u128) -> Self
pub const fn new_saturating(value: u128) -> Self
Creates a ranged integer with the given value, saturating if it is out of range.
Sourcepub const fn expand<const NEW_MIN: u128, const NEW_MAX: u128>(
self,
) -> RangedU128<NEW_MIN, NEW_MAX>
pub const fn expand<const NEW_MIN: u128, const NEW_MAX: u128>( self, ) -> RangedU128<NEW_MIN, NEW_MAX>
Expand the range that the value may be in. Fails to compile if the new range is not a superset of the current range.
Sourcepub const fn narrow<const NEW_MIN: u128, const NEW_MAX: u128>(
self,
) -> Option<RangedU128<NEW_MIN, NEW_MAX>>
pub const fn narrow<const NEW_MIN: u128, const NEW_MAX: u128>( self, ) -> Option<RangedU128<NEW_MIN, NEW_MAX>>
Attempt to narrow the range that the value may be in. Returns None
if the value
is outside the new range. Fails to compile if the new range is not a subset of
the current range.
Sourcepub fn from_str_radix(src: &str, radix: u32) -> Result<Self, ParseIntError>
pub fn from_str_radix(src: &str, radix: u32) -> Result<Self, ParseIntError>
Converts a string slice in a given base to an integer.
The string is expected to be an optional +
or -
sign followed by digits. Leading
and trailing whitespace represent an error. Digits are a subset of these characters,
depending on radix
:
0-9
a-z
A-Z
§Panics
Panics if radix
is not in the range 2..=36
.
§Examples
Basic usage:
assert_eq!(RangedU128::<5, 10>::from_str_radix("A", 16), Ok(RangedU128::new_static::<10>()));
Sourcepub const fn checked_add(self, rhs: u128) -> Option<Self>
pub const fn checked_add(self, rhs: u128) -> Option<Self>
Checked integer addition. Computes self + rhs
, returning None
if the resulting
value is out of range.
Sourcepub const unsafe fn unchecked_add(self, rhs: u128) -> Self
pub const unsafe fn unchecked_add(self, rhs: u128) -> Self
Unchecked integer addition. Computes self + rhs
, assuming that the result is in
range.
§Safety
The result of self + rhs
must be in the range MIN..=MAX
.
Sourcepub const fn checked_sub(self, rhs: u128) -> Option<Self>
pub const fn checked_sub(self, rhs: u128) -> Option<Self>
Checked integer addition. Computes self - rhs
, returning None
if the resulting
value is out of range.
Sourcepub const unsafe fn unchecked_sub(self, rhs: u128) -> Self
pub const unsafe fn unchecked_sub(self, rhs: u128) -> Self
Unchecked integer subtraction. Computes self - rhs
, assuming that the result is in
range.
§Safety
The result of self - rhs
must be in the range MIN..=MAX
.
Sourcepub const fn checked_mul(self, rhs: u128) -> Option<Self>
pub const fn checked_mul(self, rhs: u128) -> Option<Self>
Checked integer addition. Computes self * rhs
, returning None
if the resulting
value is out of range.
Sourcepub const unsafe fn unchecked_mul(self, rhs: u128) -> Self
pub const unsafe fn unchecked_mul(self, rhs: u128) -> Self
Unchecked integer multiplication. Computes self * rhs
, assuming that the result is
in range.
§Safety
The result of self * rhs
must be in the range MIN..=MAX
.
Sourcepub const fn checked_div(self, rhs: u128) -> Option<Self>
pub const fn checked_div(self, rhs: u128) -> Option<Self>
Checked integer addition. Computes self / rhs
, returning None
if rhs == 0
or
if the resulting value is out of range.
Sourcepub const unsafe fn unchecked_div(self, rhs: u128) -> Self
pub const unsafe fn unchecked_div(self, rhs: u128) -> Self
Unchecked integer division. Computes self / rhs
, assuming that rhs != 0
and that
the result is in range.
§Safety
self
must not be zero and the result of self / rhs
must be in the range
MIN..=MAX
.
Sourcepub const fn checked_div_euclid(self, rhs: u128) -> Option<Self>
pub const fn checked_div_euclid(self, rhs: u128) -> Option<Self>
Checked Euclidean division. Computes self.div_euclid(rhs)
, returning None
if
rhs == 0
or if the resulting value is out of range.
Sourcepub const unsafe fn unchecked_div_euclid(self, rhs: u128) -> Self
pub const unsafe fn unchecked_div_euclid(self, rhs: u128) -> Self
Unchecked Euclidean division. Computes self.div_euclid(rhs)
, assuming that
rhs != 0
and that the result is in range.
§Safety
self
must not be zero and the result of self.div_euclid(rhs)
must be in the
range MIN..=MAX
.
Sourcepub const fn rem<const RHS_VALUE: u128>(
self,
rhs: RangedU128<RHS_VALUE, RHS_VALUE>,
) -> RangedU128<0, RHS_VALUE>
pub const fn rem<const RHS_VALUE: u128>( self, rhs: RangedU128<RHS_VALUE, RHS_VALUE>, ) -> RangedU128<0, RHS_VALUE>
Remainder. Computes self % rhs
, statically guaranteeing that the returned value
is in range.
Sourcepub const fn checked_rem(self, rhs: u128) -> Option<Self>
pub const fn checked_rem(self, rhs: u128) -> Option<Self>
Checked integer remainder. Computes self % rhs
, returning None
if rhs == 0
or
if the resulting value is out of range.
Sourcepub const unsafe fn unchecked_rem(self, rhs: u128) -> Self
pub const unsafe fn unchecked_rem(self, rhs: u128) -> Self
Unchecked remainder. Computes self % rhs
, assuming that rhs != 0
and that the
result is in range.
§Safety
self
must not be zero and the result of self % rhs
must be in the range
MIN..=MAX
.
Sourcepub const fn checked_rem_euclid(self, rhs: u128) -> Option<Self>
pub const fn checked_rem_euclid(self, rhs: u128) -> Option<Self>
Checked Euclidean remainder. Computes self.rem_euclid(rhs)
, returning None
if
rhs == 0
or if the resulting value is out of range.
Sourcepub const unsafe fn unchecked_rem_euclid(self, rhs: u128) -> Self
pub const unsafe fn unchecked_rem_euclid(self, rhs: u128) -> Self
Unchecked Euclidean remainder. Computes self.rem_euclid(rhs)
, assuming that
rhs != 0
and that the result is in range.
§Safety
self
must not be zero and the result of self.rem_euclid(rhs)
must be in the
range MIN..=MAX
.
Sourcepub const fn checked_neg(self) -> Option<Self>
pub const fn checked_neg(self) -> Option<Self>
Checked negation. Computes -self
, returning None
if the resulting value is out
of range.
Sourcepub const unsafe fn unchecked_neg(self) -> Self
pub const unsafe fn unchecked_neg(self) -> Self
Unchecked negation. Computes -self
, assuming that -self
is in range.
§Safety
The result of -self
must be in the range MIN..=MAX
.
Sourcepub const fn neg(self) -> Self
pub const fn neg(self) -> Self
Negation. Computes self.neg()
, failing to compile if the result is not
guaranteed to be in range.
Sourcepub const fn checked_shl(self, rhs: u32) -> Option<Self>
pub const fn checked_shl(self, rhs: u32) -> Option<Self>
Checked shift left. Computes self << rhs
, returning None
if the resulting value
is out of range.
Sourcepub const unsafe fn unchecked_shl(self, rhs: u32) -> Self
pub const unsafe fn unchecked_shl(self, rhs: u32) -> Self
Unchecked shift left. Computes self << rhs
, assuming that the result is in range.
§Safety
The result of self << rhs
must be in the range MIN..=MAX
.
Sourcepub const fn checked_shr(self, rhs: u32) -> Option<Self>
pub const fn checked_shr(self, rhs: u32) -> Option<Self>
Checked shift right. Computes self >> rhs
, returning None
if
the resulting value is out of range.
Sourcepub const unsafe fn unchecked_shr(self, rhs: u32) -> Self
pub const unsafe fn unchecked_shr(self, rhs: u32) -> Self
Unchecked shift right. Computes self >> rhs
, assuming that the result is in range.
§Safety
The result of self >> rhs
must be in the range MIN..=MAX
.
Sourcepub const fn checked_pow(self, exp: u32) -> Option<Self>
pub const fn checked_pow(self, exp: u32) -> Option<Self>
Checked exponentiation. Computes self.pow(exp)
, returning None
if the resulting
value is out of range.
Sourcepub const unsafe fn unchecked_pow(self, exp: u32) -> Self
pub const unsafe fn unchecked_pow(self, exp: u32) -> Self
Unchecked exponentiation. Computes self.pow(exp)
, assuming that the result is in
range.
§Safety
The result of self.pow(exp)
must be in the range MIN..=MAX
.
Sourcepub const fn saturating_add(self, rhs: u128) -> Self
pub const fn saturating_add(self, rhs: u128) -> Self
Saturating integer addition. Computes self + rhs
, saturating at the numeric
bounds.
Sourcepub const fn saturating_sub(self, rhs: u128) -> Self
pub const fn saturating_sub(self, rhs: u128) -> Self
Saturating integer subtraction. Computes self - rhs
, saturating at the numeric
bounds.
Sourcepub const fn saturating_mul(self, rhs: u128) -> Self
pub const fn saturating_mul(self, rhs: u128) -> Self
Saturating integer multiplication. Computes self * rhs
, saturating at the numeric
bounds.
Sourcepub const fn saturating_pow(self, exp: u32) -> Self
pub const fn saturating_pow(self, exp: u32) -> Self
Saturating integer exponentiation. Computes self.pow(exp)
, saturating at the
numeric bounds.
Sourcepub const fn wrapping_add(self, rhs: u128) -> Self
pub const fn wrapping_add(self, rhs: u128) -> Self
Wrapping integer addition. Computes self + rhs
, wrapping around the numeric
bounds.
Sourcepub const fn wrapping_sub(self, rhs: u128) -> Self
pub const fn wrapping_sub(self, rhs: u128) -> Self
Wrapping integer subtraction. Computes self - rhs
, wrapping around the numeric
bounds.
Trait Implementations§
Source§impl<const MIN: u128, const MAX: u128> Arbitrary for RangedU128<MIN, MAX>
Available on crate feature quickcheck
only.
impl<const MIN: u128, const MAX: u128> Arbitrary for RangedU128<MIN, MAX>
quickcheck
only.Source§impl<const MIN: u128, const MAX: u128> Clone for RangedU128<MIN, MAX>
impl<const MIN: u128, const MAX: u128> Clone for RangedU128<MIN, MAX>
Source§fn clone(&self) -> RangedU128<MIN, MAX>
fn clone(&self) -> RangedU128<MIN, MAX>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<'de, const MIN: u128, const MAX: u128> Deserialize<'de> for RangedU128<MIN, MAX>
Available on crate feature serde
only.
impl<'de, const MIN: u128, const MAX: u128> Deserialize<'de> for RangedU128<MIN, MAX>
serde
only.Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Source§#[doc(hidden)] fn deserialize_in_place<D>(
deserializer: D,
place: &mut Self,
) -> Result<(), <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
#[doc(hidden)] fn deserialize_in_place<D>(
deserializer: D,
place: &mut Self,
) -> Result<(), <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
self
from the given Deserializer. Read moreSource§impl<const MIN: u128, const MAX: u128> Distribution<RangedU128<MIN, MAX>> for Standard
Available on crate feature rand08
only.
impl<const MIN: u128, const MAX: u128> Distribution<RangedU128<MIN, MAX>> for Standard
rand08
only.Source§fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> RangedU128<MIN, MAX>
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> RangedU128<MIN, MAX>
T
, using rng
as the source of randomness.Source§fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
T
, using rng
as
the source of randomness. Read moreSource§impl<const MIN: u128, const MAX: u128> Eq for RangedU128<MIN, MAX>
impl<const MIN: u128, const MAX: u128> Eq for RangedU128<MIN, MAX>
#[doc(hidden)] fn assert_receiver_is_total_eq(&self)
Source§impl<const MIN_SRC: i128, const MAX_SRC: i128, const MIN_DST: u128, const MAX_DST: u128> From<RangedI128<MIN_SRC, MAX_SRC>> for RangedU128<MIN_DST, MAX_DST>
impl<const MIN_SRC: i128, const MAX_SRC: i128, const MIN_DST: u128, const MAX_DST: u128> From<RangedI128<MIN_SRC, MAX_SRC>> for RangedU128<MIN_DST, MAX_DST>
Source§fn from(value: RangedI128<MIN_SRC, MAX_SRC>) -> Self
fn from(value: RangedI128<MIN_SRC, MAX_SRC>) -> Self
Source§impl<const MIN_SRC: i16, const MAX_SRC: i16, const MIN_DST: u128, const MAX_DST: u128> From<RangedI16<MIN_SRC, MAX_SRC>> for RangedU128<MIN_DST, MAX_DST>
impl<const MIN_SRC: i16, const MAX_SRC: i16, const MIN_DST: u128, const MAX_DST: u128> From<RangedI16<MIN_SRC, MAX_SRC>> for RangedU128<MIN_DST, MAX_DST>
Source§impl<const MIN_SRC: i32, const MAX_SRC: i32, const MIN_DST: u128, const MAX_DST: u128> From<RangedI32<MIN_SRC, MAX_SRC>> for RangedU128<MIN_DST, MAX_DST>
impl<const MIN_SRC: i32, const MAX_SRC: i32, const MIN_DST: u128, const MAX_DST: u128> From<RangedI32<MIN_SRC, MAX_SRC>> for RangedU128<MIN_DST, MAX_DST>
Source§impl<const MIN_SRC: i64, const MAX_SRC: i64, const MIN_DST: u128, const MAX_DST: u128> From<RangedI64<MIN_SRC, MAX_SRC>> for RangedU128<MIN_DST, MAX_DST>
impl<const MIN_SRC: i64, const MAX_SRC: i64, const MIN_DST: u128, const MAX_DST: u128> From<RangedI64<MIN_SRC, MAX_SRC>> for RangedU128<MIN_DST, MAX_DST>
Source§impl<const MIN_SRC: i8, const MAX_SRC: i8, const MIN_DST: u128, const MAX_DST: u128> From<RangedI8<MIN_SRC, MAX_SRC>> for RangedU128<MIN_DST, MAX_DST>
impl<const MIN_SRC: i8, const MAX_SRC: i8, const MIN_DST: u128, const MAX_DST: u128> From<RangedI8<MIN_SRC, MAX_SRC>> for RangedU128<MIN_DST, MAX_DST>
Source§impl<const MIN_SRC: isize, const MAX_SRC: isize, const MIN_DST: u128, const MAX_DST: u128> From<RangedIsize<MIN_SRC, MAX_SRC>> for RangedU128<MIN_DST, MAX_DST>
impl<const MIN_SRC: isize, const MAX_SRC: isize, const MIN_DST: u128, const MAX_DST: u128> From<RangedIsize<MIN_SRC, MAX_SRC>> for RangedU128<MIN_DST, MAX_DST>
Source§fn from(value: RangedIsize<MIN_SRC, MAX_SRC>) -> Self
fn from(value: RangedIsize<MIN_SRC, MAX_SRC>) -> Self
Source§impl From<RangedU128<1, { $internal::MAX }>> for NonZero<u128>
impl From<RangedU128<1, { $internal::MAX }>> for NonZero<u128>
Source§fn from(value: RangedU128<1, { u128::MAX }>) -> Self
fn from(value: RangedU128<1, { u128::MAX }>) -> Self
Source§impl<const MIN: u128, const MAX: u128> From<RangedU128<MIN, MAX>> for OptionRangedU128<MIN, MAX>
impl<const MIN: u128, const MAX: u128> From<RangedU128<MIN, MAX>> for OptionRangedU128<MIN, MAX>
Source§fn from(value: RangedU128<MIN, MAX>) -> Self
fn from(value: RangedU128<MIN, MAX>) -> Self
Source§impl<const MIN: u128, const MAX: u128> From<RangedU128<MIN, MAX>> for u128
impl<const MIN: u128, const MAX: u128> From<RangedU128<MIN, MAX>> for u128
Source§fn from(value: RangedU128<MIN, MAX>) -> Self
fn from(value: RangedU128<MIN, MAX>) -> Self
Source§impl<const MIN_SRC: u128, const MAX_SRC: u128, const MIN_DST: i128, const MAX_DST: i128> From<RangedU128<MIN_SRC, MAX_SRC>> for RangedI128<MIN_DST, MAX_DST>
impl<const MIN_SRC: u128, const MAX_SRC: u128, const MIN_DST: i128, const MAX_DST: i128> From<RangedU128<MIN_SRC, MAX_SRC>> for RangedI128<MIN_DST, MAX_DST>
Source§fn from(value: RangedU128<MIN_SRC, MAX_SRC>) -> Self
fn from(value: RangedU128<MIN_SRC, MAX_SRC>) -> Self
Source§impl<const MIN_SRC: u128, const MAX_SRC: u128, const MIN_DST: i16, const MAX_DST: i16> From<RangedU128<MIN_SRC, MAX_SRC>> for RangedI16<MIN_DST, MAX_DST>
impl<const MIN_SRC: u128, const MAX_SRC: u128, const MIN_DST: i16, const MAX_DST: i16> From<RangedU128<MIN_SRC, MAX_SRC>> for RangedI16<MIN_DST, MAX_DST>
Source§fn from(value: RangedU128<MIN_SRC, MAX_SRC>) -> Self
fn from(value: RangedU128<MIN_SRC, MAX_SRC>) -> Self
Source§impl<const MIN_SRC: u128, const MAX_SRC: u128, const MIN_DST: i32, const MAX_DST: i32> From<RangedU128<MIN_SRC, MAX_SRC>> for RangedI32<MIN_DST, MAX_DST>
impl<const MIN_SRC: u128, const MAX_SRC: u128, const MIN_DST: i32, const MAX_DST: i32> From<RangedU128<MIN_SRC, MAX_SRC>> for RangedI32<MIN_DST, MAX_DST>
Source§fn from(value: RangedU128<MIN_SRC, MAX_SRC>) -> Self
fn from(value: RangedU128<MIN_SRC, MAX_SRC>) -> Self
Source§impl<const MIN_SRC: u128, const MAX_SRC: u128, const MIN_DST: i64, const MAX_DST: i64> From<RangedU128<MIN_SRC, MAX_SRC>> for RangedI64<MIN_DST, MAX_DST>
impl<const MIN_SRC: u128, const MAX_SRC: u128, const MIN_DST: i64, const MAX_DST: i64> From<RangedU128<MIN_SRC, MAX_SRC>> for RangedI64<MIN_DST, MAX_DST>
Source§fn from(value: RangedU128<MIN_SRC, MAX_SRC>) -> Self
fn from(value: RangedU128<MIN_SRC, MAX_SRC>) -> Self
Source§impl<const MIN_SRC: u128, const MAX_SRC: u128, const MIN_DST: i8, const MAX_DST: i8> From<RangedU128<MIN_SRC, MAX_SRC>> for RangedI8<MIN_DST, MAX_DST>
impl<const MIN_SRC: u128, const MAX_SRC: u128, const MIN_DST: i8, const MAX_DST: i8> From<RangedU128<MIN_SRC, MAX_SRC>> for RangedI8<MIN_DST, MAX_DST>
Source§fn from(value: RangedU128<MIN_SRC, MAX_SRC>) -> Self
fn from(value: RangedU128<MIN_SRC, MAX_SRC>) -> Self
Source§impl<const MIN_SRC: u128, const MAX_SRC: u128, const MIN_DST: isize, const MAX_DST: isize> From<RangedU128<MIN_SRC, MAX_SRC>> for RangedIsize<MIN_DST, MAX_DST>
impl<const MIN_SRC: u128, const MAX_SRC: u128, const MIN_DST: isize, const MAX_DST: isize> From<RangedU128<MIN_SRC, MAX_SRC>> for RangedIsize<MIN_DST, MAX_DST>
Source§fn from(value: RangedU128<MIN_SRC, MAX_SRC>) -> Self
fn from(value: RangedU128<MIN_SRC, MAX_SRC>) -> Self
Source§impl<const MIN_SRC: u128, const MAX_SRC: u128, const MIN_DST: u16, const MAX_DST: u16> From<RangedU128<MIN_SRC, MAX_SRC>> for RangedU16<MIN_DST, MAX_DST>
impl<const MIN_SRC: u128, const MAX_SRC: u128, const MIN_DST: u16, const MAX_DST: u16> From<RangedU128<MIN_SRC, MAX_SRC>> for RangedU16<MIN_DST, MAX_DST>
Source§fn from(value: RangedU128<MIN_SRC, MAX_SRC>) -> Self
fn from(value: RangedU128<MIN_SRC, MAX_SRC>) -> Self
Source§impl<const MIN_SRC: u128, const MAX_SRC: u128, const MIN_DST: u32, const MAX_DST: u32> From<RangedU128<MIN_SRC, MAX_SRC>> for RangedU32<MIN_DST, MAX_DST>
impl<const MIN_SRC: u128, const MAX_SRC: u128, const MIN_DST: u32, const MAX_DST: u32> From<RangedU128<MIN_SRC, MAX_SRC>> for RangedU32<MIN_DST, MAX_DST>
Source§fn from(value: RangedU128<MIN_SRC, MAX_SRC>) -> Self
fn from(value: RangedU128<MIN_SRC, MAX_SRC>) -> Self
Source§impl<const MIN_SRC: u128, const MAX_SRC: u128, const MIN_DST: u64, const MAX_DST: u64> From<RangedU128<MIN_SRC, MAX_SRC>> for RangedU64<MIN_DST, MAX_DST>
impl<const MIN_SRC: u128, const MAX_SRC: u128, const MIN_DST: u64, const MAX_DST: u64> From<RangedU128<MIN_SRC, MAX_SRC>> for RangedU64<MIN_DST, MAX_DST>
Source§fn from(value: RangedU128<MIN_SRC, MAX_SRC>) -> Self
fn from(value: RangedU128<MIN_SRC, MAX_SRC>) -> Self
Source§impl<const MIN_SRC: u128, const MAX_SRC: u128, const MIN_DST: u8, const MAX_DST: u8> From<RangedU128<MIN_SRC, MAX_SRC>> for RangedU8<MIN_DST, MAX_DST>
impl<const MIN_SRC: u128, const MAX_SRC: u128, const MIN_DST: u8, const MAX_DST: u8> From<RangedU128<MIN_SRC, MAX_SRC>> for RangedU8<MIN_DST, MAX_DST>
Source§fn from(value: RangedU128<MIN_SRC, MAX_SRC>) -> Self
fn from(value: RangedU128<MIN_SRC, MAX_SRC>) -> Self
Source§impl<const MIN_SRC: u128, const MAX_SRC: u128, const MIN_DST: usize, const MAX_DST: usize> From<RangedU128<MIN_SRC, MAX_SRC>> for RangedUsize<MIN_DST, MAX_DST>
impl<const MIN_SRC: u128, const MAX_SRC: u128, const MIN_DST: usize, const MAX_DST: usize> From<RangedU128<MIN_SRC, MAX_SRC>> for RangedUsize<MIN_DST, MAX_DST>
Source§fn from(value: RangedU128<MIN_SRC, MAX_SRC>) -> Self
fn from(value: RangedU128<MIN_SRC, MAX_SRC>) -> Self
Source§impl<const MIN_SRC: u16, const MAX_SRC: u16, const MIN_DST: u128, const MAX_DST: u128> From<RangedU16<MIN_SRC, MAX_SRC>> for RangedU128<MIN_DST, MAX_DST>
impl<const MIN_SRC: u16, const MAX_SRC: u16, const MIN_DST: u128, const MAX_DST: u128> From<RangedU16<MIN_SRC, MAX_SRC>> for RangedU128<MIN_DST, MAX_DST>
Source§impl<const MIN_SRC: u32, const MAX_SRC: u32, const MIN_DST: u128, const MAX_DST: u128> From<RangedU32<MIN_SRC, MAX_SRC>> for RangedU128<MIN_DST, MAX_DST>
impl<const MIN_SRC: u32, const MAX_SRC: u32, const MIN_DST: u128, const MAX_DST: u128> From<RangedU32<MIN_SRC, MAX_SRC>> for RangedU128<MIN_DST, MAX_DST>
Source§impl<const MIN_SRC: u64, const MAX_SRC: u64, const MIN_DST: u128, const MAX_DST: u128> From<RangedU64<MIN_SRC, MAX_SRC>> for RangedU128<MIN_DST, MAX_DST>
impl<const MIN_SRC: u64, const MAX_SRC: u64, const MIN_DST: u128, const MAX_DST: u128> From<RangedU64<MIN_SRC, MAX_SRC>> for RangedU128<MIN_DST, MAX_DST>
Source§impl<const MIN_SRC: u8, const MAX_SRC: u8, const MIN_DST: u128, const MAX_DST: u128> From<RangedU8<MIN_SRC, MAX_SRC>> for RangedU128<MIN_DST, MAX_DST>
impl<const MIN_SRC: u8, const MAX_SRC: u8, const MIN_DST: u128, const MAX_DST: u128> From<RangedU8<MIN_SRC, MAX_SRC>> for RangedU128<MIN_DST, MAX_DST>
Source§impl<const MIN_SRC: usize, const MAX_SRC: usize, const MIN_DST: u128, const MAX_DST: u128> From<RangedUsize<MIN_SRC, MAX_SRC>> for RangedU128<MIN_DST, MAX_DST>
impl<const MIN_SRC: usize, const MAX_SRC: usize, const MIN_DST: u128, const MAX_DST: u128> From<RangedUsize<MIN_SRC, MAX_SRC>> for RangedU128<MIN_DST, MAX_DST>
Source§fn from(value: RangedUsize<MIN_SRC, MAX_SRC>) -> Self
fn from(value: RangedUsize<MIN_SRC, MAX_SRC>) -> Self
Source§impl<const MIN: u128, const MAX: u128> Ord for RangedU128<MIN, MAX>
impl<const MIN: u128, const MAX: u128> Ord for RangedU128<MIN, MAX>
Source§fn cmp(&self, other: &RangedU128<MIN, MAX>) -> Ordering
fn cmp(&self, other: &RangedU128<MIN, MAX>) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl<const MIN_A: u128, const MAX_A: u128, const MIN_B: u128, const MAX_B: u128> PartialEq<RangedU128<MIN_B, MAX_B>> for RangedU128<MIN_A, MAX_A>
impl<const MIN_A: u128, const MAX_A: u128, const MIN_B: u128, const MAX_B: u128> PartialEq<RangedU128<MIN_B, MAX_B>> for RangedU128<MIN_A, MAX_A>
Source§impl<const MIN_A: u128, const MAX_A: u128, const MIN_B: u128, const MAX_B: u128> PartialOrd<RangedU128<MIN_B, MAX_B>> for RangedU128<MIN_A, MAX_A>
impl<const MIN_A: u128, const MAX_A: u128, const MIN_B: u128, const MAX_B: u128> PartialOrd<RangedU128<MIN_B, MAX_B>> for RangedU128<MIN_A, MAX_A>
Source§fn partial_cmp(&self, other: &RangedU128<MIN_B, MAX_B>) -> Option<Ordering>
fn partial_cmp(&self, other: &RangedU128<MIN_B, MAX_B>) -> Option<Ordering>
Source§#[doc(hidden)] fn __chaining_lt(&self, other: &Rhs) -> ControlFlow<bool>
#[doc(hidden)] fn __chaining_lt(&self, other: &Rhs) -> ControlFlow<bool>
partial_ord_chaining_methods
)self == other
, returns ControlFlow::Continue(())
.
Otherwise, returns ControlFlow::Break(self < other)
. Read moreSource§#[doc(hidden)] fn __chaining_le(&self, other: &Rhs) -> ControlFlow<bool>
#[doc(hidden)] fn __chaining_le(&self, other: &Rhs) -> ControlFlow<bool>
partial_ord_chaining_methods
)__chaining_lt
, but for <=
instead of <
.Source§#[doc(hidden)] fn __chaining_gt(&self, other: &Rhs) -> ControlFlow<bool>
#[doc(hidden)] fn __chaining_gt(&self, other: &Rhs) -> ControlFlow<bool>
partial_ord_chaining_methods
)__chaining_lt
, but for >
instead of <
.Source§#[doc(hidden)] fn __chaining_ge(&self, other: &Rhs) -> ControlFlow<bool>
#[doc(hidden)] fn __chaining_ge(&self, other: &Rhs) -> ControlFlow<bool>
partial_ord_chaining_methods
)__chaining_lt
, but for >=
instead of <
.Source§impl<const MIN: u128, const MAX: u128> Serialize for RangedU128<MIN, MAX>
Available on crate feature serde
only.
impl<const MIN: u128, const MAX: u128> Serialize for RangedU128<MIN, MAX>
serde
only.Source§impl<const MIN: u128, const MAX: u128> SmartDisplay for RangedU128<MIN, MAX>
Available on crate feature powerfmt
only.
impl<const MIN: u128, const MAX: u128> SmartDisplay for RangedU128<MIN, MAX>
powerfmt
only.Source§fn metadata(&self, f: FormatterOptions) -> Metadata<'_, Self>
fn metadata(&self, f: FormatterOptions) -> Metadata<'_, Self>
impl<const MIN: u128, const MAX: u128> Copy for RangedU128<MIN, MAX>
Auto Trait Implementations§
impl<const MIN: u128, const MAX: u128> Freeze for RangedU128<MIN, MAX>
impl<const MIN: u128, const MAX: u128> RefUnwindSafe for RangedU128<MIN, MAX>
impl<const MIN: u128, const MAX: u128> Send for RangedU128<MIN, MAX>
impl<const MIN: u128, const MAX: u128> Sync for RangedU128<MIN, MAX>
impl<const MIN: u128, const MAX: u128> Unpin for RangedU128<MIN, MAX>
impl<const MIN: u128, const MAX: u128> UnwindSafe for RangedU128<MIN, MAX>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> SizedTypeProperties for T
impl<T> SizedTypeProperties for T
Source§#[doc(hidden)] const IS_ZST: bool = _
#[doc(hidden)] const IS_ZST: bool = _
sized_type_properties
)Source§#[doc(hidden)] const LAYOUT: Layout = _
#[doc(hidden)] const LAYOUT: Layout = _
sized_type_properties
)Source§#[doc(hidden)] const MAX_SLICE_LEN: usize = _
#[doc(hidden)] const MAX_SLICE_LEN: usize = _
sized_type_properties
)[Self]
. Read more