mirror of
https://github.com/rust-lang/rust.git
synced 2025-10-22 12:58:58 +00:00

Currently the macro always provides `CFn`, `RustFn`, `RustArgs`, etc. Change this so that: 1. This information must be explicily requested in the invocation. 2. There is a new `FTy` field available that emits a single float type, rather than a tuple or signature. Additionally, add two new macros that create enums representing function names.
20 lines
481 B
Rust
20 lines
481 B
Rust
#[libm_macros::function_enum(BaseName)]
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
|
pub enum Function {}
|
|
|
|
#[libm_macros::base_name_enum]
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
|
pub enum BaseName {}
|
|
|
|
#[test]
|
|
fn as_str() {
|
|
assert_eq!(Function::Sin.as_str(), "sin");
|
|
assert_eq!(Function::Sinf.as_str(), "sinf");
|
|
}
|
|
|
|
#[test]
|
|
fn basename() {
|
|
assert_eq!(Function::Sin.base_name(), BaseName::Sin);
|
|
assert_eq!(Function::Sinf.base_name(), BaseName::Sin);
|
|
}
|