Skip to content

Commit

Permalink
reorder statics and lazy's
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-ha458 committed Nov 23, 2023
1 parent a0dcb19 commit 8950d77
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ use encoding::all::encodings;
use once_cell::sync::Lazy;
use regex::Regex;

pub static TOO_BIG_SEQUENCE: usize = 1_000_000; // 10E6
pub(crate) static MAX_PROCESSED_BYTES: usize = 500_000;
pub(crate) static TOO_SMALL_SEQUENCE: usize = 32;
pub(crate) static UTF8_MAXIMAL_ALLOCATION: usize = 1_112_064;
pub(crate) static COMMON_SAFE_ASCII_CHARACTERS: &'static str = "<>=:/&;{}[],|\"-";

// Contain for each eligible encoding a list of/item bytes SIG/BOM
pub(crate) static ENCODING_MARKS: Lazy<HashMap<&'static str, &'static [u8]>> = Lazy::new(|| {
HashMap::from_iter([
Expand All @@ -14,11 +20,6 @@ pub(crate) static ENCODING_MARKS: Lazy<HashMap<&'static str, &'static [u8]>> = L
])
});

pub static TOO_BIG_SEQUENCE: usize = 1_000_000; // 10E6
pub(crate) static MAX_PROCESSED_BYTES: usize = 500_000;
pub(crate) static TOO_SMALL_SEQUENCE: usize = 32;
pub(crate) static UTF8_MAXIMAL_ALLOCATION: usize = 1_112_064;

pub(crate) static UNICODE_RANGES_COMBINED: Lazy<[(&'static str, RangeInclusive<u32>); 279]> =
Lazy::new(|| {
[
Expand Down Expand Up @@ -327,8 +328,6 @@ pub(crate) static UNICODE_SECONDARY_RANGE_KEYWORD: Lazy<HashSet<&'static str>> =
])
});

pub(crate) static COMMON_SAFE_ASCII_CHARACTERS: &'static str = "<>=:/&;{}[],|\"-";

pub(crate) static RE_POSSIBLE_ENCODING_INDICATION: Lazy<Regex> = Lazy::new(|| {
Regex::new(
r#"(?:(?:encoding)|(?:charset)|(?:coding))(?:[\:= ]{1,10})(?:["']?)([a-zA-Z0-9\-_]+)(?:["']?)"#
Expand Down

0 comments on commit 8950d77

Please sign in to comment.