diff --git a/src/array.rs b/src/array.rs index 6cff1f6..346853d 100644 --- a/src/array.rs +++ b/src/array.rs @@ -259,6 +259,12 @@ impl From> for Vec { } } +impl<'a, T: Clone, LenT: ValidLength> From<&'a FixedArray> for Cow<'a, [T]> { + fn from(value: &'a FixedArray) -> Self { + Cow::Borrowed(value.as_slice()) + } +} + impl From> for Cow<'_, [T]> { fn from(value: FixedArray) -> Self { Cow::Owned(value.into_vec()) diff --git a/src/string.rs b/src/string.rs index 940fd4b..c48a1eb 100644 --- a/src/string.rs +++ b/src/string.rs @@ -288,6 +288,12 @@ impl From> for String { } } +impl<'a, LenT: ValidLength> From<&'a FixedString> for Cow<'a, str> { + fn from(value: &'a FixedString) -> Self { + Cow::Borrowed(value.as_str()) + } +} + impl From> for Cow<'_, str> { fn from(value: FixedString) -> Self { Cow::Owned(value.into_string())