Skip to content

Commit 8c20653

Browse files
authored
Merge pull request #17 from cuviper/unsize-owned
Let Owned work with unsized items
2 parents 8e7b44a + 39e7280 commit 8c20653

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/lib.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1270,7 +1270,7 @@ pub struct Owned<I>(I);
12701270
impl<I> Iterator for Owned<I>
12711271
where
12721272
I: StreamingIterator,
1273-
I::Item: Sized + ToOwned,
1273+
I::Item: ToOwned,
12741274
{
12751275
type Item = <I::Item as ToOwned>::Owned;
12761276

@@ -1819,6 +1819,15 @@ mod test {
18191819
assert_eq!(it.collect::<Vec<_>>(), items);
18201820
}
18211821

1822+
#[test]
1823+
#[cfg(feature = "std")]
1824+
fn owned_str() {
1825+
let s = "The quick brown fox jumps over the lazy dog";
1826+
let words = s.split_whitespace().map(str::to_owned).collect::<Vec<_>>();
1827+
let it = convert_ref(s.split_whitespace()).owned();
1828+
assert_eq!(it.collect::<Vec<_>>(), words);
1829+
}
1830+
18221831
#[test]
18231832
fn position() {
18241833
let items = [0, 1];

0 commit comments

Comments
 (0)