U24

Struct U24 

Source
pub struct U24(/* private fields */);
Expand description

A 24-bit unsigned integer type.

The U24 type represents a 24-bit unsigned integer. It provides a memory-efficient alternative to u32 when only 24 bits of precision are needed, while offering a much larger range than u16.

This type is particularly suited to applications such as audio processing, graphics, binary file manipulation, embedded systems, or networking protocols where 24-bit unsigned integers are common.

§Range

The valid value range is:

  MIN = 0          // 0
  MAX = 16_777_215 // 2^24 - 1

Arithmetic operations are implemented to match Rust’s standard integer behavior, including overflow and checked variants.

§Memory Layout and Safety

U24 is implemented as a #[repr(transparent)] wrapper around a 4-byte internal representation. Although the logical width is 24 bits, one additional byte is used for alignment and padding control.

This struct:

The layout is verified via compile-time assertions to ensure portability and correctness.

Implementations§

Source§

impl U24

Source

pub const BITS: u32 = 24u32

The size of this integer type in bits

Source

pub const MIN: U24

The smallest value that can be represented by this integer type (0)

Source

pub const MAX: U24

The largest value that can be represented by this integer type (224 − 1).

Source

pub const ZERO: U24

Creates a new U24 with all bits set to zero.

Source

pub const fn as_bits(&self) -> &u32

Returns a reference to the underlying 32-bit representation.

The 24-bit value is stored in the lower 24 bits, with the upper 8 bits guaranteed to be zero. This method provides direct access to the internal bit representation for advanced use cases.

Source

pub const fn to_u32(self) -> u32

Converts the 24-bit unsigned integer to a 32-bit unsigned integer.

This is a zero-extending conversion.

§Returns

The 32-bit unsigned integer representation of this U24.

Source

pub const fn wrapping_from_u32(n: u32) -> Self

Creates a U24 from a 32-bit unsigned integer.

This method truncates the input to 24 bits if it’s outside the valid range.

§Arguments
  • n - The 32-bit unsigned integer to convert.
§Returns

A U24 instance representing the input value (truncated to 24 bits).

Source

pub const fn saturating_from_u32(n: u32) -> Self

Creates a U24 from a 32-bit unsigned integer.

This method saturates the input if it’s outside the valid range.

§Arguments
  • n - The 32-bit unsigned integer to convert.
§Returns

A U24 instance representing the input value (saturated to the valid range).

Source

pub const fn swap_bytes(self) -> Self

Reverses the byte order of the integer.

Source

pub const fn to_le(self) -> Self

Converts self to little endian from the target’s endianness. On little endian this is a no-op. On big endian the bytes are swapped.

Source

pub const fn to_be(self) -> Self

Converts self to big endian from the target’s endianness. On big endian this is a no-op. On little endian the bytes are swapped.

Source

pub const fn to_ne_bytes(self) -> [u8; 3]

Return the memory representation of this integer as a byte array in native byte order. As the target platform’s native endianness is used, portable code should use to_be_bytes or to_le_bytes, as appropriate, instead.

Source

pub const fn to_le_bytes(self) -> [u8; 3]

Create a native endian integer value from its representation as a byte array in little endian.

Source

pub const fn to_be_bytes(self) -> [u8; 3]

Return the memory representation of this integer as a byte array in big-endian (network) byte order.

Source

pub const fn from_ne_bytes(bytes: [u8; 3]) -> Self

Creates a U24 from three bytes in native endian order.

§Arguments
  • bytes - An array of 3 bytes representing the 24-bit unsigned integer.
§Returns

A U24 instance containing the input bytes.

Source

pub const fn from_le_bytes(bytes: [u8; 3]) -> Self

Creates a U24 from three bytes in little-endian order.

§Arguments
  • bytes - An array of 3 bytes representing the 24-bit unsigned integer in little-endian order.
§Returns

A U24 instance containing the input bytes.

Source

pub const fn from_be_bytes(bytes: [u8; 3]) -> Self

