fidl_fuchsia_test_intl_manager/
fidl_fuchsia_test_intl_manager.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_test_intl_manager__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
15pub struct PropertyManagerMarker;
16
17impl fidl::endpoints::ProtocolMarker for PropertyManagerMarker {
18 type Proxy = PropertyManagerProxy;
19 type RequestStream = PropertyManagerRequestStream;
20 #[cfg(target_os = "fuchsia")]
21 type SynchronousProxy = PropertyManagerSynchronousProxy;
22
23 const DEBUG_NAME: &'static str = "fuchsia.test.intl.manager.PropertyManager";
24}
25impl fidl::endpoints::DiscoverableProtocolMarker for PropertyManagerMarker {}
26
27pub trait PropertyManagerProxyInterface: Send + Sync {
28 type SetProfileResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
29 fn r#set_profile(
30 &self,
31 intl_profile: &fidl_fuchsia_intl::Profile,
32 ) -> Self::SetProfileResponseFut;
33}
34#[derive(Debug)]
35#[cfg(target_os = "fuchsia")]
36pub struct PropertyManagerSynchronousProxy {
37 client: fidl::client::sync::Client,
38}
39
40#[cfg(target_os = "fuchsia")]
41impl fidl::endpoints::SynchronousProxy for PropertyManagerSynchronousProxy {
42 type Proxy = PropertyManagerProxy;
43 type Protocol = PropertyManagerMarker;
44
45 fn from_channel(inner: fidl::Channel) -> Self {
46 Self::new(inner)
47 }
48
49 fn into_channel(self) -> fidl::Channel {
50 self.client.into_channel()
51 }
52
53 fn as_channel(&self) -> &fidl::Channel {
54 self.client.as_channel()
55 }
56}
57
58#[cfg(target_os = "fuchsia")]
59impl PropertyManagerSynchronousProxy {
60 pub fn new(channel: fidl::Channel) -> Self {
61 Self { client: fidl::client::sync::Client::new(channel) }
62 }
63
64 pub fn into_channel(self) -> fidl::Channel {
65 self.client.into_channel()
66 }
67
68 pub fn wait_for_event(
71 &self,
72 deadline: zx::MonotonicInstant,
73 ) -> Result<PropertyManagerEvent, fidl::Error> {
74 PropertyManagerEvent::decode(self.client.wait_for_event::<PropertyManagerMarker>(deadline)?)
75 }
76
77 pub fn r#set_profile(
79 &self,
80 mut intl_profile: &fidl_fuchsia_intl::Profile,
81 ___deadline: zx::MonotonicInstant,
82 ) -> Result<(), fidl::Error> {
83 let _response = self.client.send_query::<
84 PropertyManagerSetProfileRequest,
85 fidl::encoding::EmptyPayload,
86 PropertyManagerMarker,
87 >(
88 (intl_profile,),
89 0x359d8cfc3cdd020d,
90 fidl::encoding::DynamicFlags::empty(),
91 ___deadline,
92 )?;
93 Ok(_response)
94 }
95}
96
97#[cfg(target_os = "fuchsia")]
98impl From<PropertyManagerSynchronousProxy> for zx::NullableHandle {
99 fn from(value: PropertyManagerSynchronousProxy) -> Self {
100 value.into_channel().into()
101 }
102}
103
104#[cfg(target_os = "fuchsia")]
105impl From<fidl::Channel> for PropertyManagerSynchronousProxy {
106 fn from(value: fidl::Channel) -> Self {
107 Self::new(value)
108 }
109}
110
111#[cfg(target_os = "fuchsia")]
112impl fidl::endpoints::FromClient for PropertyManagerSynchronousProxy {
113 type Protocol = PropertyManagerMarker;
114
115 fn from_client(value: fidl::endpoints::ClientEnd<PropertyManagerMarker>) -> Self {
116 Self::new(value.into_channel())
117 }
118}
119
120#[derive(Debug, Clone)]
121pub struct PropertyManagerProxy {
122 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
123}
124
125impl fidl::endpoints::Proxy for PropertyManagerProxy {
126 type Protocol = PropertyManagerMarker;
127
128 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
129 Self::new(inner)
130 }
131
132 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
133 self.client.into_channel().map_err(|client| Self { client })
134 }
135
136 fn as_channel(&self) -> &::fidl::AsyncChannel {
137 self.client.as_channel()
138 }
139}
140
141impl PropertyManagerProxy {
142 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
144 let protocol_name = <PropertyManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
145 Self { client: fidl::client::Client::new(channel, protocol_name) }
146 }
147
148 pub fn take_event_stream(&self) -> PropertyManagerEventStream {
154 PropertyManagerEventStream { event_receiver: self.client.take_event_receiver() }
155 }
156
157 pub fn r#set_profile(
159 &self,
160 mut intl_profile: &fidl_fuchsia_intl::Profile,
161 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
162 PropertyManagerProxyInterface::r#set_profile(self, intl_profile)
163 }
164}
165
166impl PropertyManagerProxyInterface for PropertyManagerProxy {
167 type SetProfileResponseFut =
168 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
169 fn r#set_profile(
170 &self,
171 mut intl_profile: &fidl_fuchsia_intl::Profile,
172 ) -> Self::SetProfileResponseFut {
173 fn _decode(
174 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
175 ) -> Result<(), fidl::Error> {
176 let _response = fidl::client::decode_transaction_body::<
177 fidl::encoding::EmptyPayload,
178 fidl::encoding::DefaultFuchsiaResourceDialect,
179 0x359d8cfc3cdd020d,
180 >(_buf?)?;
181 Ok(_response)
182 }
183 self.client.send_query_and_decode::<PropertyManagerSetProfileRequest, ()>(
184 (intl_profile,),
185 0x359d8cfc3cdd020d,
186 fidl::encoding::DynamicFlags::empty(),
187 _decode,
188 )
189 }
190}
191
192pub struct PropertyManagerEventStream {
193 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
194}
195
196impl std::marker::Unpin for PropertyManagerEventStream {}
197
198impl futures::stream::FusedStream for PropertyManagerEventStream {
199 fn is_terminated(&self) -> bool {
200 self.event_receiver.is_terminated()
201 }
202}
203
204impl futures::Stream for PropertyManagerEventStream {
205 type Item = Result<PropertyManagerEvent, fidl::Error>;
206
207 fn poll_next(
208 mut self: std::pin::Pin<&mut Self>,
209 cx: &mut std::task::Context<'_>,
210 ) -> std::task::Poll<Option<Self::Item>> {
211 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
212 &mut self.event_receiver,
213 cx
214 )?) {
215 Some(buf) => std::task::Poll::Ready(Some(PropertyManagerEvent::decode(buf))),
216 None => std::task::Poll::Ready(None),
217 }
218 }
219}
220
221#[derive(Debug)]
222pub enum PropertyManagerEvent {}
223
224impl PropertyManagerEvent {
225 fn decode(
227 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
228 ) -> Result<PropertyManagerEvent, fidl::Error> {
229 let (bytes, _handles) = buf.split_mut();
230 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
231 debug_assert_eq!(tx_header.tx_id, 0);
232 match tx_header.ordinal {
233 _ => Err(fidl::Error::UnknownOrdinal {
234 ordinal: tx_header.ordinal,
235 protocol_name:
236 <PropertyManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
237 }),
238 }
239 }
240}
241
242pub struct PropertyManagerRequestStream {
244 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
245 is_terminated: bool,
246}
247
248impl std::marker::Unpin for PropertyManagerRequestStream {}
249
250impl futures::stream::FusedStream for PropertyManagerRequestStream {
251 fn is_terminated(&self) -> bool {
252 self.is_terminated
253 }
254}
255
256impl fidl::endpoints::RequestStream for PropertyManagerRequestStream {
257 type Protocol = PropertyManagerMarker;
258 type ControlHandle = PropertyManagerControlHandle;
259
260 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
261 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
262 }
263
264 fn control_handle(&self) -> Self::ControlHandle {
265 PropertyManagerControlHandle { inner: self.inner.clone() }
266 }
267
268 fn into_inner(
269 self,
270 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
271 {
272 (self.inner, self.is_terminated)
273 }
274
275 fn from_inner(
276 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
277 is_terminated: bool,
278 ) -> Self {
279 Self { inner, is_terminated }
280 }
281}
282
283impl futures::Stream for PropertyManagerRequestStream {
284 type Item = Result<PropertyManagerRequest, fidl::Error>;
285
286 fn poll_next(
287 mut self: std::pin::Pin<&mut Self>,
288 cx: &mut std::task::Context<'_>,
289 ) -> std::task::Poll<Option<Self::Item>> {
290 let this = &mut *self;
291 if this.inner.check_shutdown(cx) {
292 this.is_terminated = true;
293 return std::task::Poll::Ready(None);
294 }
295 if this.is_terminated {
296 panic!("polled PropertyManagerRequestStream after completion");
297 }
298 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
299 |bytes, handles| {
300 match this.inner.channel().read_etc(cx, bytes, handles) {
301 std::task::Poll::Ready(Ok(())) => {}
302 std::task::Poll::Pending => return std::task::Poll::Pending,
303 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
304 this.is_terminated = true;
305 return std::task::Poll::Ready(None);
306 }
307 std::task::Poll::Ready(Err(e)) => {
308 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
309 e.into(),
310 ))));
311 }
312 }
313
314 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
316
317 std::task::Poll::Ready(Some(match header.ordinal {
318 0x359d8cfc3cdd020d => {
319 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
320 let mut req = fidl::new_empty!(
321 PropertyManagerSetProfileRequest,
322 fidl::encoding::DefaultFuchsiaResourceDialect
323 );
324 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PropertyManagerSetProfileRequest>(&header, _body_bytes, handles, &mut req)?;
325 let control_handle =
326 PropertyManagerControlHandle { inner: this.inner.clone() };
327 Ok(PropertyManagerRequest::SetProfile {
328 intl_profile: req.intl_profile,
329
330 responder: PropertyManagerSetProfileResponder {
331 control_handle: std::mem::ManuallyDrop::new(control_handle),
332 tx_id: header.tx_id,
333 },
334 })
335 }
336 _ => Err(fidl::Error::UnknownOrdinal {
337 ordinal: header.ordinal,
338 protocol_name:
339 <PropertyManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
340 }),
341 }))
342 },
343 )
344 }
345}
346
347#[derive(Debug)]
355pub enum PropertyManagerRequest {
356 SetProfile {
358 intl_profile: fidl_fuchsia_intl::Profile,
359 responder: PropertyManagerSetProfileResponder,
360 },
361}
362
363impl PropertyManagerRequest {
364 #[allow(irrefutable_let_patterns)]
365 pub fn into_set_profile(
366 self,
367 ) -> Option<(fidl_fuchsia_intl::Profile, PropertyManagerSetProfileResponder)> {
368 if let PropertyManagerRequest::SetProfile { intl_profile, responder } = self {
369 Some((intl_profile, responder))
370 } else {
371 None
372 }
373 }
374
375 pub fn method_name(&self) -> &'static str {
377 match *self {
378 PropertyManagerRequest::SetProfile { .. } => "set_profile",
379 }
380 }
381}
382
383#[derive(Debug, Clone)]
384pub struct PropertyManagerControlHandle {
385 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
386}
387
388impl fidl::endpoints::ControlHandle for PropertyManagerControlHandle {
389 fn shutdown(&self) {
390 self.inner.shutdown()
391 }
392
393 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
394 self.inner.shutdown_with_epitaph(status)
395 }
396
397 fn is_closed(&self) -> bool {
398 self.inner.channel().is_closed()
399 }
400 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
401 self.inner.channel().on_closed()
402 }
403
404 #[cfg(target_os = "fuchsia")]
405 fn signal_peer(
406 &self,
407 clear_mask: zx::Signals,
408 set_mask: zx::Signals,
409 ) -> Result<(), zx_status::Status> {
410 use fidl::Peered;
411 self.inner.channel().signal_peer(clear_mask, set_mask)
412 }
413}
414
415impl PropertyManagerControlHandle {}
416
417#[must_use = "FIDL methods require a response to be sent"]
418#[derive(Debug)]
419pub struct PropertyManagerSetProfileResponder {
420 control_handle: std::mem::ManuallyDrop<PropertyManagerControlHandle>,
421 tx_id: u32,
422}
423
424impl std::ops::Drop for PropertyManagerSetProfileResponder {
428 fn drop(&mut self) {
429 self.control_handle.shutdown();
430 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
432 }
433}
434
435impl fidl::endpoints::Responder for PropertyManagerSetProfileResponder {
436 type ControlHandle = PropertyManagerControlHandle;
437
438 fn control_handle(&self) -> &PropertyManagerControlHandle {
439 &self.control_handle
440 }
441
442 fn drop_without_shutdown(mut self) {
443 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
445 std::mem::forget(self);
447 }
448}
449
450impl PropertyManagerSetProfileResponder {
451 pub fn send(self) -> Result<(), fidl::Error> {
455 let _result = self.send_raw();
456 if _result.is_err() {
457 self.control_handle.shutdown();
458 }
459 self.drop_without_shutdown();
460 _result
461 }
462
463 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
465 let _result = self.send_raw();
466 self.drop_without_shutdown();
467 _result
468 }
469
470 fn send_raw(&self) -> Result<(), fidl::Error> {
471 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
472 (),
473 self.tx_id,
474 0x359d8cfc3cdd020d,
475 fidl::encoding::DynamicFlags::empty(),
476 )
477 }
478}
479
480mod internal {
481 use super::*;
482}