Struct agb::fixnum::Num

source ·
pub struct Num<I, const N: usize>(/* private fields */)
where
    I: FixedWidthUnsignedInteger;
Expand description

A fixed point number represented using I with N bits of fractional precision

Implementations§

source§

impl<I, const N: usize> Num<I, N>

source

pub fn change_base<J, const M: usize>(self) -> Num<J, M>
where J: FixedWidthUnsignedInteger + From<I>,

Performs the conversion between two integer types and between two different fractional precisions

source

pub fn try_change_base<J, const M: usize>(self) -> Option<Num<J, M>>
where J: FixedWidthUnsignedInteger + TryFrom<I>,

Attempts to perform the conversion between two integer types and between two different fractional precisions

let a: Num<i32, 8> = 1.into();
let b: Option<Num<u8, 4>> = a.try_change_base();
assert_eq!(b, Some(1.into()));

let a: Num<i32, 8> = 18.into();
let b: Option<Num<u8, 4>> = a.try_change_base();
assert_eq!(b, None);
Examples found in repository?
examples/windows.rs (line 74)
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
fn main(mut gba: agb::Gba) -> ! {
    let (gfx, mut vram) = gba.display.video.tiled0();

    let mut map = gfx.background(
        agb::display::Priority::P0,
        RegularBackgroundSize::Background32x32,
        TileFormat::FourBpp,
    );
    let mut window = gba.display.window.get();
    window
        .win_in(WinIn::Win0)
        .set_background_enable(map.background(), true)
        .set_position(&Rect::new((10, 10).into(), (64, 64).into()))
        .enable();

    window
        .win_out()
        .enable()
        .set_background_enable(map.background(), true)
        .set_blend_enable(true);

    example_logo::display_logo(&mut map, &mut vram);

    let mut blend = gba.display.blend.get();

    blend
        .set_background_enable(Layer::Top, map.background(), true)
        .set_backdrop_enable(Layer::Bottom, true)
        .set_blend_mode(BlendMode::Normal);

    let mut pos: Vector2D<FNum> = (10, 10).into();
    let mut velocity: Vector2D<FNum> = Vector2D::new(1.into(), 1.into());

    let mut blend_amount: Num<i32, 8> = num!(0.5);
    let mut blend_velocity: Num<i32, 8> = Num::new(1) / 128;

    let vblank = VBlank::get();

    loop {
        pos += velocity;

        if pos.x.floor() > WIDTH - 64 || pos.x.floor() < 0 {
            velocity.x *= -1;
        }

        if pos.y.floor() > HEIGHT - 64 || pos.y.floor() < 0 {
            velocity.y *= -1;
        }

        blend_amount += blend_velocity;
        if blend_amount > num!(0.75) || blend_amount < num!(0.25) {
            blend_velocity *= -1;
        }

        blend_amount = blend_amount.clamp(0.into(), 1.into());

        blend.set_blend_weight(Layer::Top, blend_amount.try_change_base().unwrap());

        window
            .win_in(WinIn::Win0)
            .set_position(&Rect::new(pos.floor(), (64, 64).into()));

        vblank.wait_for_vblank();
        window.commit();
        blend.commit();
    }
}
source

pub const fn from_raw(n: I) -> Num<I, N>

A bit for bit conversion from a number to a fixed num

source

pub fn to_raw(self) -> I

The internal representation of the fixed point number

source

pub fn from_f32(input: f32) -> Num<I, N>

Lossily transforms an f32 into a fixed point representation. This is not const because you cannot currently do floating point operations in const contexts, so you should use the num! macro from agb-macros if you want a const from_f32/f64

source

pub fn from_f64(input: f64) -> Num<I, N>

Lossily transforms an f64 into a fixed point representation. This is not const because you cannot currently do floating point operations in const contexts, so you should use the num! macro from agb-macros if you want a const from_f32/f64

source

pub fn trunc(self) -> I

Truncates the fixed point number returning the integral part

let n: Num<i32, 8> = num!(5.67);
assert_eq!(n.trunc(), 5);
let n: Num<i32, 8> = num!(-5.67);
assert_eq!(n.trunc(), -5);
source

pub fn rem_euclid(self, rhs: Num<I, N>) -> Num<I, N>

Performs the equivalent to the integer rem_euclid, which is modulo numbering.

let n: Num<i32, 8> = num!(5.67);
let r: Num<i32, 8> = num!(4.);
assert_eq!(n.rem_euclid(r), num!(1.67));

let n: Num<i32, 8> = num!(-1.5);
let r: Num<i32, 8> = num!(4.);
assert_eq!(n.rem_euclid(r), num!(2.5));
source

pub fn floor(self) -> I

Performs rounding towards negative infinity

let n: Num<i32, 8> = num!(5.67);
assert_eq!(n.floor(), 5);
let n: Num<i32, 8> = num!(-5.67);
assert_eq!(n.floor(), -6);
Examples found in repository?
examples/windows.rs (line 59)
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
fn main(mut gba: agb::Gba) -> ! {
    let (gfx, mut vram) = gba.display.video.tiled0();

    let mut map = gfx.background(
        agb::display::Priority::P0,
        RegularBackgroundSize::Background32x32,
        TileFormat::FourBpp,
    );
    let mut window = gba.display.window.get();
    window
        .win_in(WinIn::Win0)
        .set_background_enable(map.background(), true)
        .set_position(&Rect::new((10, 10).into(), (64, 64).into()))
        .enable();

    window
        .win_out()
        .enable()
        .set_background_enable(map.background(), true)
        .set_blend_enable(true);

    example_logo::display_logo(&mut map, &mut vram);

    let mut blend = gba.display.blend.get();

    blend
        .set_background_enable(Layer::Top, map.background(), true)
        .set_backdrop_enable(Layer::Bottom, true)
        .set_blend_mode(BlendMode::Normal);

    let mut pos: Vector2D<FNum> = (10, 10).into();
    let mut velocity: Vector2D<FNum> = Vector2D::new(1.into(), 1.into());

    let mut blend_amount: Num<i32, 8> = num!(0.5);
    let mut blend_velocity: Num<i32, 8> = Num::new(1) / 128;

    let vblank = VBlank::get();

    loop {
        pos += velocity;

        if pos.x.floor() > WIDTH - 64 || pos.x.floor() < 0 {
            velocity.x *= -1;
        }

        if pos.y.floor() > HEIGHT - 64 || pos.y.floor() < 0 {
            velocity.y *= -1;
        }

        blend_amount += blend_velocity;
        if blend_amount > num!(0.75) || blend_amount < num!(0.25) {
            blend_velocity *= -1;
        }

        blend_amount = blend_amount.clamp(0.into(), 1.into());

        blend.set_blend_weight(Layer::Top, blend_amount.try_change_base().unwrap());

        window
            .win_in(WinIn::Win0)
            .set_position(&Rect::new(pos.floor(), (64, 64).into()));

        vblank.wait_for_vblank();
        window.commit();
        blend.commit();
    }
}
More examples
Hide additional examples
examples/dma_effect_circular_window.rs (line 66)
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
fn main(mut gba: agb::Gba) -> ! {
    let (gfx, mut vram) = gba.display.video.tiled0();

    let mut map = gfx.background(
        agb::display::Priority::P0,
        RegularBackgroundSize::Background32x32,
        TileFormat::FourBpp,
    );
    let mut window = gba.display.window.get();
    window
        .win_in(WinIn::Win0)
        .set_background_enable(map.background(), true)
        .set_position(&Rect::new((10, 10).into(), (64, 64).into()))
        .enable();

    let dmas = gba.dma.dma();

    example_logo::display_logo(&mut map, &mut vram);

    let mut pos: Vector2D<FNum> = (10, 10).into();
    let mut velocity: Vector2D<FNum> = Vector2D::new(1.into(), 1.into());

    let vblank = VBlank::get();

    let circle: Box<[_]> = (1..64i32)
        .map(|i| {
            let y = 32 - i;
            let x = (32 * 32 - y * y).isqrt();
            let x1 = 32 - x;
            let x2 = 32 + x;

            ((x1 as u16) << 8) | (x2 as u16)
        })
        .collect();

    let mut circle_poses = vec![0; 160];

    loop {
        pos += velocity;

        if pos.x.floor() > WIDTH - 64 || pos.x.floor() < 0 {
            velocity.x *= -1;
        }

        if pos.y.floor() > HEIGHT - 64 || pos.y.floor() < 0 {
            velocity.y *= -1;
        }

        let x_pos = pos.x.floor().max(0) as u16;
        let y_pos = pos.y.floor().max(0);
        let x_adjustment = x_pos << 8 | x_pos;
        for (i, value) in circle_poses.iter_mut().enumerate() {
            let i = i as i32;
            if i <= y_pos || i >= y_pos + 64 {
                *value = 0;
                continue;
            }

            *value = circle[(i - y_pos) as usize - 1] + x_adjustment;
        }

        window
            .win_in(WinIn::Win0)
            .set_position(&Rect::new(pos.floor(), (64, 65).into()));
        window.commit();

        let dma_controllable = window.win_in(WinIn::Win0).horizontal_position_dma();
        let _transfer = unsafe { dmas.dma0.hblank_transfer(&dma_controllable, &circle_poses) };

        vblank.wait_for_vblank();
    }
}
source

