Debian Codegraph @

tests/derive_ref/fails/noderive.rs

raw symbols SCIP
1 extern crate impls;
2 extern crate static_assertions;
3
4 use std::sync::atomic::AtomicU8;
5 use std::sync::atomic::Ordering;
6
7 use impls::impls;
8 use static_assertions::const_assert;
9
10 pub trait Counter {
11 fn increment(&self);
12 }
13
14 #[derive(Default)]
15 struct AtomicCounter {
16 count: AtomicU8
17 }
18
19 impl Counter for AtomicCounter {
20 fn increment(&self) {
21 self.count.fetch_add(1, Ordering::SeqCst);
22 }
23 }
24
25 fn main() {
26 const_assert!(impls!(AtomicCounter: Counter));
27 const_assert!(impls!(&AtomicCounter: Counter));
28 }