Macro godot::builtin::real

macro_rules! real {
    ($f:literal) => { ... };
}
Expand description

A macro to coerce float-literals into the real type.

Mainly used where you’d normally use a suffix to specify the type, such as 115.0f32.

§Examples

Rust is not able to infer the self type of this call to to_radians:

use godot::builtin::real;

let radians: real = 115.0.to_radians();

But we cannot add a suffix to the literal, since it may be either f32 or f64 depending on the context. So instead we use our macro:

use godot::builtin::real;

let radians: real = real!(115.0).to_radians();