From 07c8e8e95a9dba84b64bf943c004da51e0acae0d Mon Sep 17 00:00:00 2001 From: Danik Vitek Date: Wed, 29 Jan 2025 21:14:58 +0200 Subject: [PATCH] fix: `impl<'a> From for Cow<'a, AsciiStr>` Fixes #110 Modify the implementation of `From` for `Cow<'a, AsciiStr>`. * Change `impl From for Cow<'static, AsciiStr>` to `impl<'a> From for Cow<'a, AsciiStr>` in `src/ascii_string.rs` * Broaden the conversion abilities by making it generic over any lifetime `'a` --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/tomprogrammer/rust-ascii/issues/110?shareId=XXXX-XXXX-XXXX-XXXX). --- src/ascii_string.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ascii_string.rs b/src/ascii_string.rs index b6d2b0b..dbefa76 100644 --- a/src/ascii_string.rs +++ b/src/ascii_string.rs @@ -579,8 +579,8 @@ impl<'a> From> for AsciiString { } } -impl From for Cow<'static, AsciiStr> { - fn from(string: AsciiString) -> Cow<'static, AsciiStr> { +impl<'a> From for Cow<'a, AsciiStr> { + fn from(string: AsciiString) -> Cow<'a, AsciiStr> { Cow::Owned(string) } }