pub trait IntoOkwhere
Self: Sized,{
// Required method
fn into_ok<E>(self) -> Result<Self, E>;
}Expand description
A trait for converting a value into a Result::Ok variant.
This trait provides a convenient way to wrap any value in a Result::Ok,
which can be useful in contexts where a Result is expected but you have
a value that cannot fail.
§Examples
use cutoff_common::IntoOk;
let value = 42;
let result: Result<i32, &str> = value.into_ok();
assert_eq!(result, Ok(42));Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.