Skip to main content

tuwunel_core/utils/result/
into_is_ok.rs

1use super::Result;
2
3/// Consumes a result and reduces it to success or failure.
4///
5/// Both contained values are discarded. The returned Boolean records only
6/// whether the original result was `Ok`.
7pub trait IntoIsOk<T, E> {
8	/// Reports whether the consumed result is `Ok`.
9	///
10	/// The success value and error are both discarded. No conversion or logging
11	/// is performed for either branch.
12	fn into_is_ok(self) -> bool;
13}
14
15impl<T, E> IntoIsOk<T, E> for Result<T, E> {
16	#[inline]
17	fn into_is_ok(self) -> bool { self.is_ok() }
18}