Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Boolean::try_from(OsString)
1 parent 0fa676a commit 5f675d3Copy full SHA for 5f675d3
1 file changed
git-config-value/src/boolean.rs
@@ -1,3 +1,4 @@
1
+use std::ffi::OsString;
2
use std::{borrow::Cow, convert::TryFrom, fmt::Display};
3
4
use bstr::{BStr, BString, ByteSlice};
@@ -11,6 +12,16 @@ fn bool_err(input: impl Into<BString>) -> Error {
11
12
)
13
}
14
15
+impl TryFrom<OsString> for Boolean {
16
+ type Error = Error;
17
+
18
+ fn try_from(value: OsString) -> Result<Self, Self::Error> {
19
+ let value = git_path::os_str_into_bstr(&value)
20
+ .map_err(|_| Error::new("Illformed UTF-8", std::path::Path::new(&value).display().to_string()))?;
21
+ Self::try_from(value)
22
+ }
23
+}
24
25
impl TryFrom<&BStr> for Boolean {
26
type Error = Error;
27
0 commit comments