Creates a U24 from three bytes in big-endian order.

§Arguments
  • bytes - An array of 3 bytes representing the 24-bit unsigned integer in big-endian order.
§Returns

A U24 instance with the bytes in the correct order.

Source

pub fn checked_add(self, other: Self) -> Option<Self>

Performs checked addition.

§Arguments
  • other - The U24 to add to this value.
§Returns

Some(U24) if the addition was successful, or None if it would overflow.

Source

pub fn checked_sub(self, other: Self) -> Option<Self>

Performs checked subtraction.

§Arguments
  • other - The U24 to subtract from this value.
§Returns

Some(U24) if the subtraction was successful, or None if it would underflow.

Source

pub fn checked_mul(self, other: Self) -> Option<Self>

Performs checked multiplication.

§Arguments
  • other - The U24 to multiply with this value.
§Returns

Some(U24) if the multiplication was successful, or None if it would overflow.

Source

pub fn checked_div(self, other: Self) -> Option<Self>

Performs checked division.

§Arguments
  • other - The U24 to divide this value by.
§Returns

Some(U24) if the division was successful, or None if the divisor is zero.

Source

pub fn checked_rem(self, other: Self) -> Option<Self>

Performs checked integer remainder.

§Arguments
  • other - The U24 to divide this value by.
§Returns

Some(U24) if the remainder operation was successful, or None if the divisor is zero.

Source

pub fn wrapping_add(self, rhs: Self) -> Self

Wrapping (modular) addition. Computes self + rhs, wrapping around at the boundary of the type.

Source

pub fn wrapping_sub(self, rhs: Self) -> Self

Wrapping (modular) subtraction. Computes self - rhs, wrapping around at the boundary of the type.

Source

pub fn wrapping_mul(self, rhs: Self) -> Self

Wrapping (modular) multiplication. Computes self * rhs, wrapping around at the boundary of the type.

Source

pub fn wrapping_div(self, rhs: Self) -> Self

Wrapping (modular) division. Computes self / rhs, wrapping around at the boundary of the type.

§Panics

This function will panic if rhs is 0.

Source

pub fn wrapping_rem(self, rhs: Self) -> Self

Wrapping (modular) remainder. Computes self % rhs, wrapping around at the boundary of the type.

§Panics

This function will panic if rhs is 0.

Source

pub fn saturating_add(self, rhs: Self) -> Self

Saturating integer addition. Computes self + rhs, saturating at the numeric bounds.

Source

pub fn saturating_sub(self, rhs: Self) -> Self

Saturating integer subtraction. Computes self - rhs, saturating at the numeric bounds.

Source

pub const fn saturating_mul(self, rhs: Self) -> Self

Saturating integer multiplication. Computes self * rhs, saturating at the numeric bounds.

Source

pub fn saturating_div(self, rhs: Self) -> Self

Saturating integer division. Computes self / rhs, saturating at the numeric bounds.

§Panics

This function will panic if rhs is 0.

Source

pub fn min(self, other: Self) -> Self

Computes the minimum of self and other.

Source

pub fn max(self, other: Self) -> Self

Computes the maximum of self and other.

Source

pub fn clamp(self, min: Self, max: Self) -> Self

Restricts the value to a certain interval.

Returns max if self is greater than max, and min if self is less than min. Otherwise, returns self.

§Panics

Panics if min > max.

Source

pub const fn from_bytes_le(bytes: U24Bytes) -> Self

Construct a U24 from U24Bytes in little-endian byte order. This is a convenience method for converting from the wire format.

Source

pub const fn from_bytes_be(bytes: U24Bytes) -> Self

Construct a U24 from U24Bytes in big-endian byte order. This is a convenience method for converting from the wire format.

Source

pub const fn to_bytes_le(self) -> U24Bytes

Convert a U24 into U24Bytes in little-endian byte order. This is a convenience method for converting to the wire format.

Source

pub const fn to_bytes_be(self) -> U24Bytes

