File: noderive.rs

package info (click to toggle)
rust-blanket 0.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 548 kB
  • sloc: makefile: 2
file content (22 lines) | stat: -rw-r--r-- 407 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
extern crate impls;
extern crate static_assertions;

use impls::impls;
use static_assertions::const_assert;

pub trait Counter {
    fn increment(&mut self);
}

struct AtomicCounter(u8);

impl Counter for AtomicCounter {
    fn increment(&mut self) {
        self.0 += 1;
    }
}

fn main() {
    const_assert!(impls!(AtomicCounter:      Counter));
    const_assert!(impls!(&mut AtomicCounter: Counter));
}