variable_len_reader/asynchronous/
write_bools.rs1macro_rules! write_bools_future {
2 ($future: ident, $n: literal) => {
3 write_bools_future!(f cfg(feature = "async_bools"), $future, WriteSingle, $n);
4 };
5 (f $feature: meta, $future: ident, $inner_future: ident, $n: literal) => {
6 write_wrap_future!(f $feature, [bool; $n], $future, $inner_future);
7 #[$feature]
8 impl<'a, W: ?Sized> $future<'a, W> {
9 fn _handle(bools: [bool; $n]) -> u8 {
10 let mut b = 0;
11 for i in 0..$n {
12 if bools[i] {
13 b |= 1 << i;
14 }
15 }
16 b
17 }
18 }
19 };
20}
21macro_rules! write_bools_func {
22 ($future: ident, $func: ident, $n: literal) => {
23 write_bools_func!(f cfg(feature = "async_bools"), $future, $func, $n);
24 };
25 (f $feature: meta, $future: ident, $func: ident, $n: literal) => {
26 write_wrap_func!(f $feature, [bool; $n], $future, $func);
27 };
28}
29
30macro_rules! define_write_bools_future {
31 () => {
32 write_bools_future!(WriteBools2, 2);
33 write_bools_future!(WriteBools3, 3);
34 write_bools_future!(WriteBools4, 4);
35 write_bools_future!(WriteBools5, 5);
36 write_bools_future!(WriteBools6, 6);
37 write_bools_future!(WriteBools7, 7);
38 write_bools_future!(WriteBools8, 8);
39 };
40}
41macro_rules! define_write_bools_func {
42 () => {
43 write_bools_func!(WriteBools2, write_bools_2, 2);
44 write_bools_func!(WriteBools3, write_bools_3, 3);
45 write_bools_func!(WriteBools4, write_bools_4, 4);
46 write_bools_func!(WriteBools5, write_bools_5, 5);
47 write_bools_func!(WriteBools6, write_bools_6, 6);
48 write_bools_func!(WriteBools7, write_bools_7, 7);
49 write_bools_func!(WriteBools8, write_bools_8, 8);
50 };
51}
52
53define_write_bools_future!();