1#![allow(unused_variables)]
12
13
14
15
16#[cfg(feature = "ok")]
18pub fn adjoin() {
19 fn one(input: &str) -> String {
24 let result = format!("{}{}", input, "?");
25 println!("two() input = {:p}", &input);
26 result
27 }
28
29 fn two(input: &str) -> String {
30 let result = format!("{}{}", input, "?");
31 println!("two() input = {:p}", &input);
32 result
33 }
34
35 let mut instance = String::new();
36 println!("instance = {:p}", &instance);
37
38 instance.push_str("Hello");
39 println!("instance = {:p}", &instance);
40
41 instance = one(&instance);
42 println!("instance = {:p}", &instance);
43
44 instance = two(&instance);
45 println!("instance = {:p}", &instance);
46
47 println!("instance = {:?}", instance);
48
49 }
51
52
53
54
55#[cfg(feature = "cp")]
57pub fn adjoin() {
58 fn one(mut hello_from: String) -> String {
59 hello_from.push('!');
60 hello_from
61 }
62
63 fn two(mut hello_from: String) -> String {
64 hello_from.push('?');
65 hello_from
66 }
67
68 let mut hello_from = String::new();
69 hello_from.push_str("Hello");
70 hello_from = one(hello_from);
71 hello_from = two(hello_from);
72 println!("hello from {:?}", hello_from);
73}
74
75
76
77#[cfg(feature = "okay")]
79pub fn adjoin() {
80 fn one(input: &str) -> Box<String> {
85 let result = format!("{}{}", input, "?");
86 Box::new(result)
87 }
88
89 fn two(input: &str) -> Box<String> {
90 let result = format!("{}{}", input, "!");
91 Box::new(result)
92 }
93
94 let mut hello_from = String::new();
95 hello_from.push_str("Hello");
96
97 let mut mut_ref :&str = &hello_from;
98 hello_from = one(mut_ref).to_string();
99 mut_ref = &hello_from;
100 hello_from = two(mut_ref).to_string();
101 println!("hello from {:?}", hello_from);
102
103 let mut_ref :&str = &hello_from;
104 hello_from = one(mut_ref).to_string();
105 let mut_ref :&str = &hello_from;
106 hello_from = two(mut_ref).to_string();
107 println!("hello from {:?}", hello_from);
108
109 }
111
112
113
114
115#[cfg(feature = "okey")]
117pub fn adjoin() {
118 fn one(input: &mut String) -> Box<String> {
123 input.push('?');
124 Box::new(input.to_string())
125 }
126
127 fn two(input: &mut String) -> Box<String> {
128 input.push('!');
129 Box::new(input.to_string())
130 }
131
132 let mut mut_instance = String::new();
133 mut_instance.push_str("Hello");
134 println!("1. mut_instance = {:?}", mut_instance);
135
136 let mut mut_ref :&mut String = &mut mut_instance;
137 mut_instance = one(mut_ref).to_string();
138 println!("2. mut_instance = {:?}", mut_instance);
139
140 mut_ref = &mut mut_instance;
141 mut_instance = two(mut_ref).to_string();
142 println!("3. mut_instance = {:?}", mut_instance);
143
144 }
146
147
148
149
150#[cfg(feature = "err_01")]
152pub fn adjoin() {
153 fn one(hello_from: &mut String) -> &String {
158 hello_from.push('!');
159 hello_from
160 }
161
162 fn two(hello_from: &mut String) -> &String {
163 hello_from.push('?');
164 hello_from
165 }
166
167 let mut hello_from = String::new();
168 hello_from.push_str("Hello");
169 let mut_ref :&String = &mut hello_from; one(mut_ref);
173 two(mut_ref);
174 println!("hello from {:?}", hello_from);
175
176 }
178
179
180
181
182#[cfg(feature = "err_02")]
184pub fn adjoin() {
185 fn one(input: &str) -> Box<String> {
190 let mut buf = String::with_capacity(input.len());
191 buf.push_str(input);
192 buf.push('!');
193 buf.into()
194 }
195
196 fn two(input: &str) -> Box<String> {
197 let mut buf = String::with_capacity(input.len());
198 buf.push_str(input);
199 buf.push('!');
200 buf.into()
201 }
202
203
204 let mut hello_from = String::new();
205 hello_from.push_str("Hello");
206 let mut_ref :&str = &hello_from;
207 hello_from = one(mut_ref).to_string();
208 hello_from = two(mut_ref).to_string();
210 println!("hello from {:?}", hello_from);
211
212 }
214
215
216
217
218#[cfg(feature = "err_03")]
220pub fn adjoin() {
221 use std::borrow::Cow;
226
227 fn one<'a>(input: &'a str) -> Cow<'a, str> {
228 let mut buf = String::with_capacity(input.len());
229 buf.push_str(input);
230 buf.push('!');
231 buf.into()
232 }
233
234 fn two<'a>(input: &'a str) -> Cow<'a, str> {
235 let mut buf = String::with_capacity(input.len());
236 buf.push_str(input);
237 buf.push('!');
238 buf.into()
239 }
240
241 let mut hello_from = String::new();
242 hello_from.push_str("Hello");
243
244 let mut_ref :&str = &hello_from;
245 let fn_one :Cow<'_, str> = one(mut_ref);
246 hello_from = fn_one.to_string();
247
248 hello_from = two(mut_ref).to_string();
250
251 println!("hello from {:?}", hello_from);
252
253 }
255
256
257
258
259#[cfg(feature = "err_04")]
261pub fn adjoin() {
262 fn one(input: &str) -> Box<String> {
267 let result = [input, "!"].join("");
268 println!("one() input = {:p}", &input);
269 let result = [input, "!"].concat();
270 println!("one() input = {:p}", &input);
271 Box::new(result)
272 }
273
274 fn two(input: &str) -> Box<String> {
275 let result = [input, "!"].join("");
276 println!("one() input = {:p}", &input);
277 let result = [input, "!"].concat();
278 println!("one() input = {:p}", &input);
279 Box::new(result)
280 }
281
282 let mut hello_from = String::new();
283 hello_from.push_str("Hello");
284 let mut_ref :&str = &hello_from; hello_from = one(mut_ref).to_string();
296
297 hello_from = two(mut_ref).to_string();
299
300 println!("hello from {:?}", hello_from);
301
302 }
304
305
306
307#[cfg(feature = "err_05")]
309pub fn adjoin() {
310 fn one(hello_from: &mut String) -> &String {
315 hello_from.push('!');
316 hello_from
317 }
318
319 fn two(hello_from: &mut String) -> &String {
320 hello_from.push('?');
321 hello_from
322 }
323
324 let mut hello_from = String::new();
325 hello_from.push_str("Hello");
326 let mut_ref :&String = &mut hello_from; one(mut_ref);
329 two(mut_ref);
330 println!("hello from {:?}", hello_from);
331
332 }
334
335
336
337
338#[cfg(feature = "err_06")]
340pub fn adjoin() {
341 fn one(hello_from: String) -> String {
347 hello_from.push('!');
348 hello_from
349 }
350
351 fn two(hello_from: String) -> String {
353 hello_from.push('?');
354 hello_from
355 }
356
357 let mut hello_from = String::new();
358 hello_from.push_str("Hello");
359 hello_from = one(hello_from);
360 hello_from = two(hello_from);
361 println!("hello from {:?}", hello_from);
362
363 }
365
366
367
368
369#[cfg(all(
371 not(feature = "ok"),
372 not(feature = "cp"),
373 not(feature = "okay"),
374 not(feature = "okey"),
375 not(feature = "err_01"),
376 not(feature = "err_02"),
377 not(feature = "err_03"),
378 not(feature = "err_04"),
379 not(feature = "err_05"),
380 not(feature = "err_06"),
381))]
382pub fn adjoin() {
383 use aide::*;
384 hello();
385}
386
387