Skip to main content

fidl_fuchsia_hardware_block_volume/
fidl_fuchsia_hardware_block_volume.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10pub use fidl_fuchsia_hardware_block_volume_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
15pub struct ServiceMarker;
16
17#[cfg(target_os = "fuchsia")]
18impl fidl::endpoints::ServiceMarker for ServiceMarker {
19    type Proxy = ServiceProxy;
20    type Request = ServiceRequest;
21    const SERVICE_NAME: &'static str = "fuchsia.hardware.block.volume.Service";
22}
23
24/// A request for one of the member protocols of Service.
25///
26#[cfg(target_os = "fuchsia")]
27pub enum ServiceRequest {
28    Volume(fidl_fuchsia_storage_block::BlockRequestStream),
29    Mapper(fidl_fuchsia_storage_block::MapperRequestStream),
30    InlineEncryption(fidl_fuchsia_hardware_inlineencryption::DeviceRequestStream),
31    Token(fidl_fuchsia_driver_token::NodeTokenRequestStream),
32}
33
34#[cfg(target_os = "fuchsia")]
35impl fidl::endpoints::ServiceRequest for ServiceRequest {
36    type Service = ServiceMarker;
37
38    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
39        match name {
40            "volume" => Self::Volume(
41                <fidl_fuchsia_storage_block::BlockRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
42            ),
43            "mapper" => Self::Mapper(
44                <fidl_fuchsia_storage_block::MapperRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
45            ),
46            "inline_encryption" => Self::InlineEncryption(
47                <fidl_fuchsia_hardware_inlineencryption::DeviceRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
48            ),
49            "token" => Self::Token(
50                <fidl_fuchsia_driver_token::NodeTokenRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
51            ),
52            _ => panic!("no such member protocol name for service Service"),
53        }
54    }
55
56    fn member_names() -> &'static [&'static str] {
57        &["volume", "mapper", "inline_encryption", "token"]
58    }
59}
60#[cfg(target_os = "fuchsia")]
61pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
62
63#[cfg(target_os = "fuchsia")]
64impl fidl::endpoints::ServiceProxy for ServiceProxy {
65    type Service = ServiceMarker;
66
67    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
68        Self(opener)
69    }
70}
71
72#[cfg(target_os = "fuchsia")]
73impl ServiceProxy {
74    pub fn connect_to_volume(&self) -> Result<fidl_fuchsia_storage_block::BlockProxy, fidl::Error> {
75        let (proxy, server_end) =
76            fidl::endpoints::create_proxy::<fidl_fuchsia_storage_block::BlockMarker>();
77        self.connect_channel_to_volume(server_end)?;
78        Ok(proxy)
79    }
80
81    /// Like `connect_to_volume`, but returns a sync proxy.
82    /// See [`Self::connect_to_volume`] for more details.
83    pub fn connect_to_volume_sync(
84        &self,
85    ) -> Result<fidl_fuchsia_storage_block::BlockSynchronousProxy, fidl::Error> {
86        let (proxy, server_end) =
87            fidl::endpoints::create_sync_proxy::<fidl_fuchsia_storage_block::BlockMarker>();
88        self.connect_channel_to_volume(server_end)?;
89        Ok(proxy)
90    }
91
92    /// Like `connect_to_volume`, but accepts a server end.
93    /// See [`Self::connect_to_volume`] for more details.
94    pub fn connect_channel_to_volume(
95        &self,
96        server_end: fidl::endpoints::ServerEnd<fidl_fuchsia_storage_block::BlockMarker>,
97    ) -> Result<(), fidl::Error> {
98        self.0.open_member("volume", server_end.into_channel())
99    }
100    pub fn connect_to_mapper(
101        &self,
102    ) -> Result<fidl_fuchsia_storage_block::MapperProxy, fidl::Error> {
103        let (proxy, server_end) =
104            fidl::endpoints::create_proxy::<fidl_fuchsia_storage_block::MapperMarker>();
105        self.connect_channel_to_mapper(server_end)?;
106        Ok(proxy)
107    }
108
109    /// Like `connect_to_mapper`, but returns a sync proxy.
110    /// See [`Self::connect_to_mapper`] for more details.
111    pub fn connect_to_mapper_sync(
112        &self,
113    ) -> Result<fidl_fuchsia_storage_block::MapperSynchronousProxy, fidl::Error> {
114        let (proxy, server_end) =
115            fidl::endpoints::create_sync_proxy::<fidl_fuchsia_storage_block::MapperMarker>();
116        self.connect_channel_to_mapper(server_end)?;
117        Ok(proxy)
118    }
119
120    /// Like `connect_to_mapper`, but accepts a server end.
121    /// See [`Self::connect_to_mapper`] for more details.
122    pub fn connect_channel_to_mapper(
123        &self,
124        server_end: fidl::endpoints::ServerEnd<fidl_fuchsia_storage_block::MapperMarker>,
125    ) -> Result<(), fidl::Error> {
126        self.0.open_member("mapper", server_end.into_channel())
127    }
128    pub fn connect_to_inline_encryption(
129        &self,
130    ) -> Result<fidl_fuchsia_hardware_inlineencryption::DeviceProxy, fidl::Error> {
131        let (proxy, server_end) =
132            fidl::endpoints::create_proxy::<fidl_fuchsia_hardware_inlineencryption::DeviceMarker>();
133        self.connect_channel_to_inline_encryption(server_end)?;
134        Ok(proxy)
135    }
136
137    /// Like `connect_to_inline_encryption`, but returns a sync proxy.
138    /// See [`Self::connect_to_inline_encryption`] for more details.
139    pub fn connect_to_inline_encryption_sync(
140        &self,
141    ) -> Result<fidl_fuchsia_hardware_inlineencryption::DeviceSynchronousProxy, fidl::Error> {
142        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<
143            fidl_fuchsia_hardware_inlineencryption::DeviceMarker,
144        >();
145        self.connect_channel_to_inline_encryption(server_end)?;
146        Ok(proxy)
147    }
148
149    /// Like `connect_to_inline_encryption`, but accepts a server end.
150    /// See [`Self::connect_to_inline_encryption`] for more details.
151    pub fn connect_channel_to_inline_encryption(
152        &self,
153        server_end: fidl::endpoints::ServerEnd<
154            fidl_fuchsia_hardware_inlineencryption::DeviceMarker,
155        >,
156    ) -> Result<(), fidl::Error> {
157        self.0.open_member("inline_encryption", server_end.into_channel())
158    }
159    pub fn connect_to_token(
160        &self,
161    ) -> Result<fidl_fuchsia_driver_token::NodeTokenProxy, fidl::Error> {
162        let (proxy, server_end) =
163            fidl::endpoints::create_proxy::<fidl_fuchsia_driver_token::NodeTokenMarker>();
164        self.connect_channel_to_token(server_end)?;
165        Ok(proxy)
166    }
167
168    /// Like `connect_to_token`, but returns a sync proxy.
169    /// See [`Self::connect_to_token`] for more details.
170    pub fn connect_to_token_sync(
171        &self,
172    ) -> Result<fidl_fuchsia_driver_token::NodeTokenSynchronousProxy, fidl::Error> {
173        let (proxy, server_end) =
174            fidl::endpoints::create_sync_proxy::<fidl_fuchsia_driver_token::NodeTokenMarker>();
175        self.connect_channel_to_token(server_end)?;
176        Ok(proxy)
177    }
178
179    /// Like `connect_to_token`, but accepts a server end.
180    /// See [`Self::connect_to_token`] for more details.
181    pub fn connect_channel_to_token(
182        &self,
183        server_end: fidl::endpoints::ServerEnd<fidl_fuchsia_driver_token::NodeTokenMarker>,
184    ) -> Result<(), fidl::Error> {
185        self.0.open_member("token", server_end.into_channel())
186    }
187
188    pub fn instance_name(&self) -> &str {
189        self.0.instance_name()
190    }
191}
192
193mod internal {
194    use super::*;
195}