2
2
* License, v. 2.0. If a copy of the MPL was not distributed with this
3
3
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
4
5
+ /// See docs of the `procedural-masquarade` crate.
5
6
define_invoke_proc_macro ! ( cssparser_internal__invoke_proc_macro) ;
6
7
7
- /// Expands to an expression equivalent to a `match` with string patterns,
8
- /// but matching is case-insensitive in the ASCII range.
8
+ /// Expands to a `match` expression with string patterns,
9
+ /// matching case-insensitively in the ASCII range.
9
10
///
10
11
/// The patterns must not contain ASCII upper case letters. (They must be already be lower-cased.)
11
12
///
@@ -63,7 +64,7 @@ macro_rules! match_ignore_ascii_case {
63
64
/// ```rust
64
65
/// #[macro_use] extern crate cssparser;
65
66
///
66
- /// # fn main() {} // Make doctest not wrap everythig in its own main
67
+ /// # fn main() {} // Make doctest not wrap everything in its own main
67
68
///
68
69
/// fn color_rgb(input: &str) -> Option<(u8, u8, u8)> {
69
70
/// ascii_case_insensitive_phf_map! {
@@ -99,18 +100,18 @@ macro_rules! ascii_case_insensitive_phf_map {
99
100
///
100
101
/// **This macro is not part of the public API. It can change or be removed between any versions.**
101
102
///
102
- /// * Check at compile-time that none of the `$string`s contain ASCII uppercase letters
103
- /// * Define a local variable named `$output` to the result of calling `_internal__to_lowercase`
104
- /// with a stack-allocated buffer as long as the longest `$string `.
103
+ /// Define a local variable named `$output`
104
+ /// and assign it the result of calling `_internal__to_lowercase`
105
+ /// with a stack-allocated buffer of length `$BUFFER_SIZE `.
105
106
#[ macro_export]
106
107
#[ doc( hidden) ]
107
108
macro_rules! cssparser_internal__to_lowercase {
108
- ( $input: expr, $MAX_LENGTH : expr => $output: ident) => {
109
+ ( $input: expr, $BUFFER_SIZE : expr => $output: ident) => {
109
110
// mem::uninitialized() is ok because `buffer` is only used in `_internal__to_lowercase`,
110
111
// which initializes with `copy_from_slice` the part of the buffer it uses,
111
112
// before it uses it.
112
113
#[ allow( unsafe_code) ]
113
- let mut buffer: [ u8 ; $MAX_LENGTH ] = unsafe {
114
+ let mut buffer: [ u8 ; $BUFFER_SIZE ] = unsafe {
114
115
:: std:: mem:: uninitialized( )
115
116
} ;
116
117
let input: & str = $input;
@@ -122,8 +123,8 @@ macro_rules! cssparser_internal__to_lowercase {
122
123
///
123
124
/// **This function is not part of the public API. It can change or be removed between any verisons.**
124
125
///
125
- /// Return `input`, lower-cased, unless larger than ` buffer`
126
- /// which is used temporary space for lower-casing a copy of `input` if necessary.
126
+ /// If `input` is larger than buffer, return `None`.
127
+ /// Otherwise, return `input` ASCII-lowercased, using `buffer` as temporary space if necessary.
127
128
#[ doc( hidden) ]
128
129
#[ allow( non_snake_case) ]
129
130
pub fn _internal__to_lowercase < ' a > ( buffer : & ' a mut [ u8 ] , input : & ' a str ) -> Option < & ' a str > {
0 commit comments