Convert a U24 into U24Bytes in big-endian byte order. This is a convenience method for converting to the wire format.

Source§

impl U24

Source

pub const fn from_u8(value: u8) -> Self

Creates a U24 from a u8 value.

This conversion is guaranteed to succeed as the source type fits within the 24-bit range.

Source§

impl U24

Source

pub const fn from_u16(value: u16) -> Self

Creates a U24 from a u16 value.

This conversion is guaranteed to succeed as the source type fits within the 24-bit range.

Source§

impl U24

Source

pub const fn from_bool(value: bool) -> Self

Creates a U24 from a bool value.

This conversion is guaranteed to succeed as the source type fits within the 24-bit range.

Source§

impl U24

Source

pub const fn try_from_u32(value: u32) -> Option<Self>

Tries to create a U24 from a u32 value.

Returns Some(U24) if the value fits within the 24-bit unsigned range [0, 16,777,215], or None if the value is out of range.

Source§

impl U24

Source

pub const fn try_from_u64(value: u64) -> Option<Self>

Tries to create a U24 from a u64 value.

Returns Some(U24) if the value fits within the 24-bit unsigned range [0, 16,777,215], or None if the value is out of range.

Source§

impl U24

Source

pub const fn try_from_u128(value: u128) -> Option<Self>

Tries to create a U24 from a u128 value.

Returns Some(U24) if the value fits within the 24-bit unsigned range [0, 16,777,215], or None if the value is out of range.

Source§

impl U24

Source

pub const fn try_from_i32(value: i32) -> Option<Self>

Tries to create a U24 from a i32 value.

Returns Some(U24) if the value fits within the 24-bit unsigned range [0, 16,777,215], or None if the value is out of range.

Source§

impl U24

Source

pub const fn try_from_i64(value: i64) -> Option<Self>

Tries to create a U24 from a i64 value.

Returns Some(U24) if the value fits within the 24-bit unsigned range [0, 16,777,215], or None if the value is out of range.

Source§

impl U24

Source

pub const fn try_from_i128(value: i128) -> Option<Self>

Tries to create a U24 from a i128 value.

Returns Some(U24) if the value fits within the 24-bit unsigned range [0, 16,777,215], or None if the value is out of range.

Trait Implementations§

Source§

impl Add<&U24> for &U24

Source§

type Output = U24

The resulting type after applying the + operator.
Source§

fn add(self, other: &U24) -> U24

Performs the + operation. Read more
Source§

impl Add<&U24> for U24

Source§

type Output = U24

The resulting type after applying the + operator.
Source§

fn add(self, other: &U24) -> Self

Performs the + operation. Read more
Source§

impl Add<U24> for &U24

Source§

type Output = U24

The resulting type after applying the + operator.
Source§

fn add(self, other: U24) -> U24

Performs the + operation. Read more
Source§

impl Add for U24

Source§

type Output = U24

The resulting type after applying the + operator.
Source§

fn add(self, other: U24) -> Self

Performs the + operation. Read more
Source§

impl AddAssign<&U24> for U24

Source§

fn add_assign(&mut self, rhs: &U24)

Performs the += operation. Read more
Source§

impl AddAssign for U24

Source§

fn add_assign(&mut self, rhs: U24)

Performs the += operation. Read more
Source§

impl Binary for U24

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl BitAnd<&U24> for &U24

Source§

type Output = U24

The resulting type after applying the & operator.
Source§

fn bitand(self, other: &U24) -> U24

Performs the & operation. Read more
Source§

impl BitAnd<&U24> for U24

Source§

type Output = U24

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: &U24) -> Self

Performs the & operation. Read more
Source§

impl BitAnd<U24> for &U24

Source§

type Output = U24

The resulting type after applying the & operator.
Source§

fn bitand(self, other: U24) -> U24

Performs the & operation. Read more
Source§

impl BitAnd for U24

Source§

type Output = U24

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: U24) -> Self

Performs the & operation. Read more
Source§

impl BitAndAssign<&U24> for U24

