4 releases
0.1.3 | May 8, 2024 |
---|---|
0.1.2 | Mar 14, 2024 |
0.1.1 | Mar 12, 2024 |
0.1.0 | Mar 12, 2024 |
#350 in Procedural macros
53KB
1.5K
SLoC
callback-trait
Implement trait for Fn so that functions that accept traits as parameters can directly receive Fn parameters, such as:
#[callback_trait]
pub trait ExampleCallback {
async fn call(&self, p1: u32, p2, u32) -> Result<u32, u32>;
}
fn set_callback(callback: impl ExampleCallback) {
}
set_callback(|p1: u32, p2: u32| {
async move {
Ok(0)
}
})
Dependencies
~225–660KB
~16K SLoC