Skip to content

Commit

Permalink
Derive Display for CompactStrCow
Browse files Browse the repository at this point in the history
  • Loading branch information
eminence authored and sharkdp committed Jan 12, 2025
1 parent 9f419b8 commit aa96754
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions numbat/src/markup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ pub enum CompactStrCow {
Static(&'static str),
}

impl std::fmt::Display for CompactStrCow {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match self {
CompactStrCow::Owned(s) => write!(f, "{s}"),
CompactStrCow::Static(s) => write!(f, "{s}"),
}
}
}

impl From<CompactStrCow> for CompactString {
fn from(value: CompactStrCow) -> Self {
match value {
Expand Down

0 comments on commit aa96754

Please sign in to comment.