Debian Codegraph @

tests/derive_ref/successes/where_clause_assoc_fn.rs

raw symbols SCIP
1 extern crate blanket;
2 extern crate impls;
3
4 use std::sync::atomic::AtomicU8;
5 use std::sync::atomic::Ordering;
6
7 use blanket::blanket;
8 use impls::impls;
9
10 #[blanket(derive(Ref))]
11 pub trait Counter<T>
12 where
13 T: Clone,
14 {
15 fn increment(&self, t: T);
16
17 fn super_helpful_helper(&self, t: T)
18 {
19 self.increment(t.clone())
20 }
21 }
22
23 struct AtomicCounter {
24 count: AtomicU8,
25 }
26
27 impl Counter<u8> for AtomicCounter {
28 fn increment(&self, value: u8) {
29 self.count.fetch_add(value, Ordering::SeqCst);
30 }
31 }
32
33 fn main() {
34 assert!(impls!(AtomicCounter: Counter<u8>));
35 assert!(impls!(&AtomicCounter: Counter<u8>));
36 }