diff --git a/src/traits.rs b/src/traits.rs index 9f6e60d..27cac99 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -60,66 +60,6 @@ impl IntoStr for DerefFn where B: Fn(&A) -> &str { } -/*pub trait DerefStr { - type Output: Deref; - - fn deref_str(&self) -> Self::Output; -} - -impl DerefStr for String { - type Output = Self; - - #[inline] - fn deref_str(&self) -> Self::Output { - self - } -} - -impl<'a> DerefStr for &'a str { - type Output = &'a str; - - #[inline] - fn deref_str(&self) -> Self::Output { - self - } -} - -impl DerefStr for DerefFn where B: Fn(&A) -> &str { - type Output = Self; - - #[inline] - fn deref_str(&self) -> Self::Output { - self - } -} - - -pub trait DerefOptionStr { - type Output: Deref; - - fn deref_option_str(&self) -> Option; -} - -impl DerefOptionStr for A { - type Output = A::Output; - - #[inline] - fn deref_option_str(&self) -> Option { - Some(self.deref_str()) - } -} - -impl DerefOptionStr for Option { - type Output = A::Output; - - #[inline] - fn deref_option_str(&self) -> Option { - self.map(|x| x.deref_str()) - } -}*/ - - - // TODO figure out a way to implement this for all of AsRef / Borrow / etc. pub trait IntoOptionStr { type Output: Deref; @@ -144,31 +84,3 @@ impl IntoOptionStr for Option { self.map(|x| x.into_str()) } } - -/*impl AsOptionStr for Box> { - #[inline] - fn as_option_str(&self) -> Option<&str> { - (**self).as_option_str() - } -} - -impl AsOptionStr for Arc> { - #[inline] - fn as_option_str(&self) -> Option<&str> { - (**self).as_option_str() - } -} - -impl AsOptionStr for Rc> { - #[inline] - fn as_option_str(&self) -> Option<&str> { - (**self).as_option_str() - } -} - -impl<'a, A: AsStr + Clone> AsOptionStr for Cow<'a, Option> { - #[inline] - fn as_option_str(&self) -> Option<&str> { - (**self).as_option_str() - } -}*/