about summary refs log tree commit diff
path: root/library/std/src/sys/unix/stack_overflow.rs
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-02-20 00:37:23 +0100
committerGitHub <noreply@github.com>2022-02-20 00:37:23 +0100
commit575f6c5cc1779508cd30847ccb9f3f489f5e6c00 (patch)
tree5c6ef62c5414d405964d5f986945c379eed3338c /library/std/src/sys/unix/stack_overflow.rs
parent4f533de571acce5913d3713062c1f3e44e9a3594 (diff)
parentf7448a77e4d9ddb2e0b52905a6a89cab86ea35f6 (diff)
downloadrust-575f6c5cc1779508cd30847ccb9f3f489f5e6c00.tar.gz
rust-575f6c5cc1779508cd30847ccb9f3f489f5e6c00.zip
Rollup merge of #93686 - dbrgn:trim-on-byte-slices, r=joshtriplett
core: Implement ASCII trim functions on byte slices

Hi ````````@rust-lang/libs!```````` This is a feature that I wished for when implementing serial protocols with microcontrollers. Often these protocols may contain leading or trailing whitespace, which needs to be removed. Because oftentimes drivers will operate on the byte level, decoding to unicode and checking for unicode whitespace is unnecessary overhead.

This PR adds three new methods to byte slices:

- `trim_ascii_start`
- `trim_ascii_end`
- `trim_ascii`

I did not find any pre-existing discussions about this, which surprises me a bit. Maybe I'm missing something, and this functionality is already possible through other means? There's https://github.com/rust-lang/rfcs/issues/2547 ("Trim methods on slices"), but that has a different purpose.

As per the [std dev guide](https://std-dev-guide.rust-lang.org/feature-lifecycle/new-unstable-features.html), this is a proposed implementation without any issue / RFC. If this is the wrong process, please let me know. However, I thought discussing code is easier than discussing a mere idea, and hacking on the stdlib was fun.

Tracking issue: https://github.com/rust-lang/rust/issues/94035
Diffstat (limited to 'library/std/src/sys/unix/stack_overflow.rs')
0 files changed, 0 insertions, 0 deletions