mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-02 11:44:28 +00:00
Implement ToSocketAddrs for &[SocketAddr]
This commit is contained in:
parent
0486e12ad0
commit
7ea0abfb35
@ -21,6 +21,8 @@ use option;
|
||||
use sys::net::netc as c;
|
||||
use sys_common::{FromInner, AsInner, IntoInner};
|
||||
use vec;
|
||||
use iter;
|
||||
use slice;
|
||||
|
||||
/// Representation of a socket address for networking applications.
|
||||
///
|
||||
@ -457,6 +459,15 @@ impl ToSocketAddrs for str {
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "slice_to_socket_addrs", since = "1.8.0")]
|
||||
impl<'a> ToSocketAddrs for &'a [SocketAddr] {
|
||||
type Iter = iter::Cloned<slice::Iter<'a, SocketAddr>>;
|
||||
|
||||
fn to_socket_addrs(&self) -> io::Result<Self::Iter> {
|
||||
Ok(self.iter().cloned())
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, T: ToSocketAddrs + ?Sized> ToSocketAddrs for &'a T {
|
||||
type Iter = T::Iter;
|
||||
|
Loading…
Reference in New Issue
Block a user