pub fn frac(self) -> I

Returns the fractional component of a number as it’s integer representation

let n: Num<i32, 8> = num!(5.5);
assert_eq!(n.frac(), 1 << 7);
source

pub fn new(integral: I) -> Num<I, N>

Creates an integer represented by a fixed point number

let n: Num<i32, 8> = Num::new(5);
assert_eq!(n.frac(), 0); // no fractional component
assert_eq!(n, num!(5.)); // just equals the number 5
Examples found in repository?
examples/windows.rs (line 52)
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
fn main(mut gba: agb::Gba) -> ! {
    let (gfx, mut vram) = gba.display.video.tiled0();

    let mut map = gfx.background(
        agb::display::Priority::P0,
        RegularBackgroundSize::Background32x32,
        TileFormat::FourBpp,
    );
    let mut window = gba.display.window.get();
    window
        .win_in(WinIn::Win0)
        .set_background_enable(map.background(), true)
        .set_position(&Rect::new((10, 10).into(), (64, 64).into()))
        .enable();

    window
        .win_out()
        .enable()
        .set_background_enable(map.background(), true)
        .set_blend_enable(true);

    example_logo::display_logo(&mut map, &mut vram);

    let mut blend = gba.display.blend.get();

    blend
        .set_background_enable(Layer::Top, map.background(), true)
        .set_backdrop_enable(Layer::Bottom, true)
        .set_blend_mode(BlendMode::Normal);

    let mut pos: Vector2D<FNum> = (10, 10).into();
    let mut velocity: Vector2D<FNum> = Vector2D::new(1.into(), 1.into());

    let mut blend_amount: Num<i32, 8> = num!(0.5);
    let mut blend_velocity: Num<i32, 8> = Num::new(1) / 128;

    let vblank = VBlank::get();

    loop {
        pos += velocity;

        if pos.x.floor() > WIDTH - 64 || pos.x.floor() < 0 {
            velocity.x *= -1;
        }

        if pos.y.floor() > HEIGHT - 64 || pos.y.floor() < 0 {
            velocity.y *= -1;
        }

        blend_amount += blend_velocity;
        if blend_amount > num!(0.75) || blend_amount < num!(0.25) {
            blend_velocity *= -1;
        }

        blend_amount = blend_amount.clamp(0.into(), 1.into());

        blend.set_blend_weight(Layer::Top, blend_amount.try_change_base().unwrap());

        window
            .win_in(WinIn::Win0)
            .set_position(&Rect::new(pos.floor(), (64, 64).into()));

        vblank.wait_for_vblank();
        window.commit();
        blend.commit();
    }
}
source§

impl<const N: usize> Num<i32, N>

source

pub fn sqrt(self) -> Num<i32, N>

Returns the square root of a number, it is calculated a digit at a time.

let n: Num<i32, 8> = num!(16.);
assert_eq!(n.sqrt(), num!(4.));
let n: Num<i32, 8> = num!(2.25);
assert_eq!(n.sqrt(), num!(1.5));
source§

