Skip to content

Commit

Permalink
refactor: delete enum, add nameless-gangster
Browse files Browse the repository at this point in the history
  • Loading branch information
GHGHGHKO committed Apr 7, 2024
1 parent 828da93 commit 19e0726
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions src/movie_enum.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
pub enum Movies {
NewWorld,
TheWarOfFlower,
}

pub fn str_to_movie(name: String) -> Result<&'static str, &'static str> {
let movie = match name.as_str() {
"new-world" => Movies::NewWorld,
"the-war-of-flower" => Movies::TheWarOfFlower,
Ok(match name.as_str() {
"new-world" => "신세계",
"the-war-of-flower" => "타짜",
"nameless-gangster" => "범죄와의 전쟁",
_ => return Err("404 Not Found: Unknown movie title"),
};

Ok(match movie {
Movies::NewWorld => "신세계",
Movies::TheWarOfFlower => "타짜"
})
}

0 comments on commit 19e0726

Please sign in to comment.