Runs a closure on `arg` where `A` is mapped to a `&CStr`
(arg: Option<A>, f: F)
| 94 | |
| 95 | /// Runs a closure on `arg` where `A` is mapped to a `&CStr` |
| 96 | pub fn option_into_with_c_str<T, F, A>(arg: Option<A>, f: F) -> io::Result<T> |
| 97 | where |
| 98 | A: Arg + Sized, |
| 99 | F: FnOnce(Option<&CStr>) -> io::Result<T>, |
| 100 | { |
| 101 | if let Some(arg) = arg { |
| 102 | arg.into_with_c_str(|p| f(Some(p))) |
| 103 | } else { |
| 104 | f(None) |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | impl Arg for &str { |
| 109 | #[inline] |
no test coverage detected