impl<I, const N: usize> Num<I, N>

source

pub fn abs(self) -> Num<I, N>

Returns the absolute value of a fixed point number

let n: Num<i32, 8> = num!(5.5);
assert_eq!(n.abs(), num!(5.5));
let n: Num<i32, 8> = num!(-5.5);
assert_eq!(n.abs(), num!(5.5));
source

pub fn cos(self) -> Num<I, N>

Calculates the cosine of a fixed point number with the domain of [0, 1]. Uses a fifth order polynomial.

let n: Num<i32, 8> = num!(0.);   // 0 radians
assert_eq!(n.cos(), num!(1.));
let n: Num<i32, 8> = num!(0.25); // pi / 2 radians
assert_eq!(n.cos(), num!(0.));
let n: Num<i32, 8> = num!(0.5);  // pi radians
assert_eq!(n.cos(), num!(-1.));
let n: Num<i32, 8> = num!(0.75); // 3pi/2 radians
assert_eq!(n.cos(), num!(0.));
let n: Num<i32, 8> = num!(1.);   // 2 pi radians (whole rotation)
assert_eq!(n.cos(), num!(1.));
source

pub fn sin(self) -> Num<I, N>

Calculates the sine of a number with domain of [0, 1].

let n: Num<i32, 8> = num!(0.);   // 0 radians
assert_eq!(n.sin(), num!(0.));
let n: Num<i32, 8> = num!(0.25); // pi / 2 radians
assert_eq!(n.sin(), num!(1.));
let n: Num<i32, 8> = num!(0.5);  // pi radians
assert_eq!(n.sin(), num!(0.));
let n: Num<i32, 8> = num!(0.75); // 3pi/2 radians
assert_eq!(n.sin(), num!(-1.));
let n: Num<i32, 8> = num!(1.);   // 2 pi radians (whole rotation)
assert_eq!(n.sin(), num!(0.));

Trait Implementations§

source§

impl<I, T, const N: usize> Add<T> for Num<I, N>
where I: FixedWidthUnsignedInteger, T: Into<Num<I, N>>,

§

type Output = Num<I, N>

The resulting type after applying the + operator.
source§

fn add(self, rhs: T) -> <Num<I, N> as Add<T>>::Output

Performs the + operation. Read more
source§

impl<I, T, const N: usize> AddAssign<T> for Num<I, N>
where I: FixedWidthUnsignedInteger, T: Into<Num<I, N>>,

source§

fn add_assign(&mut self, rhs: T)

Performs the += operation. Read more
source§

impl<I, const N: usize> Clone for Num<I, N>
where I: Clone + FixedWidthUnsignedInteger,

source§

fn clone(&self) -> Num<I, N>

Returns a copy of the value. Read more
1.0.0§

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

Performs copy-assignment from source. Read more
source§

impl<I, const N: usize> Debug for Num<I, N>

source§

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

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

impl<I, const N: usize> Default for Num<I, N>

source§

fn default() -> Num<I, N>

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

impl<I, const N: usize> Display for Num<I, N>

source§

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

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

impl<I, const N: usize> Div<I> for Num<I, N>

§

type Output = Num<I, N>

The resulting type after applying the / operator.
source§

fn div(self, rhs: I) -> <Num<I, N> as Div<I>>::Output

Performs the / operation. Read more
source§

impl<I, const N: usize> Div for Num<I, N>

§

type Output = Num<I, N>

The resulting type after applying the / operator.
source§

fn div(self, rhs: Num<I, N>) -> <Num<I, N> as Div>::Output

Performs the / operation. Read more
source§

impl<I, T, const N: usize> DivAssign<T> for Num<I, N>
where I: FixedWidthUnsignedInteger, Num<I, N>: Div<T, Output = Num<I, N>>,

source§

fn div_assign(&mut self, rhs: T)

Performs the /= operation. Read more
source§

impl<I, const N: usize> From<I> for Num<I, N>

source§

fn from(value: I) -> Num<I, N>

Converts to this type from the input type.
source§

impl<I, const N: usize> Hash for Num<I, N>
where I: Hash + FixedWidthUnsignedInteger,