Source§

fn bitand_assign(&mut self, rhs: &U24)

Performs the &= operation. Read more
Source§

impl BitAndAssign for U24

Source§

fn bitand_assign(&mut self, rhs: U24)

Performs the &= operation. Read more
Source§

impl BitOr<&U24> for &U24

Source§

type Output = U24

The resulting type after applying the | operator.
Source§

fn bitor(self, other: &U24) -> U24

Performs the | operation. Read more
Source§

impl BitOr<&U24> for U24

Source§

type Output = U24

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: &U24) -> Self

Performs the | operation. Read more
Source§

impl BitOr<U24> for &U24

Source§

type Output = U24

The resulting type after applying the | operator.
Source§

fn bitor(self, other: U24) -> U24

Performs the | operation. Read more
Source§

impl BitOr for U24

Source§

type Output = U24

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: U24) -> Self

Performs the | operation. Read more
Source§

impl BitOrAssign<&U24> for U24

Source§

fn bitor_assign(&mut self, rhs: &U24)

Performs the |= operation. Read more
Source§

impl BitOrAssign for U24

Source§

fn bitor_assign(&mut self, rhs: U24)

Performs the |= operation. Read more
Source§

impl BitXor<&U24> for &U24

Source§

type Output = U24

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, other: &U24) -> U24

Performs the ^ operation. Read more
Source§

impl BitXor<&U24> for U24

Source§

type Output = U24

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, rhs: &U24) -> Self

Performs the ^ operation. Read more
Source§

impl BitXor<U24> for &U24

Source§

type Output = U24

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, other: U24) -> U24

Performs the ^ operation. Read more
Source§

impl BitXor for U24

Source§

type Output = U24

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, rhs: U24) -> Self

Performs the ^ operation. Read more
Source§

impl BitXorAssign<&U24> for U24

Source§

fn bitxor_assign(&mut self, rhs: &U24)

Performs the ^= operation. Read more
Source§

impl BitXorAssign for U24

Source§

fn bitxor_assign(&mut self, rhs: U24)

Performs the ^= operation. Read more
Source§

impl Clone for U24

Source§

fn clone(&self) -> U24

Returns a duplicate of the value. Read more
1.0.0§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for U24

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for U24

Source§

fn default() -> U24

Returns the “default value” for a type. Read more
Source§

impl Display for U24

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Div<&U24> for &U24

Source§

type Output = U24

The resulting type after applying the / operator.
Source§

fn div(self, other: &U24) -> U24

Performs the / operation. Read more
Source§

impl Div<&U24> for U24

Source§

type Output = U24

The resulting type after applying the / operator.
Source§

fn div(self, other: &U24) -> Self

Performs the / operation. Read more
Source§

impl Div<U24> for &U24

Source§

type Output = U24

The resulting type after applying the / operator.
Source§

fn div(self, other: U24) -> U24

Performs the / operation. Read more
Source§

impl Div for U24

Source§

type Output = U24

The resulting type after applying the / operator.
Source§

fn div(self, other: U24) -> Self

Performs the / operation. Read more
Source§

impl DivAssign<&U24> for U24

Source§

fn div_assign(&mut self, rhs: &U24)

Performs the /= operation. Read more
Source§

impl DivAssign for U24

Source§

fn div_assign(&mut self, rhs: U24)

Performs the /= operation. Read more
Source§

impl From<U24> for u128

Source§

fn from(value: U24) -> Self

Converts to this type from the input type.
Source§

impl From<U24> for u32

Source§

fn from(value: U24) -> Self

Converts to this type from the input type.
Source§

impl From<U24> for u64

Source§

fn from(value: U24) -> Self

Converts to this type from the input type.
Source§

impl From<U24> for usize

Source§

fn from(value: U24) -> Self

Converts to this type from the input type.
Source§

impl From<bool> for U24

Source§

fn from(value: bool) -> Self

Converts to this type from the input type.
Source§

impl From<u16> for U24

Source§

