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

Commit ff2d844

Browse files
author
Francesco Cogno
authored
Storage blob - functions must not require cloneable Client if no stream function is called (#316)
* relaxed list_blobs requirements if not calling `stream`
1 parent 5c90b4a commit ff2d844

File tree

3 files changed

+35
-3
lines changed

3 files changed

+35
-3
lines changed

azure_sdk_storage_blob/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "azure_sdk_storage_blob"
3-
version = "0.45.1"
3+
version = "0.45.2"
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]>"]

azure_sdk_storage_blob/examples/blob_03_boxed_client.rs

+28
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,34 @@ async fn main() -> Result<(), Box<dyn Error>> {
3636
Ok(())
3737
}
3838

39+
async fn list_blobs_box<'a>(
40+
client: &'a Box<dyn Client>,
41+
container: &'a str,
42+
) -> Result<(), AzureError> {
43+
client
44+
.list_blobs()
45+
.with_max_results(100)
46+
.with_container_name(container)
47+
.finalize()
48+
.await?;
49+
50+
Ok(())
51+
}
52+
53+
async fn list_blobs_arc<'a>(
54+
client: &'a Arc<dyn Client>,
55+
container: &'a str,
56+
) -> Result<(), AzureError> {
57+
client
58+
.list_blobs()
59+
.with_max_results(100)
60+
.with_container_name(container)
61+
.finalize()
62+
.await?;
63+
64+
Ok(())
65+
}
66+
3967
async fn get_blob_box<'a>(
4068
client: &'a Box<dyn Client>,
4169
container: &'a str,

azure_sdk_storage_blob/src/container/requests/list_blobs_builder.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -540,10 +540,9 @@ where
540540

541541
impl<'a, C> IncludeListOptions for ListBlobBuilder<'a, C, Yes> where C: Client {}
542542

543-
// methods callable only when every mandatory field has been filled
544543
impl<'a, C> ListBlobBuilder<'a, C, Yes>
545544
where
546-
C: Client + Clone,
545+
C: Client,
547546
{
548547
pub async fn finalize(self) -> Result<ListBlobsResponse, AzureError> {
549548
// we create a copy to move into the future's closure.
@@ -584,7 +583,12 @@ where
584583
.await?;
585584
ListBlobsResponse::from_response(&container_name, &headers, &body_as_str)
586585
}
586+
}
587587

588+
impl<'a, C> ListBlobBuilder<'a, C, Yes>
589+
where
590+
C: Client + Clone,
591+
{
588592
pub fn stream(self) -> impl Stream<Item = Result<ListBlobsResponse, AzureError>> + 'a {
589593
#[derive(Debug, Clone, PartialEq)]
590594
enum States {

0 commit comments

Comments
 (0)