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

Commit d13d5f6

Browse files
author
Francesco Cogno
authored
Azure Storage Core: Added ?Sized on impl (#308)
* Added ?Sized on impl * bumped deps
1 parent 1036adc commit d13d5f6

File tree

18 files changed

+81
-67
lines changed

18 files changed

+81
-67
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
[![Build Status](https://travis-ci.org/MindFlavor/AzureSDKForRust.svg?branch=master)](https://travis-ci.org/MindFlavor/AzureSDKForRust) [![Coverage Status](https://coveralls.io/repos/MindFlavor/AzureSDKForRust/badge.svg?branch=master&service=github)](https://coveralls.io/github/MindFlavor/AzureSDKForRust?branch=master) ![stability-unstable](https://img.shields.io/badge/stability-unstable-yellow.svg)
77

8-
[![tag](https://img.shields.io/github/tag/mindflavor/AzureSDKForRust.svg)](https://github.com/MindFlavor/AzureSDKForRust/tree/storage_blob_0.44.3) [![release](https://img.shields.io/github/release/mindflavor/AzureSDKForRust.svg)](https://github.com/MindFlavor/AzureSDKForRust/releases/tag/storage_blob_0.44.3) [![commitssince](https://img.shields.io/github/commits-since/mindflavor/AzureSDKForRust/storage_blob_0.44.3)](https://github.com/MindFlavor/AzureSDKForRust/commits/master)
8+
[![tag](https://img.shields.io/github/tag/mindflavor/AzureSDKForRust.svg)](https://github.com/MindFlavor/AzureSDKForRust/tree/storage_core_0.44.3) [![release](https://img.shields.io/github/release/mindflavor/AzureSDKForRust.svg)](https://github.com/MindFlavor/AzureSDKForRust/releases/tag/storage_core_0.44.3) [![commitssince](https://img.shields.io/github/commits-since/mindflavor/AzureSDKForRust/storage_core_0.44.3)](https://github.com/MindFlavor/AzureSDKForRust/commits/master)
99

1010
[![GitHub contributors](https://img.shields.io/github/contributors/MindFlavor/AzureSDKForRust.svg)](https://github.com/MindFlavor/AzureSDKForRust/graphs/contributors)
1111

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.2"
3+
version = "0.41.3"
44
description = "Rust wrappers around Microsoft Azure REST APIs - Blob storage account crate"
55
readme = "README.md"
66
authors = ["Francesco Cogno <[email protected]>", "Max Gortman <[email protected]>"]
@@ -16,7 +16,7 @@ edition = "2018"
1616

1717
[dependencies]
1818
azure_sdk_core = { path = "../azure_sdk_core", version = "0.43.5" }
19-
azure_sdk_storage_core = { path = "../azure_sdk_storage_core", version = "0.44.2" }
19+
azure_sdk_storage_core = { path = "../azure_sdk_storage_core", version = "0.44.3" }
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.3"
3+
version = "0.44.4"
44
description = "Rust wrappers around Microsoft Azure REST APIs - Blob storage crate"
55
readme = "README.md"
66
authors = ["Francesco Cogno <[email protected]>", "Max Gortman <[email protected]>", "Dong Liu <[email protected]>"]
@@ -16,7 +16,7 @@ edition = "2018"
1616

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

azure_sdk_storage_blob/examples/blob_03_boxed_client.rs

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
#[macro_use]
22
extern crate log;
33

4+
use azure_sdk_core::errors::AzureError;
45
use azure_sdk_core::prelude::*;
56
use azure_sdk_storage_blob::prelude::*;
67
use azure_sdk_storage_core::prelude::*;
78
use std::error::Error;
9+
use std::sync::Arc;
810

911
#[tokio::main]
1012
async fn main() -> Result<(), Box<dyn Error>> {
@@ -22,7 +24,23 @@ async fn main() -> Result<(), Box<dyn Error>> {
2224
.expect("please specify blob name as command line parameter");
2325

2426
let client: Box<dyn Client> = Box::new(client::with_access_key(&account, &master_key));
27+
let s_content = get_blob_box(&client, &container, &blob).await?;
28+
println!("blob == {:?}", blob);
29+
println!("s_content == {}", s_content);
30+
31+
let client: Arc<dyn Client> = Arc::new(client::with_access_key(&account, &master_key));
32+
let s_content = get_blob_arc(client, &container, &blob).await?;
33+
println!("blob == {:?}", blob);
34+
println!("s_content == {}", s_content);
2535

36+
Ok(())
37+
}
38+
39+
async fn get_blob_box<'a>(
40+
client: &'a Box<dyn Client>,
41+
container: &'a str,
42+
blob: &'a str,
43+
) -> Result<String, AzureError> {
2644
trace!("Requesting blob");
2745

2846
let response = client
@@ -32,9 +50,22 @@ async fn main() -> Result<(), Box<dyn Error>> {
3250
.finalize()
3351
.await?;
3452

35-
let s_content = String::from_utf8(response.data)?;
36-
println!("blob == {:?}", blob);
37-
println!("s_content == {}", s_content);
53+
Ok(String::from_utf8(response.data)?)
54+
}
3855

39-
Ok(())
56+
async fn get_blob_arc<'a>(
57+
client: Arc<dyn Client>,
58+
container: &'a str,
59+
blob: &'a str,
60+
) -> Result<String, AzureError> {
61+
trace!("Requesting blob");
62+
63+
let response = client
64+
.get_blob()
65+
.with_container_name(&container)
66+
.with_blob_name(&blob)
67+
.finalize()
68+
.await?;
69+
70+
Ok(String::from_utf8(response.data)?)
4071
}

azure_sdk_storage_blob/src/blob/block_list.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use crate::blob::{BlobBlockType, BlockWithSizeList};
2-
use base64;
32
use std::borrow::Borrow;
43

54
#[derive(Default, Debug, Clone, PartialEq)]

azure_sdk_storage_blob/src/blob/block_with_size_list.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use crate::blob::BlobBlockType;
22
use crate::blob::BlobBlockWithSize;
33
use azure_sdk_core::errors::AzureError;
4-
use base64;
54
use std::borrow::Borrow;
65

76
#[derive(Debug, Deserialize)]

azure_sdk_storage_blob/src/blob/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ pub(crate) fn incomplete_vector_from_response(
423423
}
424424

425425
#[inline]
426-
pub(crate) fn generate_blob_uri<'a, C>(
426+
pub(crate) fn generate_blob_uri<C>(
427427
t: &C,
428428
container_name: &str,
429429
blob_name: &str,

azure_sdk_storage_blob/src/blob/requests/put_block_list_builder.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
"azure_sdk_core::lease::LeaseId",
1111
"azure_sdk_core::prelude::*",
1212
"hyper::{Method, StatusCode}",
13-
"md5",
1413
"azure_sdk_storage_core::prelude::*",
1514
"azure_sdk_core::add_content_md5_header",
1615
"azure_sdk_core::{Yes, No, ToAssign}",

azure_sdk_storage_blob/src/blob/requests/put_block_list_builder.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use azure_sdk_core::prelude::*;
99
use azure_sdk_core::{No, ToAssign, Yes};
1010
use azure_sdk_storage_core::prelude::*;
1111
use hyper::{Method, StatusCode};
12-
use md5;
1312
use std::borrow::Borrow;
1413
use std::collections::HashMap;
1514
use std::marker::PhantomData;

azure_sdk_storage_blob/src/container/mod.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -277,11 +277,7 @@ pub(crate) fn incomplete_vector_from_container_response(
277277
}
278278

279279
#[inline]
280-
pub(crate) fn generate_container_uri<'a, C>(
281-
c: &C,
282-
container_name: &str,
283-
params: Option<&str>,
284-
) -> String
280+
pub(crate) fn generate_container_uri<C>(c: &C, container_name: &str, params: Option<&str>) -> String
285281
where
286282
C: Client,
287283
{

0 commit comments

Comments
 (0)