1#![allow(unused_variables)]
12
13
14
15#[cfg(feature = "ok")]
17pub fn adjoin() {
18 fn one(input: &str) -> String {
23 let result = format!("{}{}", input, ", world");
24 println!("one() input = {:p}", input);
25 result
26 }
27
28 fn two(input: &str) -> String {
29 let result = format!("{}{}", input, "!");
30 println!("two() input = {:p}", input);
31 result
32 }
33
34 let mut instance = String::new();
35 println!("instance = {:p}", &instance);
36 instance.push_str("Hello");
37 println!();
38
39 let mut mut_immut_ref :&str = &instance;
40 println!("before call one() mut_immut_ref = {:p}", mut_immut_ref);
41 let tmp_instance = one(mut_immut_ref);
42 println!("after call one() mut_immut_ref = {:p}", mut_immut_ref);
43 instance = tmp_instance;
44 println!("instance = {:?}", instance);
45 println!();
46
47 mut_immut_ref = &instance;
48 println!("mut_immut_ref = {:p}", mut_immut_ref);
49 instance = two(mut_immut_ref);
50 println!("instance = {:?}", instance);
51 println!();
52
53 println!("instance = {:p}", &instance);
54
55 }
57
58
59
60#[cfg(feature = "cp")]
62pub fn adjoin() {
63 use std::borrow::Cow;
68
69 fn one<'a>(input: &'a str) -> Cow<'a, str> {
70 let mut buf = String::with_capacity(input.len());
71 buf.push_str(input);
72 buf.push_str(", world");
73 buf.into()
74 }
75
76 fn two<'a>(input: &'a str) -> Cow<'a, str> {
77 let mut buf = String::with_capacity(input.len());
78 buf.push_str(input);
79 buf.push('!');
80 buf.into()
81 }
82
83 let mut hello_from = String::new();
84 hello_from.push_str("Hello");
85
86 let mut_ref :&str = &hello_from;
87 let fn_one :Cow<'_, str> = one(mut_ref);
88 hello_from = fn_one.to_string();
89
90 let mut_ref :&str = &hello_from;
91 hello_from = two(mut_ref).to_string();
92
93 println!("hello from {:?}", hello_from);
94
95 }
97
98
99
100#[cfg(feature = "okay")]
102pub fn adjoin() {
103 fn one(input: &str) -> Box<String> {
108 let result = format!("{}{}", input, ", world");
109 Box::new(result)
110 }
111
112 fn two(input: &str) -> Box<String> {
113 let result = format!("{}{}", input, "!");
114 Box::new(result)
115 }
116
117 let mut hello_from = String::new();
118 hello_from.push_str("Hello");
119
120 let mut_ref :&str = &hello_from;
121 hello_from = one(mut_ref).to_string();
122 let mut_ref :&str = &hello_from;
123 hello_from = two(mut_ref).to_string();
124 println!("hello from {:?}", hello_from);
125
126 let mut mut_ref :&str = &hello_from;
127 hello_from = one(mut_ref).to_string();
128 mut_ref = &hello_from;
129 hello_from = two(mut_ref).to_string();
130 println!("hello from {:?}", hello_from);
131
132 }
134
135
136
137
138#[cfg(feature = "okey")]
140pub fn adjoin() {
141 }
148
149
150
151
152#[cfg(feature = "err_01")]
154pub fn adjoin() {
155 fn one(input: &str) -> Box<String> {
160 let result = format!("{}{}", input, ", world");
161 Box::new(result)
162 }
163
164 fn two(input: &str) -> Box<String> {
165 let result = format!("{}{}", input, "!");
166 Box::new(result)
167 }
168
169 let mut hello_from = String::new();
170 hello_from.push_str("Hello");
171
172 let mut_ref :&str = &hello_from;
173 hello_from = one(mut_ref).to_string();
174 hello_from = two(mut_ref).to_string();
176 println!("hello from {:?}", hello_from);
177
178 }
180
181
182
183#[cfg(feature = "err_02")]
185pub fn adjoin() {
186 }
194
195
196
197
198#[cfg(feature = "err_03")]
200pub fn adjoin() {
201 fn manipulate(input: &mut String) {
206 input.push('!');
207 }
208
209 let mut instance = String::new();
210 instance.push_str("Hello");
211 let mut_ref = &mut instance;
212 manipulate(mut_ref);
213 println!("{}", instance);
214
215 }
217
218
219
220#[cfg(all(
222 not(feature = "ok"),
223 not(feature = "cp"),
224 not(feature = "okay"),
225 not(feature = "okey"),
226 not(feature = "err_01"),
227 not(feature = "err_02"),
228 not(feature = "err_03"),
229))]
230pub fn adjoin() {
231 use aide::*;
232 hello();
233}
234
235