Skip to content

Commit

Permalink
impl Display for CommentType
Browse files Browse the repository at this point in the history
  • Loading branch information
datanel committed Mar 7, 2024
1 parent 24f919a commit fe9c2f7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
authors = ["Hove <core@hove.com>", "Guillaume Pinot <texitoi@texitoi.eu>"]
name = "transit_model"
version = "0.62.0"
version = "0.62.1"
license = "AGPL-3.0-only"
description = "Transit data management"
repository = "https://github.com/hove-io/transit_model"
Expand Down
14 changes: 14 additions & 0 deletions src/objects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1413,6 +1413,20 @@ pub enum CommentType {
OnDemandTransport,
}

/// ```
/// # use transit_model::objects::CommentType;
/// assert_eq!(format!("{}", CommentType::Information), "information");
/// assert_eq!(format!("{}", CommentType::OnDemandTransport), "on_demand_transport");
/// ```
impl std::fmt::Display for CommentType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match self {
CommentType::Information => write!(f, "information"),
CommentType::OnDemandTransport => write!(f, "on_demand_transport"),
}
}
}

#[derive(Default, Serialize, Deserialize, Debug, Eq, PartialEq)]
pub struct Comment {
#[serde(rename = "comment_id")]
Expand Down

0 comments on commit fe9c2f7

Please sign in to comment.