Trait ming::ValueExt [−][src]
pub trait ValueExt: Sealed { fn parse<T: FromStr>(&self) -> Result<T, Error>
where
T::Err: Into<Box<dyn Error + Send + Sync + 'static>>; fn parse_with<F, T, E>(&self, func: F) -> Result<T, Error>
where
F: FnOnce(&str) -> Result<T, E>,
E: Into<Box<dyn Error + Send + Sync + 'static>>; }
Expand description
An optional extension trait with methods for parsing OsString
s.
They may fail in two cases:
- The value cannot be decoded because it’s invalid unicode
(
Error::NonUnicodeValue
) - The value can be decoded, but parsing fails (
Error::ParsingFailed
)
If parsing fails the error will be wrapped in lexopt’s own Error
type.
Required methods
Decode the value and parse it using FromStr
.
This will fail if the value is not valid unicode or if the subsequent parsing fails.