linksplatform / doublets-rs

The Unlicense
5 stars 2 forks source link

Improve `ffi::specialize_for` #11

Open uselessgoddess opened 2 years ago

uselessgoddess commented 2 years ago

Now the specialization for all integer types looks like this:

#[ffi::specialize_for(
    types = "u8",
    types = "u16",
    types = "u32",
    types = "u64",
    convention = "rust",
    name = "doublets_constants_*"
)]

I see two ways of development:

1. Remove convention and add explicit annotation with more luxury style:

#[ffi::specialize_for(
    types(
        u8  => "u8",
        u16 => "uint16",
        u32 => "uint",
        u64 => "ll",
    )
    name = "doublets_constants_*"
)]
#[ffi::specialize_for(
    u8(u8), u16(uint16), u32(uint), u64(ll),
    name = "doublets_constants_*"
)]

2. Use a more limited solution with embedded annotations:

#[ffi::specialize("doublets_constants_*")]
uselessgoddess commented 2 years ago

Improve in #10