| 1 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/; |
| 2 | |
| 3 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:)] |
| 4 | pub enum Staterust-analyzer cargo process_alive 0.2.0 state/State# { |
| 5 | Aliverust-analyzer cargo process_alive 0.2.0 state/State#Alive#, |
| 6 | Deadrust-analyzer cargo process_alive 0.2.0 state/State#Dead#, |
| 7 | Unknownrust-analyzer cargo process_alive 0.2.0 state/State#Unknown#, |
| 8 | } |
| 9 | |
| 10 | impl Staterust-analyzer cargo process_alive 0.2.0 state/State# { |
| 11 | pub fn is_aliverust-analyzer cargo process_alive 0.2.0 state/impl#[State]is_alive().(&self) -> bool { |
| 12 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self rust-analyzer cargo process_alive 0.2.0 state/impl#[State][`PartialEq<Self>`]eq().==rust-analyzer cargo process_alive 0.2.0 state/impl#[State][`PartialEq<Self>`]eq(). rust-analyzer cargo process_alive 0.2.0 state/impl#[State][`PartialEq<Self>`]eq().Selfrust-analyzer cargo process_alive 0.2.0 state/impl#[State]::Aliverust-analyzer cargo process_alive 0.2.0 state/State#Alive# |
| 13 | } |
| 14 | } |
| 15 | |
| 16 | impl fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for Staterust-analyzer cargo process_alive 0.2.0 state/State# { |
| 17 | fn fmtrust-analyzer cargo process_alive 0.2.0 state/impl#[State][Display]fmt().(&self, f: &mut fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 18 | let s = match self { |
| 19 | Selfrust-analyzer cargo process_alive 0.2.0 state/impl#[State][Display]::Aliverust-analyzer cargo process_alive 0.2.0 state/State#Alive# => "alive", |
| 20 | Selfrust-analyzer cargo process_alive 0.2.0 state/impl#[State][Display]::Deadrust-analyzer cargo process_alive 0.2.0 state/State#Dead# => "dead", |
| 21 | Selfrust-analyzer cargo process_alive 0.2.0 state/impl#[State][Display]::Unknownrust-analyzer cargo process_alive 0.2.0 state/State#Unknown# => "unknown", |
| 22 | }; |
| 23 | writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "{}", s) |
| 24 | } |
| 25 | } |