Skip to content

Commit 0c5643b

Browse files
authored
Merge pull request #93 from RAprogramm/codex/fix-missing-readme.md-for-publish
Publish masterror-template for derive releases
2 parents 09ea496 + 14508f6 commit 0c5643b

File tree

7 files changed

+120
-8
lines changed

7 files changed

+120
-8
lines changed

CHANGELOG.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
55

66
## [0.10.7] - 2025-10-24
77

8+
### Fixed
9+
- Published the shared template parser crate so `masterror-derive` no longer
10+
depends on a workspace-only package when uploaded to crates.io.
11+
12+
### Documentation
13+
- Added a dedicated README for `masterror-template` describing installation,
14+
parsing examples and formatter metadata for crates.io readers.
815
### Tests
916
- Added regression coverage for long classifier needles to exercise the
1017
heap-allocation fallback.
@@ -16,6 +23,8 @@ All notable changes to this project will be documented in this file.
1623
- Precomputed lowercase Turnkey classifier needles with a stack-backed buffer
1724
to remove repeated transformations while keeping the common zero-allocation
1825
path for short patterns.
26+
- Bumped `masterror-derive` to `0.6.6` and `masterror-template` to `0.3.6` so
27+
downstream users rely on the newly published parser crate.
1928

2029

2130
## [0.10.6] - 2025-09-21
@@ -168,6 +177,12 @@ All notable changes to this project will be documented in this file.
168177
- Documented the `#[app_error(...)]` attribute in the README, outlining the
169178
struct and enum mapping patterns and the `message` flag behaviour.
170179

180+
## [0.6.6] - 2025-10-24
181+
182+
### Fixed
183+
- Pointed the derive crate at the published `masterror-template` dependency so
184+
`cargo publish` succeeds without private workspace patches.
185+
171186
## [0.6.5] - 2025-10-12
172187

173188
### Added
@@ -465,6 +480,15 @@ All notable changes to this project will be documented in this file.
465480
### Documentation
466481
- Documented browser/WASM support and console logging workflow in the README and crate docs.
467482

483+
## [0.3.6] - 2025-10-24
484+
485+
### Added
486+
- Wrote a README for crates.io explaining installation and parser usage.
487+
488+
### Fixed
489+
- Removed the `publish = false` flag so the shared template parser can be
490+
released alongside the derive crate.
491+
468492
## [0.3.5] - 2025-09-12
469493
### Added
470494
- Conversion from `teloxide_core::RequestError` into `AppError` (feature `teloxide`).
@@ -565,10 +589,19 @@ All notable changes to this project will be documented in this file.
565589
- **MSRV:** 1.89
566590
- **No unsafe:** the crate forbids `unsafe`.
567591

592+
[0.10.7]: https://github.com/RAprogramm/masterror/releases/tag/v0.10.7
593+
[0.10.6]: https://github.com/RAprogramm/masterror/releases/tag/v0.10.6
594+
[0.6.6]: https://github.com/RAprogramm/masterror/releases/tag/v0.6.6
595+
[0.6.5]: https://github.com/RAprogramm/masterror/releases/tag/v0.6.5
596+
[0.6.4]: https://github.com/RAprogramm/masterror/releases/tag/v0.6.4
597+
[0.6.3]: https://github.com/RAprogramm/masterror/releases/tag/v0.6.3
598+
[0.6.2]: https://github.com/RAprogramm/masterror/releases/tag/v0.6.2
599+
[0.6.0]: https://github.com/RAprogramm/masterror/releases/tag/v0.6.0
568600
[0.5.2]: https://github.com/RAprogramm/masterror/releases/tag/v0.5.2
569601
[0.5.1]: https://github.com/RAprogramm/masterror/releases/tag/v0.5.1
570602
[0.5.0]: https://github.com/RAprogramm/masterror/releases/tag/v0.5.0
571603
[0.4.0]: https://github.com/RAprogramm/masterror/releases/tag/v0.4.0
604+
[0.3.6]: https://github.com/RAprogramm/masterror/releases/tag/v0.3.6
572605
[0.3.5]: https://github.com/RAprogramm/masterror/releases/tag/v0.3.5
573606
[0.3.4]: https://github.com/RAprogramm/masterror/releases/tag/v0.3.4
574607
[0.3.3]: https://github.com/RAprogramm/masterror/releases/tag/v0.3.3

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ turnkey = []
7171
openapi = ["dep:utoipa"]
7272

7373
[workspace.dependencies]
74-
masterror-derive = { version = "0.6.2" }
75-
masterror-template = { version = "0.3.1" }
74+
masterror-derive = { version = "0.6.6" }
75+
masterror-template = { version = "0.3.6" }
7676

7777
[dependencies]
7878
masterror-derive = { version = "0.6" }

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -709,4 +709,3 @@ MSRV = 1.90 (may raise in minor, never in patch).
709709
Apache-2.0 OR MIT, at your option.
710710

