Use std HashMap to simplify API

This commit is contained in:
Dirkjan Ochtman 2021-02-04 10:16:38 +01:00
parent c1068c2e53
commit 970caeba44
1 changed files with 3 additions and 2 deletions

View File

@ -1,7 +1,6 @@
use std::ops::{Index, Range}; use std::ops::{Index, Range};
use std::str; use std::str;
use ahash::AHashMap as HashMap;
use smartstring::alias::String; use smartstring::alias::String;
#[cfg(feature = "__test_data")] #[cfg(feature = "__test_data")]
@ -86,7 +85,7 @@ impl<'a> SegmentState<'a> {
Self { Self {
data, data,
text, text,
memo: HashMap::new(), memo: HashMap::default(),
split_cache: Vec::new(), split_cache: Vec::new(),
result, result,
best: vec![vec![]; SEGMENT_SIZE], best: vec![vec![]; SEGMENT_SIZE],
@ -186,6 +185,8 @@ impl Index<Range<usize>> for Ascii {
} }
} }
type HashMap<K, V> = std::collections::HashMap<K, V, ahash::RandomState>;
const DEFAULT_LIMIT: usize = 24; const DEFAULT_LIMIT: usize = 24;
const DEFAULT_TOTAL: f64 = 1_024_908_267_229.0; const DEFAULT_TOTAL: f64 = 1_024_908_267_229.0;
const SEGMENT_SIZE: usize = 250; const SEGMENT_SIZE: usize = 250;