in_str

Crates.ioin_str
lib.rsin_str
version0.1.0
sourcesrc
created_at2024-11-20 12:49:28.923757
updated_at2024-11-20 12:49:28.923757
descriptionA procedural macro to generate a closure that checks if a character is in the provided literal string.
homepage
repositoryhttps://github.com/DiscreteTom/in_str
max_upload_size
id1454765
size5,231
DiscreteTom (DiscreteTom)

documentation

README

in_str!

Crates.io Version license

use in_str::in_str;

let _ = in_str!("abc");
// equals to
let _ = |c: char| matches!(c, 'a' | 'b' | 'c');
// usually faster than
let _ = |c: char| "abc".contains(c);

// escape will be handled automatically
let _ = in_str!("\n\u{10ffff}");
// equals to
let _ = |c: char| matches!(c, '\n' | '\u{10ffff}');
Commit count: 5

cargo fmt