Skip to content

Commit 2e63a3c

Browse files
committed
Prepare the next release.
1 parent 5a2a73b commit 2e63a3c

File tree

9 files changed

+197
-30
lines changed

9 files changed

+197
-30
lines changed

Cargo.toml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "refinement-types"
3-
version = "0.1.0"
3+
version = "0.2.0"
44
authors = ["nekitdev <[email protected]>"]
55
edition = "2024"
66
description = "Refinement types."
@@ -13,8 +13,6 @@ categories = ["no-std", "no-std::no-alloc", "rust-patterns"]
1313

1414
[dependencies.miette]
1515
version = "7.5.0"
16-
# TODO: remove this
17-
features = ["fancy"]
1816
optional = true
1917

2018
[dependencies.paste]
@@ -39,8 +37,7 @@ features = ["regex", "serde"]
3937
path = "."
4038

4139
[features]
42-
# TODO: `std` feature by default
43-
default = ["diagnostics"]
40+
default = ["std"]
4441
serde = ["dep:serde"]
4542
regex = ["dep:regex", "std"]
4643
diagnostics = ["dep:miette", "std"]

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Or by directly specifying it in the configuration like so:
2121

2222
```toml
2323
[dependencies]
24-
refinement-types = "0.1.0"
24+
refinement-types = "0.2.0"
2525
```
2626

2727
Alternatively, you can add it directly from the source:
@@ -42,13 +42,13 @@ git = "https://github.com/nekitdev/refinement-types.git"
4242

4343
use core::fmt;
4444

45-
use refinement_types::{Refinement, int::U8Closed, length::Closed, logic::And, str::IsAscii};
45+
use refinement_types::{Refinement, int::u8, length, logic::And, str};
4646

4747
/// Represents device names.
48-
pub type Name<'n> = Refinement<&'n str, And<Closed<1, 32>, IsAscii>>;
48+
pub type Name<'n> = Refinement<&'n str, And<str::Ascii, length::Closed<1, 32>>>;
4949

5050
/// Represents device charge, in percentage.
51-
pub type Charge = Refinement<u8, U8Closed<1, 100>>;
51+
pub type Charge = Refinement<u8, u8::Closed<1, 100>>;
5252

5353
/// Represents devices.
5454
#[derive(Debug)]
@@ -83,16 +83,16 @@ impl<'d> Device<'d> {
8383
```rust
8484
// main.rs
8585

86+
use anyhow::Result;
8687
use device::{Charge, Device, Name};
87-
use refinement_types::MessageError;
8888

89-
fn main() -> Result<(), MessageError> {
90-
let charge = Charge::refine(69)?;
89+
fn main() -> Result<()> {
90+
let charge = Charge::refine(13)?;
9191
let name = Name::refine("nekit")?;
9292

9393
let device = Device::new(name, charge);
9494

95-
println!("{device}"); // nekit: 69%
95+
println!("{device}"); // nekit: 13%
9696

9797
Ok(())
9898
}

changelogging.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[context]
22
name = "refinement-types"
3-
version = "0.1.0"
3+
version = "0.2.0"
44
url = "https://github.com/nekitdev/refinement-types"
55

66
[formats]

changes/~rewrite.change.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
The entire crate has been rewritten; please refer to the
2+
[documentation](https://docs.rs/refinement-types).

src/core.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ where
301301
P::Error: ErrorCore + 'static,
302302
{
303303
fn source(&self) -> Option<&(dyn ErrorCore + 'static)> {
304-
Some(&self.error)
304+
Some(self.error())
305305
}
306306
}
307307

@@ -319,7 +319,7 @@ where
319319
}
320320

321321
fn diagnostic_source(&self) -> Option<&dyn Diagnostic> {
322-
Some(&self.error)
322+
Some(self.error())
323323
}
324324
}
325325

@@ -436,6 +436,7 @@ impl<T, P: Predicate<T> + ?Sized, H: TypeStr + ?Sized> Refinement<T, P, H> {
436436
}
437437

438438
/// Returns a reference to the value of the refinement.
439+
#[allow(clippy::missing_const_for_fn)]
439440
pub fn get(&self) -> &T {
440441
#[cfg(feature = "unsafe-assert")]
441442
self.assert_refined();

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//! TODO
1010
1111
#![cfg_attr(not(feature = "std"), no_std)]
12-
#![warn(missing_docs)]
12+
#![deny(missing_docs)]
1313
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
1414

1515
#[cfg(feature = "alloc")]
@@ -23,7 +23,7 @@ pub mod length;
2323
#[macro_use]
2424
pub mod logic;
2525
pub mod static_str;
26-
// pub mod str;
26+
pub mod str;
2727
#[macro_use]
2828
pub mod type_str;
2929

src/str/bytes.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
//! Predicates based on bytes of strings.

src/str/chars.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
//! Predicates based on characters of strings.

0 commit comments

Comments
 (0)