rust_anilist/models/
status.rs1use serde::{Deserialize, Serialize};
7
8#[derive(Debug, Default, Clone, Eq, Hash, PartialEq, Deserialize, Serialize)]
10#[serde(rename_all(deserialize = "SCREAMING_SNAKE_CASE"))]
11pub enum Status {
12 Finished,
14 Releasing,
16 #[default]
18 NotYetReleased,
19 Cancelled,
21 Hiatus,
23 Current,
25 Planning,
27 Completed,
29 Dropped,
31 Paused,
33 Repeating,
35}
36
37impl Status {
38 pub fn summary(&self) -> &str {
40 match self {
41 Status::Finished => "Has completed and is no longer being updated.",
42 Status::Releasing => "Currently releasing.",
43 Status::NotYetReleased => "To be released in the future.",
44 Status::Cancelled => "Ended before the work could be completed.",
45 Status::Hiatus => "Currently paused with the intention of resuming in the future.",
46 Status::Current => "Currently being updated.",
47 Status::Planning => "Planned for future release.",
48 Status::Completed => "Has completed and is no longer being updated.",
49 Status::Dropped => {
50 "No longer being updated due to a lack of interest or other reasons."
51 }
52 Status::Paused => "Currently paused.",
53 Status::Repeating => "Repeating the same content.",
54 }
55 }
56}
57
58impl std::fmt::Display for Status {
59 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
60 match self {
61 Status::Finished => write!(f, "Finished"),
62 Status::Releasing => write!(f, "Releasing"),
63 Status::NotYetReleased => write!(f, "Not Yet Released"),
64 Status::Cancelled => write!(f, "Cancelled"),
65 Status::Hiatus => write!(f, "Hiatus"),
66 Status::Current => write!(f, "Current"),
67 Status::Planning => write!(f, "Planning"),
68 Status::Completed => write!(f, "Completed"),
69 Status::Dropped => write!(f, "Dropped"),
70 Status::Paused => write!(f, "Paused"),
71 Status::Repeating => write!(f, "Repeating"),
72 }
73 }
74}