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