posix-space

GitHub Actions Discord Twitter
Crate API API trunk

A small crate which determines if a byte is classified as a space in the POSIX locale [POSIX.1-2017], chapter 7, [Locale].

space

Define characters to be classified as white-space characters.

In the POSIX locale, exactly \

The function defined in this crate should have equivalent behavior to the C fucntion [isspace] as defined in ctype.h.

Usage

Add this to your Cargo.toml:

toml [dependencies] posix-space = "1.0.0"

Then classify bytes like:

```rust assert!(posixspace::isspace(b' ')); assert!(posixspace::isspace(b'\t')); assert!(posixspace::isspace(b'\r'));

assert!(!posixspace::isspace(b'\0')); assert!(!posixspace::isspace(b'C')); assert!(!posixspace::isspace(b'&')); ```

This crate's behavior differs from [u8::is_ascii_whitespace] in the Rust standard library in that \\x0B, is considered a space.

rust assert!(posix_space::is_space(b'\x0B'));

Crate features

posix-space is no_std with no dependencies outside of Rust [core].

Minimum Supported Rust Version

This crate requires at least Rust 1.31.0. This version can be bumped in minor releases.

License

posix-space is licensed under the MIT License (c) Ryan Lopopolo.