Skip to content

Commit

Permalink
use try_from for serde DraftIsoCode
Browse files Browse the repository at this point in the history
  • Loading branch information
seakayone committed Jul 26, 2024
1 parent eb9481b commit e121061
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion dsp-meta/src/domain/model/draft_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,8 @@ pub struct DraftGrant {
pub struct DraftText(HashMap<DraftIsoCode, String>);

#[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq, Hash)]
pub struct DraftIsoCode(pub String);
#[serde(try_from = "String")]
pub struct DraftIsoCode(String);
impl DraftIsoCode {
pub fn as_string(&self) -> String {
self.0.to_string()
Expand Down

0 comments on commit e121061

Please sign in to comment.