#[sealed]
This crate provides a convenient and simple way to implement the sealed trait pattern, as described in the Rust API Guidelines [1].
[]
= "0.2.0-rc2"
Example
In the following code structs A and B implement the sealed trait T,
the C struct, which is not sealed, will error during compilation.
Examples are available in examples/, you can also see a demo in demo/.
use sealed;
;
;
;
// compile error
Details
The #[sealed] attribute can be attached to either a trait or an impl.
It supports:
- Several traits per module
- Generic parameters
- Foreign types
- Blanket
impls
Expansion
Input
use sealed;
;
;
Expanded
use sealed;
pub
;
;