1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
* str.rs
*
* ref-map - Convenience methods for references of Option and Result.
* Copyright (c) 2020-2026 Emmie Maeda
*
* ref-map is available free of charge under the terms of the MIT
* License. You are free to redistribute and/or modify it under those
* terms. It is distributed in the hopes that it will be useful, but
* WITHOUT ANY WARRANTY. See the LICENSE file for more details.
*
*/
use Cow;
/// Adds the `as_str()` extension method onto owned string [`Option`] values.
///
/// ```
/// use ref_map::*;
///
/// let maybe_string = Some(String::from("foo_bar"));
/// let maybe_str: Option<&str> = maybe_string.as_str();
/// ```
// Pass-through case