From 763820676b80645032209b1158f9002f82a52bf6 Mon Sep 17 00:00:00 2001 From: Trevor Spiteri Date: Tue, 20 Apr 2021 17:26:44 +0200 Subject: [PATCH] add "see also" for trait comments --- src/traits.rs | 777 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 775 insertions(+), 2 deletions(-) diff --git a/src/traits.rs b/src/traits.rs index 83cb490..cb756ce 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -295,94 +295,169 @@ where /// The number of fractional bits. /// - /// <F as [Fixed]>::Frac::[U32] is equivalent to - /// <F as [Fixed]>::[FRAC_NBITS][Fixed::FRAC_NBITS]. + /// \::Frac::[U32] is equivalent to \::[FRAC\_NBITS]. /// /// [U32]: crate::types::extra::Unsigned::U32 + /// [FRAC\_NBITS]: Fixed::FRAC_NBITS type Frac: Unsigned; /// Zero. + /// + /// See also FixedI32::[ZERO][FixedI32::ZERO] and + /// FixedU32::[ZERO][FixedU32::ZERO]. const ZERO: Self; /// The difference between any two successive representable numbers, Δ. + /// + /// See also FixedI32::[DELTA][FixedI32::DELTA] and + /// FixedU32::[DELTA][FixedU32::DELTA]. const DELTA: Self; /// The smallest value that can be represented. + /// + /// See also FixedI32::[MIN][FixedI32::MIN] and + /// FixedU32::[MIN][FixedU32::MIN]. const MIN: Self; /// The largest value that can be represented. + /// + /// See also FixedI32::[MAX][FixedI32::MAX] and + /// FixedU32::[MAX][FixedU32::MAX]. const MAX: Self; /// [`true`] if the type is signed. + /// + /// See also FixedI32::[IS_SIGNED][FixedI32::IS_SIGNED] and + /// FixedU32::[IS_SIGNED][FixedU32::IS_SIGNED]. const IS_SIGNED: bool; /// The number of integer bits. + /// + /// See also FixedI32::[INT_NBITS][FixedI32::INT_NBITS] and + /// FixedU32::[INT_NBITS][FixedU32::INT_NBITS]. const INT_NBITS: u32; /// The number of fractional bits. + /// + /// See also FixedI32::[FRAC_NBITS][FixedI32::FRAC_NBITS] and + /// FixedU32::[FRAC_NBITS][FixedU32::FRAC_NBITS]. const FRAC_NBITS: u32; /// Creates a fixed-point number that has a bitwise representation /// identical to the given integer. + /// + /// See also FixedI32::[from\_bits][FixedI32::from_bits] and + /// FixedU32::[from\_bits][FixedU32::from_bits]. fn from_bits(bits: Self::Bits) -> Self; /// Creates an integer that has a bitwise representation identical /// to the given fixed-point number. + /// + /// See also FixedI32::[to\_bits][FixedI32::to_bits] and + /// FixedU32::[to\_bits][FixedU32::to_bits]. fn to_bits(self) -> Self::Bits; /// Converts a fixed-point number from big endian to the target’s endianness. + /// + /// See also FixedI32::[from\_be][FixedI32::from_be] and + /// FixedU32::[from\_be][FixedU32::from_be]. fn from_be(fixed: Self) -> Self; /// Converts a fixed-point number from little endian to the target’s endianness. + /// + /// See also FixedI32::[from\_le][FixedI32::from_le] and + /// FixedU32::[from\_le][FixedU32::from_le]. fn from_le(fixed: Self) -> Self; /// Converts this fixed-point number to big endian from the target’s endianness. + /// + /// See also FixedI32::[to\_be][FixedI32::to_be] and + /// FixedU32::[to\_be][FixedU32::to_be]. fn to_be(self) -> Self; /// Converts this fixed-point number to little endian from the target’s endianness. + /// + /// See also FixedI32::[to\_le][FixedI32::to_le] and + /// FixedU32::[to\_le][FixedU32::to_le]. fn to_le(self) -> Self; ///Reverses the byte order of the fixed-point number. + /// + /// See also FixedI32::[swap\_bytes][FixedI32::swap_bytes] and + /// FixedU32::[swap\_bytes][FixedU32::swap_bytes]. fn swap_bytes(self) -> Self; /// Creates a fixed-point number from its representation as a byte /// array in big endian. + /// + /// See also + /// FixedI32::[from\_be\_bytes][FixedI32::from_be_bytes] and + /// FixedU32::[from\_be\_bytes][FixedU32::from_be_bytes]. fn from_be_bytes(bytes: Self::Bytes) -> Self; /// Creates a fixed-point number from its representation as a byte /// array in little endian. + /// + /// See also + /// FixedI32::[from\_le\_bytes][FixedI32::from_le_bytes] and + /// FixedU32::[from\_le\_bytes][FixedU32::from_le_bytes]. fn from_le_bytes(bytes: Self::Bytes) -> Self; /// Creates a fixed-point number from its representation as a byte /// array in native endian. + /// + /// See also + /// FixedI32::[from\_ne\_bytes][FixedI32::from_ne_bytes] and + /// FixedU32::[from\_ne\_bytes][FixedU32::from_ne_bytes]. fn from_ne_bytes(bytes: Self::Bytes) -> Self; /// Returns the memory representation of this fixed-point number /// as a byte array in big-endian byte order. + /// + /// See also FixedI32::[to\_be\_bytes][FixedI32::to_be_bytes] + /// and FixedU32::[to\_be\_bytes][FixedU32::to_be_bytes]. fn to_be_bytes(self) -> Self::Bytes; /// Returns the memory representation of this fixed-point number /// as a byte array in little-endian byte order. + /// + /// See also FixedI32::[to\_le\_bytes][FixedI32::to_le_bytes] + /// and FixedU32::[to\_le\_bytes][FixedU32::to_le_bytes]. fn to_le_bytes(self) -> Self::Bytes; /// Returns the memory representation of this fixed-point number /// as a byte array in native byte order. + /// + /// See also FixedI32::[to\_ne\_bytes][FixedI32::to_ne_bytes] + /// and FixedU32::[to\_ne\_bytes][FixedU32::to_ne_bytes]. fn to_ne_bytes(self) -> Self::Bytes; /// Creates a fixed-point number from another number. /// /// Returns the same value as [`src.to_fixed()`][ToFixed::to_fixed]. + /// + /// See also FixedI32::[from\_num][FixedI32::from_num] and + /// FixedU32::[from\_num][FixedU32::from_num]. fn from_num(src: Src) -> Self; /// Converts a fixed-point number to another number. /// /// Returns the same value as [`Dst::from_fixed(self)`][FromFixed::from_fixed]. + /// + /// See also FixedI32::[to\_num][FixedI32::to_num] and + /// FixedU32::[to\_num][FixedU32::to_num]. fn to_num(self) -> Dst; /// Creates a fixed-point number from another number if it fits, /// otherwise returns [`None`]. /// /// Returns the same value as [`src.checked_to_fixed()`][ToFixed::checked_to_fixed]. + /// + /// See also + /// FixedI32::[checked\_from\_num][FixedI32::checked_from_num] + /// and + /// FixedU32::[checked\_from\_num][FixedU32::checked_from_num]. fn checked_from_num(src: Src) -> Option; /// Converts a fixed-point number to another number if it fits, @@ -390,12 +465,21 @@ where /// /// Returns the same value as /// [`Dst::checked_from_fixed(self)`][FromFixed::checked_from_fixed]. + /// + /// See also + /// FixedI32::[checked\_to\_num][FixedI32::checked_to_num] and + /// FixedU32::[checked\_to\_num][FixedU32::checked_to_num]. fn checked_to_num(self) -> Option; /// Creates a fixed-point number from another number, saturating the /// value if it does not fit. /// /// Returns the same value as [`src.saturating_to_fixed()`][ToFixed::saturating_to_fixed]. + /// + /// See also + /// FixedI32::[saturating\_from\_num][FixedI32::saturating_from_num] + /// and + /// FixedU32::[saturating\_from\_num][FixedU32::saturating_from_num]. fn saturating_from_num(src: Src) -> Self; /// Converts a fixed-point number to another number, saturating the @@ -403,12 +487,22 @@ where /// /// Returns the same value as /// [`Dst::saturating_from_fixed(self)`][FromFixed::saturating_from_fixed]. + /// + /// See also + /// FixedI32::[saturating\_to\_num][FixedI32::saturating_to_num] + /// and + /// FixedU32::[saturating\_to\_num][FixedU32::saturating_to_num]. fn saturating_to_num(self) -> Dst; /// Creates a fixed-point number from another number, wrapping the /// value on overflow. /// /// Returns the same value as [`src.wrapping_to_fixed()`][ToFixed::wrapping_to_fixed]. + /// + /// See also + /// FixedI32::[wrapping\_from\_num][FixedI32::wrapping_from_num] + /// and + /// FixedU32::[wrapping\_from\_num][FixedU32::wrapping_from_num]. fn wrapping_from_num(src: Src) -> Self; /// Converts a fixed-point number to another number, wrapping the @@ -416,10 +510,20 @@ where /// /// Returns the same value as /// [`Src::wrapping_from_fixed(self)`][FromFixed::wrapping_from_fixed]. + /// + /// See also + /// FixedI32::[wrapping\_to\_num][FixedI32::wrapping_to_num] + /// and + /// FixedU32::[wrapping\_to\_num][FixedU32::wrapping_to_num]. fn wrapping_to_num(self) -> Dst; /// Creates a fixed-point number from another number, panicking on overflow. /// + /// See also + /// FixedI32::[unwrapped\_from\_num][FixedI32::unwrapped_from_num] + /// and + /// FixedU32::[unwrapped\_from\_num][FixedU32::unwrapped_from_num]. + /// /// # Panics /// /// Panics if the value does not fit. @@ -428,6 +532,11 @@ where /// Converts a fixed-point number to another number, panicking on overflow. /// + /// See also + /// FixedI32::[unwrapped\_to\_num][FixedI32::unwrapped_to_num] + /// and + /// FixedU32::[unwrapped\_to\_num][FixedU32::unwrapped_to_num]. + /// /// # Panics /// /// Panics if the value does not fit. @@ -437,75 +546,137 @@ where /// Creates a fixed-point number from another number. /// /// Returns the same value as [`src.overflowing_to_fixed()`][ToFixed::overflowing_to_fixed]. + /// + /// See also + /// FixedI32::[overflowing\_from\_num][FixedI32::overflowing_from_num] + /// and + /// FixedU32::[overflowing\_from\_num][FixedU32::overflowing_from_num]. fn overflowing_from_num(src: Src) -> (Self, bool); /// Converts a fixed-point number to another number. /// /// Returns the same value as /// [`Dst::overflowing_from_fixed(self)`][FromFixed::overflowing_from_fixed]. + /// + /// See also + /// FixedI32::[overflowing\_to\_num][FixedI32::overflowing_to_num] + /// and + /// FixedU32::[overflowing\_to\_num][FixedU32::overflowing_to_num]. fn overflowing_to_num(self) -> (Dst, bool); /// Parses a string slice containing binary digits to return a fixed-point number. /// /// Rounding is to the nearest, with ties rounded to even. + /// + /// See also + /// FixedI32::[from\_str\_binary][FixedI32::from_str_binary] + /// and + /// FixedU32::[from\_str\_binary][FixedU32::from_str_binary]. fn from_str_binary(src: &str) -> Result; /// Parses a string slice containing octal digits to return a fixed-point number. /// /// Rounding is to the nearest, with ties rounded to even. + /// + /// See also + /// FixedI32::[from\_str\_octal][FixedI32::from_str_octal] and + /// FixedU32::[from\_str\_octal][FixedU32::from_str_octal]. fn from_str_octal(src: &str) -> Result; /// Parses a string slice containing hexadecimal digits to return a fixed-point number. /// /// Rounding is to the nearest, with ties rounded to even. + /// + /// See also FixedI32::[from\_str\_hex][FixedI32::from_str_hex] + /// and FixedU32::[from\_str\_hex][FixedU32::from_str_hex]. fn from_str_hex(src: &str) -> Result; /// Parses a string slice containing decimal digits to return a /// fixed-point number, saturating on overflow. /// /// Rounding is to the nearest, with ties rounded to even. + /// + /// See also + /// FixedI32::[saturating\_from\_str][FixedI32::saturating_from_str] + /// and + /// FixedU32::[saturating\_from\_str][FixedU32::saturating_from_str]. fn saturating_from_str(src: &str) -> Result; /// Parses a string slice containing binary digits to return a /// fixed-point number, saturating on overflow. /// /// Rounding is to the nearest, with ties rounded to even. + /// + /// See also + /// FixedI32::[saturating\_from\_str\_binary][FixedI32::saturating_from_str_binary] + /// and + /// FixedU32::[saturating\_from\_str\_binary][FixedU32::saturating_from_str_binary]. fn saturating_from_str_binary(src: &str) -> Result; /// Parses a string slice containing octal digits to return a /// fixed-point number, saturating on overflow. /// /// Rounding is to the nearest, with ties rounded to even. + /// + /// See also + /// FixedI32::[saturating\_from\_str\_octal][FixedI32::saturating_from_str_octal] + /// and + /// FixedU32::[saturating\_from\_str\_octal][FixedU32::saturating_from_str_octal]. fn saturating_from_str_octal(src: &str) -> Result; /// Parses a string slice containing hexadecimal digits to return a /// fixed-point number, saturating on overflow. /// /// Rounding is to the nearest, with ties rounded to even. + /// + /// See also + /// FixedI32::[saturating\_from\_str\_hex][FixedI32::saturating_from_str_hex] + /// and + /// FixedU32::[saturating\_from\_str\_hex][FixedU32::saturating_from_str_hex]. fn saturating_from_str_hex(src: &str) -> Result; /// Parses a string slice containing decimal digits to return a /// fixed-point number, wrapping on overflow. /// /// Rounding is to the nearest, with ties rounded to even. + /// + /// See also + /// FixedI32::[wrapping\_from\_str][FixedI32::wrapping_from_str] + /// and + /// FixedU32::[wrapping\_from\_str][FixedU32::wrapping_from_str]. fn wrapping_from_str(src: &str) -> Result; /// Parses a string slice containing binary digits to return a /// fixed-point number, wrapping on overflow. /// /// Rounding is to the nearest, with ties rounded to even. + /// + /// See also + /// FixedI32::[wrapping\_from\_str\_binary][FixedI32::wrapping_from_str_binary] + /// and + /// FixedU32::[wrapping\_from\_str\_binary][FixedU32::wrapping_from_str_binary]. fn wrapping_from_str_binary(src: &str) -> Result; /// Parses a string slice containing octal digits to return a /// fixed-point number, wrapping on overflow. /// /// Rounding is to the nearest, with ties rounded to even. + /// + /// See also + /// FixedI32::[wrapping\_from\_str\_octal][FixedI32::wrapping_from_str_octal] + /// and + /// FixedU32::[wrapping\_from\_str\_octal][FixedU32::wrapping_from_str_octal]. fn wrapping_from_str_octal(src: &str) -> Result; /// Parses a string slice containing hexadecimal digits to return a /// fixed-point number, wrapping on overflow. /// /// Rounding is to the nearest, with ties rounded to even. + /// + /// See also + /// FixedI32::[wrapping\_from\_str\_hex][FixedI32::wrapping_from_str_hex] + /// and + /// FixedU32::[wrapping\_from\_str\_hex][FixedU32::wrapping_from_str_hex]. fn wrapping_from_str_hex(src: &str) -> Result; /// Parses a string slice containing decimal digits to return a @@ -516,6 +687,11 @@ where /// wrapped value is returned. /// /// Rounding is to the nearest, with ties rounded to even. + /// + /// See also + /// FixedI32::[overflowing\_from\_str][FixedI32::overflowing_from_str] + /// and + /// FixedU32::[overflowing\_from\_str][FixedU32::overflowing_from_str]. fn overflowing_from_str(src: &str) -> Result<(Self, bool), ParseFixedError>; /// Parses a string slice containing binary digits to return a @@ -526,6 +702,11 @@ where /// wrapped value is returned. /// /// Rounding is to the nearest, with ties rounded to even. + /// + /// See also + /// FixedI32::[overflowing\_from\_str\_binary][FixedI32::overflowing_from_str_binary] + /// and + /// FixedU32::[overflowing\_from\_str\_binary][FixedU32::overflowing_from_str_binary]. fn overflowing_from_str_binary(src: &str) -> Result<(Self, bool), ParseFixedError>; /// Parses a string slice containing octal digits to return a @@ -536,6 +717,11 @@ where /// wrapped value is returned. /// /// Rounding is to the nearest, with ties rounded to even. + /// + /// See also + /// FixedI32::[overflowing\_from\_str\_octal][FixedI32::overflowing_from_str_octal] + /// and + /// FixedU32::[overflowing\_from\_str\_octal][FixedU32::overflowing_from_str_octal]. fn overflowing_from_str_octal(src: &str) -> Result<(Self, bool), ParseFixedError>; /// Parses a string slice containing hexadecimal digits to return a @@ -546,80 +732,165 @@ where /// wrapped value is returned. /// /// Rounding is to the nearest, with ties rounded to even. + /// + /// See also + /// FixedI32::[overflowing\_from\_str\_hex][FixedI32::overflowing_from_str_hex] + /// and + /// FixedU32::[overflowing\_from\_str\_hex][FixedU32::overflowing_from_str_hex]. fn overflowing_from_str_hex(src: &str) -> Result<(Self, bool), ParseFixedError>; /// Returns the integer part. + /// + /// See also FixedI32::[int][FixedI32::int] and + /// FixedU32::[int][FixedU32::int]. fn int(self) -> Self; /// Returns the fractional part. + /// + /// See also FixedI32::[frac][FixedI32::frac] and + /// FixedU32::[frac][FixedU32::frac]. fn frac(self) -> Self; /// Rounds to the next integer towards 0. + /// + /// See also + /// FixedI32::[round\_to\_zero][FixedI32::round_to_zero] and + /// FixedU32::[round\_to\_zero][FixedU32::round_to_zero]. fn round_to_zero(self) -> Self; /// Rounds to the next integer towards +∞. + /// + /// See also FixedI32::[ceil][FixedI32::ceil] and + /// FixedU32::[ceil][FixedU32::ceil]. fn ceil(self) -> Self; /// Rounds to the next integer towards −∞. + /// + /// See also FixedI32::[floor][FixedI32::floor] and + /// FixedU32::[floor][FixedU32::floor]. fn floor(self) -> Self; /// Rounds to the nearest integer, with ties rounded away from zero. + /// + /// See also FixedI32::[round][FixedI32::round] and + /// FixedU32::[round][FixedU32::round]. fn round(self) -> Self; /// Rounds to the nearest integer, with ties rounded to even. + /// + /// See also + /// FixedI32::[round\_ties\_to\_even][FixedI32::round_ties_to_even] + /// and + /// FixedU32::[round\_ties\_to\_even][FixedU32::round_ties_to_even]. fn round_ties_to_even(self) -> Self; /// Checked ceil. Rounds to the next integer towards +∞, returning /// [`None`] on overflow. + /// + /// See also FixedI32::[checked\_ceil][FixedI32::checked_ceil] + /// and FixedU32::[checked\_ceil][FixedU32::checked_ceil]. fn checked_ceil(self) -> Option; /// Checked floor. Rounds to the next integer towards −∞, returning /// [`None`] on overflow. + /// + /// See also + /// FixedI32::[checked\_floor][FixedI32::checked_floor] and + /// FixedU32::[checked\_floor][FixedU32::checked_floor]. fn checked_floor(self) -> Option; /// Checked round. Rounds to the nearest integer, with ties /// rounded away from zero, returning [`None`] on overflow. + /// + /// See also + /// FixedI32::[checked\_round][FixedI32::checked_round] and + /// FixedU32::[checked\_round][FixedU32::checked_round]. fn checked_round(self) -> Option; /// Checked round. Rounds to the nearest integer, with ties /// rounded to even, returning [`None`] on overflow. + /// + /// See also + /// FixedI32::[checked\_round\_ties\_to\_even][FixedI32::checked_round_ties_to_even] + /// and + /// FixedU32::[checked\_round\_ties\_to\_even][FixedU32::checked_round_ties_to_even]. fn checked_round_ties_to_even(self) -> Option; /// Saturating ceil. Rounds to the next integer towards +∞, /// saturating on overflow. + /// + /// See also + /// FixedI32::[saturating\_ceil][FixedI32::saturating_ceil] and + /// FixedU32::[saturating\_ceil][FixedU32::saturating_ceil]. fn saturating_ceil(self) -> Self; /// Saturating floor. Rounds to the next integer towards −∞, /// saturating on overflow. + /// + /// See also + /// FixedI32::[saturating\_floor][FixedI32::saturating_floor] + /// and + /// FixedU32::[saturating\_floor][FixedU32::saturating_floor]. fn saturating_floor(self) -> Self; /// Saturating round. Rounds to the nearest integer, with ties /// rounded away from zero, and saturating on overflow. + /// + /// See also + /// FixedI32::[saturating\_round][FixedI32::saturating_round] + /// and + /// FixedU32::[saturating\_round][FixedU32::saturating_round]. fn saturating_round(self) -> Self; /// Saturating round. Rounds to the nearest integer, with ties /// rounded to_even, and saturating on overflow. + /// + /// See also + /// FixedI32::[saturating\_round\_ties\_to\_even][FixedI32::saturating_round_ties_to_even] + /// and + /// FixedU32::[saturating\_round\_ties\_to\_even][FixedU32::saturating_round_ties_to_even]. fn saturating_round_ties_to_even(self) -> Self; /// Wrapping ceil. Rounds to the next integer towards +∞, wrapping /// on overflow. + /// + /// See also + /// FixedI32::[wrapping\_ceil][FixedI32::wrapping_ceil] and + /// FixedU32::[wrapping\_ceil][FixedU32::wrapping_ceil]. fn wrapping_ceil(self) -> Self; /// Wrapping floor. Rounds to the next integer towards −∞, /// wrapping on overflow. + /// + /// See also + /// FixedI32::[wrapping\_floor][FixedI32::wrapping_floor] and + /// FixedU32::[wrapping\_floor][FixedU32::wrapping_floor]. fn wrapping_floor(self) -> Self; /// Wrapping round. Rounds to the next integer to the nearest, /// with ties rounded away from zero, and wrapping on overflow. + /// + /// See also + /// FixedI32::[wrapping\_round][FixedI32::wrapping_round] and + /// FixedU32::[wrapping\_round][FixedU32::wrapping_round]. fn wrapping_round(self) -> Self; /// Wrapping round. Rounds to the next integer to the nearest, /// with ties rounded to even, and wrapping on overflow. + /// + /// See also + /// FixedI32::[wrapping\_round\_ties\_to\_even][FixedI32::wrapping_round_ties_to_even] + /// and + /// FixedU32::[wrapping\_round\_ties\_to\_even][FixedU32::wrapping_round_ties_to_even]. fn wrapping_round_ties_to_even(self) -> Self; /// Unwrapped ceil. Rounds to the next integer towards +∞, /// panicking on overflow. /// + /// See also + /// FixedI32::[unwrapped\_ceil][FixedI32::unwrapped_ceil] and + /// FixedU32::[unwrapped\_ceil][FixedU32::unwrapped_ceil]. + /// /// # Panics /// /// Panics if the result does not fit. @@ -629,6 +900,10 @@ where /// Unwrapped floor. Rounds to the next integer towards −∞, /// panicking on overflow. /// + /// See also + /// FixedI32::[unwrapped\_floor][FixedI32::unwrapped_floor] and + /// FixedU32::[unwrapped\_floor][FixedU32::unwrapped_floor]. + /// /// # Panics /// /// Panics if the result does not fit. @@ -638,6 +913,10 @@ where /// Unwrapped round. Rounds to the next integer to the nearest, /// with ties rounded away from zero, and panicking on overflow. /// + /// See also + /// FixedI32::[unwrapped\_round][FixedI32::unwrapped_round] and + /// FixedU32::[unwrapped\_round][FixedU32::unwrapped_round]. + /// /// # Panics /// /// Panics if the result does not fit. @@ -647,6 +926,11 @@ where /// Unwrapped round. Rounds to the next integer to the nearest, /// with ties rounded to even, and panicking on overflow. /// + /// See also + /// FixedI32::[unwrapped\_round\_ties\_to\_even][FixedI32::unwrapped_round_ties_to_even] + /// and + /// FixedU32::[unwrapped\_round\_ties\_to\_even][FixedU32::unwrapped_round_ties_to_even]. + /// /// # Panics /// /// Panics if the result does not fit. @@ -658,6 +942,11 @@ where /// Returns a [tuple] of the fixed-point number and a [`bool`], /// indicating whether an overflow has occurred. On overflow, the /// wrapped value is returned. + /// + /// See also + /// FixedI32::[overflowing\_ceil][FixedI32::overflowing_ceil] + /// and + /// FixedU32::[overflowing\_ceil][FixedU32::overflowing_ceil]. fn overflowing_ceil(self) -> (Self, bool); /// Overflowing floor. Rounds to the next integer towards −∞. @@ -665,6 +954,11 @@ where /// Returns a [tuple] of the fixed-point number and a [`bool`], /// indicating whether an overflow has occurred. On overflow, the /// wrapped value is returned. + /// + /// See also + /// FixedI32::[overflowing\_floor][FixedI32::overflowing_floor] + /// and + /// FixedU32::[overflowing\_floor][FixedU32::overflowing_floor]. fn overflowing_floor(self) -> (Self, bool); /// Overflowing round. Rounds to the next integer to the nearest, @@ -673,6 +967,11 @@ where /// Returns a [tuple] of the fixed-point number and a [`bool`], /// indicating whether an overflow has occurred. On overflow, the /// wrapped value is returned. + /// + /// See also + /// FixedI32::[overflowing\_round][FixedI32::overflowing_round] + /// and + /// FixedU32::[overflowing\_round][FixedU32::overflowing_round]. fn overflowing_round(self) -> (Self, bool); /// Overflowing round. Rounds to the next integer to the nearest, @@ -681,28 +980,57 @@ where /// Returns a [tuple] of the fixed-point number and a [`bool`], /// indicating whether an overflow has occurred. On overflow, the /// wrapped value is returned. + /// + /// See also + /// FixedI32::[overflowing\_round\_ties\_to\_even][FixedI32::overflowing_round_ties_to_even] + /// and + /// FixedU32::[overflowing\_round\_ties\_to\_even][FixedU32::overflowing_round_ties_to_even]. fn overflowing_round_ties_to_even(self) -> (Self, bool); /// Returns the number of ones in the binary representation. + /// + /// See also FixedI32::[count\_ones][FixedI32::count_ones] and + /// FixedU32::[count\_ones][FixedU32::count_ones]. fn count_ones(self) -> u32; /// Returns the number of zeros in the binary representation. + /// + /// See also FixedI32::[count\_zeros][FixedI32::count_zeros] + /// and FixedU32::[count\_zeros][FixedU32::count_zeros]. fn count_zeros(self) -> u32; /// Returns the number of leading ones in the binary representation. + /// + /// See also FixedI32::[leading\_ones][FixedI32::leading_ones] + /// and FixedU32::[leading\_ones][FixedU32::leading_ones]. fn leading_ones(self) -> u32; /// Returns the number of leading zeros in the binary representation. + /// + /// See also + /// FixedI32::[leading\_zeros][FixedI32::leading_zeros] and + /// FixedU32::[leading\_zeros][FixedU32::leading_zeros]. fn leading_zeros(self) -> u32; /// Returns the number of trailing ones in the binary representation. + /// + /// See also + /// FixedI32::[trailing\_ones][FixedI32::trailing_ones] and + /// FixedU32::[trailing\_ones][FixedU32::trailing_ones]. fn trailing_ones(self) -> u32; /// Returns the number of trailing zeros in the binary representation. + /// + /// See also + /// FixedI32::[trailing\_zeros][FixedI32::trailing_zeros] and + /// FixedU32::[trailing\_zeros][FixedU32::trailing_zeros]. fn trailing_zeros(self) -> u32; /// Integer base-2 logarithm, rounded down. /// + /// See also FixedI32::[int\_log2][FixedI32::int_log2] and + /// FixedU32::[int\_log2][FixedU32::int_log2]. + /// /// # Panics /// /// Panics if the fixed-point number is ≤ 0. @@ -710,6 +1038,9 @@ where /// Integer base-10 logarithm, rounded down. /// + /// See also FixedI32::[int\_log10][FixedI32::int_log10] and + /// FixedU32::[int\_log10][FixedU32::int_log10]. + /// /// # Panics /// /// Panics if the fixed-point number is ≤ 0. @@ -717,30 +1048,55 @@ where /// Checked integer base-2 logarithm, rounded down. Returns the /// logarithm or [`None`] if the fixed-point number is ≤ 0. + /// + /// See also + /// FixedI32::[checked\_int\_log2][FixedI32::checked_int_log2] + /// and + /// FixedU32::[checked\_int\_log2][FixedU32::checked_int_log2]. fn checked_int_log2(self) -> Option; /// Checked integer base-10 logarithm, rounded down. Returns the /// logarithm or [`None`] if the fixed-point number is ≤ 0. + /// + /// See also + /// FixedI32::[checked\_int\_log10][FixedI32::checked_int_log10] + /// and + /// FixedU32::[checked\_int\_log10][FixedU32::checked_int_log10]. fn checked_int_log10(self) -> Option; /// Reverses the order of the bits of the fixed-point number. + /// + /// See also FixedI32::[reverse\_bits][FixedI32::reverse_bits] + /// and FixedU32::[reverse\_bits][FixedU32::reverse_bits]. #[must_use = "this returns the result of the operation, without modifying the original"] fn reverse_bits(self) -> Self; /// Shifts to the left by `n` bits, wrapping the truncated bits to the right end. + /// + /// See also FixedI32::[rotate\_left][FixedI32::rotate_left] + /// and FixedU32::[rotate\_left][FixedU32::rotate_left]. #[must_use = "this returns the result of the operation, without modifying the original"] fn rotate_left(self, n: u32) -> Self; /// Shifts to the right by `n` bits, wrapping the truncated bits to the left end. + /// + /// See also FixedI32::[rotate\_right][FixedI32::rotate_right] + /// and FixedU32::[rotate\_right][FixedU32::rotate_right]. #[must_use = "this returns the result of the operation, without modifying the original"] fn rotate_right(self, n: u32) -> Self; /// Returns the mean of `self` and `other`. + /// + /// See also FixedI32::[mean][FixedI32::mean] and + /// FixedU32::[mean][FixedU32::mean]. #[must_use = "this returns the result of the operation, without modifying the original"] fn mean(self, other: Self) -> Self; /// Returns the reciprocal. /// + /// See also FixedI32::[recip][FixedI32::recip] and + /// FixedU32::[recip][FixedU32::recip]. + /// /// # Panics /// /// Panics if `self` is zero. @@ -754,6 +1110,9 @@ where /// fractional bits. /// /// [`mul_add`]: FixedI32::mul_add + /// + /// See also FixedI32::[mul\_add][FixedI32::mul_add] and + /// FixedU32::[mul\_add][FixedU32::mul_add]. #[must_use = "this returns the result of the operation, without modifying the original"] fn mul_add(self, mul: Self, add: Self) -> Self; @@ -764,10 +1123,16 @@ where /// like `self` but with a different number of fractional bits. /// /// [`mul_acc`]: FixedI32::mul_acc + /// + /// See also FixedI32::[mul\_acc][FixedI32::mul_acc] and + /// FixedU32::[mul\_acc][FixedU32::mul_acc]. fn mul_acc(&mut self, a: Self, b: Self); /// Euclidean division by an integer. /// + /// See also FixedI32::[div\_euclid][FixedI32::div_euclid] and + /// FixedU32::[div\_euclid][FixedU32::div_euclid]. + /// /// # Panics /// /// Panics if the divisor is zero or if the division results in overflow. @@ -776,6 +1141,9 @@ where /// Remainder for Euclidean division. /// + /// See also FixedI32::[rem\_euclid][FixedI32::rem_euclid] and + /// FixedU32::[rem\_euclid][FixedU32::rem_euclid]. + /// /// # Panics /// /// Panics if the divisor is zero. @@ -784,6 +1152,10 @@ where /// Euclidean division by an integer. /// + /// See also + /// FixedI32::[div\_euclid\_int][FixedI32::div_euclid_int] and + /// FixedU32::[div\_euclid\_int][FixedU32::div_euclid_int]. + /// /// # Panics /// /// Panics if the divisor is zero or if the division results in overflow. @@ -792,6 +1164,10 @@ where /// Remainder for Euclidean division by an integer. /// + /// See also + /// FixedI32::[rem\_euclid\_int][FixedI32::rem_euclid_int] and + /// FixedU32::[rem\_euclid\_int][FixedU32::rem_euclid_int]. + /// /// # Panics /// /// Panics if the divisor is zero or if the division results in overflow. @@ -799,110 +1175,203 @@ where fn rem_euclid_int(self, rhs: Self::Bits) -> Self; /// Checked negation. Returns the negated value, or [`None`] on overflow. + /// + /// See also FixedI32::[checked\_neg][FixedI32::checked_neg] + /// and FixedU32::[checked\_neg][FixedU32::checked_neg]. fn checked_neg(self) -> Option; /// Checked addition. Returns the sum, or [`None`] on overflow. + /// + /// See also FixedI32::[checked\_add][FixedI32::checked_add] + /// and FixedU32::[checked\_add][FixedU32::checked_add]. #[must_use = "this returns the result of the operation, without modifying the original"] fn checked_add(self, rhs: Self) -> Option; /// Checked subtraction. Returns the difference, or [`None`] on overflow. + /// + /// See also FixedI32::[checked\_sub][FixedI32::checked_sub] + /// and FixedU32::[checked\_sub][FixedU32::checked_sub]. #[must_use = "this returns the result of the operation, without modifying the original"] fn checked_sub(self, rhs: Self) -> Option; /// Checked multiplication. Returns the product, or [`None`] on overflow. + /// + /// See also FixedI32::[checked\_mul][FixedI32::checked_mul] + /// and FixedU32::[checked\_mul][FixedU32::checked_mul]. #[must_use = "this returns the result of the operation, without modifying the original"] fn checked_mul(self, rhs: Self) -> Option; /// Checked division. Returns the quotient, or [`None`] if the /// divisor is zero or on overflow. + /// + /// See also FixedI32::[checked\_div][FixedI32::checked_div] + /// and FixedU32::[checked\_div][FixedU32::checked_div]. #[must_use = "this returns the result of the operation, without modifying the original"] fn checked_div(self, rhs: Self) -> Option; /// Checked remainder. Returns the remainder, or [`None`] if the /// divisor is zero. + /// + /// See also FixedI32::[checked\_rem][FixedI32::checked_rem] + /// and FixedU32::[checked\_rem][FixedU32::checked_rem]. #[must_use = "this returns the result of the operation, without modifying the original"] fn checked_rem(self, rhs: Self) -> Option; /// Checked reciprocal. Returns the reciprocal, or [`None`] if /// `self` is zero or on overflow. + /// + /// See also + /// FixedI32::[checked\_recip][FixedI32::checked_recip] and + /// FixedU32::[checked\_recip][FixedU32::checked_recip]. fn checked_recip(self) -> Option; /// Checked multiply and add. Returns `self` × `mul` + `add`, or [`None`] on overflow. + /// + /// See also + /// FixedI32::[checked\_mul\_add][FixedI32::checked_mul_add] + /// and + /// FixedU32::[checked\_mul\_add][FixedU32::checked_mul_add]. #[must_use = "this returns the result of the operation, without modifying the original"] fn checked_mul_add(self, mul: Self, add: Self) -> Option; /// Checked multiply and accumulate. Adds (`a` × `b`) to `self`, or returns /// [`None`] on overflow. + /// + /// See also + /// FixedI32::[checked\_mul\_acc][FixedI32::checked_mul_acc] + /// and + /// FixedU32::[checked\_mul\_acc][FixedU32::checked_mul_acc]. #[must_use = "this `Option` may be a `None` variant indicating overflow, which should be handled"] fn checked_mul_acc(&mut self, a: Self, b: Self) -> Option<()>; /// Checked remainder for Euclidean division. Returns the /// remainder, or [`None`] if the divisor is zero or the division /// results in overflow. + /// + /// See also + /// FixedI32::[checked\_div\_euclid][FixedI32::checked_div_euclid] + /// and + /// FixedU32::[checked\_div\_euclid][FixedU32::checked_div_euclid]. #[must_use = "this returns the result of the operation, without modifying the original"] fn checked_div_euclid(self, rhs: Self) -> Option; /// Checked remainder for Euclidean division. Returns the /// remainder, or [`None`] if the divisor is zero. + /// + /// See also + /// FixedI32::[checked\_rem\_euclid][FixedI32::checked_rem_euclid] + /// and + /// FixedU32::[checked\_rem\_euclid][FixedU32::checked_rem_euclid]. #[must_use = "this returns the result of the operation, without modifying the original"] fn checked_rem_euclid(self, rhs: Self) -> Option; /// Checked multiplication by an integer. Returns the product, or /// [`None`] on overflow. + /// + /// See also + /// FixedI32::[checked\_mul\_int][FixedI32::checked_mul_int] + /// and + /// FixedU32::[checked\_mul\_int][FixedU32::checked_mul_int]. #[must_use = "this returns the result of the operation, without modifying the original"] fn checked_mul_int(self, rhs: Self::Bits) -> Option; /// Checked division by an integer. Returns the quotient, or /// [`None`] if the divisor is zero or if the division results in /// overflow. + /// + /// See also + /// FixedI32::[checked\_div\_int][FixedI32::checked_div_int] + /// and + /// FixedU32::[checked\_div\_int][FixedU32::checked_div_int]. #[must_use = "this returns the result of the operation, without modifying the original"] fn checked_div_int(self, rhs: Self::Bits) -> Option; /// Checked fixed-point remainder for division by an integer. /// Returns the remainder, or [`None`] if the divisor is zero or /// if the division results in overflow. + /// + /// See also + /// FixedI32::[checked\_rem\_int][FixedI32::checked_rem_int] + /// and + /// FixedU32::[checked\_rem\_int][FixedU32::checked_rem_int]. #[must_use = "this returns the result of the operation, without modifying the original"] fn checked_rem_int(self, rhs: Self::Bits) -> Option; /// Checked Euclidean division by an integer. Returns the /// quotient, or [`None`] if the divisor is zero or if the /// division results in overflow. + /// + /// See also + /// FixedI32::[checked\_div\_euclid\_int][FixedI32::checked_div_euclid_int] + /// and + /// FixedU32::[checked\_div\_euclid\_int][FixedU32::checked_div_euclid_int]. #[must_use = "this returns the result of the operation, without modifying the original"] fn checked_div_euclid_int(self, rhs: Self::Bits) -> Option; /// Checked remainder for Euclidean division by an integer. /// Returns the remainder, or [`None`] if the divisor is zero or /// if the remainder results in overflow. + /// + /// See also + /// FixedI32::[checked\_rem\_euclid\_int][FixedI32::checked_rem_euclid_int] + /// and + /// FixedU32::[checked\_rem\_euclid\_int][FixedU32::checked_rem_euclid_int]. #[must_use = "this returns the result of the operation, without modifying the original"] fn checked_rem_euclid_int(self, rhs: Self::Bits) -> Option; /// Checked shift left. Returns the shifted number, or [`None`] if /// `rhs` ≥ the number of bits. + /// + /// See also FixedI32::[checked\_shl][FixedI32::checked_shl] + /// and FixedU32::[checked\_shl][FixedU32::checked_shl]. #[must_use = "this returns the result of the operation, without modifying the original"] fn checked_shl(self, rhs: u32) -> Option; /// Checked shift right. Returns the shifted number, or [`None`] /// if `rhs` ≥ the number of bits. + /// + /// See also FixedI32::[checked\_shr][FixedI32::checked_shr] + /// and FixedU32::[checked\_shr][FixedU32::checked_shr]. #[must_use = "this returns the result of the operation, without modifying the original"] fn checked_shr(self, rhs: u32) -> Option; /// Saturated negation. Returns the negated value, saturating on overflow. + /// + /// See also + /// FixedI32::[saturating\_neg][FixedI32::saturating_neg] and + /// FixedU32::[saturating\_neg][FixedU32::saturating_neg]. fn saturating_neg(self) -> Self; /// Saturating addition. Returns the sum, saturating on overflow. + /// + /// See also + /// FixedI32::[saturating\_add][FixedI32::saturating_add] and + /// FixedU32::[saturating\_add][FixedU32::saturating_add]. #[must_use = "this returns the result of the operation, without modifying the original"] fn saturating_add(self, rhs: Self) -> Self; /// Saturating subtraction. Returns the difference, saturating on overflow. + /// + /// See also + /// FixedI32::[saturating\_sub][FixedI32::saturating_sub] and + /// FixedU32::[saturating\_sub][FixedU32::saturating_sub]. #[must_use = "this returns the result of the operation, without modifying the original"] fn saturating_sub(self, rhs: Self) -> Self; /// Saturating multiplication. Returns the product, saturating on overflow. + /// + /// See also + /// FixedI32::[saturating\_mul][FixedI32::saturating_mul] and + /// FixedU32::[saturating\_mul][FixedU32::saturating_mul]. #[must_use = "this returns the result of the operation, without modifying the original"] fn saturating_mul(self, rhs: Self) -> Self; /// Saturating division. Returns the quotient, saturating on overflow. /// + /// See also + /// FixedI32::[saturating\_div][FixedI32::saturating_div] and + /// FixedU32::[saturating\_div][FixedU32::saturating_div]. + /// /// # Panics /// /// Panics if the divisor is zero. @@ -911,20 +1380,40 @@ where /// Saturating reciprocal. /// + /// See also + /// FixedI32::[saturating\_recip][FixedI32::saturating_recip] + /// and + /// FixedU32::[saturating\_recip][FixedU32::saturating_recip]. + /// /// # Panics /// /// Panics if `self` is zero. fn saturating_recip(self) -> Self; /// Saturating multiply and add. Returns `self` × `mul` + `add`, saturating on overflow. + /// + /// See also + /// FixedI32::[saturating\_mul\_add][FixedI32::saturating_mul_add] + /// and + /// FixedU32::[saturating\_mul\_add][FixedU32::saturating_mul_add]. #[must_use = "this returns the result of the operation, without modifying the original"] fn saturating_mul_add(self, mul: Self, add: Self) -> Self; /// Saturating multiply and add. Adds (`a` × `b`) to `self`, saturating on overflow. + /// + /// See also + /// FixedI32::[saturating\_mul\_acc][FixedI32::saturating_mul_acc] + /// and + /// FixedU32::[saturating\_mul\_acc][FixedU32::saturating_mul_acc]. fn saturating_mul_acc(&mut self, a: Self, b: Self); /// Saturating Euclidean division. Returns the quotient, saturating on overflow. /// + /// See also + /// FixedI32::[saturating\_div\_euclid][FixedI32::saturating_div_euclid] + /// and + /// FixedU32::[saturating\_div\_euclid][FixedU32::saturating_div_euclid]. + /// /// # Panics /// /// Panics if the divisor is zero. @@ -932,12 +1421,22 @@ where fn saturating_div_euclid(self, rhs: Self) -> Self; /// Saturating multiplication by an integer. Returns the product, saturating on overflow. + /// + /// See also + /// FixedI32::[saturating\_mul\_int][FixedI32::saturating_mul_int] + /// and + /// FixedU32::[saturating\_mul\_int][FixedU32::saturating_mul_int]. #[must_use = "this returns the result of the operation, without modifying the original"] fn saturating_mul_int(self, rhs: Self::Bits) -> Self; /// Saturating Euclidean division by an integer. Returns the /// quotient, saturating on overflow. /// + /// See also + /// FixedI32::[saturating\_div\_euclid\_int][FixedI32::saturating_div_euclid_int] + /// and + /// FixedU32::[saturating\_div\_euclid\_int][FixedU32::saturating_div_euclid_int]. + /// /// # Panics /// /// Panics if the divisor is zero. @@ -947,6 +1446,11 @@ where /// Saturating remainder for Euclidean division by an integer. /// Returns the remainder, saturating on overflow. /// + /// See also + /// FixedI32::[saturating\_rem\_euclid\_int][FixedI32::saturating_rem_euclid_int] + /// and + /// FixedU32::[saturating\_rem\_euclid\_int][FixedU32::saturating_rem_euclid_int]. + /// /// # Panics /// /// Panics if the divisor is zero. @@ -954,22 +1458,37 @@ where fn saturating_rem_euclid_int(self, rhs: Self::Bits) -> Self; /// Wrapping negation. Returns the negated value, wrapping on overflow. + /// + /// See also FixedI32::[wrapping\_neg][FixedI32::wrapping_neg] + /// and FixedU32::[wrapping\_neg][FixedU32::wrapping_neg]. fn wrapping_neg(self) -> Self; /// Wrapping addition. Returns the sum, wrapping on overflow. + /// + /// See also FixedI32::[wrapping\_add][FixedI32::wrapping_add] + /// and FixedU32::[wrapping\_add][FixedU32::wrapping_add]. #[must_use = "this returns the result of the operation, without modifying the original"] fn wrapping_add(self, rhs: Self) -> Self; /// Wrapping subtraction. Returns the difference, wrapping on overflow. + /// + /// See also FixedI32::[wrapping\_sub][FixedI32::wrapping_sub] + /// and FixedU32::[wrapping\_sub][FixedU32::wrapping_sub]. #[must_use = "this returns the result of the operation, without modifying the original"] fn wrapping_sub(self, rhs: Self) -> Self; /// Wrapping multiplication. Returns the product, wrapping on overflow. + /// + /// See also FixedI32::[wrapping\_mul][FixedI32::wrapping_mul] + /// and FixedU32::[wrapping\_mul][FixedU32::wrapping_mul]. #[must_use = "this returns the result of the operation, without modifying the original"] fn wrapping_mul(self, rhs: Self) -> Self; /// Wrapping division. Returns the quotient, wrapping on overflow. /// + /// See also FixedI32::[wrapping\_div][FixedI32::wrapping_div] + /// and FixedU32::[wrapping\_div][FixedU32::wrapping_div]. + /// /// # Panics /// /// Panics if the divisor is zero. @@ -978,20 +1497,39 @@ where /// Wrapping reciprocal. /// + /// See also + /// FixedI32::[wrapping\_recip][FixedI32::wrapping_recip] and + /// FixedU32::[wrapping\_recip][FixedU32::wrapping_recip]. + /// /// # Panics /// /// Panics if `self` is zero. fn wrapping_recip(self) -> Self; /// Wrapping multiply and add. Returns `self` × `mul` + `add`, wrapping on overflow. + /// + /// See also + /// FixedI32::[wrapping\_mul\_add][FixedI32::wrapping_mul_add] + /// and + /// FixedU32::[wrapping\_mul\_add][FixedU32::wrapping_mul_add]. #[must_use = "this returns the result of the operation, without modifying the original"] fn wrapping_mul_add(self, mul: Self, add: Self) -> Self; /// Wrapping multiply and accumulate. Adds (`a` × `b`) to `self`, wrapping on overflow. + /// + /// See also + /// FixedI32::[wrapping\_mul\_acc][FixedI32::wrapping_mul_acc] + /// and + /// FixedU32::[wrapping\_mul\_acc][FixedU32::wrapping_mul_acc]. fn wrapping_mul_acc(&mut self, a: Self, b: Self); /// Wrapping Euclidean division. Returns the quotient, wrapping on overflow. /// + /// See also + /// FixedI32::[wrapping\_div\_euclid][FixedI32::wrapping_div_euclid] + /// and + /// FixedU32::[wrapping\_div\_euclid][FixedU32::wrapping_div_euclid]. + /// /// # Panics /// /// Panics if the divisor is zero. @@ -999,6 +1537,11 @@ where fn wrapping_div_euclid(self, rhs: Self) -> Self; /// Wrapping multiplication by an integer. Returns the product, wrapping on overflow. + /// + /// See also + /// FixedI32::[wrapping\_mul\_int][FixedI32::wrapping_mul_int] + /// and + /// FixedU32::[wrapping\_mul\_int][FixedU32::wrapping_mul_int]. #[must_use = "this returns the result of the operation, without modifying the original"] fn wrapping_mul_int(self, rhs: Self::Bits) -> Self; @@ -1006,6 +1549,11 @@ where /// /// Overflow can only occur when dividing the minimum value by −1. /// + /// See also + /// FixedI32::[wrapping\_div\_int][FixedI32::wrapping_div_int] + /// and + /// FixedU32::[wrapping\_div\_int][FixedU32::wrapping_div_int]. + /// /// # Panics /// /// Panics if the divisor is zero. @@ -1017,6 +1565,11 @@ where /// /// Overflow can only occur when dividing the minimum value by −1. /// + /// See also + /// FixedI32::[wrapping\_div\_euclid\_int][FixedI32::wrapping_div_euclid_int] + /// and + /// FixedU32::[wrapping\_div\_euclid\_int][FixedU32::wrapping_div_euclid_int]. + /// /// # Panics /// /// Panics if the divisor is zero. @@ -1026,6 +1579,11 @@ where /// Wrapping remainder for Euclidean division by an integer. /// Returns the remainder, wrapping on overflow. /// + /// See also + /// FixedI32::[wrapping\_rem\_euclid\_int][FixedI32::wrapping_rem_euclid_int] + /// and + /// FixedU32::[wrapping\_rem\_euclid\_int][FixedU32::wrapping_rem_euclid_int]. + /// /// # Panics /// /// Panics if the divisor is zero. @@ -1034,16 +1592,26 @@ where /// Wrapping shift left. Wraps `rhs` if `rhs` ≥ the number of /// bits, then shifts and returns the number. + /// + /// See also FixedI32::[wrapping\_shl][FixedI32::wrapping_shl] + /// and FixedU32::[wrapping\_shl][FixedU32::wrapping_shl]. #[must_use = "this returns the result of the operation, without modifying the original"] fn wrapping_shl(self, rhs: u32) -> Self; /// Wrapping shift right. Wraps `rhs` if `rhs` ≥ the number of /// bits, then shifts and returns the number. + /// + /// See also FixedI32::[wrapping\_shr][FixedI32::wrapping_shr] + /// and FixedU32::[wrapping\_shr][FixedU32::wrapping_shr]. #[must_use = "this returns the result of the operation, without modifying the original"] fn wrapping_shr(self, rhs: u32) -> Self; /// Unwrapped negation. Returns the negated value, panicking on overflow. /// + /// See also + /// FixedI32::[unwrapped\_neg][FixedI32::unwrapped_neg] and + /// FixedU32::[unwrapped\_neg][FixedU32::unwrapped_neg]. + /// /// # Panics /// /// Panics if the result does not fit. @@ -1052,6 +1620,10 @@ where /// Unwrapped addition. Returns the sum, panicking on overflow. /// + /// See also + /// FixedI32::[unwrapped\_add][FixedI32::unwrapped_add] and + /// FixedU32::[unwrapped\_add][FixedU32::unwrapped_add]. + /// /// # Panics /// /// Panics if the result does not fit. @@ -1061,6 +1633,10 @@ where /// Unwrapped subtraction. Returns the difference, panicking on overflow. /// + /// See also + /// FixedI32::[unwrapped\_sub][FixedI32::unwrapped_sub] and + /// FixedU32::[unwrapped\_sub][FixedU32::unwrapped_sub]. + /// /// # Panics /// /// Panics if the result does not fit. @@ -1070,6 +1646,10 @@ where /// Unwrapped multiplication. Returns the product, panicking on overflow. /// + /// See also + /// FixedI32::[unwrapped\_mul][FixedI32::unwrapped_mul] and + /// FixedU32::[unwrapped\_mul][FixedU32::unwrapped_mul]. + /// /// # Panics /// /// Panics if the result does not fit. @@ -1079,6 +1659,10 @@ where /// Unwrapped division. Returns the quotient, panicking on overflow. /// + /// See also + /// FixedI32::[unwrapped\_div][FixedI32::unwrapped_div] and + /// FixedU32::[unwrapped\_div][FixedU32::unwrapped_div]. + /// /// # Panics /// /// Panics if the divisor is zero or if the result does not fit. @@ -1088,6 +1672,10 @@ where /// Unwrapped remainder. Returns the quotient, panicking if the divisor is zero. /// + /// See also + /// FixedI32::[unwrapped\_rem][FixedI32::unwrapped_rem] and + /// FixedU32::[unwrapped\_rem][FixedU32::unwrapped_rem]. + /// /// # Panics /// /// Panics if the divisor is zero. @@ -1097,6 +1685,10 @@ where /// Unwrapped reciprocal. Returns reciprocal, panicking on overflow. /// + /// See also + /// FixedI32::[unwrapped\_recip][FixedI32::unwrapped_recip] and + /// FixedU32::[unwrapped\_recip][FixedU32::unwrapped_recip]. + /// /// # Panics /// /// Panics if `self` is zero or on overflow. @@ -1105,6 +1697,11 @@ where /// Unwrapped multiply and add. Returns `self` × `mul` + `add`, panicking on overflow. /// + /// See also + /// FixedI32::[unwrapped\_mul\_add][FixedI32::unwrapped_mul_add] + /// and + /// FixedU32::[unwrapped\_mul\_add][FixedU32::unwrapped_mul_add]. + /// /// # Panics /// /// Panics if the result does not fit. @@ -1114,6 +1711,11 @@ where /// Unwrapped multiply and accumulate. Adds (`a` × `b`) to `self`, panicking on overflow. /// + /// See also + /// FixedI32::[unwrapped\_mul\_acc][FixedI32::unwrapped_mul_acc] + /// and + /// FixedU32::[unwrapped\_mul\_acc][FixedU32::unwrapped_mul_acc]. + /// /// # Panics /// /// Panics if the result does not fit. @@ -1122,6 +1724,11 @@ where /// Unwrapped Euclidean division. Returns the quotient, panicking on overflow. /// + /// See also + /// FixedI32::[unwrapped\_div\_euclid][FixedI32::unwrapped_div_euclid] + /// and + /// FixedU32::[unwrapped\_div\_euclid][FixedU32::unwrapped_div_euclid]. + /// /// # Panics /// /// Panics if the divisor is zero or if the result does not fit. @@ -1132,6 +1739,11 @@ where /// Unwrapped remainder for Euclidean division. Returns the /// remainder, panicking if the divisor is zero. /// + /// See also + /// FixedI32::[unwrapped\_rem\_euclid][FixedI32::unwrapped_rem_euclid] + /// and + /// FixedU32::[unwrapped\_rem\_euclid][FixedU32::unwrapped_rem_euclid]. + /// /// # Panics /// /// Panics if the divisor is zero. @@ -1141,6 +1753,11 @@ where /// Unwrapped multiplication by an integer. Returns the product, panicking on overflow. /// + /// See also + /// FixedI32::[unwrapped\_mul\_int][FixedI32::unwrapped_mul_int] + /// and + /// FixedU32::[unwrapped\_mul\_int][FixedU32::unwrapped_mul_int]. + /// /// # Panics /// /// Panics if the result does not fit. @@ -1152,6 +1769,11 @@ where /// /// Overflow can only occur when dividing the minimum value by −1. /// + /// See also + /// FixedI32::[unwrapped\_div\_int][FixedI32::unwrapped_div_int] + /// and + /// FixedU32::[unwrapped\_div\_int][FixedU32::unwrapped_div_int]. + /// /// # Panics /// /// Panics if the divisor is zero or if the result does not fit. @@ -1162,6 +1784,11 @@ where /// Unwrapped remainder for division by an integer. Returns the /// remainder, panicking if the divisor is zero. /// + /// See also + /// FixedI32::[unwrapped\_rem\_int][FixedI32::unwrapped_rem_int] + /// and + /// FixedU32::[unwrapped\_rem\_int][FixedU32::unwrapped_rem_int]. + /// /// # Panics /// /// Panics if the divisor is zero. @@ -1174,6 +1801,11 @@ where /// /// Overflow can only occur when dividing the minimum value by −1. /// + /// See also + /// FixedI32::[unwrapped\_div\_euclid\_int][FixedI32::unwrapped_div_euclid_int] + /// and + /// FixedU32::[unwrapped\_div\_euclid\_int][FixedU32::unwrapped_div_euclid_int]. + /// /// # Panics /// /// Panics if the divisor is zero or if the result does not fit. @@ -1184,6 +1816,11 @@ where /// Unwrapped remainder for Euclidean division by an integer. /// Returns the remainder, panicking on overflow. /// + /// See also + /// FixedI32::[unwrapped\_rem\_euclid\_int][FixedI32::unwrapped_rem_euclid_int] + /// and + /// FixedU32::[unwrapped\_rem\_euclid\_int][FixedU32::unwrapped_rem_euclid_int]. + /// /// # Panics /// /// Panics if the divisor is zero or if the result does not fit. @@ -1193,6 +1830,10 @@ where /// Unwrapped shift left. Panics if `rhs` ≥ the number of bits. /// + /// See also + /// FixedI32::[unwrapped\_shl][FixedI32::unwrapped_shl] and + /// FixedU32::[unwrapped\_shl][FixedU32::unwrapped_shl]. + /// /// # Panics /// /// Panics if `rhs` ≥ the number of bits. @@ -1202,6 +1843,10 @@ where /// Unwrapped shift right. Panics if `rhs` ≥ the number of bits. /// + /// See also + /// FixedI32::[unwrapped\_shr][FixedI32::unwrapped_shr] and + /// FixedU32::[unwrapped\_shr][FixedU32::unwrapped_shr]. + /// /// # Panics /// /// Panics if `rhs` ≥ the number of bits. @@ -1214,6 +1859,10 @@ where /// Returns a [tuple] of the negated value and a [`bool`], /// indicating whether an overflow has occurred. On overflow, the /// wrapped value is returned. + /// + /// See also + /// FixedI32::[overflowing\_neg][FixedI32::overflowing_neg] and + /// FixedU32::[overflowing\_neg][FixedU32::overflowing_neg]. fn overflowing_neg(self) -> (Self, bool); /// Overflowing addition. @@ -1221,6 +1870,10 @@ where /// Returns a [tuple] of the sum and a [`bool`], indicating whether /// an overflow has occurred. On overflow, the wrapped value is /// returned. + /// + /// See also + /// FixedI32::[overflowing\_add][FixedI32::overflowing_add] and + /// FixedU32::[overflowing\_add][FixedU32::overflowing_add]. #[must_use = "this returns the result of the operation, without modifying the original"] fn overflowing_add(self, rhs: Self) -> (Self, bool); @@ -1229,6 +1882,10 @@ where /// Returns a [tuple] of the difference and a [`bool`], indicating /// whether an overflow has occurred. On overflow, the wrapped /// value is returned. + /// + /// See also + /// FixedI32::[overflowing\_sub][FixedI32::overflowing_sub] and + /// FixedU32::[overflowing\_sub][FixedU32::overflowing_sub]. #[must_use = "this returns the result of the operation, without modifying the original"] fn overflowing_sub(self, rhs: Self) -> (Self, bool); @@ -1237,6 +1894,10 @@ where /// Returns a [tuple] of the product and a [`bool`], indicating /// whether an overflow has occurred. On overflow, the wrapped /// value is returned. + /// + /// See also + /// FixedI32::[overflowing\_mul][FixedI32::overflowing_mul] and + /// FixedU32::[overflowing\_mul][FixedU32::overflowing_mul]. #[must_use = "this returns the result of the operation, without modifying the original"] fn overflowing_mul(self, rhs: Self) -> (Self, bool); @@ -1246,6 +1907,10 @@ where /// whether an overflow has occurred. On overflow, the wrapped /// value is returned. /// + /// See also + /// FixedI32::[overflowing\_div][FixedI32::overflowing_div] and + /// FixedU32::[overflowing\_div][FixedU32::overflowing_div]. + /// /// # Panics /// /// Panics if the divisor is zero. @@ -1258,6 +1923,11 @@ where /// indicating whether an overflow has occurred. On overflow, the /// wrapped value is returned. /// + /// See also + /// FixedI32::[overflowing\_recip][FixedI32::overflowing_recip] + /// and + /// FixedU32::[overflowing\_recip][FixedU32::overflowing_recip]. + /// /// # Panics /// /// Panics if `self` is zero. @@ -1268,11 +1938,21 @@ where /// Returns a [tuple] of `self` × `mul` + `add` and a [`bool`], /// indicating whether an overflow has occurred. On overflow, the /// wrapped value is returned. + /// + /// See also + /// FixedI32::[overflowing\_mul\_add][FixedI32::overflowing_mul_add] + /// and + /// FixedU32::[overflowing\_mul\_add][FixedU32::overflowing_mul_add]. #[must_use = "this returns the result of the operation, without modifying the original"] fn overflowing_mul_add(self, mul: Self, add: Self) -> (Self, bool); /// Overflowing multiply and accumulate. Adds (`a` × `b`) to `self`, /// wrapping and returning [`true`] if overflow occurs. + /// + /// See also + /// FixedI32::[overflowing\_mul\_acc][FixedI32::overflowing_mul_acc] + /// and + /// FixedU32::[overflowing\_mul\_acc][FixedU32::overflowing_mul_acc]. #[must_use = "this returns whether overflow occurs; use `wrapping_mul_acc` if the flag is not needed"] fn overflowing_mul_acc(&mut self, a: Self, b: Self) -> bool; @@ -1282,6 +1962,11 @@ where /// whether an overflow has occurred. On overflow, the wrapped /// value is returned. /// + /// See also + /// FixedI32::[overflowing\_div\_euclid][FixedI32::overflowing_div_euclid] + /// and + /// FixedU32::[overflowing\_div\_euclid][FixedU32::overflowing_div_euclid]. + /// /// # Panics /// /// Panics if the divisor is zero. @@ -1293,6 +1978,11 @@ where /// Returns a [tuple] of the product and a [`bool`], indicating /// whether an overflow has occurred. On overflow, the wrapped /// value is returned. + /// + /// See also + /// FixedI32::[overflowing\_mul\_int][FixedI32::overflowing_mul_int] + /// and + /// FixedU32::[overflowing\_mul\_int][FixedU32::overflowing_mul_int]. #[must_use = "this returns the result of the operation, without modifying the original"] fn overflowing_mul_int(self, rhs: Self::Bits) -> (Self, bool); @@ -1302,6 +1992,11 @@ where /// whether an overflow has occurred. On overflow, the wrapped /// value is returned. /// + /// See also + /// FixedI32::[overflowing\_div\_int][FixedI32::overflowing_div_int] + /// and + /// FixedU32::[overflowing\_div\_int][FixedU32::overflowing_div_int]. + /// /// # Panics /// /// Panics if the divisor is zero. @@ -1314,6 +2009,11 @@ where /// whether an overflow has occurred. On overflow, the wrapped /// value is returned. /// + /// See also + /// FixedI32::[overflowing\_div\_euclid\_int][FixedI32::overflowing_div_euclid_int] + /// and + /// FixedU32::[overflowing\_div\_euclid\_int][FixedU32::overflowing_div_euclid_int]. + /// /// # Panics /// /// Panics if the divisor is zero. @@ -1326,6 +2026,11 @@ where /// whether an overflow has occurred. On overflow, the wrapped /// value is returned. /// + /// See also + /// FixedI32::[overflowing\_rem\_euclid\_int][FixedI32::overflowing_rem_euclid_int] + /// and + /// FixedU32::[overflowing\_rem\_euclid\_int][FixedU32::overflowing_rem_euclid_int]. + /// /// # Panics /// /// Panics if the divisor is zero. @@ -1337,6 +2042,10 @@ where /// Returns a [tuple] of the shifted value and a [`bool`], /// indicating whether an overflow has occurred. On overflow, the /// wrapped value is returned. + /// + /// See also + /// FixedI32::[overflowing\_shl][FixedI32::overflowing_shl] and + /// FixedU32::[overflowing\_shl][FixedU32::overflowing_shl]. #[must_use = "this returns the result of the operation, without modifying the original"] fn overflowing_shl(self, rhs: u32) -> (Self, bool); @@ -1345,6 +2054,10 @@ where /// Returns a [tuple] of the shifted value and a [`bool`], /// indicating whether an overflow has occurred. On overflow, the /// wrapped value is returned. + /// + /// See also + /// FixedI32::[overflowing\_shr][FixedI32::overflowing_shr] and + /// FixedU32::[overflowing\_shr][FixedU32::overflowing_shr]. #[must_use = "this returns the result of the operation, without modifying the original"] fn overflowing_shr(self, rhs: u32) -> (Self, bool); } @@ -1363,23 +2076,35 @@ pub trait FixedSigned: Fixed + Neg { type Unsigned: FixedUnsigned; /// Returns the number of bits required to represent the value. + /// + /// See also FixedI32::[signed\_bits][FixedI32::signed_bits]. fn signed_bits(self) -> u32; /// Returns [`true`] if the number is > 0. + /// + /// See also FixedI32::[is\_positive][FixedI32::is_positive]. fn is_positive(self) -> bool; /// Returns [`true`] if the number is < 0. + /// + /// See also FixedI32::[is\_negative][FixedI32::is_negative]. fn is_negative(self) -> bool; /// Returns the absolute value. + /// + /// See also FixedI32::[abs][FixedI32::abs]. fn abs(self) -> Self; /// Returns the absolute value using an unsigned type without any /// wrapping or panicking. + /// + /// See also FixedI32::[unsigned\_abs][FixedI32::unsigned_abs]. fn unsigned_abs(self) -> Self::Unsigned; /// Returns a number representing the sign of `self`. /// + /// See also FixedI32::[signum][FixedI32::signum]. + /// /// # Panics /// /// When debug assertions are enabled, this method panics @@ -1398,6 +2123,8 @@ pub trait FixedSigned: Fixed + Neg { /// Checked absolute value. Returns the absolute value, or [`None`] on overflow. /// /// Overflow can only occur when trying to find the absolute value of the minimum value. + /// + /// See also FixedI32::[checked\_abs][FixedI32::checked_abs]. fn checked_abs(self) -> Option; /// Checked signum. Returns a number representing the sign of @@ -1408,11 +2135,17 @@ pub trait FixedSigned: Fixed + Neg { /// or one integer bits such that it cannot hold the value 1. /// * if the value is negative and the fixed-point number has zero /// integer bits, such that it cannot hold the value −1. + /// + /// See also + /// FixedI32::[checked\_signum][FixedI32::checked_signum]. fn checked_signum(self) -> Option; /// Saturating absolute value. Returns the absolute value, saturating on overflow. /// /// Overflow can only occur when trying to find the absolute value of the minimum value. + /// + /// See also + /// FixedI32::[saturating\_abs][FixedI32::saturating_abs]. fn saturating_abs(self) -> Self; /// Saturating signum. Returns a number representing the sign of @@ -1423,11 +2156,16 @@ pub trait FixedSigned: Fixed + Neg { /// or one integer bits such that it cannot hold the value 1. /// * if the value is negative and the fixed-point number has zero /// integer bits, such that it cannot hold the value −1. + /// + /// See also + /// FixedI32::[saturating\_signum][FixedI32::saturating_signum]. fn saturating_signum(self) -> Self; /// Wrapping absolute value. Returns the absolute value, wrapping on overflow. /// /// Overflow can only occur when trying to find the absolute value of the minimum value. + /// + /// See also FixedI32::[wrapping\_abs][FixedI32::wrapping_abs]. fn wrapping_abs(self) -> Self; /// Wrapping signum. Returns a number representing the sign of @@ -1438,12 +2176,18 @@ pub trait FixedSigned: Fixed + Neg { /// or one integer bits such that it cannot hold the value 1. /// * if the value is negative and the fixed-point number has zero /// integer bits, such that it cannot hold the value −1. + /// + /// See also + /// FixedI32::[wrapping\_signum][FixedI32::wrapping_signum]. fn wrapping_signum(self) -> Self; /// Unwrapped absolute value. Returns the absolute value, panicking on overflow. /// /// Overflow can only occur when trying to find the absolute value of the minimum value. /// + /// See also + /// FixedI32::[unwrapped\_abs][FixedI32::unwrapped_abs]. + /// /// # Panics /// /// Panics if the result does not fit. @@ -1459,6 +2203,9 @@ pub trait FixedSigned: Fixed + Neg { /// * if the value is negative and the fixed-point number has zero /// integer bits, such that it cannot hold the value −1. /// + /// See also + /// FixedI32::[unwrapped\_signum][FixedI32::unwrapped_signum]. + /// /// # Panics /// /// Panics if the result does not fit. @@ -1470,6 +2217,9 @@ pub trait FixedSigned: Fixed + Neg { /// Returns a [tuple] of the fixed-point number and a [`bool`], /// indicating whether an overflow has occurred. On overflow, the /// wrapped value is returned. + /// + /// See also + /// FixedI32::[overflowing\_abs][FixedI32::overflowing_abs]. fn overflowing_abs(self) -> (Self, bool); /// Overflowing signum. @@ -1483,6 +2233,9 @@ pub trait FixedSigned: Fixed + Neg { /// or one integer bits such that it cannot hold the value 1. /// * if the value is negative and the fixed-point number has zero /// integer bits, such that it cannot hold the value −1. + /// + /// See also + /// FixedI32::[overflowing\_signum][FixedI32::overflowing_signum]. fn overflowing_signum(self) -> (Self, bool); } @@ -1496,30 +2249,50 @@ pub trait FixedSigned: Fixed + Neg { /// [`FixedU64`], and [`FixedU128`]. pub trait FixedUnsigned: Fixed { /// Returns the number of bits required to represent the value. + /// + /// See also + /// FixedU32::[significant\_bits][FixedU32::significant_bits]. fn significant_bits(self) -> u32; /// Returns [`true`] if the fixed-point number is /// 2k for some integer k. + /// + /// See also + /// FixedU32::[is\_power\_of\_two][FixedU32::is_power_of_two]. fn is_power_of_two(self) -> bool; /// Returns the highest one in the binary representation, or zero /// if `self` is zero. + /// + /// See also FixedU32::[highest\_one][FixedU32::highest_one]. fn highest_one(self) -> Self; /// Returns the smallest power of two that is ≥ `self`. + /// + /// See also + /// FixedU32::[next\_power\_of\_two][FixedU32::next_power_of_two]. fn next_power_of_two(self) -> Self; /// Returns the smallest power of two that is ≥ `self`, or [`None`] if the /// next power of two is too large to represent. + /// + /// See also + /// FixedU32::[checked\_next\_power\_of\_two][FixedU32::checked_next_power_of_two]. fn checked_next_power_of_two(self) -> Option; /// Returns the smallest power of two that is ≥ `self`, wrapping /// to 0 if the next power of two is too large to represent. + /// + /// See also + /// FixedU32::[wrapping\_next\_power\_of\_two][FixedU32::wrapping_next_power_of_two]. fn wrapping_next_power_of_two(self) -> Self; /// Returns the smallest power of two that is ≥ `self`, panicking /// if the next power of two is too large to represent. /// + /// See also + /// FixedU32::[unwrapped\_next\_power\_of\_two][FixedU32::unwrapped_next_power_of_two]. + /// /// # Panics /// /// Panics if the result does not fit.