fn from(value: u16) -> Self

Converts to this type from the input type.
Source§

impl From<u8> for U24

Source§

fn from(value: u8) -> Self

Converts to this type from the input type.
Source§

impl FromPrimitive for U24
where LittleEndianU24Repr: FromPrimitive,

Source§

fn from_i64(n: i64) -> Option<Self>

Converts an i64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u64(n: u64) -> Option<Self>

Converts an u64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_isize(n: isize) -> Option<Self>

Converts an isize to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i8(n: i8) -> Option<Self>

Converts an i8 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i16(n: i16) -> Option<Self>

Converts an i16 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i32(n: i32) -> Option<Self>

Converts an i32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i128(n: i128) -> Option<Self>

Converts an i128 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more
Source§

fn from_usize(n: usize) -> Option<Self>

Converts a usize to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u8(n: u8) -> Option<Self>

Converts an u8 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u16(n: u16) -> Option<Self>

Converts an u16 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u32(n: u32) -> Option<Self>

Converts an u32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u128(n: u128) -> Option<Self>

Converts an u128 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more
Source§

fn from_f32(n: f32) -> Option<Self>

Converts a f32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_f64(n: f64) -> Option<Self>

Converts a f64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more
Source§

impl FromStr for U24

Source§

type Err = ParseIntError

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl Hash for U24

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl LowerHex for U24

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Mul<&U24> for &U24

Source§

type Output = U24

The resulting type after applying the * operator.
Source§

fn mul(self, other: &U24) -> U24

Performs the * operation. Read more
Source§

impl Mul<&U24> for U24

Source§

type Output = U24

The resulting type after applying the * operator.
Source§

fn mul(self, other: &U24) -> Self

Performs the * operation. Read more
Source§

impl Mul<U24> for &U24

Source§

type Output = U24

The resulting type after applying the * operator.
Source§

fn mul(self, other: U24) -> U24

Performs the * operation. Read more
Source§

impl Mul for U24

Source§

type Output = U24

The resulting type after applying the * operator.
Source§

fn mul(self, other: U24) -> Self

Performs the * operation. Read more
Source§

impl MulAssign<&U24> for U24

Source§

fn mul_assign(&mut self, rhs: &U24)

Performs the *= operation. Read more
Source§

impl MulAssign for U24

Source§

fn mul_assign(&mut self, rhs: U24)

Performs the *= operation. Read more
Source§

impl Not for &U24

Source§

type Output = U24

The resulting type after applying the ! operator.
Source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
Source§

impl Not for U24

Source§

type Output = U24

The resulting type after applying the ! operator.
Source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
Source§

impl Num for U24

Source§

type FromStrRadixErr = ParseIntError

Source§

fn from_str_radix(str: &str, radix: u32) -> Result<Self, Self::FromStrRadixErr>

Convert from a string and radix (typically 2..=36). Read more
Source§

impl Octal for U24

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl One for U24

Source§

fn one() -> Self

Returns the multiplicative identity element of Self, 1. Read more
Source§

fn set_one(&mut self)

Sets self to the multiplicative identity element of Self, 1.
Source§

fn is_one(&self) -> bool
where Self: PartialEq,

Returns true if self is equal to the multiplicative identity. Read more
Source§

impl Ord for U24

Source§

fn cmp(&self, other: &U24) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for U24

Source§

fn eq(&self, other: &U24) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for U24

Source§

fn partial_cmp(&self, other: &U24) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Rem<&U24> for &U24

Source§

type Output = U24

The resulting type after applying the % operator.
Source§

fn rem(self, other: &U24) -> U24

Performs the % operation. Read more
Source§

impl Rem<&U24> for U24

Source§

type Output = U24

The resulting type after applying the % operator.
Source§

fn rem(self, other: &U24) -> Self

Performs the % operation. Read more
Source§

impl Rem<U24> for &U24

Source§

type Output = U24

The resulting type after applying the % operator.
Source§

fn rem(self, other: U24) -> U24

