Skip to main content

azure_storage_blob/generated/models/
models_impl.rs

1// Copyright (c) Microsoft Corporation. All rights reserved.
2// Licensed under the MIT License.
3//
4// Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT.
5
6use super::{
7    BlobItem, BlobServiceProperties, BlobTags, BlockLookupList, ContainerItem, FilterBlobItem,
8    FilteredBlobResponse, KeyInfo, ListBlobsResponse, ListContainersResponse, SignedIdentifiers,
9};
10use async_trait::async_trait;
11use azure_core::{
12    http::{pager::Page, RequestContent, XmlFormat},
13    xml::to_xml,
14    Result,
15};
16
17#[async_trait]
18impl Page for FilteredBlobResponse {
19    type Item = FilterBlobItem;
20    type IntoIter = <Vec<FilterBlobItem> as IntoIterator>::IntoIter;
21    async fn into_items(self) -> Result<Self::IntoIter> {
22        Ok(self.blob_items.into_iter())
23    }
24}
25
26#[async_trait]
27impl Page for ListBlobsResponse {
28    type Item = BlobItem;
29    type IntoIter = <Vec<BlobItem> as IntoIterator>::IntoIter;
30    async fn into_items(self) -> Result<Self::IntoIter> {
31        Ok(self.blob_items.into_iter())
32    }
33}
34
35#[async_trait]
36impl Page for ListContainersResponse {
37    type Item = ContainerItem;
38    type IntoIter = <Vec<ContainerItem> as IntoIterator>::IntoIter;
39    async fn into_items(self) -> Result<Self::IntoIter> {
40        Ok(self.container_items.into_iter())
41    }
42}
43
44impl TryFrom<BlobServiceProperties> for RequestContent<BlobServiceProperties, XmlFormat> {
45    type Error = azure_core::Error;
46    fn try_from(value: BlobServiceProperties) -> Result<Self> {
47        Ok(to_xml(&value)?.into())
48    }
49}
50
51impl TryFrom<BlobTags> for RequestContent<BlobTags, XmlFormat> {
52    type Error = azure_core::Error;
53    fn try_from(value: BlobTags) -> Result<Self> {
54        Ok(to_xml(&value)?.into())
55    }
56}
57
58impl TryFrom<BlockLookupList> for RequestContent<BlockLookupList, XmlFormat> {
59    type Error = azure_core::Error;
60    fn try_from(value: BlockLookupList) -> Result<Self> {
61        Ok(to_xml(&value)?.into())
62    }
63}
64
65impl TryFrom<KeyInfo> for RequestContent<KeyInfo, XmlFormat> {
66    type Error = azure_core::Error;
67    fn try_from(value: KeyInfo) -> Result<Self> {
68        Ok(to_xml(&value)?.into())
69    }
70}
71
72impl TryFrom<SignedIdentifiers> for RequestContent<SignedIdentifiers, XmlFormat> {
73    type Error = azure_core::Error;
74    fn try_from(value: SignedIdentifiers) -> Result<Self> {
75        Ok(to_xml(&value)?.into())
76    }
77}