Skip to main content

math_constants

Macro math_constants 

Source
macro_rules! math_constants {
    ($($variant:ident = $discriminant:literal, $kind:ident $field:ident;)+) => { ... };
    (@value $self:ident, record $field:ident) => { ... };
    (@value $self:ident, int $field:ident) => { ... };
    (@value $self:ident, uint $field:ident) => { ... };
    (@for_ppem $self:ident, record $field:ident, $ppem:ident) => { ... };
    (@for_ppem $self:ident, int $field:ident, $ppem:ident) => { ... };
    (@for_ppem $self:ident, uint $field:ident, $ppem:ident) => { ... };
}
Expand description

Declares the constants of MathConstants, in the order the spec lists them.

One list defines the MathConstant enum, its numbering, and the arm of MathConstants::constant that reads each one, so a constant cannot be numbered as one field and read from another. The matches have no catch-all, so a constant added here without a field will not compile.

The record constants are MathValueRecords and can carry a device table. The int and uint ones are stored as bare integers, so they never do.