Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #![feature(const_generics)]
- enum Node {
- A,
- B,
- }
- struct Foo<const T: Node> {}
- impl Foo<{ Node::A }> {
- fn nice(&self) {
- println!("nice");
- }
- }
- impl Foo<{ Node::B }> {
- fn ok(&self) {
- println!("ok");
- }
- }
- fn main() {
- let a: Foo<{ Node::A }> = Foo {};
- a.nice();
- let b: Foo<{ Node::B }> = Foo {};
- b.ok();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement