diff --git a/src/strings/capped.rs b/src/strings/capped.rs index 25bf6cc..fc06a18 100644 --- a/src/strings/capped.rs +++ b/src/strings/capped.rs @@ -199,6 +199,16 @@ impl TryFrom for CappedString { } } +#[cfg(feature = "alloc")] +impl TryFrom> for CappedString { + type Error = Error; + + #[inline] + fn try_from(s: Box) -> Result { + Self::new(&s) + } +} + #[cfg(feature = "alloc")] impl<'a, const N: usize> TryFrom> for CappedString { type Error = Error; @@ -217,6 +227,14 @@ impl From> for String { } } +#[cfg(feature = "alloc")] +impl From> for Box { + #[inline] + fn from(s: CappedString) -> Self { + s.into_boxed_str() + } +} + impl PartialEq> for CappedString { #[inline] fn eq(&self, other: &CappedString) -> bool {