Skip to content

Commit bdbf5b8

Browse files
authored
small improvements (#10)
1 parent 9713a2e commit bdbf5b8

File tree

4 files changed

+15
-7
lines changed

4 files changed

+15
-7
lines changed

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [0.4.0] - 2023-03-01
8+
### Changed
9+
- **Breaking Change**: Made error enums `non_exhaustive`
10+
- Added `Copy` implementation to `Trait` and `Formattable`
11+
712
## [0.3.0] - 2023-03-01
813
### Added
914
- `i` gained implicit format `({})` when none is specified `{:i}`
@@ -28,7 +33,8 @@ Fixed URLs in Cargo.toml
2833
## [0.1.0] - 2023-02-27
2934
Initial release
3035

31-
[unreleased]: https://github.com/ModProg/interpolator/compare/v0.3.0...HEAD
36+
[unreleased]: https://github.com/ModProg/interpolator/compare/v0.4.0...HEAD
37+
[0.4.0]: https://github.com/ModProg/interpolator/compare/v0.3.0...v0.4.0
3238
[0.3.0]: https://github.com/ModProg/interpolator/compare/v0.2.0...v0.3.0
3339
[0.2.0]: https://github.com/ModProg/interpolator/compare/v0.1.2...v0.2.0
3440
[0.1.2]: https://github.com/ModProg/interpolator/compare/v0.1.1...v0.1.2

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "interpolator"
3-
version = "0.3.0"
3+
version = "0.4.0"
44
edition = "2021"
55
categories = ["template-engine", "value-formatting", "text-processing"]
66
description = "runtime format strings, fully compatible with std's macros"

src/error.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
use super::*;
22

3-
#[derive(Debug, PartialEq, Clone)]
43
/// Error returned by [`format()`].
4+
#[derive(Debug, PartialEq, Clone)]
5+
#[non_exhaustive]
56
pub enum Error {
67
/// Value was formatted with unimplemented trait.
78
/// - `.0` the trait
@@ -66,9 +67,9 @@ impl Display for Error {
6667

6768
impl StdError for Error {}
6869

69-
#[derive(Debug, PartialEq, Clone)]
70-
#[non_exhaustive]
7170
/// The trait used to format.
71+
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
72+
#[non_exhaustive]
7273
pub enum Trait {
7374
/// [`Binary`]
7475
#[cfg(feature = "number")]
@@ -101,8 +102,9 @@ pub enum Trait {
101102
Iter,
102103
}
103104

104-
#[derive(Debug, PartialEq, Clone)]
105105
/// Error caused by invalid format string
106+
#[derive(Debug, PartialEq, Clone)]
107+
#[non_exhaustive]
106108
pub enum ParseError {
107109
/// Format spec at byte index is nether closed with a `}`
108110
FormatSpecUnclosed(usize),

src/formattable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use super::*;
22
/// Utility struct holding references to the trait implementation of a value to
33
/// enable runtime verification and execution of them
4-
#[derive(Default)]
4+
#[derive(Default, Clone, Copy)]
55
#[must_use]
66
pub struct Formattable<'a> {
77
#[cfg(any(feature = "debug", feature = "number"))]

0 commit comments

Comments
 (0)