Crates.io | whatwg-infra |
lib.rs | whatwg-infra |
version | 1.1.0 |
source | src |
created_at | 2023-03-20 06:28:43.003052 |
updated_at | 2024-11-03 15:50:39.09927 |
description | Tiny Rust-based implementation of the WHATWG Infra Standard |
homepage | |
repository | https://github.com/neoncitylights/whatwg-rust |
max_upload_size | |
id | 814962 |
size | 43,726 |
A tiny Rust crate that implements parts of the WHATWG Infra Standard. Specifically, it implements the following:
It exposes a small set of primitives that are useful for parsing text into machine-readable data.
cargo add whatwg-infra
You can import individual functions:
use whatwg_infra::{
is_ascii_tab_newline,
is_c0_control,
is_c0_control_space,
is_noncharacter
};
assert!(is_ascii_tab_newline('\t'));
assert!(is_c0_control('\u{0000}'));
assert!(is_c0_control_space('\u{0020}'));
You can also import the traits to get all the functionality, and execute the methods on the types directly.
use whatwg_infra::{InfraScalarValue, InfraStr, InfraUtf16Surrogate};
assert_eq!('a'.is_ascii_tab_newline(), false);
assert_eq!('\u{001E}'.is_c0_control(), true);
assert_eq!('\n'.is_c0_control_space(), true);
assert_eq!('\u{CFFFF}'.is_noncharacter(), true);
This crate does not depend on libstd, and can be used in #![no_std]
environments.
Licensed under either of
LICENSE-APACHE
or http://www.apache.org/licenses/LICENSE-2.0)LICENSE-MIT
or http://opensource.org/licenses/MIT)at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.