UCY2DO3DQ2WE55CVVJYMHINBWCZYPCSZ5Q2EHMZNNZIU5LPCJNSAC
type Error = Box<dyn std::error::Error + Sync + Send>;
type Future = Box<dyn Future<Item = Response<Self::ResBody>, Error = Self::Error> + Send>;
type Error = Box<dyn std::error::Error + Sync + Send + 'static>;
type Future = Box<dyn Future<Item = Response<Self::ResBody>, Error = Self::Error> + Send + 'static>;
.map_err(|e| Box::new(e) as Box<dyn std::error::Error + Sync + Send>),
)) as Box<Future<Item = _, Error = _> + Send>
.map_err(|e| Box::new(e) as Box<dyn std::error::Error + Sync + Send + 'static>),
)) as Box<Future<Item = _, Error = _> + Send + 'static>
self.cmd_send
.clone()
.send(XmppCommand { xmpp_to })
.then(|r| match r {
Ok(_) => {
tokio::prelude::future::ok(Response::new(Body::from("Accepted")))
}
Err(e) => {
error!("Command sent error: {}", e);
tokio::prelude::future::result(
Response::builder()
.status(hyper::StatusCode::BAD_REQUEST)
.body(Body::from(format!("Command sent error: {}", e))),
)
}
/*req.into_body()
.map_err(|e| Box::new(e) as Box<dyn std::error::Error + Sync + Send + 'static>)
.fold(String::new(), |acc, ch| {
std::str::from_utf8(&*ch).map(|s| {
acc.push_str(s);
acc
})
.map_err(|e| Box::new(e) as Box<dyn std::error::Error + Sync + Send>),
) as Box<Future<Item = _, Error = _> + Send>
.and_then(|msg: String| {*/
self.cmd_send
.clone()
.send(XmppCommand { xmpp_to })
.then(|r| match r {
Ok(_) => tokio::prelude::future::ok(Response::new(Body::from(
"Accepted",
))),
Err(e) => {
error!("Command sent error: {}", e);
tokio::prelude::future::result(
Response::builder()
.status(hyper::StatusCode::BAD_REQUEST)
.body(Body::from(format!(
"Command sent error: {}",
e
))),
)
}
})
.map_err(|e| {
Box::new(e) as Box<dyn std::error::Error + Sync + Send + 'static>
})
// }),
) as Box<Future<Item = _, Error = _> + Send + 'static>