Breaking change: removing some of the AsStr and MultiStr impls

This commit is contained in:
Pauan 2018-09-18 11:04:03 -10:00
parent f5b2dde273
commit 476902616d
2 changed files with 5 additions and 26 deletions

View File

@ -1089,12 +1089,12 @@ mod tests {
.style_signal("foo".to_owned(), always("bar".to_owned()))
.style(&"foo".to_owned(), &"bar".to_owned())
.style(Box::new("foo".to_owned()), Box::new("bar".to_owned()))
//.style(Box::new("foo".to_owned()), Box::new("bar".to_owned()))
//.style_signal(Box::new("foo".to_owned()), always(Box::new("bar".to_owned())))
.style_signal(&*FOO, always(&*FOO))
.style_signal(Box::new("foo".to_owned()), always(Box::new("bar".to_owned())))
.style(vec!["-moz-foo", "-webkit-foo", "foo"].as_slice(), vec!["bar"].as_slice())
//.style(vec!["-moz-foo", "-webkit-foo", "foo"].as_slice(), vec!["bar"].as_slice())
.style_signal(RefFn::new(vec!["-moz-foo", "-webkit-foo", "foo"], |x| x.as_slice()), always(RefFn::new(vec!["bar"], |x| x.as_slice())))
.style_signal(["-moz-foo", "-webkit-foo", "foo"], always("bar"))

View File

@ -28,20 +28,6 @@ impl<'a, A> AsStr for &'a A where A: AsStr {
}
}
impl<'a, A> AsStr for &'a mut A where A: AsStr {
#[inline]
fn as_str(&self) -> &str {
AsStr::as_str(*self)
}
}
impl<A> AsStr for Box<A> where A: AsStr {
#[inline]
fn as_str(&self) -> &str {
AsStr::as_str(&**self)
}
}
impl AsStr for String {
#[inline]
fn as_str(&self) -> &str {
@ -63,13 +49,6 @@ impl<'a> AsStr for &'a str {
}
}
impl<'a> AsStr for &'a mut str {
#[inline]
fn as_str(&self) -> &str {
self
}
}
impl<A, C> AsStr for RefFn<A, str, C> where C: Fn(&A) -> &str {
#[inline]
fn as_str(&self) -> &str {
@ -98,12 +77,12 @@ impl<A> MultiStr for A where A: AsStr {
}
// TODO it would be great to use IntoIterator instead, and then we can replace the array implementations with it
impl<'a, A> MultiStr for &'a [A] where A: AsStr {
/*impl<'a, A> MultiStr for &'a [A] where A: AsStr {
#[inline]
fn any<F>(&self, mut f: F) -> bool where F: FnMut(&str) -> bool {
self.iter().any(|x| f(x.as_str()))
}
}
}*/
// TODO it would be great to use IntoIterator or Iterator instead
impl<'a, A, C> MultiStr for RefFn<A, [&'a str], C> where C: Fn(&A) -> &[&'a str] {