1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
//! Compile-time string operations
//!
//! MSRV: Rust 1.51.0
//!
#![deny(unsafe_code, missing_docs, clippy::all, clippy::cargo)]
#![allow(
    clippy::missing_docs_in_private_items,
    clippy::missing_inline_in_public_items,
    clippy::implicit_return
)]
#![cfg_attr(not(any(test, feature = "std")), no_std)]

macro_rules! constfn_assert {
    ($e:expr) => {{
        let _: () = [()][(!($e) as usize)];
    }};
}

macro_rules! constfn_panic {
    ($s: literal) => {{
        #[allow(unconditional_panic)]
        let _: &str = [$s][1];
        loop {}
    }};
}

macro_rules! constfn_unreachable {
    () => {
        constfn_panic!("unreachable")
    };
}

#[allow(unused_macros)]
macro_rules! item_group {
    ($($tt:tt)*) => {
        $($tt)*
    }
}

mod ascii;
mod bytes;
mod str;
mod utf16;
mod utf8;

#[doc(hidden)]
pub mod __proc {
    mod case;
    pub use self::case::*;

    mod fmt;
    pub use self::fmt::*;

    mod str;
    pub use self::str::*;

    #[cfg(feature = "verify-http")]
    item_group! {
        mod verify_http;
        pub use self::verify_http::*;
    }

    #[cfg(feature = "verify-regex")]
    item_group! {
        mod verify_regex;
        pub use self::verify_regex::*;
    }
}

#[doc(hidden)]
pub mod __ctfe {
    mod ascii_case;
    pub use self::ascii_case::*;

    mod concat;
    pub use self::concat::*;

    #[cfg(feature = "std")]
    item_group! {
        mod cstr;
        pub use self::cstr::*;
    }

    mod encode;
    pub use self::encode::*;

    mod equal;
    pub use self::equal::*;

    mod find;
    pub use self::find::*;

    mod fmt;
    pub use self::fmt::*;

    mod hex_bytes;
    pub use self::hex_bytes::*;

    mod len;
    pub use self::len::*;

    #[cfg(feature = "std")]
    item_group! {
        mod net;
        pub use self::net::*;
    }

    mod parse;
    pub use self::parse::*;

    mod repeat;
    pub use self::repeat::*;
    mod replace;
    pub use self::replace::*;

    mod str_buf;
    pub use self::str_buf::*;

    mod to_byte_array;
    pub use self::to_byte_array::*;

    mod to_char_array;
    pub use self::to_char_array::*;

    mod to_str;
    pub use self::to_str::*;
}