Skip to content

Commit a9677d0

Browse files
committed
refactor: rename feature flag from rev-mappings to rev-map
1 parent 4a49473 commit a9677d0

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ documentation = "https://docs.rs/mime_guess2/"
1111
readme = "README.md"
1212

1313
[features]
14-
default = ["rev-mappings"]
14+
default = ["rev-map"]
1515
phf-map = ["phf", "phf_codegen"]
1616

1717
# generate reverse-mappings for lookup of extensions by MIME type
1818
# default-on but can be turned off for smaller generated code
19-
rev-mappings = []
19+
rev-map = []
2020

2121
[dependencies]
2222
mime = "0.3"
@@ -41,7 +41,7 @@ criterion = "0.5"
4141

4242
[[example]]
4343
name = "rev_map"
44-
required-features = ["rev-mappings"]
44+
required-features = ["rev-map"]
4545

4646
[[bench]]
4747
name = "benchmark"

build.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ fn main() {
3030
#[cfg(feature = "phf")]
3131
build_forward_map(&mut outfile);
3232

33-
#[cfg(feature = "rev-mappings")]
33+
#[cfg(feature = "rev-map")]
3434
build_rev_map(&mut outfile);
3535
}
3636

@@ -71,7 +71,7 @@ fn build_forward_map<W: Write>(out: &mut W) {
7171
}
7272

7373
// Build reverse mappings (mime type -> ext)
74-
#[cfg(all(feature = "phf", feature = "rev-mappings"))]
74+
#[cfg(all(feature = "phf", feature = "rev-map"))]
7575
fn build_rev_map<W: Write>(out: &mut W) {
7676
use phf_codegen::Map as PhfMap;
7777

@@ -114,7 +114,7 @@ fn build_rev_map<W: Write>(out: &mut W) {
114114
writeln!(out, "const EXTS: &'static [&'static str] = &{:?};", exts).unwrap();
115115
}
116116

117-
#[cfg(all(not(feature = "phf"), feature = "rev-mappings"))]
117+
#[cfg(all(not(feature = "phf"), feature = "rev-map"))]
118118
fn build_rev_map<W: Write>(out: &mut W) {
119119
use std::fmt::Write as _;
120120

@@ -166,7 +166,7 @@ fn build_rev_map<W: Write>(out: &mut W) {
166166
writeln!(out, "const EXTS: &'static [&'static str] = &{:?};", exts).unwrap();
167167
}
168168

169-
#[cfg(feature = "rev-mappings")]
169+
#[cfg(feature = "rev-map")]
170170
fn get_rev_mappings(
171171
) -> BTreeMap<UniCase<&'static str>, BTreeMap<UniCase<&'static str>, Vec<&'static str>>> {
172172
// First, collect all the mime type -> ext mappings)

src/impl_bin_search.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use unicase::UniCase;
33
include!("mime_types.rs");
44
include!(env!("MIME_TYPES_GENERATED_PATH"));
55

6-
#[cfg(feature = "rev-mappings")]
6+
#[cfg(feature = "rev-map")]
77
#[derive(Copy, Clone)]
88
struct TopLevelExts {
99
start: usize,
@@ -17,7 +17,7 @@ pub fn get_mime_types(ext: &str) -> Option<&'static [&'static str]> {
1717
map_lookup(MIME_TYPES, &ext)
1818
}
1919

20-
#[cfg(feature = "rev-mappings")]
20+
#[cfg(feature = "rev-map")]
2121
pub fn get_extensions(toplevel: &str, sublevel: &str) -> Option<&'static [&'static str]> {
2222
if toplevel == "*" {
2323
return Some(EXTS);

src/impl_phf.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use unicase::UniCase;
44

55
include!(env!("MIME_TYPES_GENERATED_PATH"));
66

7-
#[cfg(feature = "rev-mappings")]
7+
#[cfg(feature = "rev-map")]
88
struct TopLevelExts {
99
start: usize,
1010
end: usize,

src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ pub fn get_mime_type_str(search_ext: &str) -> Option<&'static str> {
374374
/// If the top-level of the MIME type is a wildcard (`*`), returns all extensions.
375375
///
376376
/// If the sub-level of the MIME type is a wildcard, returns all extensions for the top-level.
377-
#[cfg(feature = "rev-mappings")]
377+
#[cfg(feature = "rev-map")]
378378
pub fn get_mime_extensions(mime: &Mime) -> Option<&'static [&'static str]> {
379379
get_extensions(mime.type_().as_ref(), mime.subtype().as_ref())
380380
}
@@ -392,7 +392,7 @@ pub fn get_mime_extensions(mime: &Mime) -> Option<&'static [&'static str]> {
392392
///
393393
/// ### Panics
394394
/// If `mime_str` is not a valid MIME type specifier (naive).
395-
#[cfg(feature = "rev-mappings")]
395+
#[cfg(feature = "rev-map")]
396396
pub fn get_mime_extensions_str(mut mime_str: &str) -> Option<&'static [&'static str]> {
397397
mime_str = mime_str.trim();
398398

@@ -417,7 +417,7 @@ pub fn get_mime_extensions_str(mut mime_str: &str) -> Option<&'static [&'static
417417
/// If the top-level of the MIME type is a wildcard (`*`), returns all extensions.
418418
///
419419
/// If the sub-level of the MIME type is a wildcard, returns all extensions for the top-level.
420-
#[cfg(feature = "rev-mappings")]
420+
#[cfg(feature = "rev-map")]
421421
pub fn get_extensions(toplevel: &str, sublevel: &str) -> Option<&'static [&'static str]> {
422422
impl_::get_extensions(toplevel, sublevel)
423423
}

0 commit comments

Comments
 (0)