Skip to content

Commit

Permalink
Avoid the bug by accepting parametrized type instead of trait
Browse files Browse the repository at this point in the history
  • Loading branch information
waterlink committed Oct 31, 2014
1 parent 3983071 commit 6ba292f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ impl Node {
self.contact().tx.send(ExitCommand);
}

pub fn start(&mut self, host: &str, intercommunication: &mut Intercommunication) {
pub fn start<T: Intercommunication>(&mut self, host: &str, intercommunication: &mut T) {

This comment has been minimized.

Copy link
@waterlink

waterlink Oct 31, 2014

Author Contributor

Intercommunication is a trait here.

match self.contact {
Some(_) => {},
None => self.contact = Some(NodeService::start_service(
Expand Down Expand Up @@ -170,7 +170,7 @@ impl NodeService {
}
}

fn start_service(host: String, intercommunication: &mut Intercommunication) -> NodeContact {
fn start_service < T: Intercommunication >(host: String, intercommunication: &mut T) -> NodeContact {
let (contact, service_contact) = NodeService::channels();

let comm = intercommunication.register(host.clone());
Expand Down

0 comments on commit 6ba292f

Please sign in to comment.