mirror of
https://github.com/rosenpass/rosenpass.git
synced 2026-02-28 06:23:08 -08:00
docs(result): fix docstring warnings
Signed-off-by: Paul Spooren <mail@aparcar.org>
This commit is contained in:
@@ -8,7 +8,9 @@ macro_rules! attempt {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Trait for the ok operation, which provides a way to convert a value into a Result
|
||||||
pub trait OkExt<E>: Sized {
|
pub trait OkExt<E>: Sized {
|
||||||
|
/// Wraps a value in a Result::Ok variant
|
||||||
fn ok(self) -> Result<Self, E>;
|
fn ok(self) -> Result<Self, E>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -25,6 +27,7 @@ impl<T, E> OkExt<E> for T {
|
|||||||
///
|
///
|
||||||
/// Implementations must not panic.
|
/// Implementations must not panic.
|
||||||
pub trait GuaranteedValue {
|
pub trait GuaranteedValue {
|
||||||
|
/// The value type that will be returned by guaranteed()
|
||||||
type Value;
|
type Value;
|
||||||
|
|
||||||
/// Extract the contained value while being panic-safe, like .unwrap()
|
/// Extract the contained value while being panic-safe, like .unwrap()
|
||||||
@@ -35,7 +38,11 @@ pub trait GuaranteedValue {
|
|||||||
fn guaranteed(self) -> Self::Value;
|
fn guaranteed(self) -> Self::Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Extension trait for adding finally operation to types
|
||||||
pub trait FinallyExt {
|
pub trait FinallyExt {
|
||||||
|
/// Executes a closure with mutable access to self and returns self
|
||||||
|
///
|
||||||
|
/// The closure is guaranteed to be executed before returning.
|
||||||
fn finally<F: FnOnce(&mut Self)>(self, f: F) -> Self;
|
fn finally<F: FnOnce(&mut Self)>(self, f: F) -> Self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user