azure_storage_blob 0.11.0

Microsoft Azure Blob Storage client library for Rust
Documentation
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
//
// Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT.

use super::{
    BlobItem, BlobServiceProperties, BlobTags, BlockLookupList, ContainerItem, ListBlobsResponse,
    ListContainersSegmentResponse, SignedIdentifiers,
};
use async_trait::async_trait;
use azure_core::{
    http::{pager::Page, RequestContent, XmlFormat},
    xml::to_xml,
    Result,
};

#[async_trait]
impl Page for ListBlobsResponse {
    type Item = BlobItem;
    type IntoIter = <Vec<BlobItem> as IntoIterator>::IntoIter;
    async fn into_items(self) -> Result<Self::IntoIter> {
        Ok(self.segment.blob_items.into_iter())
    }
}

#[async_trait]
impl Page for ListContainersSegmentResponse {
    type Item = ContainerItem;
    type IntoIter = <Vec<ContainerItem> as IntoIterator>::IntoIter;
    async fn into_items(self) -> Result<Self::IntoIter> {
        Ok(self.container_items.into_iter())
    }
}

impl TryFrom<BlobServiceProperties> for RequestContent<BlobServiceProperties, XmlFormat> {
    type Error = azure_core::Error;
    fn try_from(value: BlobServiceProperties) -> Result<Self> {
        Ok(to_xml(&value)?.into())
    }
}

impl TryFrom<BlobTags> for RequestContent<BlobTags, XmlFormat> {
    type Error = azure_core::Error;
    fn try_from(value: BlobTags) -> Result<Self> {
        Ok(to_xml(&value)?.into())
    }
}

impl TryFrom<BlockLookupList> for RequestContent<BlockLookupList, XmlFormat> {
    type Error = azure_core::Error;
    fn try_from(value: BlockLookupList) -> Result<Self> {
        Ok(to_xml(&value)?.into())
    }
}

impl TryFrom<SignedIdentifiers> for RequestContent<SignedIdentifiers, XmlFormat> {
    type Error = azure_core::Error;
    fn try_from(value: SignedIdentifiers) -> Result<Self> {
        Ok(to_xml(&value)?.into())
    }
}