mirror of
https://github.com/OMGeeky/tarpc.git
synced 2026-01-01 00:51:25 +01:00
Rework the future Connect trait to only have one method, which takes an Options arg.
This commit is contained in:
@@ -6,8 +6,8 @@
|
||||
use futures::{Future, Poll};
|
||||
use futures::stream::Stream;
|
||||
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
||||
use std::error::Error;
|
||||
use std::{fmt, io};
|
||||
use std::error::Error;
|
||||
use std::net::{SocketAddr, ToSocketAddrs};
|
||||
|
||||
/// A bottom type that impls `Error`, `Serialize`, and `Deserialize`. It is impossible to
|
||||
@@ -102,10 +102,10 @@ pub trait FirstSocketAddr: ToSocketAddrs {
|
||||
/// Returns the first resolved `SocketAddr`, if one exists.
|
||||
fn try_first_socket_addr(&self) -> io::Result<SocketAddr> {
|
||||
if let Some(a) = self.to_socket_addrs()?.next() {
|
||||
Ok(a)
|
||||
Ok(a)
|
||||
} else {
|
||||
Err(io::Error::new(io::ErrorKind::AddrNotAvailable,
|
||||
"`ToSocketAddrs::to_socket_addrs` returned an empty iterator."))
|
||||
Err(io::Error::new(io::ErrorKind::AddrNotAvailable,
|
||||
"`ToSocketAddrs::to_socket_addrs` returned an empty iterator."))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user