Skip to content

Commit

Permalink
release: 0.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
joshstoik1 committed Apr 30, 2022
2 parents b6ec9e9 + 309eeab commit 9fd1982
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 50 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
RUSTFLAGS: "-D warnings"

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
Expand All @@ -55,14 +55,11 @@ jobs:
- name: Build
run: |
cargo build --release --target ${{ matrix.target }}
cargo build --release --no-default-features --target ${{ matrix.target }}
- name: Clippy
run: |
cargo clippy --release --target ${{ matrix.target }}
cargo clippy --release --no-default-features --target ${{ matrix.target }}
- name: Tests
run: |
cargo test --release --target ${{ matrix.target }}
cargo test --release --no-default-features --target ${{ matrix.target }}
12 changes: 10 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
# Changelog

## [0.1.2](https://github.com/Blobfolio/trimothy/releases/tag/v0.1.2) - 2022-04-30

### Changed

* Make crate `#![no_std]` w/o any feature gates



## [0.1.1](https://github.com/Blobfolio/trimothy/releases/tag/v0.1.1) - 2022-04-11

## Changes
### Changed

* Minor performance improvements

## Fixed
### Fixed

* Return empty slice when all bytes match trim predicate.
* Markdown (docs) formatting issues.
Expand Down
4 changes: 2 additions & 2 deletions CREDITS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Project Dependencies
Package: trimothy
Version: 0.1.1
Generated: 2022-04-12 05:23:34 UTC
Version: 0.1.2
Generated: 2022-04-30 19:39:20 UTC

This package has no dependencies.
11 changes: 3 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
[package]
name = "trimothy"
version = "0.1.1"
version = "0.1.2"
authors = ["Blobfolio, LLC. <[email protected]>"]
edition = "2021"
rust-version = "1.60"
description = "Traits for trimming slices, vecs, and strings."
license = "WTFPL"
repository = "https://github.com/Blobfolio/trimothy"
readme = "README.md"
keywords = []
keywords = [ "trim" ]
categories = [ "no-std" ]
exclude = [
".github",
".gitignore",
Expand All @@ -26,16 +27,10 @@ credits-dir = "./"
[dev-dependencies]
brunch = "0.2.*"

[features]
default = [ "std" ]
std = []

[[bench]]
name = "fn_trim_slice"
harness = false
required-features = [ "std" ]

[[bench]]
name = "fn_trim_mut_vec"
harness = false
required-features = [ "std" ]
9 changes: 2 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Trimothy is a small library that expands on the limited String- and slice-trimmi

If any of these methods happened to be introduced into stable Rust in the future, they will simply be removed from here.

This crate is `#![no_std]`-compatible.



### TrimSlice
Expand Down Expand Up @@ -65,13 +67,6 @@ The dependency can be added the normal way:
trimothy = "0.1"
```

To use this library with `no_std` environments — albeith with `alloc` — disable the default `std` crate feature:

```toml
[dependencies.trimothy]
version = "0.1"
default-features = false
```


## License
Expand Down
8 changes: 0 additions & 8 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -99,19 +99,11 @@ bench BENCH="":
# Unit tests!
@test:
clear
fyi notice "Testing default features."
cargo test \
--release \
--target x86_64-unknown-linux-gnu \
--target-dir "{{ cargo_dir }}"
fyi notice "Testing no_std."
cargo test \
--release \
--no-default-features \
--target x86_64-unknown-linux-gnu \
--target-dir "{{ cargo_dir }}"
# Get/Set version.
version:
Expand Down
14 changes: 5 additions & 9 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ Trimothy is a small library that expands on the limited String- and slice-trimmi
If any of these methods happened to be introduced into stable Rust in the future, they will simply be removed from here.
This crate is `#![no_std]`-compatible.
### [`TrimSlice`]
Expand Down Expand Up @@ -60,15 +62,10 @@ The dependency can be added the normal way:
[dependencies]
trimothy = "0.1"
```
To use this library with `no_std` environments — albeith with `alloc` — disable the default `std` crate feature:
```ignore,toml
[dependencies.trimothy]
version = "0.1"
default-features = false
*/

#![deny(unsafe_code)]

#![warn(
clippy::filetype_is_file,
clippy::integer_division,
Expand All @@ -92,9 +89,8 @@ default-features = false
)]
#![allow(clippy::module_name_repetitions)]

#![cfg_attr(not(feature = "std"), no_std)]
#![no_std]

#[cfg(not(feature = "std"))]
extern crate alloc;

mod trim_mut;
Expand Down
16 changes: 8 additions & 8 deletions src/trim_mut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,18 @@
# Trimothy - Mutable Trim
*/

#[cfg(not(feature = "std"))]
use alloc::{
boxed::Box,
string::String,
vec::Vec,
};

use core::intrinsics::copy;
use crate::{
not_whitespace,
TrimSlice,
TrimSliceMatches,
};

#[cfg(feature = "std")]
use std::ptr::copy;

#[cfg(not(feature = "std"))]
use core::intrinsics::copy;



/// # Mutable Trim.
Expand Down Expand Up @@ -116,6 +109,7 @@ pub trait TrimMatchesMut {


impl TrimMut for String {
#[allow(unsafe_code)]
/// # Trim Mut.
///
/// Remove leading and trailing whitespace, mutably.
Expand Down Expand Up @@ -149,6 +143,7 @@ impl TrimMut for String {
}
}

#[allow(unsafe_code)]
/// # Trim Start Mut.
///
/// Remove leading whitespace, mutably.
Expand Down Expand Up @@ -205,6 +200,7 @@ impl TrimMut for String {
impl TrimMatchesMut for String {
type MatchUnit = char;

#[allow(unsafe_code)]
/// # Trim Matches Mut.
///
/// Trim arbitrary leading and trailing bytes as determined by the provided
Expand Down Expand Up @@ -241,6 +237,7 @@ impl TrimMatchesMut for String {
}
}

#[allow(unsafe_code)]
/// # Trim Start Matches Mut.
///
/// Trim arbitrary leading bytes as determined by the provided callback,
Expand Down Expand Up @@ -449,6 +446,7 @@ impl TrimMut for Vec<u8> {
self.trim_end_mut();
}

#[allow(unsafe_code)]
/// # Trim Start Mut.
///
/// Remove leading (ASCII) whitespace, mutably.
Expand Down Expand Up @@ -502,6 +500,7 @@ impl TrimMut for Vec<u8> {
impl TrimMatchesMut for Vec<u8> {
type MatchUnit = u8;

#[allow(unsafe_code)]
/// # Trim Matches Mut.
///
/// Trim arbitrary leading and trailing bytes as determined by the provided
Expand Down Expand Up @@ -537,6 +536,7 @@ impl TrimMatchesMut for Vec<u8> {
}
}

#[allow(unsafe_code)]
/// # Trim Start Matches Mut.
///
/// Trim arbitrary leading bytes as determined by the provided callback,
Expand Down
2 changes: 0 additions & 2 deletions src/trim_slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@
# Trimothy - Trim Slice
*/

#[cfg(not(feature = "std"))]
use alloc::{
boxed::Box,
vec::Vec,
};

use crate::not_whitespace;


Expand Down

0 comments on commit 9fd1982

Please sign in to comment.