11extern crate azure_sdk_for_rust;
22
3+ extern crate chrono;
34extern crate futures;
4- extern crate tokio_core;
5- extern crate tokio;
65extern crate hyper;
76extern crate hyper_tls;
8- extern crate chrono;
7+ extern crate tokio;
8+ extern crate tokio_core;
99
1010use std:: error:: Error ;
1111
@@ -49,12 +49,12 @@ fn main() {
4949}
5050
5151fn code ( ) -> Result < ( ) , Box < Error > > {
52- let database_name = std:: env:: args ( ) . nth ( 1 ) . expect (
53- "please specify database name as first command line parameter" ,
54- ) ;
55- let collection_name = std:: env:: args ( ) . nth ( 2 ) . expect (
56- "please specify collection name as second command line parameter" ,
57- ) ;
52+ let database_name = std:: env:: args ( )
53+ . nth ( 1 )
54+ . expect ( "please specify database name as first command line parameter" ) ;
55+ let collection_name = std:: env:: args ( )
56+ . nth ( 2 )
57+ . expect ( "please specify collection name as second command line parameter" ) ;
5858
5959 let master_key =
6060 std:: env:: var ( "COSMOS_MASTER_KEY" ) . expect ( "Set env variable COSMOS_MASTER_KEY first!" ) ;
@@ -76,9 +76,13 @@ fn code() -> Result<(), Box<Error>> {
7676
7777 // let's add an entity. we ignore the errors at this point and just
7878 // notify the user.
79- match core. run (
80- client. create_document_as_entity ( & database_name, & collection_name, false , None , & doc) ,
81- ) {
79+ match core. run ( client. create_document_as_entity (
80+ & database_name,
81+ & collection_name,
82+ false ,
83+ None ,
84+ & doc,
85+ ) ) {
8286 Ok ( _) => {
8387 println ! ( "entity added" ) ;
8488 }
@@ -92,9 +96,11 @@ fn code() -> Result<(), Box<Error>> {
9296 let mut ldo = LIST_DOCUMENTS_OPTIONS_DEFAULT . clone ( ) ;
9397 ldo. max_item_count = Some ( 3 ) ;
9498
95- let response: ListDocumentsResponse < MySampleStructOwned > = core. run (
96- client. list_documents ( & database_name, & collection_name, & ldo) ,
97- ) . unwrap ( ) ;
99+ let response: ListDocumentsResponse < MySampleStructOwned > = core. run ( client. list_documents (
100+ & database_name,
101+ & collection_name,
102+ & ldo,
103+ ) ) . unwrap ( ) ;
98104
99105 assert_eq ! ( response. documents. len( ) , 3 ) ;
100106 println ! ( "response == {:?}" , response) ;
@@ -111,9 +117,11 @@ fn code() -> Result<(), Box<Error>> {
111117 let mut ldo = LIST_DOCUMENTS_OPTIONS_DEFAULT . clone ( ) ;
112118 ldo. continuation_token = Some ( & ct) ;
113119
114- let response: ListDocumentsResponse < MySampleStructOwned > = core. run (
115- client. list_documents ( & database_name, & collection_name, & ldo) ,
116- ) . unwrap ( ) ;
120+ let response: ListDocumentsResponse < MySampleStructOwned > = core. run ( client. list_documents (
121+ & database_name,
122+ & collection_name,
123+ & ldo,
124+ ) ) . unwrap ( ) ;
117125
118126 assert_eq ! ( response. documents. len( ) , 47 ) ;
119127 println ! ( "response == {:?}" , response) ;
@@ -128,19 +136,25 @@ fn code() -> Result<(), Box<Error>> {
128136 let gdo = GET_DOCUMENT_OPTIONS_DEFAULT . clone ( ) ;
129137 let id = format ! ( "unique_id{}" , 3 ) ;
130138
131- let response: GetDocumentResponse < MySampleStructOwned > = core. run (
132- client. get_document ( & database_name, & collection_name, & id, & gdo) ,
133- ) . unwrap ( ) ;
139+ let response: GetDocumentResponse < MySampleStructOwned > = core. run ( client. get_document (
140+ & database_name,
141+ & collection_name,
142+ & id,
143+ & gdo,
144+ ) ) . unwrap ( ) ;
134145
135146 assert_eq ! ( response. document. is_some( ) , true ) ;
136147 println ! ( "response == {:?}" , response) ;
137148
138149 // This id should not be found. We expect None as result
139150 let id = format ! ( "unique_id{}" , 100 ) ;
140151
141- let response: GetDocumentResponse < MySampleStructOwned > = core. run (
142- client. get_document ( & database_name, & collection_name, & id, & gdo) ,
143- ) . unwrap ( ) ;
152+ let response: GetDocumentResponse < MySampleStructOwned > = core. run ( client. get_document (
153+ & database_name,
154+ & collection_name,
155+ & id,
156+ & gdo,
157+ ) ) . unwrap ( ) ;
144158
145159 assert_eq ! ( response. document. is_some( ) , false ) ;
146160 println ! ( "response == {:?}" , response) ;
0 commit comments