vermouth 0.5.4

a new kind of parser for procedural macros
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//! Library-internal CTFE utilities.

/// Returns `true` iff any byte in `bytes` is `p`.
pub(crate) const fn bytes_any(mut bytes: &[u8], p: u8) -> bool {
    // impl borrows from stdlib's `is_ascii_simple` for optimal compile-time execution time.
    // but searching from the left should be generally faster
    // because most of the time the first byte will succeed.
    while let [first, rest @ ..] = bytes {
        if *first == p {
            break;
        }

        bytes = rest;
    }

    !bytes.is_empty()
}