doc reordering: ZERO before MIN and MAX
This commit is contained in:
parent
6f0eab0060
commit
2be8cfcd47
|
@ -23,6 +23,20 @@ macro_rules! fixed_no_frac {
|
|||
/// The implementation of items in this block is independent
|
||||
/// of the number of fractional bits `Frac`.
|
||||
impl<Frac> $Fixed<Frac> {
|
||||
comment! {
|
||||
"Zero.
|
||||
|
||||
# Examples
|
||||
|
||||
```rust
|
||||
use fixed::{types::extra::U4, ", $s_fixed, "};
|
||||
type Fix = ", $s_fixed, "<U4>;
|
||||
assert_eq!(Fix::ZERO, Fix::from_bits(0));
|
||||
```
|
||||
";
|
||||
pub const ZERO: $Fixed<Frac> = Self::from_bits(0);
|
||||
}
|
||||
|
||||
comment! {
|
||||
"The smallest value that can be represented.
|
||||
|
||||
|
@ -51,20 +65,6 @@ assert_eq!(Fix::MAX, Fix::from_bits(", $s_inner, "::MAX));
|
|||
pub const MAX: $Fixed<Frac> = Self::from_bits(<$Inner>::MAX);
|
||||
}
|
||||
|
||||
comment! {
|
||||
"Zero.
|
||||
|
||||
# Examples
|
||||
|
||||
```rust
|
||||
use fixed::{types::extra::U4, ", $s_fixed, "};
|
||||
type Fix = ", $s_fixed, "<U4>;
|
||||
assert_eq!(Fix::ZERO, Fix::from_bits(0));
|
||||
```
|
||||
";
|
||||
pub const ZERO: $Fixed<Frac> = Self::from_bits(0);
|
||||
}
|
||||
|
||||
comment! {
|
||||
"The smallest positive value that can be represented.
|
||||
|
||||
|
|
|
@ -301,15 +301,15 @@ where
|
|||
/// [U32]: crate::types::extra::Unsigned::U32
|
||||
type Frac: Unsigned;
|
||||
|
||||
/// Zero.
|
||||
const ZERO: Self;
|
||||
|
||||
/// The smallest value that can be represented.
|
||||
const MIN: Self;
|
||||
|
||||
/// The largest value that can be represented.
|
||||
const MAX: Self;
|
||||
|
||||
/// Zero.
|
||||
const ZERO: Self;
|
||||
|
||||
/// The smallest positive value that can be represented.
|
||||
const DELTA: Self;
|
||||
|
||||
|
@ -2257,9 +2257,9 @@ macro_rules! impl_fixed {
|
|||
type Bits = $Bits;
|
||||
type Bytes = [u8; mem::size_of::<$Bits>()];
|
||||
type Frac = Frac;
|
||||
const ZERO: Self = Self::ZERO;
|
||||
const MIN: Self = Self::MIN;
|
||||
const MAX: Self = Self::MAX;
|
||||
const ZERO: Self = Self::ZERO;
|
||||
const DELTA: Self = Self::DELTA;
|
||||
const IS_SIGNED: bool = Self::IS_SIGNED;
|
||||
const INT_NBITS: u32 = Self::INT_NBITS;
|
||||
|
|
|
@ -52,6 +52,16 @@ use core::{
|
|||
pub struct Unwrapped<F>(pub F);
|
||||
|
||||
impl<F: Fixed> Unwrapped<F> {
|
||||
/// Zero.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```rust
|
||||
/// use fixed::{types::I16F16, Unwrapped};
|
||||
/// assert_eq!(Unwrapped::<I16F16>::ZERO, Unwrapped(I16F16::ZERO));
|
||||
/// ```
|
||||
pub const ZERO: Unwrapped<F> = Unwrapped(F::ZERO);
|
||||
|
||||
/// The smallest value that can be represented.
|
||||
///
|
||||
/// # Examples
|
||||
|
@ -72,16 +82,6 @@ impl<F: Fixed> Unwrapped<F> {
|
|||
/// ```
|
||||
pub const MAX: Unwrapped<F> = Unwrapped(F::MAX);
|
||||
|
||||
/// Zero.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```rust
|
||||
/// use fixed::{types::I16F16, Unwrapped};
|
||||
/// assert_eq!(Unwrapped::<I16F16>::ZERO, Unwrapped(I16F16::ZERO));
|
||||
/// ```
|
||||
pub const ZERO: Unwrapped<F> = Unwrapped(F::ZERO);
|
||||
|
||||
/// The smallest positive value that can be represented.
|
||||
///
|
||||
/// # Examples
|
||||
|
|
|
@ -49,6 +49,16 @@ use core::{
|
|||
pub struct Wrapping<F>(pub F);
|
||||
|
||||
impl<F: Fixed> Wrapping<F> {
|
||||
/// Zero.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```rust
|
||||
/// use fixed::{types::I16F16, Wrapping};
|
||||
/// assert_eq!(Wrapping::<I16F16>::ZERO, Wrapping(I16F16::ZERO));
|
||||
/// ```
|
||||
pub const ZERO: Wrapping<F> = Wrapping(F::ZERO);
|
||||
|
||||
/// The smallest value that can be represented.
|
||||
///
|
||||
/// # Examples
|
||||
|
@ -69,16 +79,6 @@ impl<F: Fixed> Wrapping<F> {
|
|||
/// ```
|
||||
pub const MAX: Wrapping<F> = Wrapping(F::MAX);
|
||||
|
||||
/// Zero.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```rust
|
||||
/// use fixed::{types::I16F16, Wrapping};
|
||||
/// assert_eq!(Wrapping::<I16F16>::ZERO, Wrapping(I16F16::ZERO));
|
||||
/// ```
|
||||
pub const ZERO: Wrapping<F> = Wrapping(F::ZERO);
|
||||
|
||||
/// The smallest positive value that can be represented.
|
||||
///
|
||||
/// # Examples
|
||||
|
|
Loading…
Reference in New Issue