-
-
Save rust-play/269d07011fa0c01a471acac65bfb1dbb to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
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
fn main() { | |
println!("Hello, world!"); | |
} | |
// rustfmt dose not work Self::LuckyCookieMonkeyMondeySunday | |
// rustfmt dose not work Self::FooBarBazHogeFugaPiyoJapan | |
impl fmt::Display for Foo { | |
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | |
match self { | |
Self::LuckyCookieMonkeyMondeySunday{position,op_code,address}=>format!("xyz xyz yes yes no no ABCDEFGHIJK abcdefghijk {} (foo bar baz {}) abcdefghijkl ({})",position,op_code,address).fmt(f), | |
Self::ThisIsAPen { ppap } => format!("{} is Password security?", ppap).fmt(f), | |
Self::FooBarBazHogeFugaPiyoJapan{position,op_code,address}=>format!("xyz xyz yes yes no no ABCDEFGHIJK abcdefghijk {} (foo bar baz {}) abcdefghijkl ({})",position,op_code,address).fmt(f), | |
Self::Season(month) => { | |
format!("This is {}. There are 4 seasons in Japan!", month).fmt(f) | |
} | |
} | |
} | |
} | |
impl fmt::Display for FooBar { | |
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | |
match self { | |
Self::ApplePieX { foo, bar } => format!("Apple {} {}", foo, bar).fmt(f), | |
Self::AccessPermissionDenied { foo, bar, baz } => { | |
format!("Cherry {}{}{} !", foo, bar, baz).fmt(f) | |
} | |
Self::MonkeyKidsX { age, country } => { | |
format!("Monkey is {} years old in {}", age, country).fmt(f) | |
} | |
Self::JapanesePeopleX { reason } => { | |
format!("Why? Japanese People? because {}", reason).fmt(f) | |
} | |
Self::ComputerScienceX { difficulty } => { | |
format!("computer science is very {}", difficulty).fmt(f) | |
} | |
Self::ThisIsAPenX { ppap } => format!("{} is Password security?", ppap).fmt(f), | |
Self::SeasonX(month) => { | |
format!("This is {}. There are 4 seasons in Japan!", month).fmt(f) | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment