Skip to content

Commit b814916

Browse files
committed
fix code style and doc
1 parent c82ffd0 commit b814916

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

src/stream/stream/mod.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -287,10 +287,7 @@ extension_trait! {
287287
where
288288
Self: Sized,
289289
{
290-
Take {
291-
stream: self,
292-
remaining: n,
293-
}
290+
Take::new(self, n)
294291
}
295292

296293
#[doc = r#"
@@ -1454,7 +1451,7 @@ extension_trait! {
14541451
assert_eq!(sum, 6);
14551452
14561453
// if we try to use stream again, it won't work. The following line
1457-
// gives "error: use of moved value: `stream`
1454+
// gives error: use of moved value: `stream`
14581455
// assert_eq!(stream.next(), None);
14591456
14601457
// let's try that again

src/stream/stream/take.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@ pin_project! {
2121
}
2222
}
2323

24+
impl<S> Take<S> {
25+
pub(super) fn new(stream: S, remaining: usize) -> Self {
26+
Self {
27+
stream,
28+
remaining,
29+
}
30+
}
31+
}
32+
2433
impl<S: Stream> Stream for Take<S> {
2534
type Item = S::Item;
2635

0 commit comments

Comments
 (0)