This crate provides the #[mono]
macro to force a generic function to be monomorphizied with given types.
Pair with share-generics
mode in rustc, this can result less code, for details see https://github.com/rust-lang/rust/pull/48779.
toml
[dependencies]
mono-macro = "1.0"
Since we are monomorphizing ourselves, you are required to spell out the static dispatch manually:
In a bare function case, ```rust
fn func
it will be expanded to:
```rust
pub const _: *const () = (&foo::
For more complicated case, use `mono_macro!` instead:
rust
trait Tr
struct Foo<'a> { t: &'a str, }
impl<'a, T> Tr
mono_macro!(
this will expand to:
```rust
trait Tr
struct Foo<'a> { t: &'a str, }
impl<'a, T> Tr
pub const _: *const () = (&
Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.