Skip to content

Commit

Permalink
fix selector type deserialize
Browse files Browse the repository at this point in the history
  • Loading branch information
niebayes committed Dec 26, 2023
1 parent e64c12d commit 4df0d4f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/meta-srv/src/selector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ impl Default for SelectorOptions {
}

#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, Default)]
#[serde(rename_all = "snake_case")]
#[serde(try_from = "String")]
pub enum SelectorType {
#[default]
LoadBased,
Expand All @@ -78,6 +78,14 @@ impl TryFrom<&str> for SelectorType {
}
}

impl TryFrom<String> for SelectorType {
type Error = error::Error;

fn try_from(value: String) -> Result<Self> {
SelectorType::try_from(value.as_str())
}
}

#[cfg(test)]
mod tests {
use super::SelectorType;
Expand Down

0 comments on commit 4df0d4f

Please sign in to comment.