Struct etwin_core::core::IntPercentage
source · pub struct IntPercentage(_);
Expand description
A percentage value between 0 and 100 (inclusive) supporting only integer values.
Implementations§
source§impl IntPercentage
impl IntPercentage
sourcepub fn new(n: u8) -> Result<Self, IntPercentageRangeError>
pub fn new(n: u8) -> Result<Self, IntPercentageRangeError>
Constructs the integer if the given value matches the bounds
sourcepub const unsafe fn new_unchecked(n: u8) -> Self
pub const unsafe fn new_unchecked(n: u8) -> Self
Constructs the value without checking its bounds
Safety
The caller must ensure that the argument is contained in the bounds.
sourcepub fn from_u64(n: u64) -> Result<Self, IntPercentageRangeError>
pub fn from_u64(n: u64) -> Result<Self, IntPercentageRangeError>
Constructs the integer from an u64 if the given value matches the bounds
sourcepub fn from_i64(n: i64) -> Result<Self, IntPercentageRangeError>
pub fn from_i64(n: i64) -> Result<Self, IntPercentageRangeError>
Constructs the integer from an i64 if the given value matches the bounds
Trait Implementations§
source§impl Clone for IntPercentage
impl Clone for IntPercentage
source§fn clone(&self) -> IntPercentage
fn clone(&self) -> IntPercentage
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 IntPercentage
impl Debug for IntPercentage
source§impl Display for IntPercentage
impl Display for IntPercentage
source§impl Hash for IntPercentage
impl Hash for IntPercentage
source§impl Ord for IntPercentage
impl Ord for IntPercentage
source§fn cmp(&self, other: &IntPercentage) -> Ordering
fn cmp(&self, other: &IntPercentage) -> 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<IntPercentage> for IntPercentage
impl PartialEq<IntPercentage> for IntPercentage
source§fn eq(&self, other: &IntPercentage) -> bool
fn eq(&self, other: &IntPercentage) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<IntPercentage> for IntPercentage
impl PartialOrd<IntPercentage> for IntPercentage
source§fn partial_cmp(&self, other: &IntPercentage) -> Option<Ordering>
fn partial_cmp(&self, other: &IntPercentage) -> 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 more