Expand description
An alternative to the Ok
variant of Result
that allows for handling warnings.
Fields§
§warning: Option<Warning>
Implementations§
source§impl<T> Outcome<T>
impl<T> Outcome<T>
sourcepub fn map<F, U>(self, f: F) -> Outcome<U>where
F: FnOnce(T) -> U,
pub fn map<F, U>(self, f: F) -> Outcome<U>where
F: FnOnce(T) -> U,
Map the outcome to a new type with the given function.
sourcepub fn ignore_warnings(self, to_ignore: &[Warning]) -> Result<T, Warning>
pub fn ignore_warnings(self, to_ignore: &[Warning]) -> Result<T, Warning>
Returns Ok
if the warning was in the set of warnings to be ignored, otherwise returns the
Warning
as an Err
.
sourcepub fn ignore_all_warnings(self) -> T
pub fn ignore_all_warnings(self) -> T
Ignore warnings if any were emitted and return the value.
sourcepub fn err_on_warning(self) -> Result<T, Warning>
pub fn err_on_warning(self) -> Result<T, Warning>
Return an error in the case that a warning was produced.