11
22use argparse;
3- use amqp:: { ConsumerCallBackFn , Session , Table , Basic , Channel , Options , Consumer } ;
3+ use amqp:: { ConsumerCallBackFn , Session , Table , Basic , Channel , Consumer } ;
44use amqp:: protocol;
55use std:: default:: Default ;
66use rustc_serialize:: json;
@@ -172,7 +172,7 @@ fn setup_outport(participant: &Participant, port: &ParticipantPort, connection:
172172}
173173
174174
175- fn start_participant ( participant : & Participant , options : & ParticipantOptions ) -> Connection {
175+ fn start_participant ( participant : & Participant , options : & Options ) -> Connection {
176176
177177 let mut session = Session :: open_url ( & options. broker ) . expect ( "Can't create AMQP session" ) ;
178178 let mut channel = session. open_channel ( 1 ) . expect ( "could not open AMQP channel" ) ;
@@ -196,22 +196,22 @@ fn stop_participant(participant: &Participant, connection: &mut Connection) {
196196}
197197
198198#[ derive( Debug ) ]
199- struct ParticipantOptions {
199+ struct Options {
200200 role : String ,
201201 broker : String ,
202202}
203203
204- impl Default for ParticipantOptions {
205- fn default ( ) -> ParticipantOptions {
204+ impl Default for Options {
205+ fn default ( ) -> Options {
206206
207- ParticipantOptions {
207+ Options {
208208 broker : "amqp://localhost//" . to_string ( ) ,
209209 role : "" . to_string ( ) ,
210210 }
211211 }
212212}
213213
214- fn normalize_info ( old : & ParticipantInfo , options : & ParticipantOptions ) -> ParticipantInfo {
214+ fn normalize_info ( old : & ParticipantInfo , options : & Options ) -> ParticipantInfo {
215215 use rand:: { thread_rng, Rng } ;
216216
217217 let mut new = old. clone ( ) ;
@@ -248,7 +248,7 @@ fn default_queue(role: String, port_name: String) -> String {
248248 return format ! ( "{}.{}" , role, port_name. to_uppercase( ) ) ;
249249}
250250
251- fn parse ( options : & mut ParticipantOptions ) {
251+ fn parse ( options : & mut Options ) {
252252
253253 use argparse:: { StoreTrue , Store } ;
254254 let mut parser = argparse:: ArgumentParser :: new ( ) ;
@@ -267,7 +267,7 @@ fn parse(options: &mut ParticipantOptions) {
267267// TODO: nicer way to declare ports? ideally they are enums not stringly typed?
268268pub fn main ( orig : Participant ) {
269269
270- let mut options = ParticipantOptions { .. Default :: default ( ) } ;
270+ let mut options = Options { .. Default :: default ( ) } ;
271271 parse ( & mut options) ;
272272
273273 let info = normalize_info ( & orig. info , & options) ;
0 commit comments