-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: delete enum, add nameless-gangster
- Loading branch information
Showing
1 changed file
with
4 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 => "타짜" | ||
}) | ||
} |