source§

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

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<I, const N: usize> Mul<I> for Num<I, N>

§

type Output = Num<I, N>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: I) -> <Num<I, N> as Mul<I>>::Output

Performs the * operation. Read more
source§

impl<I, const N: usize> Mul for Num<I, N>

§

type Output = Num<I, N>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Num<I, N>) -> <Num<I, N> as Mul>::Output

Performs the * operation. Read more
source§

impl<I, T, const N: usize> MulAssign<T> for Num<I, N>
where I: FixedWidthUnsignedInteger, Num<I, N>: Mul<T, Output = Num<I, N>>,

source§

fn mul_assign(&mut self, rhs: T)

Performs the *= operation. Read more
source§

impl<I, const N: usize> Neg for Num<I, N>

§

type Output = Num<I, N>

The resulting type after applying the - operator.
source§

fn neg(self) -> <Num<I, N> as Neg>::Output

Performs the unary - operation. Read more
source§

impl<I, const N: usize> Num for Num<I, N>

§

type FromStrRadixErr = <f64 as Num>::FromStrRadixErr

source§

fn from_str_radix( str: &str, radix: u32 ) -> Result<Num<I, N>, <Num<I, N> as Num>::FromStrRadixErr>

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

impl<I, const N: usize> One for Num<I, N>

source§

fn one() -> Num<I, N>

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<I, const N: usize> Ord for Num<I, N>

source§

fn cmp(&self, other: &Num<I, N>) -> 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 + PartialOrd,

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

impl<I, const N: usize> PartialEq for Num<I, N>
where I: PartialEq + FixedWidthUnsignedInteger,

source§

fn eq(&self, other: &Num<I, N>) -> bool

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

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<I, const N: usize> PartialOrd for Num<I, N>
where I: PartialOrd + FixedWidthUnsignedInteger,

source§

fn partial_cmp(&self, other: &Num<I, N>) -> 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

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

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

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

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

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

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<I, T, const N: usize> Rem<T> for Num<I, N>
where I: FixedWidthUnsignedInteger, T: Into<Num<I, N>>,

§

type Output = Num<I, N>

The resulting type after applying the % operator.
source§

fn rem(self, modulus: T) -> <Num<I, N> as Rem<T>>::Output

Performs the % operation. Read more
source§

impl<I, T, const N: usize> RemAssign<T> for Num<I, N>
where I: FixedWidthUnsignedInteger, T: Into<Num<I, N>>,

source§

fn rem_assign(&mut self, modulus: T)

Performs the %= operation. Read more
source§

impl<I, T, const N: usize> Sub<T> for Num<I, N>
where I: FixedWidthUnsignedInteger, T: Into<Num<I, N>>,

§

type Output = Num<I, N>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: T) -> <Num<I, N> as Sub<T>>::Output

Performs the - operation. Read more
source§

impl<I, T, const N: usize> SubAssign<T> for Num<I, N>
where I: FixedWidthUnsignedInteger, T: Into<Num<I, N>>,

source§

fn sub_assign(&mut self, rhs: T)

Performs the -= operation. Read more
source§

impl<I, const N: usize> Zero for Num<I, N>

source§

fn zero() -> Num<I, N>

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<I, const N: usize> Copy for Num<I, N>
where I: Copy + FixedWidthUnsignedInteger,

source§

impl<I, const N: usize> Eq for Num<I, N>

source§

impl<I, const N: usize> Number for Num<I, N>

source§

impl<I, const N: usize> StructuralPartialEq for Num<I, N>

Auto Trait Implementations§

§

impl<I, const N: usize> RefUnwindSafe for Num<I, N>
where I: RefUnwindSafe,

§

impl<I, const N: usize> Send for Num<I, N>
where I: Send,

§

impl<I, const N: usize> Sync for Num<I, N>
where I: Sync,

§

impl<I, const N: usize> Unpin for Num<I, N>
where I: Unpin,

§

impl<I, const N: usize> UnwindSafe for Num<I, N>
where I: UnwindSafe,

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> 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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<T> ToString for T
where T: Display + ?Sized,

§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
§

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, 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>,