Skip to content

Commit

Permalink
docs: move constructors back to top of rustdoc pages
Browse files Browse the repository at this point in the history
  • Loading branch information
robjtede committed Oct 13, 2024
1 parent 5f51d42 commit 97af374
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 51 deletions.
11 changes: 11 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
_list:
@just --list

# Lint workspace with Clippy.
clippy:
cargo clippy --workspace --all-targets --no-default-features
cargo clippy --workspace --all-targets --all-features

# Document crates in workspace.
doc *args:
RUSTDOCFLAGS="--cfg=docsrs -Dwarnings" cargo +nightly doc --workspace --all-features {{ args }}
20 changes: 11 additions & 9 deletions src/futures/bufread/generic/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,17 @@ pin_project! {
}
}

impl<R: AsyncBufRead, D: Decode> Decoder<R, D> {
pub fn new(reader: R, decoder: D) -> Self {
Self {
reader,
decoder,
state: State::Decoding,
multiple_members: false,
}
}
}

impl<R, D> Decoder<R, D> {
pub fn get_ref(&self) -> &R {
&self.reader
Expand All @@ -51,15 +62,6 @@ impl<R, D> Decoder<R, D> {
}

impl<R: AsyncBufRead, D: Decode> Decoder<R, D> {
pub fn new(reader: R, decoder: D) -> Self {
Self {
reader,
decoder,
state: State::Decoding,
multiple_members: false,
}
}

fn do_poll_read(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
Expand Down
18 changes: 10 additions & 8 deletions src/futures/bufread/generic/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@ pin_project! {
}
}

impl<R: AsyncBufRead, E: Encode> Encoder<R, E> {
pub fn new(reader: R, encoder: E) -> Self {
Self {
reader,
encoder,
state: State::Encoding,
}
}
}

impl<R, E> Encoder<R, E> {
pub fn get_ref(&self) -> &R {
&self.reader
Expand All @@ -49,14 +59,6 @@ impl<R, E> Encoder<R, E> {
}

impl<R: AsyncBufRead, E: Encode> Encoder<R, E> {
pub fn new(reader: R, encoder: E) -> Self {
Self {
reader,
encoder,
state: State::Encoding,
}
}

fn do_poll_read(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
Expand Down
20 changes: 11 additions & 9 deletions src/tokio/bufread/generic/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,17 @@ pin_project! {
}
}

impl<R: AsyncBufRead, D: Decode> Decoder<R, D> {
pub fn new(reader: R, decoder: D) -> Self {
Self {
reader,
decoder,
state: State::Decoding,
multiple_members: false,
}
}
}

impl<R, D> Decoder<R, D> {
pub fn get_ref(&self) -> &R {
&self.reader
Expand All @@ -51,15 +62,6 @@ impl<R, D> Decoder<R, D> {
}

impl<R: AsyncBufRead, D: Decode> Decoder<R, D> {
pub fn new(reader: R, decoder: D) -> Self {
Self {
reader,
decoder,
state: State::Decoding,
multiple_members: false,
}
}

fn do_poll_read(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
Expand Down
19 changes: 10 additions & 9 deletions src/tokio/bufread/generic/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@ pin_project! {
}
}

impl<R: AsyncBufRead, E: Encode> Encoder<R, E> {
pub fn new(reader: R, encoder: E) -> Self {
Self {
reader,
encoder,
state: State::Encoding,
}
}
}

impl<R, E> Encoder<R, E> {
pub fn get_ref(&self) -> &R {
&self.reader
Expand All @@ -47,16 +57,7 @@ impl<R, E> Encoder<R, E> {
self.reader
}
}

impl<R: AsyncBufRead, E: Encode> Encoder<R, E> {
pub fn new(reader: R, encoder: E) -> Self {
Self {
reader,
encoder,
state: State::Encoding,
}
}

fn do_poll_read(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
Expand Down
18 changes: 10 additions & 8 deletions src/tokio/write/generic/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@ pin_project! {
}
}

impl<W: AsyncWrite, D: Decode> Decoder<W, D> {
pub fn new(writer: W, decoder: D) -> Self {
Self {
writer: BufWriter::new(writer),
decoder,
state: State::Decoding,
}
}
}

impl<W, D> Decoder<W, D> {
pub fn get_ref(&self) -> &W {
self.writer.get_ref()
Expand All @@ -49,14 +59,6 @@ impl<W, D> Decoder<W, D> {
}

impl<W: AsyncWrite, D: Decode> Decoder<W, D> {
pub fn new(writer: W, decoder: D) -> Self {
Self {
writer: BufWriter::new(writer),
decoder,
state: State::Decoding,
}
}

fn do_poll_write(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
Expand Down
18 changes: 10 additions & 8 deletions src/tokio/write/generic/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@ pin_project! {
}
}

impl<W: AsyncWrite, E: Encode> Encoder<W, E> {
pub fn new(writer: W, encoder: E) -> Self {
Self {
writer: BufWriter::new(writer),
encoder,
state: State::Encoding,
}
}
}

impl<W, E> Encoder<W, E> {
pub fn get_ref(&self) -> &W {
self.writer.get_ref()
Expand All @@ -53,14 +63,6 @@ impl<W, E> Encoder<W, E> {
}

impl<W: AsyncWrite, E: Encode> Encoder<W, E> {
pub fn new(writer: W, encoder: E) -> Self {
Self {
writer: BufWriter::new(writer),
encoder,
state: State::Encoding,
}
}

fn do_poll_write(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
Expand Down

0 comments on commit 97af374

Please sign in to comment.