Skip to content

Commit 863f174

Browse files
committed
Revert changes on NodeSeq because I'm not sure it's useful at all
1 parent ada85f4 commit 863f174

1 file changed

Lines changed: 12 additions & 40 deletions

File tree

packages/yew/src/utils/mod.rs

Lines changed: 12 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
33
use std::marker::PhantomData;
44

5-
use implicit_clone::unsync::IArray;
6-
use implicit_clone::ImplicitClone;
75
use yew::html::ChildrenRenderer;
86

97
/// Map `IntoIterator<Item = Into<T>>` to `Iterator<Item = T>`
@@ -17,64 +15,38 @@ where
1715

1816
/// A special type necessary for flattening components returned from nested html macros.
1917
#[derive(Debug)]
20-
pub struct NodeSeq<IN, OUT: ImplicitClone + 'static>(IArray<OUT>, PhantomData<IN>);
18+
pub struct NodeSeq<IN, OUT>(Vec<OUT>, PhantomData<IN>);
2119

22-
impl<IN: Into<OUT>, OUT: ImplicitClone + 'static> From<IN> for NodeSeq<IN, OUT> {
20+
impl<IN: Into<OUT>, OUT> From<IN> for NodeSeq<IN, OUT> {
2321
fn from(val: IN) -> Self {
24-
Self(IArray::Single([val.into()]), PhantomData)
22+
Self(vec![val.into()], PhantomData)
2523
}
2624
}
2725

28-
impl<IN: Into<OUT>, OUT: ImplicitClone + 'static> From<Option<IN>> for NodeSeq<IN, OUT> {
26+
impl<IN: Into<OUT>, OUT> From<Option<IN>> for NodeSeq<IN, OUT> {
2927
fn from(val: Option<IN>) -> Self {
30-
Self(
31-
val.map(|s| IArray::Single([s.into()])).unwrap_or_default(),
32-
PhantomData,
33-
)
28+
Self(val.map(|s| vec![s.into()]).unwrap_or_default(), PhantomData)
3429
}
3530
}
3631

37-
impl<IN: Into<OUT>, OUT: ImplicitClone + 'static> From<Vec<IN>> for NodeSeq<IN, OUT> {
38-
fn from(mut val: Vec<IN>) -> Self {
39-
if val.len() == 1 {
40-
let item = val.pop().unwrap();
41-
Self(IArray::Single([item.into()]), PhantomData)
42-
} else {
43-
Self(val.into_iter().map(|x| x.into()).collect(), PhantomData)
44-
}
32+
impl<IN: Into<OUT>, OUT> From<Vec<IN>> for NodeSeq<IN, OUT> {
33+
fn from(val: Vec<IN>) -> Self {
34+
Self(val.into_iter().map(|x| x.into()).collect(), PhantomData)
4535
}
4636
}
4737

48-
impl<IN: Into<OUT> + ImplicitClone, OUT: ImplicitClone + 'static> From<IArray<IN>>
49-
for NodeSeq<IN, OUT>
50-
{
51-
fn from(val: IArray<IN>) -> Self {
52-
Self(val.iter().map(|x| x.into()).collect(), PhantomData)
53-
}
54-
}
55-
56-
impl<IN: Into<OUT> + ImplicitClone, OUT: ImplicitClone + 'static> From<&IArray<IN>>
57-
for NodeSeq<IN, OUT>
58-
{
59-
fn from(val: &IArray<IN>) -> Self {
60-
Self(val.iter().map(|x| x.into()).collect(), PhantomData)
61-
}
62-
}
63-
64-
impl<IN: Into<OUT> + Clone, OUT: ImplicitClone + 'static> From<&ChildrenRenderer<IN>>
65-
for NodeSeq<IN, OUT>
66-
{
38+
impl<IN: Into<OUT> + Clone, OUT> From<&ChildrenRenderer<IN>> for NodeSeq<IN, OUT> {
6739
fn from(val: &ChildrenRenderer<IN>) -> Self {
6840
Self(val.iter().map(|x| x.into()).collect(), PhantomData)
6941
}
7042
}
7143

72-
impl<IN, OUT: ImplicitClone + 'static> IntoIterator for NodeSeq<IN, OUT> {
73-
type IntoIter = implicit_clone::unsync::Iter<Self::Item>;
44+
impl<IN, OUT> IntoIterator for NodeSeq<IN, OUT> {
45+
type IntoIter = std::vec::IntoIter<Self::Item>;
7446
type Item = OUT;
7547

7648
fn into_iter(self) -> Self::IntoIter {
77-
self.0.iter()
49+
self.0.into_iter()
7850
}
7951
}
8052

0 commit comments

Comments
 (0)