Skip to content

Commit 0db4f8e

Browse files
committed
Rename internal things per what they do.
1 parent 78996fc commit 0db4f8e

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

src/lib.rs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ macro_rules! match_ignore_ascii_case {
139139
#[allow(dead_code)]
140140
struct Dummy;
141141

142-
_cssparser_internal__max_len!($value => lowercase, $($string),+);
142+
_cssparser_internal__to_lowercase!($value => lowercase, $($string),+);
143143
match lowercase {
144144
$(
145145
Some($string) => $result,
@@ -203,7 +203,7 @@ macro_rules! ascii_case_insensitive_phf_map {
203203
impl $Name {
204204
#[inline]
205205
fn get(input: &str) -> Option<&'static $ValueType> {
206-
_cssparser_internal__max_len!(input => lowercase, $($key),+);
206+
_cssparser_internal__to_lowercase!(input => lowercase, $($key),+);
207207
lowercase.and_then(|string| $Name::map().get(string))
208208
}
209209
}
@@ -212,13 +212,14 @@ macro_rules! ascii_case_insensitive_phf_map {
212212

213213
/// Implementation detail of match_ignore_ascii_case! and ascii_case_insensitive_phf_map! macros.
214214
///
215+
/// **This macro is not part of the public API. It can change or be removed between any versions.**
216+
///
215217
/// * Check at compile-time that none of the `$string`s contain ASCII uppercase letters
216-
/// * Define a local variable named `$output`
217-
/// to the result of calling `_match_ignore_ascii_case__to_lowercase`
218+
/// * Define a local variable named `$output` to the result of calling `_internal__to_lowercase`
218219
/// with a stack-allocated buffer as long as the longest `$string`.
219220
#[macro_export]
220221
#[doc(hidden)]
221-
macro_rules! _cssparser_internal__max_len {
222+
macro_rules! _cssparser_internal__to_lowercase {
222223
($input: expr => $output: ident, $($string: expr),+) => {
223224
#[derive(cssparser__max_len)]
224225
#[cssparser__max_len__data($(string = $string),+)]
@@ -227,24 +228,26 @@ macro_rules! _cssparser_internal__max_len {
227228

228229
// MAX_LENGTH is generated by cssparser__match_ignore_ascii_case__max_len
229230
let mut buffer: [u8; MAX_LENGTH] =
230-
// `buffer` is only used in `_match_ignore_ascii_case__to_lowercase`,
231+
// `buffer` is only used in `_internal__to_lowercase`,
231232
// which initializes with `copy_from_slice` the part of the buffer it uses,
232233
// before it uses it.
233234
unsafe {
234235
::std::mem::uninitialized()
235236
};
236-
let $output = $crate::_match_ignore_ascii_case__to_lowercase(&mut buffer, $input);
237+
let $output = $crate::_internal__to_lowercase(&mut buffer, $input);
237238
}
238239
}
239240

240241

241242
/// Implementation detail of match_ignore_ascii_case! and ascii_case_insensitive_phf_map! macros.
242243
///
244+
/// **This function is not part of the public API. It can change or be removed between any verisons.**
245+
///
243246
/// Return `input`, lower-cased, unless larger than `buffer`
244247
/// which is used temporary space for lower-casing a copy of `input` if necessary.
245248
#[doc(hidden)]
246249
#[allow(non_snake_case)]
247-
pub fn _match_ignore_ascii_case__to_lowercase<'a>(buffer: &'a mut [u8], input: &'a str) -> Option<&'a str> {
250+
pub fn _internal__to_lowercase<'a>(buffer: &'a mut [u8], input: &'a str) -> Option<&'a str> {
248251
if let Some(buffer) = buffer.get_mut(..input.len()) {
249252
if let Some(first_uppercase) = input.bytes().position(|byte| matches!(byte, b'A'...b'Z')) {
250253
buffer.copy_from_slice(input.as_bytes());

0 commit comments

Comments
 (0)