azure_sdk_storage_queue/clients/
queue_service_client.rs1use crate::requests;
2use crate::{HasStorageClient, IntoQueueServiceClient, QueueService, WithQueueServiceClient};
3use azure_sdk_storage_core::Client;
4use std::borrow::Cow;
5use std::fmt::Debug;
6
7#[derive(Debug, Clone)]
8pub struct QueueServiceClient<'a, C>
9where
10 C: Client + Clone,
11{
12 pub storage_client: Cow<'a, C>,
13}
14
15impl<'a, C> HasStorageClient for QueueServiceClient<'a, C>
16where
17 C: Client + Clone,
18{
19 type StorageClient = C;
20
21 fn storage_client(&self) -> &C {
22 self.storage_client.as_ref()
23 }
24}
25
26impl<'a, C> WithQueueServiceClient<'a> for C
27where
28 C: Client + 'a + Clone,
29{
30 type QueueServiceClient = QueueServiceClient<'a, C>;
31
32 fn with_queue_service_client(&'a self) -> Self::QueueServiceClient {
33 QueueServiceClient {
34 storage_client: Cow::Borrowed(self),
35 }
36 }
37}
38
39impl<C> IntoQueueServiceClient for C
40where
41 C: Client + 'static + Clone,
42{
43 type QueueServiceClient = QueueServiceClient<'static, C>;
44
45 fn into_queue_service_client(self) -> Self::QueueServiceClient {
46 QueueServiceClient {
47 storage_client: Cow::Owned(self),
48 }
49 }
50}
51
52impl<'a, C> QueueService for QueueServiceClient<'a, C>
53where
54 C: Client + Clone,
55{
56 fn list_queues(&self) -> requests::ListQueuesBuilder<'_, '_, Self::StorageClient> {
57 crate::requests::ListQueuesBuilder::new(self)
58 }
59}