Skip to content

Commit

Permalink
Add Vec impl for ToServerAddrs
Browse files Browse the repository at this point in the history
Signed-off-by: Tomasz Pietrek <tomasz@nats.io>
  • Loading branch information
Jarema committed Jan 13, 2023
1 parent f5ff66d commit 743458a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions async-nats/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1165,6 +1165,14 @@ impl<'a> ToServerAddrs for &'a [ServerAddr] {
}
}

impl ToServerAddrs for Vec<ServerAddr> {
type Iter = std::vec::IntoIter<ServerAddr>;

fn to_server_addrs(&self) -> io::Result<Self::Iter> {
Ok(self.clone().into_iter())
}
}

impl<T: ToServerAddrs + ?Sized> ToServerAddrs for &T {
type Iter = T::Iter;
fn to_server_addrs(&self) -> io::Result<Self::Iter> {
Expand Down

0 comments on commit 743458a

Please sign in to comment.