Re-enabling the slice impls for MultiStr

This commit is contained in:
Pauan 2018-09-18 00:50:07 -10:00
parent 84c38d02a7
commit f5b2dde273
2 changed files with 9 additions and 8 deletions

View File

@ -1094,9 +1094,8 @@ mod tests {
.style_signal(&*FOO, always(&*FOO))
.style_signal(Box::new("foo".to_owned()), always(Box::new("bar".to_owned())))
//.style_signal(vec!["-moz-foo", "-webkit-foo", "foo"].as_slice(), always("bar"))
//.style_signal(vec!["-moz-foo", "-webkit-foo", "foo"].as_slice(), always("bar".to_owned()))
//.style_signal(vec!["-moz-foo", "-webkit-foo", "foo"].as_slice(), always("bar".to_owned()).map(|x| RefFn::new(x, |x| x.as_str())))
.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"))
.style_signal(["-moz-foo", "-webkit-foo", "foo"], always("bar".to_owned()))
@ -1104,7 +1103,9 @@ mod tests {
.style_signal(["-moz-foo", "-webkit-foo", "foo"], always(["bar", "qux"]))
.style_signal(["-moz-foo", "-webkit-foo", "foo"], always(["bar".to_owned(), "qux".to_owned()]))
//.style_signal(["-moz-foo", "-webkit-foo", "foo"], always(("bar".to_owned(), "qux".to_owned())).map(|x| RefFn::new(x, |x| [x.0.as_str(), x.1.as_str()])))
//.style_signal(["-moz-foo", "-webkit-foo", "foo"], always(AsSlice::new(["foo", "bar"])))
//.style_signal(["-moz-foo", "-webkit-foo", "foo"], always(("bar".to_owned(), "qux".to_owned())).map(|x| RefFn::new(x, |x| AsSlice::new([x.0.as_str(), x.1.as_str()]))))
.style_signal("foo", always(Some("bar")))
.style_signal("foo", always(Some("bar".to_owned())))

View File

@ -98,20 +98,20 @@ 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] {
impl<'a, A, C> MultiStr for RefFn<A, [&'a str], C> where C: Fn(&A) -> &[&'a str] {
#[inline]
fn any<F>(&self, mut f: F) -> bool where F: FnMut(&str) -> bool {
self.call_ref().iter().any(|x| f(x))
}
}*/
}
macro_rules! array_multi_str {
($size:expr) => {