Performs the % operation. Read more
Source§

impl Rem for U24

Source§

type Output = U24

The resulting type after applying the % operator.
Source§

fn rem(self, other: U24) -> Self

Performs the % operation. Read more
Source§

impl RemAssign<&U24> for U24

Source§

fn rem_assign(&mut self, rhs: &U24)

Performs the %= operation. Read more
Source§

impl RemAssign for U24

Source§

fn rem_assign(&mut self, rhs: U24)

Performs the %= operation. Read more
Source§

impl Shl<u32> for &U24

Source§

type Output = U24

The resulting type after applying the << operator.
Source§

fn shl(self, rhs: u32) -> Self::Output

Performs the << operation. Read more
Source§

impl Shl<u32> for U24

Source§

type Output = U24

The resulting type after applying the << operator.
Source§

fn shl(self, rhs: u32) -> Self::Output

Performs the << operation. Read more
Source§

impl ShlAssign<u32> for U24

Source§

fn shl_assign(&mut self, rhs: u32)

Performs the <<= operation. Read more
Source§

impl Shr<u32> for &U24

Source§

type Output = U24

The resulting type after applying the >> operator.
Source§

fn shr(self, rhs: u32) -> Self::Output

Performs the >> operation. Read more
Source§

impl Shr<u32> for U24

Source§

type Output = U24

The resulting type after applying the >> operator.
Source§

fn shr(self, rhs: u32) -> Self::Output

Performs the >> operation. Read more
Source§

impl ShrAssign<u32> for U24

Source§

fn shr_assign(&mut self, rhs: u32)

Performs the >>= operation. Read more
Source§

impl Sub<&U24> for &U24

Source§

type Output = U24

The resulting type after applying the - operator.
Source§

fn sub(self, other: &U24) -> U24

Performs the - operation. Read more
Source§

impl Sub<&U24> for U24

Source§

type Output = U24

The resulting type after applying the - operator.
Source§

fn sub(self, other: &U24) -> Self

Performs the - operation. Read more
Source§

impl Sub<U24> for &U24

Source§

type Output = U24

The resulting type after applying the - operator.
Source§

fn sub(self, other: U24) -> U24

Performs the - operation. Read more
Source§

impl Sub for U24

Source§

type Output = U24

The resulting type after applying the - operator.
Source§

fn sub(self, other: U24) -> Self

Performs the - operation. Read more
Source§

impl SubAssign<&U24> for U24

Source§

fn sub_assign(&mut self, rhs: &U24)

Performs the -= operation. Read more
Source§

impl SubAssign for U24

Source§

fn sub_assign(&mut self, rhs: U24)

Performs the -= operation. Read more
Source§

impl ToBytes for U24

Source§

type Bytes = [u8; 3]

Source§

fn to_be_bytes(&self) -> Self::Bytes

Return the memory representation of this number as a byte array in big-endian byte order. Read more
Source§

fn to_le_bytes(&self) -> Self::Bytes

Return the memory representation of this number as a byte array in little-endian byte order. Read more
Source§

fn to_ne_bytes(&self) -> Self::Bytes

Return the memory representation of this number as a byte array in native byte order. Read more
Source§

impl ToPrimitive for U24

Source§

fn to_i64(&self) -> Option<i64>

Converts the value of self to an i64. If the value cannot be represented by an i64, then None is returned.
Source§

fn to_u64(&self) -> Option<u64>

Converts the value of self to a u64. If the value cannot be represented by a u64, then None is returned.
Source§

fn to_i32(&self) -> Option<i32>

Converts the value of self to an i32. If the value cannot be represented by an i32, then None is returned.
Source§

fn to_u32(&self) -> Option<u32>

Converts the value of self to a u32. If the value cannot be represented by a u32, then None is returned.
Source§

fn to_isize(&self) -> Option<isize>

Converts the value of self to an isize. If the value cannot be represented by an isize, then None is returned.
Source§

fn to_i8(&self) -> Option<i8>

