fidl_fuchsia_hardware_block_volume/
fidl_fuchsia_hardware_block_volume.rs1#![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#[cfg(target_os = "fuchsia")]
27pub enum ServiceRequest {
28 Volume(fidl_fuchsia_storage_block::BlockRequestStream),
29 InlineEncryption(fidl_fuchsia_hardware_inlineencryption::DeviceRequestStream),
30 Token(fidl_fuchsia_driver_token::NodeTokenRequestStream),
31}
32
33#[cfg(target_os = "fuchsia")]
34impl fidl::endpoints::ServiceRequest for ServiceRequest {
35 type Service = ServiceMarker;
36
37 fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
38 match name {
39 "volume" => Self::Volume(
40 <fidl_fuchsia_storage_block::BlockRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
41 ),
42 "inline_encryption" => Self::InlineEncryption(
43 <fidl_fuchsia_hardware_inlineencryption::DeviceRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
44 ),
45 "token" => Self::Token(
46 <fidl_fuchsia_driver_token::NodeTokenRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
47 ),
48 _ => panic!("no such member protocol name for service Service"),
49 }
50 }
51
52 fn member_names() -> &'static [&'static str] {
53 &["volume", "inline_encryption", "token"]
54 }
55}
56#[cfg(target_os = "fuchsia")]
57pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
58
59#[cfg(target_os = "fuchsia")]
60impl fidl::endpoints::ServiceProxy for ServiceProxy {
61 type Service = ServiceMarker;
62
63 fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
64 Self(opener)
65 }
66}
67
68#[cfg(target_os = "fuchsia")]
69impl ServiceProxy {
70 pub fn connect_to_volume(&self) -> Result<fidl_fuchsia_storage_block::BlockProxy, fidl::Error> {
71 let (proxy, server_end) =
72 fidl::endpoints::create_proxy::<fidl_fuchsia_storage_block::BlockMarker>();
73 self.connect_channel_to_volume(server_end)?;
74 Ok(proxy)
75 }
76
77 pub fn connect_to_volume_sync(
80 &self,
81 ) -> Result<fidl_fuchsia_storage_block::BlockSynchronousProxy, fidl::Error> {
82 let (proxy, server_end) =
83 fidl::endpoints::create_sync_proxy::<fidl_fuchsia_storage_block::BlockMarker>();
84 self.connect_channel_to_volume(server_end)?;
85 Ok(proxy)
86 }
87
88 pub fn connect_channel_to_volume(
91 &self,
92 server_end: fidl::endpoints::ServerEnd<fidl_fuchsia_storage_block::BlockMarker>,
93 ) -> Result<(), fidl::Error> {
94 self.0.open_member("volume", server_end.into_channel())
95 }
96 pub fn connect_to_inline_encryption(
97 &self,
98 ) -> Result<fidl_fuchsia_hardware_inlineencryption::DeviceProxy, fidl::Error> {
99 let (proxy, server_end) =
100 fidl::endpoints::create_proxy::<fidl_fuchsia_hardware_inlineencryption::DeviceMarker>();
101 self.connect_channel_to_inline_encryption(server_end)?;
102 Ok(proxy)
103 }
104
105 pub fn connect_to_inline_encryption_sync(
108 &self,
109 ) -> Result<fidl_fuchsia_hardware_inlineencryption::DeviceSynchronousProxy, fidl::Error> {
110 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<
111 fidl_fuchsia_hardware_inlineencryption::DeviceMarker,
112 >();
113 self.connect_channel_to_inline_encryption(server_end)?;
114 Ok(proxy)
115 }
116
117 pub fn connect_channel_to_inline_encryption(
120 &self,
121 server_end: fidl::endpoints::ServerEnd<
122 fidl_fuchsia_hardware_inlineencryption::DeviceMarker,
123 >,
124 ) -> Result<(), fidl::Error> {
125 self.0.open_member("inline_encryption", server_end.into_channel())
126 }
127 pub fn connect_to_token(
128 &self,
129 ) -> Result<fidl_fuchsia_driver_token::NodeTokenProxy, fidl::Error> {
130 let (proxy, server_end) =
131 fidl::endpoints::create_proxy::<fidl_fuchsia_driver_token::NodeTokenMarker>();
132 self.connect_channel_to_token(server_end)?;
133 Ok(proxy)
134 }
135
136 pub fn connect_to_token_sync(
139 &self,
140 ) -> Result<fidl_fuchsia_driver_token::NodeTokenSynchronousProxy, fidl::Error> {
141 let (proxy, server_end) =
142 fidl::endpoints::create_sync_proxy::<fidl_fuchsia_driver_token::NodeTokenMarker>();
143 self.connect_channel_to_token(server_end)?;
144 Ok(proxy)
145 }
146
147 pub fn connect_channel_to_token(
150 &self,
151 server_end: fidl::endpoints::ServerEnd<fidl_fuchsia_driver_token::NodeTokenMarker>,
152 ) -> Result<(), fidl::Error> {
153 self.0.open_member("token", server_end.into_channel())
154 }
155
156 pub fn instance_name(&self) -> &str {
157 self.0.instance_name()
158 }
159}
160
161mod internal {
162 use super::*;
163}