ensure_impl
Trait implementation assertion.
The author of this crate is not good at English.
Forgive me if the document is hard to read.
What is this?
This crate provides an attribute macro to check the implementation of traits. Primary intended use is blanket implementation checking.
The notation is just adding #[ensure_impl] to usual trait implementation.
In usual trait implementation, duplication with existing implementations
are checked, and if there are any, compile error occurs. On the other hand,
if the attribute macro is added, the behavior is reversed, and if there is
no duplication, compile error occurs.
Background
Blanket implementation is great feature.
However, if its boundary is complex, in code reading, we humans can't judge at a glance whether the type fits the blanket or not. Moreover, even if the boundary is complex, the conditions may be loose. In such cases, there may be unintended implementations. So, later developer can't judge them.
All of these problems come from lack of explicit implementation checks.
Examples
use *;
;
Under the hood
For example, following code is ...
use *;
;
... expanded like this.
use *;
;
const _: fn = ;
Versions
See CHANGELOG.