diff --git a/foyer-storage/src/store.rs b/foyer-storage/src/store.rs index c045d6d0..aa364e7b 100644 --- a/foyer-storage/src/store.rs +++ b/foyer-storage/src/store.rs @@ -316,8 +316,7 @@ impl FromStr for Engine { type Err = String; fn from_str(s: &str) -> std::result::Result { - const MIXED_PREFIX: &str = "mixed("; - const MIXED_SUFFIX: &str = ")"; + const MIXED_PREFIX: &str = "mixed="; match s { "large" => return Ok(Engine::Large), @@ -325,8 +324,8 @@ impl FromStr for Engine { _ => {} } - if s.starts_with(MIXED_PREFIX) && s.ends_with(MIXED_SUFFIX) { - if let Ok(ratio) = s[MIXED_PREFIX.len()..s.len() - MIXED_SUFFIX.len()].parse::() { + if s.starts_with(MIXED_PREFIX) { + if let Ok(ratio) = s[MIXED_PREFIX.len()..s.len()].parse::() { return Ok(Engine::Mixed(ratio)); } }