Expand description
Trimothy
Trimothy is a small library that expands on the limited String- and slice-trimming capabilities provided by the standard library.
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
This trait adds the following basic trimming capabilities to &[u8]
, Vec<u8>
, and Box<[u8]>
, similar to those enjoyed by strings.
Method | Description |
---|---|
trim | Trim leading and trailing (ASCII) whitespace. |
trim_start | Trim leading (ASCII) whitespace. |
trim_end | Trim trailing (ASCII) whitespace. |
TrimSliceMatches
This trait adds the arbitrary, match-based trimming methods to &[u8]
, Vec<u8>
, and Box<[u8]>
:
Method | Description |
---|---|
trim_matches | Trim arbitrary leading and trailing bytes via callback. |
trim_start_matches | Trim arbitrary leading bytes via callback. |
trim_end_matches | Trim arbitrary trailing bytes via callback. |
TrimMut
This trait brings mutable trimming support to String
, Vec<u8>
, and Box<[u8]>
.
Method | Description |
---|---|
trim_mut | Trim leading and trailing whitespace (mutably). |
trim_start_mut | Trim leading whitespace (mutably). |
trim_end_mut | Trim trailing whitespace (mutably). |
TrimMatchesMut
This trait brings mutable match-based trimming String
, Vec<u8>
, and Box<[u8]>
.
Method | Description |
---|---|
trim_matches_mut | Trim arbitrary leading and trailing bytes via callback (mutably). |
trim_start_matches_mut | Trim arbitrary leading bytes via callback (mutably). |
trim_end_matches_mut | Trim arbitrary trailing bytes via callback (mutably). |
Installation
The dependency can be added the normal way:
ⓘ
[dependencies]
trimothy = "0.1"
Traits
Mutable Trim (Matches).
Mutable Trim.
Trim Slice.
Trim Slice (Matches).