Converts the value of self to an i8. If the value cannot be represented by an i8, then None is returned.
Source§

fn to_i16(&self) -> Option<i16>

Converts the value of self to an i16. If the value cannot be represented by an i16, then None is returned.
Source§

fn to_i128(&self) -> Option<i128>

Converts the value of self to an i128. If the value cannot be represented by an i128 (i64 under the default implementation), then None is returned. Read more
Source§

fn to_usize(&self) -> Option<usize>

Converts the value of self to a usize. If the value cannot be represented by a usize, then None is returned.
Source§

fn to_u8(&self) -> Option<u8>

Converts the value of self to a u8. If the value cannot be represented by a u8, then None is returned.
Source§

fn to_u16(&self) -> Option<u16>

Converts the value of self to a u16. If the value cannot be represented by a u16, then None is returned.
Source§

fn to_u128(&self) -> Option<u128>

Converts the value of self to a u128. If the value cannot be represented by a u128 (u64 under the default implementation), then None is returned. Read more
Source§

fn to_f32(&self) -> Option<f32>

Converts the value of self to an f32. Overflows may map to positive or negative inifinity, otherwise None is returned if the value cannot be represented by an f32.
Source§

fn to_f64(&self) -> Option<f64>

Converts the value of self to an f64. Overflows may map to positive or negative inifinity, otherwise None is returned if the value cannot be represented by an f64. Read more
Source§

impl TryFrom<i128> for U24

Source§

type Error = <i8 as TryFrom<i64>>::Error

The type returned in the event of a conversion error.
Source§

fn try_from(value: i128) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<i32> for U24

Source§

type Error = <i8 as TryFrom<i64>>::Error

The type returned in the event of a conversion error.
Source§

fn try_from(value: i32) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<i64> for U24

Source§

type Error = <i8 as TryFrom<i64>>::Error

The type returned in the event of a conversion error.
Source§

fn try_from(value: i64) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<u128> for U24

Source§

type Error = <i8 as TryFrom<i64>>::Error

The type returned in the event of a conversion error.
Source§

fn try_from(value: u128) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<u32> for U24

Source§

type Error = <i8 as TryFrom<i64>>::Error

The type returned in the event of a conversion error.
Source§

fn try_from(value: u32) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<u64> for U24

Source§

type Error = <i8 as TryFrom<i64>>::Error

The type returned in the event of a conversion error.
Source§

fn try_from(value: u64) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl UpperHex for U24

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Zero for U24

Source§

fn zero() -> Self

Returns the additive identity element of Self, 0. Read more
Source§

fn is_zero(&self) -> bool

Returns true if self is equal to the additive identity.
Source§

fn set_zero(&mut self)

Sets self to the additive identity element of Self, 0.
Source§

impl Zeroable for U24
where LittleEndianU24Repr: Zeroable,

Source§

fn zeroed() -> Self

Source§

impl Copy for U24

Source§

impl Eq for U24

Source§

impl NoUninit for U24
where LittleEndianU24Repr: NoUninit,

Source§

impl StructuralPartialEq for U24

Auto Trait Implementations§

§

impl Freeze for U24

§

impl RefUnwindSafe for U24

§

impl Send for U24

§

impl Sync for U24

§

impl Unpin for U24

§

impl UnwindSafe for U24

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> CloneToUninit for T
where T: Clone,

§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> NumAssign for T
where T: Num + NumAssignOps,

Source§

impl<T, Rhs> NumAssignOps<Rhs> for T
where T: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs> + RemAssign<Rhs>,

Source§

impl<T> NumAssignRef for T
where T: NumAssign + for<'r> NumAssignOps<&'r T>,

Source§

impl<T, Rhs, Output> NumOps<Rhs, Output> for T
where T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>,

Source§

impl<T> NumRef for T
where T: Num + for<'r> NumOps<&'r T>,

Source§

impl<T, Base> RefNum<Base> for T
where T: NumOps<Base, Base> + for<'r> NumOps<&'r Base, Base>,