Skip to content

Commit

Permalink
#: Modify AnimalEnum
Browse files Browse the repository at this point in the history
  • Loading branch information
zdu-strong committed Jan 29, 2025
1 parent 8919e3f commit d51474d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion rust/src/action/show_animal/print_all_animal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub async fn print_all_animal() {
println!(
"dog to string: {}, string to dog: {}",
AnimalEnum::Dog.as_ref(),
("1".parse::<AnimalEnum>().unwrap()).as_ref()
("DOG".parse::<AnimalEnum>().unwrap()).as_ref()
);
println!(
"{} is {} year{} old",
Expand Down
4 changes: 2 additions & 2 deletions rust/src/enumable/animal_enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ use strum_macros::EnumString;
#[derive(Debug, Clone, Serialize, Deserialize, EnumIter, EnumString, AsRefStr)]
#[serde(rename_all = "camelCase")]
pub enum AnimalEnum {
#[strum(serialize = "1")]
#[strum(serialize = "TIGER")]
Tiger,

#[strum(serialize = "2")]
#[strum(serialize = "DOG")]
Dog,
}

Expand Down

0 comments on commit d51474d

Please sign in to comment.