• anlumo@feddit.de
    link
    fedilink
    English
    arrow-up
    0
    ·
    9 months ago

    Oh, inspect has finally arrived! That will help a ton with debug logging.

      • anlumo@feddit.de
        link
        fedilink
        English
        arrow-up
        0
        ·
        9 months ago
        let bar: Result<T, E> = ...;
        let foo = bar.inspect(|value| log::debug("{}", value));
        

        is equivalent to

        let bar: Result<T, E> = ...;
        let foo = bar.map(|value| {
            log::debug("{}", value);
            value
        });