pub struct uint24(/* private fields */);Expand description
The 24-bit unsigned integer type stored in big-endian byte order.
Implementations§
Source§impl uint24
impl uint24
Sourcepub const MIN: Self
pub const MIN: Self
The smallest value that can be represented by this integer type.
§Examples
assert_eq!(uint24::MIN, 0);Sourcepub const MAX: Self
pub const MAX: Self
The largest value that can be represented by this integer type (224 − 1).
§Examples
assert_eq!(uint24::MAX, 16_777_215);Sourcepub const fn new(num: u32) -> Option<Self>
pub const fn new(num: u32) -> Option<Self>
Creates a big-endian uint24 from u32.
§Examples
use ttf_view::types::uint24;
assert_eq!(uint24::new(1234).unwrap(), 1234);
assert_eq!(uint24::new(15_000_000).unwrap(), 15_000_000);
assert_eq!(uint24::new(0xFFFFFF).unwrap(), 0xFFFFFF);
assert_eq!(uint24::new(17_000_000), None);
assert_eq!(uint24::new(3_999_000_000), None);Sourcepub const unsafe fn new_unchecked(num: u32) -> Self
pub const unsafe fn new_unchecked(num: u32) -> Self
Sourcepub const fn from_be_bytes(bytes: [u8; 3]) -> Self
pub const fn from_be_bytes(bytes: [u8; 3]) -> Self
Sourcepub const fn to_be_bytes(self) -> [u8; 3]
pub const fn to_be_bytes(self) -> [u8; 3]
Trait Implementations§
impl Copy for uint24
impl Eq for uint24
Source§impl Ord for uint24
impl Ord for uint24
1.21.0 (const: unstable) · 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
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for uint24
impl PartialOrd for uint24
Source§impl PartialOrd<u32> for uint24
impl PartialOrd<u32> for uint24
impl StructuralPartialEq for uint24
Auto Trait Implementations§
impl Freeze for uint24
impl RefUnwindSafe for uint24
impl Send for uint24
impl Sync for uint24
impl Unpin for uint24
impl UnsafeUnpin for uint24
impl UnwindSafe for uint24
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