forked from loafle/openapi-generator-original
[Rust] Format example with rustfmt (#7339)
This was handled via 'cargo fmt' on the current nightly rust. I also moved a few lines around and deleted an old comment.
This commit is contained in:
parent
0bf430a803
commit
3029b7b0fb
@ -1,35 +1,39 @@
|
|||||||
extern crate petstore_client;
|
|
||||||
extern crate hyper;
|
|
||||||
extern crate tokio_core;
|
|
||||||
extern crate futures;
|
extern crate futures;
|
||||||
|
extern crate hyper;
|
||||||
|
extern crate petstore_client;
|
||||||
|
extern crate tokio_core;
|
||||||
|
|
||||||
use hyper::Client;
|
use hyper::Client;
|
||||||
use hyper::client::HttpConnector;
|
use hyper::client::HttpConnector;
|
||||||
use tokio_core::reactor::Core;
|
use tokio_core::reactor::Core;
|
||||||
use futures::{Future};
|
use futures::Future;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut core = Core::new().expect("failed to init core");
|
let mut core = Core::new().expect("failed to init core");
|
||||||
let handle = core.handle();
|
let handle = core.handle();
|
||||||
|
|
||||||
let new_pet = petstore_client::models::Pet::new("barker".to_owned(), vec![]).with_id(1337);
|
|
||||||
|
|
||||||
let apicli = petstore_client::apis::client::APIClient::new(
|
let apicli = petstore_client::apis::client::APIClient::new(
|
||||||
petstore_client::apis::configuration::Configuration::new(
|
petstore_client::apis::configuration::Configuration::new(
|
||||||
Client::configure().connector(HttpConnector::new(4, &handle)).build(&handle)));
|
Client::configure()
|
||||||
|
.connector(HttpConnector::new(4, &handle))
|
||||||
|
.build(&handle),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
let work = apicli.pet_api().add_pet(new_pet)
|
let new_pet = petstore_client::models::Pet::new("barker".to_owned(), vec![]).with_id(1337);
|
||||||
// petstore_client::apis::add_pet(api, &client, &new_pet)
|
let work = apicli
|
||||||
.and_then(|_| {
|
.pet_api()
|
||||||
apicli.pet_api().update_pet_with_form(1337, "barko", "escaped")
|
.add_pet(new_pet)
|
||||||
})
|
.and_then(|_| {
|
||||||
.and_then(|_| {
|
apicli
|
||||||
apicli.pet_api().get_pet_by_id(1337)
|
.pet_api()
|
||||||
})
|
.update_pet_with_form(1337, "barko", "escaped")
|
||||||
.and_then(|pet| {
|
})
|
||||||
println!("pet: {:?}", pet);
|
.and_then(|_| apicli.pet_api().get_pet_by_id(1337))
|
||||||
futures::future::ok(())
|
.and_then(|pet| {
|
||||||
});
|
println!("pet: {:?}", pet);
|
||||||
|
futures::future::ok(())
|
||||||
|
});
|
||||||
|
|
||||||
core.run(work).expect("failed to run core");
|
core.run(work).expect("failed to run core");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user