711711
</details>
712-

masterror-derive/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "masterror-derive"
33
rust-version = "1.90"
4-
version = "0.6.2"
4+
version = "0.6.6"
55
edition = "2024"
66
license = "MIT OR Apache-2.0"
77
repository = "https://github.com/RAprogramm/masterror"

masterror-template/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
[package]
22
name = "masterror-template"
3-
version = "0.3.1"
3+
version = "0.3.6"
44
rust-version = "1.90"
55
edition = "2024"
66
repository = "https://github.com/RAprogramm/masterror"
77
readme = "README.md"
88
description = "Template utilities for masterror and its derive macros"
9-
publish = false
109
license = "MIT OR Apache-2.0"
1110

1211
[dependencies]

masterror-template/README.md

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# masterror-template
2+
3+
`masterror-template` packages the template parser shared by the [`masterror`][masterror] runtime crate and the [`masterror-derive`][derive] procedural macros. It understands the `#[error("...")]` formatting language popularised by `thiserror` v2, producing a structured representation that downstream code can inspect or render.
4+
5+
The crate is intentionally small: it exposes just enough API for advanced applications that want to inspect derived error displays, implement custom derive helpers, or perform static analysis over formatting placeholders.
6+
7+
## Installation
8+
9+
Add the crate alongside `masterror` if you need direct access to the parser:
10+
11+
```toml
12+
[dependencies]
13+
masterror-template = { version = "0.3.6" }
14+
```
15+
16+
`masterror-template` targets Rust 1.90 and builds on stable and nightly toolchains alike.
17+
18+
## Parsing templates
19+
20+
Call [`ErrorTemplate::parse`](https://docs.rs/masterror-template/latest/masterror_template/template/struct.ErrorTemplate.html#method.parse) to turn an `&str` into a structured template:
21+
22+
```rust
23+
use masterror_template::template::{ErrorTemplate, TemplateIdentifier};
24+
25+
fn inspect(template: &str) {
26+
let parsed = ErrorTemplate::parse(template).expect("valid template");
27+
28+
for placeholder in parsed.placeholders() {
29+
match placeholder.identifier() {
30+
TemplateIdentifier::Named(name) => println!("named placeholder: {name}"),
31+
TemplateIdentifier::Positional(index) => println!("positional placeholder: {index}"),
32+
TemplateIdentifier::Implicit(index) => println!("implicit placeholder: {index}"),
33+
}
34+
}
35+
}
36+
```
37+
38+
The parser preserves literal text and exposes every placeholder with span metadata, making it straightforward to surface diagnostics or transform templates programmatically.
39+
40+
## Formatter metadata
41+
42+
Each [`TemplatePlaceholder`](https://docs.rs/masterror-template/latest/masterror_template/template/struct.TemplatePlaceholder.html) advertises the requested formatter through [`TemplateFormatter`](https://docs.rs/masterror-template/latest/masterror_template/template/enum.TemplateFormatter.html) and [`TemplateFormatterKind`](https://docs.rs/masterror-template/latest/masterror_template/template/enum.TemplateFormatterKind.html):
43+
44+
```rust
45+
use masterror_template::template::{ErrorTemplate, TemplateFormatterKind};
46+
47+
let template = ErrorTemplate::parse("{value:#x}").expect("parse");
48+
let placeholder = template.placeholders().next().expect("placeholder");
49+
let formatter = placeholder.formatter();
50+
assert_eq!(formatter.kind(), TemplateFormatterKind::LowerHex);
51+
assert!(formatter.is_alternate());
52+
```
53+
54+
This mirrors the formatting traits accepted by `core::fmt`, enabling consumers to route values through `Display`, `Debug`, hexadecimal, binary, pointer, or exponential renderers.
55+
56+
## Error reporting
57+
58+
Parsing failures produce [`TemplateError`](https://docs.rs/masterror-template/latest/masterror_template/template/enum.TemplateError.html) variants with precise byte ranges. The metadata simplifies IDE integrations and procedural macros that need to point at the offending part of the template.
59+
60+
```rust
61+
use masterror_template::template::ErrorTemplate;
62+
63+
let err = ErrorTemplate::parse("{foo").unwrap_err();
64+
assert!(matches!(err, masterror_template::template::TemplateError::UnterminatedPlaceholder { .. }));
65+
```
66+
67+
## License
68+
69+
Dual licensed under either of
70+
71+
- Apache License, Version 2.0, ([LICENSE-APACHE](../LICENSE-APACHE) or <http://www.apache.org/licenses/LICENSE-2.0>)
72+
- MIT license ([LICENSE-MIT](../LICENSE-MIT) or <http://opensource.org/licenses/MIT>)
73+
74+
at your option.
75+
76+
### Contribution
77+
78+
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
79+
80+
[masterror]: https://crates.io/crates/masterror
81+
[derive]: https://crates.io/crates/masterror-derive

0 commit comments

Comments
 (0)