8 breaking releases

0.9.0 Jun 21, 2024
0.7.0 Jun 21, 2024
0.5.1 Mar 27, 2024
0.1.0 Dec 1, 2023

#602 in Rust patterns

Download history 1/week @ 2024-03-16 180/week @ 2024-03-23 46/week @ 2024-03-30 3/week @ 2024-04-06 141/week @ 2024-04-20 22/week @ 2024-04-27 1/week @ 2024-05-04 6/week @ 2024-05-18 1/week @ 2024-05-25 4/week @ 2024-06-01 2/week @ 2024-06-08 313/week @ 2024-06-15 73/week @ 2024-06-22 2/week @ 2024-06-29

391 downloads per month

MIT/Apache

11KB
203 lines

A personal utility crate.

Adds reexports of color_eyre, piping traits (Pipe, Inspect, Lay), a block_on implementation for futures, reexports thiserror, and reexports tracing + tracing_subscriber (as tracing_utils::subscriber) with a prelude and quick init function.

Run cew::init() to initialize color_eyre

cew::R is short for color_eyre::Result

cew::U is short for color_eyre::Result<()>

cew::e!(..) is short for color_eyre::eyre::eyre!(..)

cew::me!(..) is short for Err(color_eyre::eyre::eyre!(..))

The Pipe, Inspect, and Lay traits provide functions to reduce the amount of stacked parenthesis in long method chains, like the tap crate.

The tracing_subscriber quick init should be overriden with a custom impl if needed, but it gets you started quickly.

Usage:

use cew::prelude::*;

fn main() -> cew::U {
    cew::init()?;
    // turbofish is needed here, as the type parameters cannot be inferred.
    cew::tracing::init_filtered_w_env::<String, cew::tracing::Layer>(
      cew::tracing::fmt_layer().without_time(),
      cew::tracing::LevelFilter::INFO,
      []
    )?;

    info!("Traced").

    cew::me!("Error");
}

Dependencies

~4–7MB
~126K SLoC