Skip to content

Commit

Permalink
replace IntoIterator with associated type implementing Iterator
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxime2 committed Aug 8, 2019
1 parent f590c3d commit d951c48
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/peer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ pub trait Peer<Id: PeerId> {
fn get_net_addr(&self) -> String;
}

pub trait PeerList<Id: PeerId, Error>: IntoIterator {
pub trait PeerList<Id: PeerId, Error> {
type IterType: Iterator;
fn add(&mut self, p: dyn Peer<Id>) -> std::result::Result<(), Error>;
fn get_peers_from_file(&mut self, json_peer_path: String) -> std::result::Result<(), Error>;
fn iter<'a>(&'a self) -> Self::IterType;
}

0 comments on commit d951c48

Please sign in to comment.