Skip to content

Commit 92bb6d5

Browse files
committed
fixup: IdStrategy from &str instead of String
1 parent 889a2a4 commit 92bb6d5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/store.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1862,7 +1862,7 @@ pub enum IdStrategy {
18621862
AddRandomSuffix,
18631863
/// The new ID is formed by adding a static prefix to the old ID
18641864
AddPrefix(String),
1865-
/// The new ID is formed by adding or incrementing a version suffix (v1,v2,v3) to the old ID
1865+
/// The new ID is formed by adding or incrementing a version suffix (v1,v2,v3,etc) to the old ID
18661866
UpdateVersion,
18671867
/// The new ID is formed by simply replacing the old ID with a static new one
18681868
Replace(String),
@@ -1906,9 +1906,9 @@ pub fn regenerate_id<'a>(id: &'a str, strategy: &'a IdStrategy) -> String {
19061906
}
19071907
}
19081908

1909-
impl TryFrom<String> for IdStrategy {
1909+
impl TryFrom<&str> for IdStrategy {
19101910
type Error = StamError;
1911-
fn try_from(value: String) -> Result<Self, Self::Error> {
1911+
fn try_from(value: &str) -> Result<Self, Self::Error> {
19121912
if let Some(pos) = value.find("=") {
19131913
let strategy = &value[0..pos - 1];
19141914
if pos + 1 >= value.len() {
@@ -1936,7 +1936,7 @@ impl TryFrom<String> for IdStrategy {
19361936
}
19371937
}
19381938
} else {
1939-
match value.as_str() {
1939+
match value {
19401940
"version" | "updateversion" => Ok(Self::UpdateVersion),
19411941
"random" | "randomsuffix" => Ok(Self::AddRandomSuffix),
19421942
_ => Err(StamError::DeserializationError(format!(

0 commit comments

Comments
 (0)