result-transformer-core 0.0.2

Traits, macros and utilities for transforming Result values.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/// Trait for converting a success value into another type.
///
/// The `InputOk` type parameter describes the success value that will be
/// provided to [`transform_ok`].  `OutputOk` is the type produced after the
/// transformation.
pub trait OkTransformer<InputOk> {
    /// The resulting success type after the conversion.
    type OutputOk;

    /// Performs the conversion of the `ok` value.
    ///
    /// # Parameters
    /// * `ok` - The original success value to be transformed.
    ///
    /// # Returns
    /// A value of type [`Self::OutputOk`] representing the transformed result.
    fn transform_ok(&self, ok: InputOk) -> Self::OutputOk;
}