kw_fn/vec_str.rs
1// File: ./bin-hello/examples/kw_fn/vec_str/mod.rs
2// clear && cargo run --example kw_fn --features ok -- vec_str | bat -l cmd
3// clear && cargo run --example kw_fn --features err_02
4// clear && cargo run --example kw_fn -- vec_str
5
6//=======
7
8
9
10//=======
11#[cfg(feature = "ok")]
12pub fn adjoin() {
13 // ANCHOR: feature-ok
14 // File: ./bin-hello/examples/kw_fn/vec_str/mod.rs
15 // #[cfg(feature = "ok")]
16
17 fn print_berry_names(berries: &Vec<&str>) {
18 for berry in berries {
19 println!("{}", berry);
20 }
21 }
22
23 let berry_instances = vec!["Blackberry", "Strawberry"];
24 print_berry_names(&berry_instances);
25
26 dbg!(berry_instances);
27
28 // ANCHOR_END: feature-ok
29}
30
31
32
33//=======
34#[cfg(feature = "err_02")]
35// error[E0384]
36pub fn adjoin() {
37 // ANCHOR: feature-err
38 // File: ./bin-hello/examples/kw_fn/vec_str/mod.rs
39 // #[cfg(feature = "err_02")]
40
41 fn print_berry_names(berries: Vec<&str>) {
42 for berry in &berries {
43 println!("{}", berry);
44 }
45 }
46
47 let berry_instances = vec!["Blackberry", "Strawberry"];
48 print_berry_names(berry_instances);
49
50 dbg!(berry_instances);
51
52 // ANCHOR_END: feature-err
53}
54
55
56
57//=======
58#[cfg(all(not(feature = "ok"), not(feature = "err_02")))]
59pub fn adjoin() {
60 use aide::*;
61 hello();
62}