diff --git a/.github/workflows/codspeed.yml b/.github/workflows/codspeed.yml new file mode 100644 index 0000000..ead725e --- /dev/null +++ b/.github/workflows/codspeed.yml @@ -0,0 +1,55 @@ +# SPDX-FileCopyrightText: 2025-2026 RAprogramm +# +# SPDX-License-Identifier: MIT + +name: CodSpeed + +on: + push: + branches: [main] + pull_request: + # Allows CodSpeed to trigger backtest performance analysis + # in order to generate initial data. + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +permissions: + contents: read + id-token: write # OpenID Connect authentication with CodSpeed + +env: + CARGO_TERM_COLOR: always + CARGO_INCREMENTAL: 0 + +jobs: + codspeed: + name: Run benchmarks + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + + - name: Install Rust stable + uses: dtolnay/rust-toolchain@stable + + - name: Cache + uses: Swatinem/rust-cache@v2 + with: + shared-key: codspeed + save-if: ${{ github.ref == 'refs/heads/main' }} + + - name: Install cargo-codspeed + uses: taiki-e/install-action@v2 + with: + tool: cargo-codspeed + + - name: Build the benchmark targets + run: cargo codspeed build -m simulation --features benchmarks + + - name: Run the benchmarks + uses: CodSpeedHQ/action@v5 + with: + mode: simulation + run: cargo codspeed run -m simulation diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index 653dc67..8da3ef1 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -627,17 +627,17 @@ CI tests on MSRV (1.99) and stable to prevent accidental newer Rust usage. **Minimal setup** (library use): ```toml -masterror = { version = "0.31.1", default-features = false } +masterror = { version = "0.32.0", default-features = false } ``` **HTTP service**: ```toml -masterror = { version = "0.31.1", features = ["std", "axum", "tracing"] } +masterror = { version = "0.32.0", features = ["std", "axum", "tracing"] } ``` **Full-stack service**: ```toml -masterror = { version = "0.31.1", features = [ +masterror = { version = "0.32.0", features = [ "std", "axum", "sqlx", "reqwest", "redis", "tracing", "metrics", "backtrace" ] } @@ -645,7 +645,7 @@ masterror = { version = "0.31.1", features = [ **Rapid prototype**: ```toml -masterror = { version = "0.31.1", features = ["turnkey"] } +masterror = { version = "0.32.0", features = ["turnkey"] } ``` ### Error Budget diff --git a/Cargo.lock b/Cargo.lock index 2da7e1f..7d79b70 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -183,15 +183,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "alloca" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5a7d05ea6aea7e9e64d25b9156ba2fee3fdd659e34e41063cd2fc7cd020d7f4" -dependencies = [ - "cc", -] - [[package]] name = "allocator-api2" version = "0.2.21" @@ -225,6 +216,15 @@ version = "1.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470" +[[package]] +name = "approx" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6" +dependencies = [ + "num-traits", +] + [[package]] name = "ar_archive_writer" version = "0.5.3" @@ -505,6 +505,12 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600" +[[package]] +name = "cfg_aliases" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527" + [[package]] name = "chacha20" version = "0.10.2" @@ -588,6 +594,72 @@ version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c9ea0ac24bc397ab3c98583a3c9ba74fa56b09a4449bbe172b9b1ddb016027a" +[[package]] +name = "codspeed" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e7c21807b937b8e535f2745cd83c525fc250524021cd662b9ba4d3e399bb504" +dependencies = [ + "anyhow", + "cc", + "colored", + "getrandom 0.4.3", + "glob", + "nix", + "serde", + "serde_json", + "statrs", +] + +[[package]] +name = "codspeed-criterion-compat" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a14939cf9e46182bdfbf6de618a8a110361c15a27eccff8f5ad4380249e9c14" +dependencies = [ + "clap", + "codspeed", + "codspeed-criterion-compat-walltime", + "colored", + "regex", +] + +[[package]] +name = "codspeed-criterion-compat-walltime" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af785573a72d17af663e661a45e1d617a2bab9f3a13a219ca0ae6ef9412ea1d8" +dependencies = [ + "anes", + "cast", + "ciborium", + "clap", + "codspeed", + "criterion-plot", + "is-terminal", + "itertools", + "num-traits", + "once_cell", + "oorandom", + "plotters", + "rayon", + "regex", + "serde", + "serde_derive", + "serde_json", + "tinytemplate", + "walkdir", +] + +[[package]] +name = "colored" +version = "3.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "faf9468729b8cbcea668e36183cb69d317348c2e08e994829fb56ebfdfbaac34" +dependencies = [ + "windows-sys", +] + [[package]] name = "combine" version = "4.6.9" @@ -723,36 +795,11 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "217698eaf96b4a3f0bc4f3662aaa55bdf913cd54d7204591faa790070c6d0853" -[[package]] -name = "criterion" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "950046b2aa2492f9a536f5f4f9a3de7b9e2476e575e05bd6c333371add4d98f3" -dependencies = [ - "alloca", - "anes", - "cast", - "ciborium", - "clap", - "criterion-plot", - "itertools", - "num-traits", - "oorandom", - "page_size", - "plotters", - "rayon", - "regex", - "serde", - "serde_json", - "tinytemplate", - "walkdir", -] - [[package]] name = "criterion-plot" -version = "0.8.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8d80a2f4f5b554395e47b5d8305bc3d27813bacb73493eb1001e8f76dae29ea" +checksum = "6b50826342786a51a89e2da3a28f1c32b06e387201bc2d19791f622c673706b1" dependencies = [ "cast", "itertools", @@ -1888,9 +1935,9 @@ checksum = "7655c9839580ee829dfacba1d1278c2b7883e50a277ff7541299489d6bdfdc45" [[package]] name = "itertools" -version = "0.13.0" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" dependencies = [ "either", ] @@ -2051,8 +2098,8 @@ dependencies = [ "actix-web", "anyhow", "axum", + "codspeed-criterion-compat", "config", - "criterion", "http 1.5.0", "init-data-rs", "itoa", @@ -2194,6 +2241,18 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "743fb55ba31b18fb1ecef6bdc9aa2743314978ac084044301a7eee33fb99a20d" +[[package]] +name = "nix" +version = "0.31.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf20d2fde8ff38632c426f1165ed7436270b44f199fc55284c38276f9db47c3d" +dependencies = [ + "bitflags 2.13.2", + "cfg-if", + "cfg_aliases", + "libc", +] + [[package]] name = "no-std-core" version = "0.1.0" @@ -2329,16 +2388,6 @@ dependencies = [ "supports-color 3.0.2", ] -[[package]] -name = "page_size" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30d5b2194ed13191c1999ae0704b7839fb18384fa22e49b57eeaa97d79ce40da" -dependencies = [ - "libc", - "winapi", -] - [[package]] name = "parking" version = "2.2.1" @@ -3338,6 +3387,16 @@ dependencies = [ "windows-sys", ] +[[package]] +name = "statrs" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a3fe7c28c6512e766b0874335db33c94ad7b8f9054228ae1c2abd47ce7d335e" +dependencies = [ + "approx", + "num-traits", +] + [[package]] name = "stringprep" version = "0.1.5" @@ -4138,22 +4197,6 @@ version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "626c4bac6755d76ffc12cb01b2eac751db1996b9e0041de9aa02c8c211ddc82c" -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - [[package]] name = "winapi-util" version = "0.1.11" @@ -4163,12 +4206,6 @@ dependencies = [ "windows-sys", ] -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - [[package]] name = "windows-core" version = "0.62.2" diff --git a/Cargo.toml b/Cargo.toml index da55f10..711ac62 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -146,7 +146,7 @@ owo-colors = { version = "4", optional = true, default-features = false, feature [dev-dependencies] anyhow = { version = "1", default-features = false, features = ["std"] } -criterion = "0.8" +criterion = { version = "6.0.0", package = "codspeed-criterion-compat" } serde_json = "1" thiserror = "2" tokio = { version = "1", features = [ @@ -169,6 +169,10 @@ harness = false name = "comparison" harness = false +[[bench]] +name = "response_mapping" +harness = false + [build-dependencies] serde = { version = "1", features = ["derive"] } toml = "1" diff --git a/README.ko.md b/README.ko.md index c563c23..04417ac 100644 --- a/README.ko.md +++ b/README.ko.md @@ -139,9 +139,9 @@ SPDX-License-Identifier: MIT ~~~toml [dependencies] -masterror = { version = "0.31.1", default-features = false } +masterror = { version = "0.32.0", default-features = false } # or with features: -# masterror = { version = "0.31.1", features = [ +# masterror = { version = "0.32.0", features = [ # "std", "axum", "actix", "openapi", # "serde_json", "tracing", "metrics", "backtrace", # "colored", "sqlx", "sqlx-migrate", "reqwest", @@ -555,7 +555,7 @@ match mode { ~~~toml [dependencies] -masterror = { version = "0.31.1", features = ["colored"] } +masterror = { version = "0.32.0", features = ["colored"] } ~~~ `colored` 기능 없이 오류는 `AppErrorKind` 레이블을 표시합니다: diff --git a/README.md b/README.md index b889782..6b2dc93 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ SPDX-License-Identifier: MIT [![codecov](https://codecov.io/gh/RAprogramm/masterror/graph/badge.svg?token=V9JQDTZLXH)](https://codecov.io/gh/RAprogramm/masterror) [![CI](https://github.com/RAprogramm/masterror/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/RAprogramm/masterror/actions/workflows/ci.yml?query=branch%3Amain) + [![CodSpeed](https://img.shields.io/endpoint?url=https://codspeed.io/badge.json)](https://app.codspeed.io/RAprogramm/masterror?utm_source=badge) [![Hits-of-Code](https://hitsofcode.com/github/RAprogramm/masterror?branch=main&exclude=Cargo.lock,.gitignore,CHANGELOG.md)](https://hitsofcode.com/github/RAprogramm/masterror/view?branch=main&exclude=Cargo.lock,.gitignore,CHANGELOG.md) [![IMIR](https://raw.githubusercontent.com/RAprogramm/infra-metrics-insight-renderer/main/assets/badges/imir-badge-simple-public.svg)](https://github.com/RAprogramm/infra-metrics-insight-renderer) @@ -174,9 +175,9 @@ The build script keeps the full feature snippet below in sync with ~~~toml [dependencies] -masterror = { version = "0.31.1", default-features = false } +masterror = { version = "0.32.0", default-features = false } # or with features: -# masterror = { version = "0.31.1", features = [ +# masterror = { version = "0.32.0", features = [ # "std", "axum", "actix", "openapi", # "serde_json", "tracing", "metrics", "backtrace", # "colored", "sqlx", "sqlx-migrate", "reqwest", @@ -701,7 +702,7 @@ never contains escape sequences: ~~~toml [dependencies] -masterror = { version = "0.31.1", features = ["colored"] } +masterror = { version = "0.32.0", features = ["colored"] } ~~~ diff --git a/README.ru.md b/README.ru.md index 673e8c2..b73916c 100644 --- a/README.ru.md +++ b/README.ru.md @@ -140,9 +140,9 @@ SPDX-License-Identifier: MIT ~~~toml [dependencies] -masterror = { version = "0.31.1", default-features = false } +masterror = { version = "0.32.0", default-features = false } # or with features: -# masterror = { version = "0.31.1", features = [ +# masterror = { version = "0.32.0", features = [ # "std", "axum", "actix", "openapi", # "serde_json", "tracing", "metrics", "backtrace", # "colored", "sqlx", "sqlx-migrate", "reqwest", @@ -561,7 +561,7 @@ match mode { ~~~toml [dependencies] -masterror = { version = "0.31.1", features = ["colored"] } +masterror = { version = "0.32.0", features = ["colored"] } ~~~ Без функции `colored` ошибки отображают метку `AppErrorKind`: diff --git a/README.template.md b/README.template.md index f9cbb34..f474226 100644 --- a/README.template.md +++ b/README.template.md @@ -20,6 +20,7 @@ SPDX-License-Identifier: MIT [![codecov](https://codecov.io/gh/RAprogramm/masterror/graph/badge.svg?token=V9JQDTZLXH)](https://codecov.io/gh/RAprogramm/masterror) [![CI](https://github.com/RAprogramm/masterror/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/RAprogramm/masterror/actions/workflows/ci.yml?query=branch%3Amain) + [![CodSpeed](https://img.shields.io/endpoint?url=https://codspeed.io/badge.json)](https://app.codspeed.io/RAprogramm/masterror?utm_source=badge) [![Hits-of-Code](https://hitsofcode.com/github/RAprogramm/masterror?branch=main&exclude=Cargo.lock,.gitignore,CHANGELOG.md)](https://hitsofcode.com/github/RAprogramm/masterror/view?branch=main&exclude=Cargo.lock,.gitignore,CHANGELOG.md) [![IMIR](https://raw.githubusercontent.com/RAprogramm/infra-metrics-insight-renderer/main/assets/badges/imir-badge-simple-public.svg)](https://github.com/RAprogramm/infra-metrics-insight-renderer) diff --git a/benches/response_mapping.rs b/benches/response_mapping.rs new file mode 100644 index 0000000..930da69 --- /dev/null +++ b/benches/response_mapping.rs @@ -0,0 +1,91 @@ +// SPDX-FileCopyrightText: 2025-2026 RAprogramm +// +// SPDX-License-Identifier: MIT + +//! Benchmarks for the transport-facing hot paths: building `AppError` +//! values with metadata, mapping them to wire responses and serializing the +//! resulting payloads. + +use core::str::FromStr; +use std::hint::black_box; + +use criterion::{BatchSize, Criterion, criterion_group, criterion_main}; +use masterror::{AppCode, AppError, ErrorResponse, ProblemJson, field}; + +fn build_rich_error() -> AppError { + AppError::service("upstream service unavailable") + .with_code(AppCode::Service) + .with_field(field::str("operation", "sync_job")) + .with_field(field::u64("attempt", 3)) + .with_field(field::bool("idempotent", true)) + .with_retry_after_secs(30) + .with_www_authenticate("Bearer realm=\"api\"") +} + +fn app_error_builder(c: &mut Criterion) { + let mut group = c.benchmark_group("app_error_builder"); + group.bench_function("simple", |b| { + b.iter(|| black_box(AppError::not_found(black_box("user not found")))); + }); + group.bench_function("with_metadata", |b| { + b.iter(|| black_box(build_rich_error())); + }); + group.finish(); +} + +fn app_code_parse(c: &mut Criterion) { + let mut group = c.benchmark_group("app_code_parse"); + group.bench_function("builtin", |b| { + b.iter(|| black_box(AppCode::from_str(black_box("NOT_FOUND")))); + }); + group.bench_function("custom", |b| { + b.iter(|| black_box(AppCode::from_str(black_box("PAYMENT_DECLINED")))); + }); + group.finish(); +} + +fn error_response_mapping(c: &mut Criterion) { + let mut group = c.benchmark_group("error_response_mapping"); + group.bench_function("from_ref", |b| { + let error = build_rich_error(); + b.iter(|| black_box(ErrorResponse::from(black_box(&error)))); + }); + group.bench_function("from_owned", |b| { + b.iter_batched( + build_rich_error, + |error| black_box(ErrorResponse::from(error)), + BatchSize::SmallInput + ); + }); + group.finish(); +} + +fn serialize_json(c: &mut Criterion) { + let mut group = c.benchmark_group("serialize_json"); + group.bench_function("error_response", |b| { + let response = ErrorResponse::from(&build_rich_error()); + b.iter(|| black_box(serde_json::to_vec(black_box(&response)).unwrap())); + }); + group.bench_function("problem_json", |b| { + let problem = ProblemJson::from_app_error(build_rich_error()); + b.iter(|| black_box(serde_json::to_vec(black_box(&problem)).unwrap())); + }); + group.finish(); +} + +fn display_render(c: &mut Criterion) { + let error = build_rich_error(); + c.bench_function("display_render/app_error", |b| { + b.iter(|| black_box(black_box(&error).to_string())); + }); +} + +criterion_group!( + benches, + app_error_builder, + app_code_parse, + error_response_mapping, + serialize_json, + display_render +); +criterion_main!(benches); diff --git a/masterror-derive/README.md b/masterror-derive/README.md index ad55c82..e4bf8bb 100644 --- a/masterror-derive/README.md +++ b/masterror-derive/README.md @@ -22,7 +22,7 @@ Procedural macros that power [`masterror`](https://crates.io/crates/masterror)'s ```toml [dependencies] -masterror = "0.31.1" +masterror = "0.32.0" ``` ```rust diff --git a/wiki/Feature-Flags-en.md b/wiki/Feature-Flags-en.md index 7fab851..0c775b2 100644 --- a/wiki/Feature-Flags-en.md +++ b/wiki/Feature-Flags-en.md @@ -4,9 +4,9 @@ ```toml [dependencies] -masterror = { version = "0.31.1", default-features = false } +masterror = { version = "0.32.0", default-features = false } # or with features: -# masterror = { version = "0.31.1", features = [ +# masterror = { version = "0.32.0", features = [ # "std", "axum", "actix", "openapi", # "serde_json", "tracing", "metrics", "backtrace", # "colored", "sqlx", "sqlx-migrate", "reqwest", @@ -87,37 +87,37 @@ Without any feature flag, `AppError` already converts from: REST API on Axum with problem+json, OpenAPI docs and tracing: ```toml -masterror = { version = "0.31.1", features = ["axum", "openapi", "serde_json", "tracing"] } +masterror = { version = "0.32.0", features = ["axum", "openapi", "serde_json", "tracing"] } ``` Database service with sqlx, migrations and metrics: ```toml -masterror = { version = "0.31.1", features = ["sqlx", "sqlx-migrate", "metrics", "tracing"] } +masterror = { version = "0.32.0", features = ["sqlx", "sqlx-migrate", "metrics", "tracing"] } ``` gRPC service: ```toml -masterror = { version = "0.31.1", features = ["tonic", "tracing", "backtrace"] } +masterror = { version = "0.32.0", features = ["tonic", "tracing", "backtrace"] } ``` Telegram bot with Mini App auth: ```toml -masterror = { version = "0.31.1", features = ["teloxide", "init-data", "reqwest", "tokio"] } +masterror = { version = "0.32.0", features = ["teloxide", "init-data", "reqwest", "tokio"] } ``` WASM front-end: ```toml -masterror = { version = "0.31.1", features = ["frontend", "serde_json"] } +masterror = { version = "0.32.0", features = ["frontend", "serde_json"] } ``` `no_std` embedded or library target: ```toml -masterror = { version = "0.31.1", default-features = false } +masterror = { version = "0.32.0", default-features = false } ``` ## Notes diff --git a/wiki/Getting-Started-en.md b/wiki/Getting-Started-en.md index 8f19fc5..1f13002 100644 --- a/wiki/Getting-Started-en.md +++ b/wiki/Getting-Started-en.md @@ -8,14 +8,14 @@ The default build enables only the `std` feature — no web framework, no teleme ```toml [dependencies] -masterror = "0.31.1" +masterror = "0.32.0" ``` Enable integrations as you need them (see [Feature Flags](Feature-Flags-en) for the full list): ```toml [dependencies] -masterror = { version = "0.31.1", features = ["axum", "serde_json", "tracing"] } +masterror = { version = "0.32.0", features = ["axum", "serde_json", "tracing"] } ``` MSRV is **1.99**. The crate forbids `unsafe` and supports `no_std` when built with `default-features = false`. diff --git a/wiki/No-Std-en.md b/wiki/No-Std-en.md index a411775..599d847 100644 --- a/wiki/No-Std-en.md +++ b/wiki/No-Std-en.md @@ -6,7 +6,7 @@ the only thing standing between you and an embedded/WASM-friendly build: ```toml [dependencies] -masterror = { version = "0.31.1", default-features = false } +masterror = { version = "0.32.0", default-features = false } ``` ## alloc is required @@ -87,7 +87,7 @@ Library crates that want to stay transport-agnostic and `no_std`-compatible: ```toml [dependencies] -masterror = { version = "0.31.1", default-features = false } +masterror = { version = "0.32.0", default-features = false } [features] std = ["masterror/std"] @@ -98,7 +98,7 @@ needs: ```toml [dependencies] -masterror = { version = "0.31.1", features = ["axum", "tracing", "metrics"] } +masterror = { version = "0.32.0", features = ["axum", "tracing", "metrics"] } ``` Because `AppErrorKind`, `AppCode` and the wire types live in the `no_std` diff --git a/wiki/Observability-en.md b/wiki/Observability-en.md index 0d3a326..8b85c3f 100644 --- a/wiki/Observability-en.md +++ b/wiki/Observability-en.md @@ -17,7 +17,7 @@ You rarely call anything manually. ```toml [dependencies] -masterror = { version = "0.31.1", features = ["tracing", "metrics", "backtrace"] } +masterror = { version = "0.32.0", features = ["tracing", "metrics", "backtrace"] } ``` ## Tracing diff --git a/wiki/Web-Frameworks-en.md b/wiki/Web-Frameworks-en.md index b3cf647..e1f706e 100644 --- a/wiki/Web-Frameworks-en.md +++ b/wiki/Web-Frameworks-en.md @@ -18,7 +18,7 @@ the mapping by hand. ```toml [dependencies] -masterror = { version = "0.31.1", features = ["axum"] } # or ["actix"] +masterror = { version = "0.32.0", features = ["axum"] } # or ["actix"] ``` ## Wire format diff --git "a/wiki/no_std-\354\247\200\354\233\220.md" "b/wiki/no_std-\354\247\200\354\233\220.md" index 2666824..15acbd5 100644 --- "a/wiki/no_std-\354\247\200\354\233\220.md" +++ "b/wiki/no_std-\354\247\200\354\233\220.md" @@ -6,7 +6,7 @@ ```toml [dependencies] -masterror = { version = "0.31.1", default-features = false } +masterror = { version = "0.32.0", default-features = false } ``` ## alloc 필요 @@ -87,7 +87,7 @@ assert_eq!(err.metadata().len(), 1); ```toml [dependencies] -masterror = { version = "0.31.1", default-features = false } +masterror = { version = "0.32.0", default-features = false } [features] std = ["masterror/std"] @@ -97,7 +97,7 @@ std = ["masterror/std"] ```toml [dependencies] -masterror = { version = "0.31.1", features = ["axum", "tracing", "metrics"] } +masterror = { version = "0.32.0", features = ["axum", "tracing", "metrics"] } ``` `AppErrorKind`, `AppCode` 및 와이어 타입이 `no_std` 코어에 있기 때문에, diff --git "a/wiki/\320\221\320\265\320\267-std.md" "b/wiki/\320\221\320\265\320\267-std.md" index 54932ce..cbdd86d 100644 --- "a/wiki/\320\221\320\265\320\267-std.md" +++ "b/wiki/\320\221\320\265\320\267-std.md" @@ -7,7 +7,7 @@ ```toml [dependencies] -masterror = { version = "0.31.1", default-features = false } +masterror = { version = "0.32.0", default-features = false } ``` ## alloc обязателен @@ -90,7 +90,7 @@ CI-задача `no_std` (`.github/workflows/ci.yml`) проверяет эти ```toml [dependencies] -masterror = { version = "0.31.1", default-features = false } +masterror = { version = "0.32.0", default-features = false } [features] std = ["masterror/std"] @@ -100,7 +100,7 @@ std = ["masterror/std"] ```toml [dependencies] -masterror = { version = "0.31.1", features = ["axum", "tracing", "metrics"] } +masterror = { version = "0.32.0", features = ["axum", "tracing", "metrics"] } ``` Поскольку `AppErrorKind`, `AppCode` и типы на проводе живут в ядре `no_std`, diff --git "a/wiki/\320\222\320\265\320\261-\321\204\321\200\320\265\320\271\320\274\320\262\320\276\321\200\320\272\320\270.md" "b/wiki/\320\222\320\265\320\261-\321\204\321\200\320\265\320\271\320\274\320\262\320\276\321\200\320\272\320\270.md" index ea932bf..c830b83 100644 --- "a/wiki/\320\222\320\265\320\261-\321\204\321\200\320\265\320\271\320\274\320\262\320\276\321\200\320\272\320\270.md" +++ "b/wiki/\320\222\320\265\320\261-\321\204\321\200\320\265\320\271\320\274\320\262\320\276\321\200\320\272\320\270.md" @@ -18,7 +18,7 @@ ```toml [dependencies] -masterror = { version = "0.31.1", features = ["axum"] } # or ["actix"] +masterror = { version = "0.32.0", features = ["axum"] } # or ["actix"] ``` ## Формат на проводе diff --git "a/wiki/\320\235\320\260\320\261\320\273\321\216\320\264\320\260\320\265\320\274\320\276\321\201\321\202\321\214.md" "b/wiki/\320\235\320\260\320\261\320\273\321\216\320\264\320\260\320\265\320\274\320\276\321\201\321\202\321\214.md" index 9a4e6c6..7abd8d0 100644 --- "a/wiki/\320\235\320\260\320\261\320\273\321\216\320\264\320\260\320\265\320\274\320\276\321\201\321\202\321\214.md" +++ "b/wiki/\320\235\320\260\320\261\320\273\321\216\320\264\320\260\320\265\320\274\320\276\321\201\321\202\321\214.md" @@ -18,7 +18,7 @@ ```toml [dependencies] -masterror = { version = "0.31.1", features = ["tracing", "metrics", "backtrace"] } +masterror = { version = "0.32.0", features = ["tracing", "metrics", "backtrace"] } ``` ## Tracing diff --git "a/wiki/\320\235\320\260\321\207\320\260\320\273\320\276-\321\200\320\260\320\261\320\276\321\202\321\213.md" "b/wiki/\320\235\320\260\321\207\320\260\320\273\320\276-\321\200\320\260\320\261\320\276\321\202\321\213.md" index 2bb9cda..2a1d811 100644 --- "a/wiki/\320\235\320\260\321\207\320\260\320\273\320\276-\321\200\320\260\320\261\320\276\321\202\321\213.md" +++ "b/wiki/\320\235\320\260\321\207\320\260\320\273\320\276-\321\200\320\260\320\261\320\276\321\202\321\213.md" @@ -8,14 +8,14 @@ ```toml [dependencies] -masterror = "0.31.1" +masterror = "0.32.0" ``` Включайте интеграции по мере необходимости (полный список — в [Флагах возможностей](Флаги-возможностей)): ```toml [dependencies] -masterror = { version = "0.31.1", features = ["axum", "serde_json", "tracing"] } +masterror = { version = "0.32.0", features = ["axum", "serde_json", "tracing"] } ``` MSRV — **1.99**. Крейт запрещает `unsafe` и поддерживает `no_std` при сборке с `default-features = false`. diff --git "a/wiki/\320\244\320\273\320\260\320\263\320\270-\320\262\320\276\320\267\320\274\320\276\320\266\320\275\320\276\321\201\321\202\320\265\320\271.md" "b/wiki/\320\244\320\273\320\260\320\263\320\270-\320\262\320\276\320\267\320\274\320\276\320\266\320\275\320\276\321\201\321\202\320\265\320\271.md" index 5126cfb..1d9fb72 100644 --- "a/wiki/\320\244\320\273\320\260\320\263\320\270-\320\262\320\276\320\267\320\274\320\276\320\266\320\275\320\276\321\201\321\202\320\265\320\271.md" +++ "b/wiki/\320\244\320\273\320\260\320\263\320\270-\320\262\320\276\320\267\320\274\320\276\320\266\320\275\320\276\321\201\321\202\320\265\320\271.md" @@ -4,9 +4,9 @@ ```toml [dependencies] -masterror = { version = "0.31.1", default-features = false } +masterror = { version = "0.32.0", default-features = false } # or with features: -# masterror = { version = "0.31.1", features = [ +# masterror = { version = "0.32.0", features = [ # "std", "axum", "actix", "openapi", # "serde_json", "tracing", "metrics", "backtrace", # "colored", "sqlx", "sqlx-migrate", "reqwest", @@ -87,37 +87,37 @@ masterror = { version = "0.31.1", default-features = false } REST API на Axum с problem+json, документацией OpenAPI и tracing: ```toml -masterror = { version = "0.31.1", features = ["axum", "openapi", "serde_json", "tracing"] } +masterror = { version = "0.32.0", features = ["axum", "openapi", "serde_json", "tracing"] } ``` Сервис с базой данных на sqlx, миграциями и метриками: ```toml -masterror = { version = "0.31.1", features = ["sqlx", "sqlx-migrate", "metrics", "tracing"] } +masterror = { version = "0.32.0", features = ["sqlx", "sqlx-migrate", "metrics", "tracing"] } ``` gRPC-сервис: ```toml -masterror = { version = "0.31.1", features = ["tonic", "tracing", "backtrace"] } +masterror = { version = "0.32.0", features = ["tonic", "tracing", "backtrace"] } ``` Telegram-бот с аутентификацией Mini App: ```toml -masterror = { version = "0.31.1", features = ["teloxide", "init-data", "reqwest", "tokio"] } +masterror = { version = "0.32.0", features = ["teloxide", "init-data", "reqwest", "tokio"] } ``` WASM-фронтенд: ```toml -masterror = { version = "0.31.1", features = ["frontend", "serde_json"] } +masterror = { version = "0.32.0", features = ["frontend", "serde_json"] } ``` `no_std` для встраиваемых систем или библиотек: ```toml -masterror = { version = "0.31.1", default-features = false } +masterror = { version = "0.32.0", default-features = false } ``` ## Примечания diff --git "a/wiki/\352\264\200\354\270\241\354\204\261.md" "b/wiki/\352\264\200\354\270\241\354\204\261.md" index b2cacbf..da75268 100644 --- "a/wiki/\352\264\200\354\270\241\354\204\261.md" +++ "b/wiki/\352\264\200\354\270\241\354\204\261.md" @@ -17,7 +17,7 @@ ```toml [dependencies] -masterror = { version = "0.31.1", features = ["tracing", "metrics", "backtrace"] } +masterror = { version = "0.32.0", features = ["tracing", "metrics", "backtrace"] } ``` ## Tracing diff --git "a/wiki/\352\270\260\353\212\245-\355\224\214\353\236\230\352\267\270.md" "b/wiki/\352\270\260\353\212\245-\355\224\214\353\236\230\352\267\270.md" index 93131a9..f3fd73a 100644 --- "a/wiki/\352\270\260\353\212\245-\355\224\214\353\236\230\352\267\270.md" +++ "b/wiki/\352\270\260\353\212\245-\355\224\214\353\236\230\352\267\270.md" @@ -4,9 +4,9 @@ ```toml [dependencies] -masterror = { version = "0.31.1", default-features = false } +masterror = { version = "0.32.0", default-features = false } # or with features: -# masterror = { version = "0.31.1", features = [ +# masterror = { version = "0.32.0", features = [ # "std", "axum", "actix", "openapi", # "serde_json", "tracing", "metrics", "backtrace", # "colored", "sqlx", "sqlx-migrate", "reqwest", @@ -87,37 +87,37 @@ masterror = { version = "0.31.1", default-features = false } problem+json, OpenAPI 문서, tracing을 갖춘 Axum 기반 REST API: ```toml -masterror = { version = "0.31.1", features = ["axum", "openapi", "serde_json", "tracing"] } +masterror = { version = "0.32.0", features = ["axum", "openapi", "serde_json", "tracing"] } ``` sqlx, 마이그레이션, metrics를 갖춘 데이터베이스 서비스: ```toml -masterror = { version = "0.31.1", features = ["sqlx", "sqlx-migrate", "metrics", "tracing"] } +masterror = { version = "0.32.0", features = ["sqlx", "sqlx-migrate", "metrics", "tracing"] } ``` gRPC 서비스: ```toml -masterror = { version = "0.31.1", features = ["tonic", "tracing", "backtrace"] } +masterror = { version = "0.32.0", features = ["tonic", "tracing", "backtrace"] } ``` Mini App 인증을 갖춘 Telegram 봇: ```toml -masterror = { version = "0.31.1", features = ["teloxide", "init-data", "reqwest", "tokio"] } +masterror = { version = "0.32.0", features = ["teloxide", "init-data", "reqwest", "tokio"] } ``` WASM 프런트엔드: ```toml -masterror = { version = "0.31.1", features = ["frontend", "serde_json"] } +masterror = { version = "0.32.0", features = ["frontend", "serde_json"] } ``` `no_std` 임베디드 또는 라이브러리 타깃: ```toml -masterror = { version = "0.31.1", default-features = false } +masterror = { version = "0.32.0", default-features = false } ``` ## 참고 사항 diff --git "a/wiki/\354\213\234\354\236\221\355\225\230\352\270\260.md" "b/wiki/\354\213\234\354\236\221\355\225\230\352\270\260.md" index 24b7be8..7659b7e 100644 --- "a/wiki/\354\213\234\354\236\221\355\225\230\352\270\260.md" +++ "b/wiki/\354\213\234\354\236\221\355\225\230\352\270\260.md" @@ -8,14 +8,14 @@ ```toml [dependencies] -masterror = "0.31.1" +masterror = "0.32.0" ``` 필요한 통합을 그때그때 활성화하세요 (전체 목록은 [기능 플래그](기능-플래그) 참조): ```toml [dependencies] -masterror = { version = "0.31.1", features = ["axum", "serde_json", "tracing"] } +masterror = { version = "0.32.0", features = ["axum", "serde_json", "tracing"] } ``` MSRV는 **1.99**입니다. 이 크레이트는 `unsafe`를 금지하며 `default-features = false`로 빌드하면 `no_std`를 지원합니다. diff --git "a/wiki/\354\233\271-\355\224\204\353\240\210\354\236\204\354\233\214\355\201\254.md" "b/wiki/\354\233\271-\355\224\204\353\240\210\354\236\204\354\233\214\355\201\254.md" index 52ac001..a5ea6df 100644 --- "a/wiki/\354\233\271-\355\224\204\353\240\210\354\236\204\354\233\214\355\201\254.md" +++ "b/wiki/\354\233\271-\355\224\204\353\240\210\354\236\204\354\233\214\355\201\254.md" @@ -18,7 +18,7 @@ RFC 7807 `application/problem+json` 응답으로 변환하며, 텔레메트리 ```toml [dependencies] -masterror = { version = "0.31.1", features = ["axum"] } # or ["actix"] +masterror = { version = "0.32.0", features = ["axum"] } # or ["actix"] ``` ## 와이어 형식