Skip to content

Commit fa3a8db

Browse files
committed
docs: move constructors back to top of rustdoc pages
1 parent 8ce20fe commit fa3a8db

File tree

2 files changed

+22
-20
lines changed

2 files changed

+22
-20
lines changed

src/futures/write/generic/decoder.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,16 @@ pin_project! {
3030
}
3131
}
3232

33+
impl<W: AsyncWrite, D: Decode> Decoder<W, D> {
34+
pub fn new(writer: W, decoder: D) -> Self {
35+
Self {
36+
writer: BufWriter::new(writer),
37+
decoder,
38+
state: State::Decoding,
39+
}
40+
}
41+
}
42+
3343
impl<W, D> Decoder<W, D> {
3444
pub fn get_ref(&self) -> &W {
3545
self.writer.get_ref()
@@ -49,14 +59,6 @@ impl<W, D> Decoder<W, D> {
4959
}
5060

5161
impl<W: AsyncWrite, D: Decode> Decoder<W, D> {
52-
pub fn new(writer: W, decoder: D) -> Self {
53-
Self {
54-
writer: BufWriter::new(writer),
55-
decoder,
56-
state: State::Decoding,
57-
}
58-
}
59-
6062
fn do_poll_write(
6163
self: Pin<&mut Self>,
6264
cx: &mut Context<'_>,

src/futures/write/macros/decoder.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,18 @@ macro_rules! decoder {
1212
}
1313
}
1414

15+
impl<$inner: futures_io::AsyncWrite> $name<$inner> {
16+
/// Creates a new decoder which will take in compressed data and write it uncompressed
17+
/// to the given stream.
18+
pub fn new(read: $inner) -> $name<$inner> {
19+
$name {
20+
inner: crate::futures::write::Decoder::new(read, crate::codec::$name::new()),
21+
}
22+
}
23+
24+
$($($inherent_methods)*)*
25+
}
26+
1527
impl<$inner> $name<$inner> {
1628
/// Acquires a reference to the underlying reader that this decoder is wrapping.
1729
pub fn get_ref(&self) -> &$inner {
@@ -45,18 +57,6 @@ macro_rules! decoder {
4557
}
4658
}
4759

48-
impl<$inner: futures_io::AsyncWrite> $name<$inner> {
49-
/// Creates a new decoder which will take in compressed data and write it uncompressed
50-
/// to the given stream.
51-
pub fn new(read: $inner) -> $name<$inner> {
52-
$name {
53-
inner: crate::futures::write::Decoder::new(read, crate::codec::$name::new()),
54-
}
55-
}
56-
57-
$($($inherent_methods)*)*
58-
}
59-
6060
impl<$inner: futures_io::AsyncWrite> futures_io::AsyncWrite for $name<$inner> {
6161
fn poll_write(
6262
self: std::pin::Pin<&mut Self>,

0 commit comments

Comments
 (0)