Skip to content

Commit

Permalink
feat: add From<String> for ColoredString (#126)
Browse files Browse the repository at this point in the history
  • Loading branch information
mahor1221 committed Dec 5, 2023
1 parent b391ff0 commit af53167
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,15 @@ impl Deref for ColoredString {
}
}

impl From<String> for ColoredString {
fn from(s: String) -> Self {
ColoredString {
input: s,
..ColoredString::default()
}
}
}

impl<'a> From<&'a str> for ColoredString {
fn from(s: &'a str) -> Self {
ColoredString {
Expand Down

0 comments on commit af53167

Please sign in to comment.