Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
toolchain: nightly
profile: minimal
override: true
components: rustfmt, clippy
Expand Down Expand Up @@ -44,7 +44,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
toolchain: nightly
profile: minimal
override: true
components: rustfmt
Expand All @@ -57,7 +57,7 @@ jobs:
cargo fmt --all -- --check
./eng/scripts/check_json_format.sh
cargo fmt --manifest-path services/Cargo.toml --all -- --check
if: matrix.rust == 'stable'
if: matrix.rust == 'nightly'

- name: check core for wasm
run: cargo check -p azure_core --target=wasm32-unknown-unknown
Expand Down Expand Up @@ -85,7 +85,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
toolchain: nightly
profile: minimal
override: true
components: rustfmt, clippy
Expand All @@ -112,7 +112,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
toolchain: nightly
profile: minimal
override: true
components: rustfmt
Expand All @@ -136,7 +136,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
toolchain: nightly
profile: minimal
override: true
components: rustfmt
Expand Down Expand Up @@ -167,7 +167,7 @@ jobs:
- name: install rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
toolchain: nightly
profile: minimal
override: true
components: rustfmt, clippy
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/services-all-features.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
toolchain: nightly
profile: minimal
override: true

Expand Down
2 changes: 1 addition & 1 deletion sdk/core/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ macro_rules! setters {
#[allow(clippy::redundant_field_names)]
#[allow(clippy::needless_update)]
// TODO: Declare using idiomatic with_$name when https://github.com/Azure/azure-sdk-for-rust/issues/292 is resolved.
pub fn $name<T: ::std::convert::Into<$typ>>(self, $name: T) -> Self {
pub fn $name<_T: ::std::convert::Into<$typ>>(self, $name: _T) -> Self {
let $name: $typ = $name.into();
Self {
$name: $transform,
Expand Down
25 changes: 6 additions & 19 deletions sdk/data_cosmos/examples/attachments_00.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![feature(into_future)]

use azure_data_cosmos::prelude::*;
use futures::StreamExt;
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -52,7 +54,7 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
};

// let's add an entity.
match client.create_document(doc.clone()).into_future().await {
match client.create_document(doc.clone()).await {
Ok(_) => {
println!("document created");
}
Expand Down Expand Up @@ -81,19 +83,14 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
"image/jpeg",
)
.consistency_level(ret)
.into_future()
.await?;
println!("create reference == {:#?}", resp);

// we pass the consistency level to make
// sure to find the just created attachment
let session_token: ConsistencyLevel = resp.into();

let resp = attachment
.get()
.consistency_level(session_token)
.into_future()
.await?;
let resp = attachment.get().consistency_level(session_token).await?;

println!("get attachment == {:#?}", resp);
let session_token: ConsistencyLevel = resp.into();
Expand All @@ -106,16 +103,11 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
"image/jpeg",
)
.consistency_level(session_token)
.into_future()
.await?;
println!("replace reference == {:#?}", resp);

println!("deleting");
let resp_delete = attachment
.delete()
.consistency_level(&resp)
.into_future()
.await?;
let resp_delete = attachment.delete().consistency_level(&resp).await?;
println!("delete attachment == {:#?}", resp_delete);

// slug attachment
Expand All @@ -125,17 +117,12 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
.create_slug("FFFFF".into())
.consistency_level(&resp_delete)
.content_type("text/plain")
.into_future()
.await?;

println!("create slug == {:#?}", resp);

println!("deleting");
let resp_delete = attachment
.delete()
.consistency_level(&resp)
.into_future()
.await?;
let resp_delete = attachment.delete().consistency_level(&resp).await?;
println!("delete attachment == {:#?}", resp_delete);

Ok(())
Expand Down
1 change: 1 addition & 0 deletions sdk/data_cosmos/examples/cancellation.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![feature(into_future)]
use azure_data_cosmos::prelude::*;
use stop_token::prelude::*;
use stop_token::StopSource;
Expand Down
8 changes: 2 additions & 6 deletions sdk/data_cosmos/examples/collection.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![feature(into_future)]
use azure_data_cosmos::prelude::*;
use futures::stream::StreamExt;
use std::error::Error;
Expand Down Expand Up @@ -47,11 +48,7 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
// try get on the first database (if any)
if let Some(db) = databases.databases.first() {
println!("getting info of database {}", &db.id);
let db = client
.database_client(db.id.clone())
.get_database()
.into_future()
.await?;
let db = client.database_client(db.id.clone()).get_database().await?;
println!("db {} found == {:?}", &db.database.id, &db);
}

Expand All @@ -78,7 +75,6 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
let collection_response = database
.collection_client(collection.id)
.get_collection()
.into_future()
.await?;

println!("\tcollection_response {:?}", collection_response);
Expand Down
13 changes: 5 additions & 8 deletions sdk/data_cosmos/examples/create_delete_database.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![feature(into_future)]
use azure_data_cosmos::prelude::*;
use futures::stream::StreamExt;
use std::error::Error;
Expand Down Expand Up @@ -39,16 +40,13 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
}
drop(list_databases_stream);

let db = client.create_database(&database_name).into_future().await?;
let db = client.create_database(&database_name).await?;
println!("created database = {:#?}", db);

// create collection!
{
let database = client.database_client(database_name.clone());
let create_collection_response = database
.create_collection("panzadoro", "/id")
.into_future()
.await?;
let create_collection_response = database.create_collection("panzadoro", "/id").await?;

println!(
"create_collection_response == {:#?}",
Expand All @@ -57,7 +55,7 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {

let db_collection = database.collection_client("panzadoro");

let get_collection_response = db_collection.get_collection().into_future().await?;
let get_collection_response = db_collection.get_collection().await?;
println!("get_collection_response == {:#?}", get_collection_response);

let mut stream = database.list_collections().into_stream();
Expand All @@ -66,14 +64,13 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
println!("res == {:#?}", res);
}

let delete_response = db_collection.delete_collection().into_future().await?;
let delete_response = db_collection.delete_collection().await?;
println!("collection deleted: {:#?}", delete_response);
}

let resp = client
.database_client(database_name)
.delete_database()
.into_future()
.await?;
println!("database deleted. resp == {:#?}", resp);

Expand Down
3 changes: 1 addition & 2 deletions sdk/data_cosmos/examples/database_00.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![feature(into_future)]
use azure_data_cosmos::prelude::*;
use futures::stream::StreamExt;
use serde_json::Value;
Expand Down Expand Up @@ -56,7 +57,6 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
.create_document(document)
.is_upsert(true)
.partition_key(&43u32)?
.into_future()
.await?;

println!("resp == {:?}", resp);
Expand All @@ -70,7 +70,6 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
let replace_collection_response = collection
.replace_collection("/age")
.indexing_policy(indexing_policy_new)
.into_future()
.await?;
println!(
"replace_collection_response == {:#?}",
Expand Down
7 changes: 2 additions & 5 deletions sdk/data_cosmos/examples/database_01.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![feature(into_future)]
use azure_data_cosmos::prelude::*;
use futures::stream::StreamExt;
use std::error::Error;
Expand Down Expand Up @@ -25,11 +26,7 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
.unwrap()?;
println!("collections == {:#?}", collections);

let collection = database
.collection_client("cnt")
.get_collection()
.into_future()
.await?;
let collection = database.collection_client("cnt").get_collection().await?;
println!("collection == {:#?}", collection);

Ok(())
Expand Down
21 changes: 4 additions & 17 deletions sdk/data_cosmos/examples/document_00.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![feature(into_future)]
use futures::stream::StreamExt;
use serde::{Deserialize, Serialize};
// Using the prelude module of the Cosmos crate makes easier to use the Rust Azure SDK for Cosmos
Expand Down Expand Up @@ -69,13 +70,7 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
// If the requested database is not found we create it.
let database = match db {
Some(db) => db,
None => {
client
.create_database(DATABASE)
.into_future()
.await?
.database
}
None => client.create_database(DATABASE).await?.database,
};
println!("database == {:?}", database);

Expand All @@ -102,7 +97,6 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
.clone()
.database_client(database.id.clone())
.create_collection(COLLECTION, "/id")
.into_future()
.await?
.collection
}
Expand Down Expand Up @@ -131,10 +125,7 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
// The method create_document will return, upon success,
// the document attributes.

let create_document_response = collection
.create_document(doc.clone())
.into_future()
.await?;
let create_document_response = collection.create_document(doc.clone()).await?;
println!(
"create_document_response == {:#?}",
create_document_response
Expand All @@ -159,8 +150,7 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
let get_document_response = collection
.clone()
.document_client(doc.id.clone(), &doc.id)?
.get_document()
.into_future::<MySampleStruct>()
.get_document::<MySampleStruct>()
.await?;
println!("get_document_response == {:#?}", get_document_response);

Expand All @@ -179,7 +169,6 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
.document_client(doc.id.clone(), &doc.id)?
.replace_document(doc)
.if_match_condition(IfMatchCondition::Match(document.etag))
.into_future()
.await?;
println!(
"replace_document_response == {:#?}",
Expand All @@ -192,15 +181,13 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
.database_client(DATABASE.to_owned())
.collection_client(COLLECTION.to_owned())
.delete_collection()
.into_future()
.await?;
println!("collection deleted");

// And then we delete the database.
client
.database_client(database.id)
.delete_database()
.into_future()
.await?;
println!("database deleted");

Expand Down
5 changes: 2 additions & 3 deletions sdk/data_cosmos/examples/document_entries_00.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![feature(into_future)]
use azure_core::prelude::*;
use azure_data_cosmos::prelude::*;
use futures::stream::StreamExt;
Expand Down Expand Up @@ -52,7 +53,7 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
};

// let's add an entity.
response = Some(client.create_document(doc.clone()).into_future().await?);
response = Some(client.create_document(doc.clone()).await?);
}

println!("Created 5 documents.");
Expand Down Expand Up @@ -128,7 +129,6 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
.replace_document(doc.document)
.consistency_level(ConsistencyLevel::from(&response))
.if_match_condition(IfMatchCondition::Match(doc.etag)) // use optimistic concurrency check
.into_future()
.await?;

println!(
Expand All @@ -155,7 +155,6 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
client
.document_client(id.clone(), &id)?
.delete_document()
.into_future()
.await?;
}
println!("Cleaned up");
Expand Down
Loading