mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-14 02:21:21 +00:00
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
This commit is contained in:
@ -128,23 +128,14 @@ where
|
||||
/// A `Future` returned by [`dialer_select_proto_serial`] which negotiates
|
||||
/// a protocol iteratively by considering one protocol after the other.
|
||||
#[pin_project::pin_project]
|
||||
pub struct DialerSelectSeq<R, I>
|
||||
where
|
||||
R: AsyncRead + AsyncWrite,
|
||||
I: Iterator,
|
||||
I::Item: AsRef<[u8]>
|
||||
{
|
||||
pub struct DialerSelectSeq<R, I: Iterator> {
|
||||
// TODO: It would be nice if eventually N = I::Item = Protocol.
|
||||
protocols: iter::Peekable<I>,
|
||||
state: SeqState<R, I::Item>,
|
||||
version: Version,
|
||||
}
|
||||
|
||||
enum SeqState<R, N>
|
||||
where
|
||||
R: AsyncRead + AsyncWrite,
|
||||
N: AsRef<[u8]>
|
||||
{
|
||||
enum SeqState<R, N> {
|
||||
SendHeader { io: MessageIO<R>, },
|
||||
SendProtocol { io: MessageIO<R>, protocol: N },
|
||||
FlushProtocol { io: MessageIO<R>, protocol: N },
|
||||
@ -274,22 +265,13 @@ where
|
||||
/// a protocol selectively by considering all supported protocols of the remote
|
||||
/// "in parallel".
|
||||
#[pin_project::pin_project]
|
||||
pub struct DialerSelectPar<R, I>
|
||||
where
|
||||
R: AsyncRead + AsyncWrite,
|
||||
I: Iterator,
|
||||
I::Item: AsRef<[u8]>
|
||||
{
|
||||
pub struct DialerSelectPar<R, I: Iterator> {
|
||||
protocols: I,
|
||||
state: ParState<R, I::Item>,
|
||||
version: Version,
|
||||
}
|
||||
|
||||
enum ParState<R, N>
|
||||
where
|
||||
R: AsyncRead + AsyncWrite,
|
||||
N: AsRef<[u8]>
|
||||
{
|
||||
enum ParState<R, N> {
|
||||
SendHeader { io: MessageIO<R> },
|
||||
SendProtocolsRequest { io: MessageIO<R> },
|
||||
Flush { io: MessageIO<R> },
|
||||
|
@ -1,27 +0,0 @@
|
||||
// Copyright 2017 Parity Technologies (UK) Ltd.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
//! Main `ProtocolChoiceError` error.
|
||||
|
||||
pub use crate::protocol::ProtocolError;
|
||||
|
||||
use std::error::Error;
|
||||
use std::{fmt, io};
|
||||
|
@ -65,11 +65,7 @@ where
|
||||
/// The `Future` returned by [`listener_select_proto`] that performs a
|
||||
/// multistream-select protocol negotiation on an underlying I/O stream.
|
||||
#[pin_project::pin_project]
|
||||
pub struct ListenerSelectFuture<R, N>
|
||||
where
|
||||
R: AsyncRead + AsyncWrite,
|
||||
N: AsRef<[u8]>
|
||||
{
|
||||
pub struct ListenerSelectFuture<R, N> {
|
||||
// TODO: It would be nice if eventually N = Protocol, which has a
|
||||
// few more implications on the API.
|
||||
protocols: SmallVec<[(N, Protocol); 8]>,
|
||||
@ -83,11 +79,7 @@ where
|
||||
last_sent_na: bool,
|
||||
}
|
||||
|
||||
enum State<R, N>
|
||||
where
|
||||
R: AsyncRead + AsyncWrite,
|
||||
N: AsRef<[u8]>
|
||||
{
|
||||
enum State<R, N> {
|
||||
RecvHeader { io: MessageIO<R> },
|
||||
SendHeader { io: MessageIO<R> },
|
||||
RecvMessage { io: MessageIO<R> },
|
||||
|
Reference in New Issue
Block a user