8 个重大版本
| 0.9.0 | 2024 年 6 月 21 日 |
|---|---|
| 0.7.0 | 2024 年 6 月 21 日 |
| 0.5.1 | 2024 年 3 月 27 日 |
| 0.1.0 | 2023 年 12 月 1 日 |
#670 在 Rust 模式
11KB
203 行
个人工具包。
添加了 color_eyre 的重新导出,管道特性(Pipe、Inspect、Lay),futures 的 block_on 实现,重新导出 thiserror,以及重新导出 tracing + tracing_subscriber(作为 tracing_utils::subscriber)带预言和快速初始化函数。
运行 cew::init() 来初始化 color_eyre
cew::R 是 color_eyre::Result 的简称
cew::U 是 color_eyre::Result 的简称
cew::e!(..) 是 color_eyre::eyre!(..) 的简称
cew::me!(..) 是 Err
Pipe、Inspect 和 Lay 特性提供了减少长方法链中嵌套括号数量的函数,类似于 tap 库。
如果需要,应使用自定义实现覆盖 tracing_subscriber 快速初始化,但它会快速开始。
用法
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");
}
依赖关系
~4–6.5MB
~122K SLoC