mut_base/
mut_count.rs

1// File: ./bin-hello/examples/mut_base/mut_count/mod.rs
2// clear && cargo run --example mut_base --features ok -- mut_count | bat -l cmd
3// clear && cargo run --example mut_base --features err_01
4// clear && cargo run --example mut_base --features err_02
5// clear && cargo run --example mut_base --features err_03
6// clear && cargo run --example mut_base -- mut_count
7
8//=======
9#![allow(unused_mut)]
10#![allow(unused_variables)]
11
12
13
14//=======
15#[cfg(feature = "ok")]
16pub fn adjoin() {
17    // ANCHOR: feature-ok
18    // File: ./bin-hello/examples/mut_base/mut_count/mod.rs
19    // #[cfg(feature = "ok")]
20
21    let instance = vec![33u8, 42];
22    let first_ref = &instance; // immutable reference
23    let second_ref = &instance; // immutable reference
24    println!("{:?} {:?}", first_ref, second_ref);
25
26    let mut instance = vec![33, 42u8];
27    let first_mut_ref = &instance; // immutable reference
28    let second_mut_ref = &instance; // immutable reference
29    println!("{:?} {:?}", first_mut_ref, second_mut_ref);
30
31    // ANCHOR_END: feature-ok
32}
33
34
35
36//=======
37#[cfg(feature = "err_01")]
38// error[E0499]
39pub fn adjoin() {
40    // ANCHOR: feature-err_01
41    // File: ./bin-hello/examples/mut_base/mut_count/mod.rs
42    // #[cfg(feature = "err_01")]
43
44    let mut instance = vec![33u8, 42];
45    let first_mut_ref = &mut instance; // mutable reference
46    let second_mut_ref = &mut instance; // mutable reference
47    println!("{:?} {:?}", first_mut_ref, second_mut_ref);
48
49    // ANCHOR_END: feature-err_01
50}
51
52
53
54//=======
55#[cfg(feature = "err_02")]
56// error[E0502]
57pub fn adjoin() {
58    // ANCHOR: feature-err_02
59    // File: ./bin-hello/examples/mut_base/mut_count/mod.rs
60    // #[cfg(feature = "err_02")]
61
62    let mut instance = vec![33, 42u8];
63    let first_immut_ref = &instance; // immutable reference
64    let second_mut_ref = &mut instance; // mutable reference
65    println!("{:?}", first_immut_ref);
66
67    // ANCHOR_END: feature-err_02
68}
69
70
71
72//=======
73#[cfg(feature = "err_03")]
74// error[E0502]
75pub fn adjoin() {
76    // ANCHOR: feature-err_03
77    // File: ./bin-hello/examples/mut_base/mut_count/mod.rs
78    // #[cfg(feature = "err_03")]
79
80    let mut instance = vec![33u8, 42];
81    let first_mut_ref = &mut instance; // mutable reference
82    let second_immut_ref = &instance; // immutable reference
83    println!("{:?}", first_mut_ref);
84
85    // ANCHOR_END: feature-err_03
86}
87
88
89
90//=======
91#[cfg(all(
92    not(feature = "ok"),
93    not(feature = "err_01"),
94    not(feature = "err_02"),
95    not(feature = "err_03")
96))]
97pub fn adjoin() {
98    use aide::*;
99    hello();
100}