Description
A macro that allows using impl trait types in bindings.
Currently supported statements: let, const (with some limitations mentioned below), static.
This crate will be replaced by impl_trait_in_bindings feature in future,
but there is still a long way to stabilize it.
Example
extern crate bind_it;
bind_it!;
// fails, even x variable is initialized with a boolean, its type is hidden behind `Display` trait,
// and the only thing that we can do - display x
assert!;
// works
println!
How it works?
Minimal compiler version
rustc 1.61.0-nightly (c5cf08d37 2022-03-30)
Limitations
- Currently only one item per macro supported
- Associated consts are not yet supported
- Only one type per impl Trait allowed. tl;dr, you can't write
bind_it! ;
Despite of that fact that both &str and u8 implement Display trait, we need to determine ONE concrete type in the compile time.