Skip to content

Commit d9f1c71

Browse files
authored
misc/multistream-select: Cleanup trait bounds and remove unused file (#2067)
* misc/multistream-select: Remove unused file error.rs * misc/multistream-select: Remove unnecessary trait bounds
1 parent 0b7ee3f commit d9f1c71

File tree

3 files changed

+6
-59
lines changed

3 files changed

+6
-59
lines changed

misc/multistream-select/src/dialer_select.rs

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -128,23 +128,14 @@ where
128128
/// A `Future` returned by [`dialer_select_proto_serial`] which negotiates
129129
/// a protocol iteratively by considering one protocol after the other.
130130
#[pin_project::pin_project]
131-
pub struct DialerSelectSeq<R, I>
132-
where
133-
R: AsyncRead + AsyncWrite,
134-
I: Iterator,
135-
I::Item: AsRef<[u8]>
136-
{
131+
pub struct DialerSelectSeq<R, I: Iterator> {
137132
// TODO: It would be nice if eventually N = I::Item = Protocol.
138133
protocols: iter::Peekable<I>,
139134
state: SeqState<R, I::Item>,
140135
version: Version,
141136
}
142137

143-
enum SeqState<R, N>
144-
where
145-
R: AsyncRead + AsyncWrite,
146-
N: AsRef<[u8]>
147-
{
138+
enum SeqState<R, N> {
148139
SendHeader { io: MessageIO<R>, },
149140
SendProtocol { io: MessageIO<R>, protocol: N },
150141
FlushProtocol { io: MessageIO<R>, protocol: N },
@@ -274,22 +265,13 @@ where
274265
/// a protocol selectively by considering all supported protocols of the remote
275266
/// "in parallel".
276267
#[pin_project::pin_project]
277-
pub struct DialerSelectPar<R, I>
278-
where
279-
R: AsyncRead + AsyncWrite,
280-
I: Iterator,
281-
I::Item: AsRef<[u8]>
282-
{
268+
pub struct DialerSelectPar<R, I: Iterator> {
283269
protocols: I,
284270
state: ParState<R, I::Item>,
285271
version: Version,
286272
}
287273

288-
enum ParState<R, N>
289-
where
290-
R: AsyncRead + AsyncWrite,
291-
N: AsRef<[u8]>
292-
{
274+
enum ParState<R, N> {
293275
SendHeader { io: MessageIO<R> },
294276
SendProtocolsRequest { io: MessageIO<R> },
295277
Flush { io: MessageIO<R> },

misc/multistream-select/src/error.rs

Lines changed: 0 additions & 27 deletions
This file was deleted.

misc/multistream-select/src/listener_select.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,7 @@ where
6565
/// The `Future` returned by [`listener_select_proto`] that performs a
6666
/// multistream-select protocol negotiation on an underlying I/O stream.
6767
#[pin_project::pin_project]
68-
pub struct ListenerSelectFuture<R, N>
69-
where
70-
R: AsyncRead + AsyncWrite,
71-
N: AsRef<[u8]>
72-
{
68+
pub struct ListenerSelectFuture<R, N> {
7369
// TODO: It would be nice if eventually N = Protocol, which has a
7470
// few more implications on the API.
7571
protocols: SmallVec<[(N, Protocol); 8]>,
@@ -83,11 +79,7 @@ where
8379
last_sent_na: bool,
8480
}
8581

86-
enum State<R, N>
87-
where
88-
R: AsyncRead + AsyncWrite,
89-
N: AsRef<[u8]>
90-
{
82+
enum State<R, N> {
9183
RecvHeader { io: MessageIO<R> },
9284
SendHeader { io: MessageIO<R> },
9385
RecvMessage { io: MessageIO<R> },

0 commit comments

Comments
 (0)