Code Monkey home page Code Monkey logo

cew's Introduction

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");
}

cew's People

Contributors

koranir avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.