forked from the-distro/ofborg
rustfmt
This commit is contained in:
parent
5e357d5e01
commit
26e0612d5e
|
@ -26,9 +26,7 @@ fn main() {
|
|||
let nix = cfg.nix();
|
||||
|
||||
let full_logs: bool = match &cfg.feedback {
|
||||
&Some(ref feedback) => {
|
||||
feedback.full_logs
|
||||
}
|
||||
&Some(ref feedback) => feedback.full_logs,
|
||||
&None => {
|
||||
warn!("Please define feedback.full_logs in your configuration to true or false!");
|
||||
warn!("feedback.full_logs when true will cause the full build log to be sent back");
|
||||
|
@ -59,7 +57,7 @@ fn main() {
|
|||
no_ack: false,
|
||||
no_wait: false,
|
||||
exclusive: false,
|
||||
arguments: None
|
||||
arguments: None,
|
||||
},
|
||||
)
|
||||
.unwrap();
|
||||
|
|
|
@ -44,7 +44,7 @@ fn main() {
|
|||
no_ack: false,
|
||||
no_wait: false,
|
||||
exclusive: false,
|
||||
arguments: None
|
||||
arguments: None,
|
||||
},
|
||||
)
|
||||
.unwrap();
|
||||
|
|
|
@ -47,7 +47,7 @@ fn main() {
|
|||
.unwrap();
|
||||
|
||||
|
||||
channel
|
||||
channel
|
||||
.consume(
|
||||
worker::new(tasks::log_message_collector::LogMessageCollector::new(
|
||||
PathBuf::from(cfg.log_storage.clone().unwrap().path),
|
||||
|
@ -60,7 +60,7 @@ fn main() {
|
|||
no_ack: false,
|
||||
no_wait: false,
|
||||
exclusive: false,
|
||||
arguments: None
|
||||
arguments: None,
|
||||
},
|
||||
)
|
||||
.unwrap();
|
||||
|
|
|
@ -51,7 +51,7 @@ fn main() {
|
|||
no_ack: false,
|
||||
no_wait: false,
|
||||
exclusive: false,
|
||||
arguments: None
|
||||
arguments: None,
|
||||
},
|
||||
)
|
||||
.unwrap();
|
||||
|
|
|
@ -153,8 +153,7 @@ pub struct ExchangeConfig {
|
|||
arguments: Option<amqp::Table>,
|
||||
}
|
||||
|
||||
pub fn session_from_config(config: &RabbitMQConfig)
|
||||
-> Result<amqp::Session, amqp::AMQPError> {
|
||||
pub fn session_from_config(config: &RabbitMQConfig) -> Result<amqp::Session, amqp::AMQPError> {
|
||||
let scheme = if config.ssl {
|
||||
amqp::AMQPScheme::AMQPS
|
||||
} else {
|
||||
|
@ -165,36 +164,36 @@ pub fn session_from_config(config: &RabbitMQConfig)
|
|||
// properties.insert("identity".to_owned(), amqp::TableEntry::LongString(identity.to_owned()));
|
||||
properties.insert(
|
||||
"ofborg_version".to_owned(),
|
||||
amqp::TableEntry::LongString(ofborg::VERSION.to_owned())
|
||||
amqp::TableEntry::LongString(ofborg::VERSION.to_owned()),
|
||||
);
|
||||
|
||||
amqp::Session::new(
|
||||
amqp::Options{
|
||||
host: config.host.clone(),
|
||||
login: config.username.clone(),
|
||||
password: config.password.clone(),
|
||||
scheme: scheme,
|
||||
properties: properties,
|
||||
.. amqp::Options::default()
|
||||
}
|
||||
)
|
||||
amqp::Session::new(amqp::Options {
|
||||
host: config.host.clone(),
|
||||
login: config.username.clone(),
|
||||
password: config.password.clone(),
|
||||
scheme: scheme,
|
||||
properties: properties,
|
||||
..amqp::Options::default()
|
||||
})
|
||||
}
|
||||
|
||||
pub trait TypedWrappers {
|
||||
fn consume<T>(&mut self, callback: T, config: ConsumeConfig)
|
||||
-> Result<String, amqp::AMQPError>
|
||||
where T: amqp::Consumer + 'static;
|
||||
|
||||
fn declare_exchange<T>(&mut self, config: ExchangeConfig)
|
||||
-> Result<amqp::protocol::exchange::DeclareOk, amqp::AMQPError>
|
||||
where T: amqp::Consumer + 'static;
|
||||
fn consume<T>(&mut self, callback: T, config: ConsumeConfig) -> Result<String, amqp::AMQPError>
|
||||
where
|
||||
T: amqp::Consumer + 'static;
|
||||
|
||||
fn declare_exchange<T>(
|
||||
&mut self,
|
||||
config: ExchangeConfig,
|
||||
) -> Result<amqp::protocol::exchange::DeclareOk, amqp::AMQPError>
|
||||
where
|
||||
T: amqp::Consumer + 'static;
|
||||
}
|
||||
|
||||
impl TypedWrappers for amqp::Channel {
|
||||
fn consume<T>(&mut self, callback: T, config: ConsumeConfig)
|
||||
-> Result<String, amqp::AMQPError>
|
||||
where T: amqp::Consumer + 'static
|
||||
fn consume<T>(&mut self, callback: T, config: ConsumeConfig) -> Result<String, amqp::AMQPError>
|
||||
where
|
||||
T: amqp::Consumer + 'static,
|
||||
{
|
||||
self.basic_consume(
|
||||
callback,
|
||||
|
@ -208,9 +207,12 @@ impl TypedWrappers for amqp::Channel {
|
|||
)
|
||||
}
|
||||
|
||||
fn declare_exchange<T>(&mut self, config: ExchangeConfig)
|
||||
-> Result<amqp::protocol::exchange::DeclareOk, amqp::AMQPError>
|
||||
where T: amqp::Consumer + 'static
|
||||
fn declare_exchange<T>(
|
||||
&mut self,
|
||||
config: ExchangeConfig,
|
||||
) -> Result<amqp::protocol::exchange::DeclareOk, amqp::AMQPError>
|
||||
where
|
||||
T: amqp::Consumer + 'static,
|
||||
{
|
||||
self.exchange_declare(
|
||||
config.exchange,
|
||||
|
@ -220,8 +222,7 @@ impl TypedWrappers for amqp::Channel {
|
|||
config.auto_delete,
|
||||
config.internal,
|
||||
config.nowait,
|
||||
config.arguments.unwrap_or(amqp::Table::new())
|
||||
config.arguments.unwrap_or(amqp::Table::new()),
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue