Skip to content
This repository has been archived by the owner on Aug 6, 2023. It is now read-only.

Commit

Permalink
feat(Text): Add a From<Cow<str>> impl for Text
Browse files Browse the repository at this point in the history
  • Loading branch information
eminence authored and fdehau committed May 22, 2021
1 parent 975c416 commit 703e41c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,12 @@ impl<'a> From<&'a str> for Text<'a> {
}
}

impl<'a> From<Cow<'a, str>> for Text<'a> {
fn from(s: Cow<'a, str>) -> Text<'a> {
Text::raw(s)
}
}

impl<'a> From<Span<'a>> for Text<'a> {
fn from(span: Span<'a>) -> Text<'a> {
Text {
Expand Down

0 comments on commit 703e41c

Please sign in to comment.