From af53167c4a77a5777aa04ed2df40a19859a42060 Mon Sep 17 00:00:00 2001 From: Mahor Foruzesh Date: Tue, 5 Dec 2023 01:40:42 +0000 Subject: [PATCH] feat: add From for ColoredString (#126) --- src/lib.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 71e042b..54b234f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -479,6 +479,15 @@ impl Deref for ColoredString { } } +impl From 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 {