Skip to content

Commit

Permalink
release: 0.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
joshstoik1 committed Jun 1, 2023
2 parents be36b7e + 3486c62 commit 71aaeaa
Show file tree
Hide file tree
Showing 16 changed files with 331 additions and 337 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Build

on:
push:
branches: [ master ]
branches: []
pull_request:
branches: [ master ]
branches: []

defaults:
run:
Expand Down Expand Up @@ -51,6 +51,7 @@ jobs:
- name: Build
run: |
cargo build --target ${{ matrix.target }}
cargo build --release --target ${{ matrix.target }}
- name: Clippy
Expand All @@ -59,5 +60,5 @@ jobs:
- name: Tests
run: |
cargo test --release --all-features --target ${{ matrix.target }}
cargo test --release --all-features --target ${{ matrix.target }} -- --ignored
cargo test --all-features --target ${{ matrix.target }} -- --include-ignored
cargo test --release --all-features --target ${{ matrix.target }} -- --include-ignored
56 changes: 56 additions & 0 deletions .github/workflows/msrv.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: MSRV

on:
push:
branches: []
pull_request:
branches: []

defaults:
run:
shell: bash

env:
CARGO_TERM_COLOR: always

jobs:
all:
name: All

strategy:
matrix:
target:
- x86_64-unknown-linux-gnu
- x86_64-apple-darwin
- x86_64-pc-windows-msvc
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-apple-darwin
os: macos-latest
- target: x86_64-pc-windows-msvc
os: windows-latest

runs-on: ${{matrix.os}}

env:
RUSTFLAGS: "-D warnings"

steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: taiki-e/install-action@v2
with:
tool: cargo-msrv

- name: Info
run: |
rustup --version
cargo --version
cargo clippy --version
- name: MSRV
run: |
cargo msrv verify
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,23 @@



## [0.5.0](https://github.com/Blobfolio/dactyl/releases/tag/v0.5.0) - 2023-06-01


### Changed

* Bump MSRV to `1.70`
* Replace (most) `unsafe` blocks w/ safe alternatives
* Add debug/assertions around remaining `unsafe` blocks for extra/redundant test coverage
* CI: run tests in both debug and release modes
* CI: test MSRV

### Removed

* `NiceElapsed::max`



## [0.4.8](https://github.com/Blobfolio/dactyl/releases/tag/v0.4.8) - 2023-02-16

### New
Expand Down
4 changes: 2 additions & 2 deletions CREDITS.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Project Dependencies
Package: dactyl
Version: 0.4.8
Generated: 2023-02-16 19:35:21 UTC
Version: 0.5.0
Generated: 2023-06-01 19:00:52 UTC

| Package | Version | Author(s) | License |
| ---- | ---- | ---- | ---- |
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[package]
name = "dactyl"
version = "0.4.8"
version = "0.5.0"
authors = ["Blobfolio, LLC. <hello@blobfolio.com>"]
edition = "2021"
rust-version = "1.63"
rust-version = "1.70"
description = "A small library to quickly stringify integers with basic formatting."
license = "WTFPL"
repository = "https://github.com/Blobfolio/dactyl"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Add `dactyl` to your `dependencies` in `Cargo.toml`, like:

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


Expand Down
14 changes: 5 additions & 9 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,6 @@ bench BENCH="":
exit 0


# Check Release!
@check:
# First let's build the Rust bit.
cargo check \
--release \
--target x86_64-unknown-linux-gnu \
--target-dir "{{ cargo_dir }}"


# Clean Cargo crap.
@clean:
# Most things go here.
Expand Down Expand Up @@ -115,6 +106,11 @@ bench BENCH="":
# Unit tests!
@test:
clear

cargo test \
--target x86_64-unknown-linux-gnu \
--target-dir "{{ cargo_dir }}"

cargo test \
--release \
--target x86_64-unknown-linux-gnu \
Expand Down
22 changes: 13 additions & 9 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,28 +112,32 @@ static DOUBLE: [[u8; 2]; 100] = [
[57, 48], [57, 49], [57, 50], [57, 51], [57, 52], [57, 53], [57, 54], [57, 55], [57, 56], [57, 57]
];

#[allow(unsafe_code)]
#[inline]
/// # Double Pointer.
/// # Double Digits.
///
/// This produces a pointer to a specific two-digit subslice of `DOUBLE`.
/// Return both digits, ASCII-fied.
///
/// ## Panics
///
/// This will panic if the number is greater than 99.
pub(crate) fn double_ptr(idx: usize) -> *const u8 {
debug_assert!(idx < 100, "BUG: Invalid index passed to double_ptr.");
unsafe { DOUBLE.get_unchecked(idx).as_ptr() }
}
pub(crate) fn double(idx: usize) -> [u8; 2] { DOUBLE[idx] }

/// # Double Digits.
#[inline]
#[allow(clippy::cast_possible_truncation)]
/// # Triple Digits.
///
/// Return both digits, ASCII-fied.
///
/// ## Panics
///
/// This will panic if the number is greater than 99.
pub(crate) fn double(idx: usize) -> [u8; 2] { DOUBLE[idx] }
pub(crate) fn triple(idx: usize) -> [u8; 3] {
assert!(idx < 1000, "Bug: Triple must be less than 1000.");
let (div, rem) = div_mod(idx, 100);
let a = div as u8 + b'0';
let [b, c] = DOUBLE[rem];
[a, b, c]
}



Expand Down
Loading

0 comments on commit 71aaeaa

Please sign in to comment.