Skip to content

Commit

Permalink
release: 0.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
joshstoik1 committed Oct 16, 2023
2 parents edfae35 + 497a501 commit 0185905
Show file tree
Hide file tree
Showing 15 changed files with 1,108 additions and 460 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
# Changelog


## [0.6.0](https://github.com/Blobfolio/dactyl/releases/tag/v0.6.0) - 2023-10-15

### New

* `IntDivFloat` trait

### Changed

* `SaturatingFrom` is now implemented to/from all primitive integer types, even in cases where saturation isn't ever necessary, like `T->T`
* `NiceU8::as_bytes2` is now `const`
* `NiceU8::as_str2` is now `const`
* Drop `num-traits` dependency

### Deprecated

* `div_mod`
* `int_div_float` (use `IntDivFloat::div_float` instead)



## [0.5.2](https://github.com/Blobfolio/dactyl/releases/tag/v0.5.2) - 2023-10-05

Expand Down
8 changes: 3 additions & 5 deletions CREDITS.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# Project Dependencies
Package: dactyl
Version: 0.5.2
Generated: 2023-10-05 19:22:00 UTC
Version: 0.6.0
Generated: 2023-10-16 01:12:30 UTC

| Package | Version | Author(s) | License |
| ---- | ---- | ---- | ---- |
| [num-traits](https://github.com/rust-num/num-traits) | 0.2.16 | The Rust Project Developers | Apache-2.0 or MIT |
This package has no dependencies.
5 changes: 1 addition & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "dactyl"
version = "0.5.2"
version = "0.6.0"
authors = ["Blobfolio, LLC. <hello@blobfolio.com>"]
edition = "2021"
rust-version = "1.70"
Expand All @@ -27,9 +27,6 @@ bash-dir = "./"
man-dir = "./"
credits-dir = "./"

[dependencies]
num-traits = "0.2.*"

[dev-dependencies]
brunch = "0.5.*"
fastrand = "2"
Expand Down
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,19 @@

This crate provides a fast interface to "stringify" unsigned integers, formatted with commas at each thousand. It prioritizes speed and simplicity over configurability.

If your application just wants to quickly turn `1010` into `"1,010"`, `Dactyl` is a great choice. If your application requires locale awareness or other options, something like [`num-format`](https://crates.io/crates/num-format) would probably make more sense.
If your application just wants to quickly turn `1010` into `"1,010"`, Dactyl is a great choice. If your application requires locale awareness or other options, something like [`num-format`](https://crates.io/crates/num-format) would probably make more sense.

Similar to [`itoa`](https://crates.io/crates/itoa), Dactyl writes ASCII conversions to a temporary buffer, but does so using fixed arrays sized for each type's maximum value, minimizing the allocation overhead for, say, tiny little `u8`s.

Each type has its own struct, each of which works exactly the same way:

* [`NiceU8`]
* [`NiceU16`]
* [`NiceU32`]
* [`NiceU64`]

(Note: support for `usize` values is folded into [`NiceU64`].)
* `NiceU8`
* `NiceU16`
* `NiceU32`
* `NiceU64` (also covers `usize`)
* `NiceFloat`
* `NiceElapsed` (for durations)
* `NicePercent` (for floats representing percentages)

The intended use case is to simply call the appropriate `from()` for the type, then use either the `as_str()` or `as_bytes()` struct methods to retrieve the output in the desired format. Each struct also implements traits like `Deref`, `Display`, `AsRef<str>`, `AsRef<[u8]>`, etc., if you prefer those.

Expand All @@ -32,6 +33,14 @@ assert_eq!(NiceU16::from(11234_u16).as_str(), "11,234");
assert_eq!(NiceU16::from(11234_u16).as_bytes(), b"11,234");
```

But the niceness doesn't stop there. Dactyl provides several other structs, methods, and traits to performantly work with integers, such as:

* `NoHash`: a passthrough hasher for integer `HashSet`/`HashMap` collections
* `traits::BytesToSigned`: signed integer parsing from byte slices
* `traits::BytesToUnsigned`: unsigned integer parsing from byte slices
* `traits::HexToSigned`: signed integer parsing from hex
* `traits::HexToUnsigned`: unsigned integer parsing from hex



## Installation
Expand All @@ -40,20 +49,11 @@ Add `dactyl` to your `dependencies` in `Cargo.toml`, like:

```
[dependencies]
dactyl = "0.5.*"
dactyl = "0.6.*"
```



## Other

This crate also contains a few more specialized "nice" structs:
* [`NiceFloat`]
* [`NiceElapsed`]
* [`NicePercent`]



## License

See also: [CREDITS.md](CREDITS.md)
Expand Down
Loading

0 comments on commit 0185905

Please sign in to comment.