Skip to content
This repository was archived by the owner on Oct 6, 2020. It is now read-only.

Commit a6e96ba

Browse files
committed
Merge remote-tracking branch 'refs/remotes/origin/master'
2 parents 2840b07 + 0a0f83a commit a6e96ba

File tree

6 files changed

+64
-8
lines changed

6 files changed

+64
-8
lines changed

azure_sdk_storage_account/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "azure_sdk_storage_account"
3-
version = "0.41.0"
3+
version = "0.41.1"
44
description = "Rust wrappers around Microsoft Azure REST APIs - Blob storage account crate"
55
readme = "README.md"
66
authors = ["Francesco Cogno <francesco.cogno@outlook.com>", "Max Gortman <mgortman@microsoft.com>"]
@@ -16,7 +16,7 @@ edition = "2018"
1616

1717
[dependencies]
1818
azure_sdk_core = { path = "../azure_sdk_core", version = "0.43.4" }
19-
azure_sdk_storage_core = { path = "../azure_sdk_storage_core", version = "0.44.0" }
19+
azure_sdk_storage_core = { path = "../azure_sdk_storage_core", version = "0.44.1" }
2020
chrono = "0.4"
2121
http = "0.2"
2222
hyper = "0.13"

azure_sdk_storage_blob/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "azure_sdk_storage_blob"
3-
version = "0.44.0"
3+
version = "0.44.1"
44
description = "Rust wrappers around Microsoft Azure REST APIs - Blob storage crate"
55
readme = "README.md"
66
authors = ["Francesco Cogno <francesco.cogno@outlook.com>", "Max Gortman <mgortman@microsoft.com>", "Dong Liu <doliu@microsoft.com>"]
@@ -16,7 +16,7 @@ edition = "2018"
1616

1717
[dependencies]
1818
azure_sdk_core = { path = "../azure_sdk_core", version = "0.43.4" }
19-
azure_sdk_storage_core = { path = "../azure_sdk_storage_core", version = "0.44.0" }
19+
azure_sdk_storage_core = { path = "../azure_sdk_storage_core", version = "0.44.1" }
2020
md5 = "0.7"
2121
RustyXML = "0.3"
2222
base64 = "0.12"

azure_sdk_storage_core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "azure_sdk_storage_core"
3-
version = "0.44.0"
3+
version = "0.44.1"
44
description = "Rust wrappers around Microsoft Azure REST APIs - Core storage crate"
55
readme = "README.md"
66
authors = ["Francesco Cogno <francesco.cogno@outlook.com>", "Max Gortman <mgortman@microsoft.com>", "Dong Liu <doliu@microsoft.com>"]
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
use azure_sdk_storage_core::prelude::*;
2+
use std::thread;
3+
4+
fn get_box() -> Box<dyn Client> {
5+
Box::new(client::with_access_key("fake", "fake"))
6+
}
7+
8+
fn get_box_send() -> Box<dyn Client + Send + Sync> {
9+
Box::new(client::with_access_key("fake", "fake"))
10+
}
11+
12+
pub fn main() {
13+
let client = get_box();
14+
println!("client.blob_uri() == {}", client.blob_uri());
15+
16+
let client_send = get_box_send();
17+
18+
let handler = thread::spawn(move || {
19+
println!("client_send.blob_uri() == {}", client_send.blob_uri());
20+
});
21+
handler.join().unwrap();
22+
}

azure_sdk_storage_core/src/client.rs

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub trait HttpHeaderAdder {
1313
fn add_headers(&self, builder: ::http::request::Builder) -> ::http::request::Builder;
1414
}
1515

16-
pub trait Client {
16+
pub trait Client: Send + Sync {
1717
fn blob_uri(&self) -> &str;
1818
fn table_uri(&self) -> &str;
1919

@@ -43,6 +43,40 @@ pub trait Client {
4343
) -> Result<hyper::client::ResponseFuture, AzureError>;
4444
}
4545

46+
impl<C> Client for Box<C>
47+
where
48+
C: Client,
49+
{
50+
fn blob_uri(&self) -> &str {
51+
self.as_ref().blob_uri()
52+
}
53+
fn table_uri(&self) -> &str {
54+
self.as_ref().table_uri()
55+
}
56+
57+
fn perform_request(
58+
&self,
59+
uri: &str,
60+
method: &Method,
61+
http_header_adder: &dyn Fn(Builder) -> Builder,
62+
request_body: Option<&[u8]>,
63+
) -> Result<hyper::client::ResponseFuture, AzureError> {
64+
self.as_ref()
65+
.perform_request(uri, method, http_header_adder, request_body)
66+
}
67+
68+
fn perform_table_request(
69+
&self,
70+
segment: &str,
71+
method: &Method,
72+
http_header_adder: &dyn Fn(Builder) -> Builder,
73+
request_str: Option<&[u8]>,
74+
) -> Result<hyper::client::ResponseFuture, AzureError> {
75+
self.as_ref()
76+
.perform_table_request(segment, method, http_header_adder, request_str)
77+
}
78+
}
79+
4680
impl Client for Box<dyn Client> {
4781
fn blob_uri(&self) -> &str {
4882
self.as_ref().blob_uri()

azure_sdk_storage_table/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "azure_sdk_storage_table"
3-
version = "0.41.0"
3+
version = "0.41.1"
44
description = "Rust wrappers around Microsoft Azure REST APIs - Table storage crate"
55
readme = "README.md"
66
authors = ["Francesco Cogno <francesco.cogno@outlook.com>", "gzp-crey", "Max Gortman <mgortman@microsoft.com>", "Dong Liu <doliu@microsoft.com>"]
@@ -16,7 +16,7 @@ edition = "2018"
1616

1717
[dependencies]
1818
azure_sdk_core = { path = "../azure_sdk_core", version = "0.43.4" }
19-
azure_sdk_storage_core = { path = "../azure_sdk_storage_core", version = "0.44.0" }
19+
azure_sdk_storage_core = { path = "../azure_sdk_storage_core", version = "0.44.1" }
2020
chrono = "0.4"
2121
http = "0.2"
2222
hyper = "0.13"

0 commit comments

Comments
 (0)