1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fdomain_client::fidl::{ControlHandle as _, FDomainFlexibleIntoResult as _, Responder as _};
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9pub use fidl_fuchsia_unknown__common::*;
10use futures::future::{self, MaybeDone, TryFutureExt};
11use zx_status;
12
13#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
14pub struct CloneableCloneRequest {
15 pub request: fdomain_client::fidl::ServerEnd<CloneableMarker>,
16}
17
18impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect> for CloneableCloneRequest {}
19
20#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
21pub struct CloneableMarker;
22
23impl fdomain_client::fidl::ProtocolMarker for CloneableMarker {
24 type Proxy = CloneableProxy;
25 type RequestStream = CloneableRequestStream;
26
27 const DEBUG_NAME: &'static str = "(anonymous) Cloneable";
28}
29
30pub trait CloneableProxyInterface: Send + Sync {
31 fn r#clone(
32 &self,
33 request: fdomain_client::fidl::ServerEnd<CloneableMarker>,
34 ) -> Result<(), fidl::Error>;
35}
36
37#[derive(Debug, Clone)]
38pub struct CloneableProxy {
39 client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
40}
41
42impl fdomain_client::fidl::Proxy for CloneableProxy {
43 type Protocol = CloneableMarker;
44
45 fn from_channel(inner: fdomain_client::Channel) -> Self {
46 Self::new(inner)
47 }
48
49 fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
50 self.client.into_channel().map_err(|client| Self { client })
51 }
52
53 fn as_channel(&self) -> &fdomain_client::Channel {
54 self.client.as_channel()
55 }
56}
57
58impl CloneableProxy {
59 pub fn new(channel: fdomain_client::Channel) -> Self {
61 let protocol_name = <CloneableMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
62 Self { client: fidl::client::Client::new(channel, protocol_name) }
63 }
64
65 pub fn take_event_stream(&self) -> CloneableEventStream {
71 CloneableEventStream { event_receiver: self.client.take_event_receiver() }
72 }
73
74 pub fn r#clone(
75 &self,
76 mut request: fdomain_client::fidl::ServerEnd<CloneableMarker>,
77 ) -> Result<(), fidl::Error> {
78 CloneableProxyInterface::r#clone(self, request)
79 }
80}
81
82impl CloneableProxyInterface for CloneableProxy {
83 fn r#clone(
84 &self,
85 mut request: fdomain_client::fidl::ServerEnd<CloneableMarker>,
86 ) -> Result<(), fidl::Error> {
87 self.client.send::<CloneableCloneRequest>(
88 (request,),
89 0x20d8a7aba2168a79,
90 fidl::encoding::DynamicFlags::empty(),
91 )
92 }
93}
94
95pub struct CloneableEventStream {
96 event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
97}
98
99impl std::marker::Unpin for CloneableEventStream {}
100
101impl futures::stream::FusedStream for CloneableEventStream {
102 fn is_terminated(&self) -> bool {
103 self.event_receiver.is_terminated()
104 }
105}
106
107impl futures::Stream for CloneableEventStream {
108 type Item = Result<CloneableEvent, fidl::Error>;
109
110 fn poll_next(
111 mut self: std::pin::Pin<&mut Self>,
112 cx: &mut std::task::Context<'_>,
113 ) -> std::task::Poll<Option<Self::Item>> {
114 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
115 &mut self.event_receiver,
116 cx
117 )?) {
118 Some(buf) => std::task::Poll::Ready(Some(CloneableEvent::decode(buf))),
119 None => std::task::Poll::Ready(None),
120 }
121 }
122}
123
124#[derive(Debug)]
125pub enum CloneableEvent {}
126
127impl CloneableEvent {
128 fn decode(
130 mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
131 ) -> Result<CloneableEvent, fidl::Error> {
132 let (bytes, _handles) = buf.split_mut();
133 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
134 debug_assert_eq!(tx_header.tx_id, 0);
135 match tx_header.ordinal {
136 _ => Err(fidl::Error::UnknownOrdinal {
137 ordinal: tx_header.ordinal,
138 protocol_name:
139 <CloneableMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
140 }),
141 }
142 }
143}
144
145pub struct CloneableRequestStream {
147 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
148 is_terminated: bool,
149}
150
151impl std::marker::Unpin for CloneableRequestStream {}
152
153impl futures::stream::FusedStream for CloneableRequestStream {
154 fn is_terminated(&self) -> bool {
155 self.is_terminated
156 }
157}
158
159impl fdomain_client::fidl::RequestStream for CloneableRequestStream {
160 type Protocol = CloneableMarker;
161 type ControlHandle = CloneableControlHandle;
162
163 fn from_channel(channel: fdomain_client::Channel) -> Self {
164 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
165 }
166
167 fn control_handle(&self) -> Self::ControlHandle {
168 CloneableControlHandle { inner: self.inner.clone() }
169 }
170
171 fn into_inner(
172 self,
173 ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
174 {
175 (self.inner, self.is_terminated)
176 }
177
178 fn from_inner(
179 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
180 is_terminated: bool,
181 ) -> Self {
182 Self { inner, is_terminated }
183 }
184}
185
186impl futures::Stream for CloneableRequestStream {
187 type Item = Result<CloneableRequest, fidl::Error>;
188
189 fn poll_next(
190 mut self: std::pin::Pin<&mut Self>,
191 cx: &mut std::task::Context<'_>,
192 ) -> std::task::Poll<Option<Self::Item>> {
193 let this = &mut *self;
194 if this.inner.check_shutdown(cx) {
195 this.is_terminated = true;
196 return std::task::Poll::Ready(None);
197 }
198 if this.is_terminated {
199 panic!("polled CloneableRequestStream after completion");
200 }
201 fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
202 |bytes, handles| {
203 match this.inner.channel().read_etc(cx, bytes, handles) {
204 std::task::Poll::Ready(Ok(())) => {}
205 std::task::Poll::Pending => return std::task::Poll::Pending,
206 std::task::Poll::Ready(Err(None)) => {
207 this.is_terminated = true;
208 return std::task::Poll::Ready(None);
209 }
210 std::task::Poll::Ready(Err(Some(e))) => {
211 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
212 e.into(),
213 ))))
214 }
215 }
216
217 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
219
220 std::task::Poll::Ready(Some(match header.ordinal {
221 0x20d8a7aba2168a79 => {
222 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
223 let mut req = fidl::new_empty!(
224 CloneableCloneRequest,
225 fdomain_client::fidl::FDomainResourceDialect
226 );
227 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<CloneableCloneRequest>(&header, _body_bytes, handles, &mut req)?;
228 let control_handle = CloneableControlHandle { inner: this.inner.clone() };
229 Ok(CloneableRequest::Clone { request: req.request, control_handle })
230 }
231 _ => Err(fidl::Error::UnknownOrdinal {
232 ordinal: header.ordinal,
233 protocol_name:
234 <CloneableMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
235 }),
236 }))
237 },
238 )
239 }
240}
241
242#[derive(Debug)]
247pub enum CloneableRequest {
248 Clone {
249 request: fdomain_client::fidl::ServerEnd<CloneableMarker>,
250 control_handle: CloneableControlHandle,
251 },
252}
253
254impl CloneableRequest {
255 #[allow(irrefutable_let_patterns)]
256 pub fn into_clone(
257 self,
258 ) -> Option<(fdomain_client::fidl::ServerEnd<CloneableMarker>, CloneableControlHandle)> {
259 if let CloneableRequest::Clone { request, control_handle } = self {
260 Some((request, control_handle))
261 } else {
262 None
263 }
264 }
265
266 pub fn method_name(&self) -> &'static str {
268 match *self {
269 CloneableRequest::Clone { .. } => "clone",
270 }
271 }
272}
273
274#[derive(Debug, Clone)]
275pub struct CloneableControlHandle {
276 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
277}
278
279impl fdomain_client::fidl::ControlHandle for CloneableControlHandle {
280 fn shutdown(&self) {
281 self.inner.shutdown()
282 }
283
284 fn is_closed(&self) -> bool {
285 self.inner.channel().is_closed()
286 }
287 fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
288 self.inner.channel().on_closed()
289 }
290}
291
292impl CloneableControlHandle {}
293
294#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
295pub struct CloseableMarker;
296
297impl fdomain_client::fidl::ProtocolMarker for CloseableMarker {
298 type Proxy = CloseableProxy;
299 type RequestStream = CloseableRequestStream;
300
301 const DEBUG_NAME: &'static str = "(anonymous) Closeable";
302}
303pub type CloseableCloseResult = Result<(), i32>;
304
305pub trait CloseableProxyInterface: Send + Sync {
306 type CloseResponseFut: std::future::Future<Output = Result<CloseableCloseResult, fidl::Error>>
307 + Send;
308 fn r#close(&self) -> Self::CloseResponseFut;
309}
310
311#[derive(Debug, Clone)]
312pub struct CloseableProxy {
313 client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
314}
315
316impl fdomain_client::fidl::Proxy for CloseableProxy {
317 type Protocol = CloseableMarker;
318
319 fn from_channel(inner: fdomain_client::Channel) -> Self {
320 Self::new(inner)
321 }
322
323 fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
324 self.client.into_channel().map_err(|client| Self { client })
325 }
326
327 fn as_channel(&self) -> &fdomain_client::Channel {
328 self.client.as_channel()
329 }
330}
331
332impl CloseableProxy {
333 pub fn new(channel: fdomain_client::Channel) -> Self {
335 let protocol_name = <CloseableMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
336 Self { client: fidl::client::Client::new(channel, protocol_name) }
337 }
338
339 pub fn take_event_stream(&self) -> CloseableEventStream {
345 CloseableEventStream { event_receiver: self.client.take_event_receiver() }
346 }
347
348 pub fn r#close(
359 &self,
360 ) -> fidl::client::QueryResponseFut<
361 CloseableCloseResult,
362 fdomain_client::fidl::FDomainResourceDialect,
363 > {
364 CloseableProxyInterface::r#close(self)
365 }
366}
367
368impl CloseableProxyInterface for CloseableProxy {
369 type CloseResponseFut = fidl::client::QueryResponseFut<
370 CloseableCloseResult,
371 fdomain_client::fidl::FDomainResourceDialect,
372 >;
373 fn r#close(&self) -> Self::CloseResponseFut {
374 fn _decode(
375 mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
376 ) -> Result<CloseableCloseResult, fidl::Error> {
377 let _response = fidl::client::decode_transaction_body::<
378 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
379 fdomain_client::fidl::FDomainResourceDialect,
380 0x5ac5d459ad7f657e,
381 >(_buf?)?;
382 Ok(_response.map(|x| x))
383 }
384 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, CloseableCloseResult>(
385 (),
386 0x5ac5d459ad7f657e,
387 fidl::encoding::DynamicFlags::empty(),
388 _decode,
389 )
390 }
391}
392
393pub struct CloseableEventStream {
394 event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
395}
396
397impl std::marker::Unpin for CloseableEventStream {}
398
399impl futures::stream::FusedStream for CloseableEventStream {
400 fn is_terminated(&self) -> bool {
401 self.event_receiver.is_terminated()
402 }
403}
404
405impl futures::Stream for CloseableEventStream {
406 type Item = Result<CloseableEvent, fidl::Error>;
407
408 fn poll_next(
409 mut self: std::pin::Pin<&mut Self>,
410 cx: &mut std::task::Context<'_>,
411 ) -> std::task::Poll<Option<Self::Item>> {
412 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
413 &mut self.event_receiver,
414 cx
415 )?) {
416 Some(buf) => std::task::Poll::Ready(Some(CloseableEvent::decode(buf))),
417 None => std::task::Poll::Ready(None),
418 }
419 }
420}
421
422#[derive(Debug)]
423pub enum CloseableEvent {}
424
425impl CloseableEvent {
426 fn decode(
428 mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
429 ) -> Result<CloseableEvent, fidl::Error> {
430 let (bytes, _handles) = buf.split_mut();
431 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
432 debug_assert_eq!(tx_header.tx_id, 0);
433 match tx_header.ordinal {
434 _ => Err(fidl::Error::UnknownOrdinal {
435 ordinal: tx_header.ordinal,
436 protocol_name:
437 <CloseableMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
438 }),
439 }
440 }
441}
442
443pub struct CloseableRequestStream {
445 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
446 is_terminated: bool,
447}
448
449impl std::marker::Unpin for CloseableRequestStream {}
450
451impl futures::stream::FusedStream for CloseableRequestStream {
452 fn is_terminated(&self) -> bool {
453 self.is_terminated
454 }
455}
456
457impl fdomain_client::fidl::RequestStream for CloseableRequestStream {
458 type Protocol = CloseableMarker;
459 type ControlHandle = CloseableControlHandle;
460
461 fn from_channel(channel: fdomain_client::Channel) -> Self {
462 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
463 }
464
465 fn control_handle(&self) -> Self::ControlHandle {
466 CloseableControlHandle { inner: self.inner.clone() }
467 }
468
469 fn into_inner(
470 self,
471 ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
472 {
473 (self.inner, self.is_terminated)
474 }
475
476 fn from_inner(
477 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
478 is_terminated: bool,
479 ) -> Self {
480 Self { inner, is_terminated }
481 }
482}
483
484impl futures::Stream for CloseableRequestStream {
485 type Item = Result<CloseableRequest, fidl::Error>;
486
487 fn poll_next(
488 mut self: std::pin::Pin<&mut Self>,
489 cx: &mut std::task::Context<'_>,
490 ) -> std::task::Poll<Option<Self::Item>> {
491 let this = &mut *self;
492 if this.inner.check_shutdown(cx) {
493 this.is_terminated = true;
494 return std::task::Poll::Ready(None);
495 }
496 if this.is_terminated {
497 panic!("polled CloseableRequestStream after completion");
498 }
499 fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
500 |bytes, handles| {
501 match this.inner.channel().read_etc(cx, bytes, handles) {
502 std::task::Poll::Ready(Ok(())) => {}
503 std::task::Poll::Pending => return std::task::Poll::Pending,
504 std::task::Poll::Ready(Err(None)) => {
505 this.is_terminated = true;
506 return std::task::Poll::Ready(None);
507 }
508 std::task::Poll::Ready(Err(Some(e))) => {
509 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
510 e.into(),
511 ))))
512 }
513 }
514
515 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
517
518 std::task::Poll::Ready(Some(match header.ordinal {
519 0x5ac5d459ad7f657e => {
520 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
521 let mut req = fidl::new_empty!(
522 fidl::encoding::EmptyPayload,
523 fdomain_client::fidl::FDomainResourceDialect
524 );
525 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
526 let control_handle = CloseableControlHandle { inner: this.inner.clone() };
527 Ok(CloseableRequest::Close {
528 responder: CloseableCloseResponder {
529 control_handle: std::mem::ManuallyDrop::new(control_handle),
530 tx_id: header.tx_id,
531 },
532 })
533 }
534 _ => Err(fidl::Error::UnknownOrdinal {
535 ordinal: header.ordinal,
536 protocol_name:
537 <CloseableMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
538 }),
539 }))
540 },
541 )
542 }
543}
544
545#[derive(Debug)]
547pub enum CloseableRequest {
548 Close { responder: CloseableCloseResponder },
559}
560
561impl CloseableRequest {
562 #[allow(irrefutable_let_patterns)]
563 pub fn into_close(self) -> Option<(CloseableCloseResponder)> {
564 if let CloseableRequest::Close { responder } = self {
565 Some((responder))
566 } else {
567 None
568 }
569 }
570
571 pub fn method_name(&self) -> &'static str {
573 match *self {
574 CloseableRequest::Close { .. } => "close",
575 }
576 }
577}
578
579#[derive(Debug, Clone)]
580pub struct CloseableControlHandle {
581 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
582}
583
584impl fdomain_client::fidl::ControlHandle for CloseableControlHandle {
585 fn shutdown(&self) {
586 self.inner.shutdown()
587 }
588
589 fn is_closed(&self) -> bool {
590 self.inner.channel().is_closed()
591 }
592 fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
593 self.inner.channel().on_closed()
594 }
595}
596
597impl CloseableControlHandle {}
598
599#[must_use = "FIDL methods require a response to be sent"]
600#[derive(Debug)]
601pub struct CloseableCloseResponder {
602 control_handle: std::mem::ManuallyDrop<CloseableControlHandle>,
603 tx_id: u32,
604}
605
606impl std::ops::Drop for CloseableCloseResponder {
610 fn drop(&mut self) {
611 self.control_handle.shutdown();
612 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
614 }
615}
616
617impl fdomain_client::fidl::Responder for CloseableCloseResponder {
618 type ControlHandle = CloseableControlHandle;
619
620 fn control_handle(&self) -> &CloseableControlHandle {
621 &self.control_handle
622 }
623
624 fn drop_without_shutdown(mut self) {
625 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
627 std::mem::forget(self);
629 }
630}
631
632impl CloseableCloseResponder {
633 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
637 let _result = self.send_raw(result);
638 if _result.is_err() {
639 self.control_handle.shutdown();
640 }
641 self.drop_without_shutdown();
642 _result
643 }
644
645 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
647 let _result = self.send_raw(result);
648 self.drop_without_shutdown();
649 _result
650 }
651
652 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
653 self.control_handle
654 .inner
655 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
656 result,
657 self.tx_id,
658 0x5ac5d459ad7f657e,
659 fidl::encoding::DynamicFlags::empty(),
660 )
661 }
662}
663
664#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
665pub struct QueryableMarker;
666
667impl fdomain_client::fidl::ProtocolMarker for QueryableMarker {
668 type Proxy = QueryableProxy;
669 type RequestStream = QueryableRequestStream;
670
671 const DEBUG_NAME: &'static str = "(anonymous) Queryable";
672}
673
674pub trait QueryableProxyInterface: Send + Sync {
675 type QueryResponseFut: std::future::Future<Output = Result<Vec<u8>, fidl::Error>> + Send;
676 fn r#query(&self) -> Self::QueryResponseFut;
677}
678
679#[derive(Debug, Clone)]
680pub struct QueryableProxy {
681 client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
682}
683
684impl fdomain_client::fidl::Proxy for QueryableProxy {
685 type Protocol = QueryableMarker;
686
687 fn from_channel(inner: fdomain_client::Channel) -> Self {
688 Self::new(inner)
689 }
690
691 fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
692 self.client.into_channel().map_err(|client| Self { client })
693 }
694
695 fn as_channel(&self) -> &fdomain_client::Channel {
696 self.client.as_channel()
697 }
698}
699
700impl QueryableProxy {
701 pub fn new(channel: fdomain_client::Channel) -> Self {
703 let protocol_name = <QueryableMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
704 Self { client: fidl::client::Client::new(channel, protocol_name) }
705 }
706
707 pub fn take_event_stream(&self) -> QueryableEventStream {
713 QueryableEventStream { event_receiver: self.client.take_event_receiver() }
714 }
715
716 pub fn r#query(
717 &self,
718 ) -> fidl::client::QueryResponseFut<Vec<u8>, fdomain_client::fidl::FDomainResourceDialect> {
719 QueryableProxyInterface::r#query(self)
720 }
721}
722
723impl QueryableProxyInterface for QueryableProxy {
724 type QueryResponseFut =
725 fidl::client::QueryResponseFut<Vec<u8>, fdomain_client::fidl::FDomainResourceDialect>;
726 fn r#query(&self) -> Self::QueryResponseFut {
727 fn _decode(
728 mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
729 ) -> Result<Vec<u8>, fidl::Error> {
730 let _response = fidl::client::decode_transaction_body::<
731 QueryableQueryResponse,
732 fdomain_client::fidl::FDomainResourceDialect,
733 0x2658edee9decfc06,
734 >(_buf?)?;
735 Ok(_response.protocol)
736 }
737 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<u8>>(
738 (),
739 0x2658edee9decfc06,
740 fidl::encoding::DynamicFlags::empty(),
741 _decode,
742 )
743 }
744}
745
746pub struct QueryableEventStream {
747 event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
748}
749
750impl std::marker::Unpin for QueryableEventStream {}
751
752impl futures::stream::FusedStream for QueryableEventStream {
753 fn is_terminated(&self) -> bool {
754 self.event_receiver.is_terminated()
755 }
756}
757
758impl futures::Stream for QueryableEventStream {
759 type Item = Result<QueryableEvent, fidl::Error>;
760
761 fn poll_next(
762 mut self: std::pin::Pin<&mut Self>,
763 cx: &mut std::task::Context<'_>,
764 ) -> std::task::Poll<Option<Self::Item>> {
765 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
766 &mut self.event_receiver,
767 cx
768 )?) {
769 Some(buf) => std::task::Poll::Ready(Some(QueryableEvent::decode(buf))),
770 None => std::task::Poll::Ready(None),
771 }
772 }
773}
774
775#[derive(Debug)]
776pub enum QueryableEvent {}
777
778impl QueryableEvent {
779 fn decode(
781 mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
782 ) -> Result<QueryableEvent, fidl::Error> {
783 let (bytes, _handles) = buf.split_mut();
784 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
785 debug_assert_eq!(tx_header.tx_id, 0);
786 match tx_header.ordinal {
787 _ => Err(fidl::Error::UnknownOrdinal {
788 ordinal: tx_header.ordinal,
789 protocol_name:
790 <QueryableMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
791 }),
792 }
793 }
794}
795
796pub struct QueryableRequestStream {
798 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
799 is_terminated: bool,
800}
801
802impl std::marker::Unpin for QueryableRequestStream {}
803
804impl futures::stream::FusedStream for QueryableRequestStream {
805 fn is_terminated(&self) -> bool {
806 self.is_terminated
807 }
808}
809
810impl fdomain_client::fidl::RequestStream for QueryableRequestStream {
811 type Protocol = QueryableMarker;
812 type ControlHandle = QueryableControlHandle;
813
814 fn from_channel(channel: fdomain_client::Channel) -> Self {
815 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
816 }
817
818 fn control_handle(&self) -> Self::ControlHandle {
819 QueryableControlHandle { inner: self.inner.clone() }
820 }
821
822 fn into_inner(
823 self,
824 ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
825 {
826 (self.inner, self.is_terminated)
827 }
828
829 fn from_inner(
830 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
831 is_terminated: bool,
832 ) -> Self {
833 Self { inner, is_terminated }
834 }
835}
836
837impl futures::Stream for QueryableRequestStream {
838 type Item = Result<QueryableRequest, fidl::Error>;
839
840 fn poll_next(
841 mut self: std::pin::Pin<&mut Self>,
842 cx: &mut std::task::Context<'_>,
843 ) -> std::task::Poll<Option<Self::Item>> {
844 let this = &mut *self;
845 if this.inner.check_shutdown(cx) {
846 this.is_terminated = true;
847 return std::task::Poll::Ready(None);
848 }
849 if this.is_terminated {
850 panic!("polled QueryableRequestStream after completion");
851 }
852 fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
853 |bytes, handles| {
854 match this.inner.channel().read_etc(cx, bytes, handles) {
855 std::task::Poll::Ready(Ok(())) => {}
856 std::task::Poll::Pending => return std::task::Poll::Pending,
857 std::task::Poll::Ready(Err(None)) => {
858 this.is_terminated = true;
859 return std::task::Poll::Ready(None);
860 }
861 std::task::Poll::Ready(Err(Some(e))) => {
862 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
863 e.into(),
864 ))))
865 }
866 }
867
868 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
870
871 std::task::Poll::Ready(Some(match header.ordinal {
872 0x2658edee9decfc06 => {
873 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
874 let mut req = fidl::new_empty!(
875 fidl::encoding::EmptyPayload,
876 fdomain_client::fidl::FDomainResourceDialect
877 );
878 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
879 let control_handle = QueryableControlHandle { inner: this.inner.clone() };
880 Ok(QueryableRequest::Query {
881 responder: QueryableQueryResponder {
882 control_handle: std::mem::ManuallyDrop::new(control_handle),
883 tx_id: header.tx_id,
884 },
885 })
886 }
887 _ => Err(fidl::Error::UnknownOrdinal {
888 ordinal: header.ordinal,
889 protocol_name:
890 <QueryableMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
891 }),
892 }))
893 },
894 )
895 }
896}
897
898#[derive(Debug)]
900pub enum QueryableRequest {
901 Query { responder: QueryableQueryResponder },
902}
903
904impl QueryableRequest {
905 #[allow(irrefutable_let_patterns)]
906 pub fn into_query(self) -> Option<(QueryableQueryResponder)> {
907 if let QueryableRequest::Query { responder } = self {
908 Some((responder))
909 } else {
910 None
911 }
912 }
913
914 pub fn method_name(&self) -> &'static str {
916 match *self {
917 QueryableRequest::Query { .. } => "query",
918 }
919 }
920}
921
922#[derive(Debug, Clone)]
923pub struct QueryableControlHandle {
924 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
925}
926
927impl fdomain_client::fidl::ControlHandle for QueryableControlHandle {
928 fn shutdown(&self) {
929 self.inner.shutdown()
930 }
931
932 fn is_closed(&self) -> bool {
933 self.inner.channel().is_closed()
934 }
935 fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
936 self.inner.channel().on_closed()
937 }
938}
939
940impl QueryableControlHandle {}
941
942#[must_use = "FIDL methods require a response to be sent"]
943#[derive(Debug)]
944pub struct QueryableQueryResponder {
945 control_handle: std::mem::ManuallyDrop<QueryableControlHandle>,
946 tx_id: u32,
947}
948
949impl std::ops::Drop for QueryableQueryResponder {
953 fn drop(&mut self) {
954 self.control_handle.shutdown();
955 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
957 }
958}
959
960impl fdomain_client::fidl::Responder for QueryableQueryResponder {
961 type ControlHandle = QueryableControlHandle;
962
963 fn control_handle(&self) -> &QueryableControlHandle {
964 &self.control_handle
965 }
966
967 fn drop_without_shutdown(mut self) {
968 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
970 std::mem::forget(self);
972 }
973}
974
975impl QueryableQueryResponder {
976 pub fn send(self, mut protocol: &[u8]) -> Result<(), fidl::Error> {
980 let _result = self.send_raw(protocol);
981 if _result.is_err() {
982 self.control_handle.shutdown();
983 }
984 self.drop_without_shutdown();
985 _result
986 }
987
988 pub fn send_no_shutdown_on_err(self, mut protocol: &[u8]) -> Result<(), fidl::Error> {
990 let _result = self.send_raw(protocol);
991 self.drop_without_shutdown();
992 _result
993 }
994
995 fn send_raw(&self, mut protocol: &[u8]) -> Result<(), fidl::Error> {
996 self.control_handle.inner.send::<QueryableQueryResponse>(
997 (protocol,),
998 self.tx_id,
999 0x2658edee9decfc06,
1000 fidl::encoding::DynamicFlags::empty(),
1001 )
1002 }
1003}
1004
1005mod internal {
1006 use super::*;
1007
1008 impl fidl::encoding::ResourceTypeMarker for CloneableCloneRequest {
1009 type Borrowed<'a> = &'a mut Self;
1010 fn take_or_borrow<'a>(
1011 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1012 ) -> Self::Borrowed<'a> {
1013 value
1014 }
1015 }
1016
1017 unsafe impl fidl::encoding::TypeMarker for CloneableCloneRequest {
1018 type Owned = Self;
1019
1020 #[inline(always)]
1021 fn inline_align(_context: fidl::encoding::Context) -> usize {
1022 4
1023 }
1024
1025 #[inline(always)]
1026 fn inline_size(_context: fidl::encoding::Context) -> usize {
1027 4
1028 }
1029 }
1030
1031 unsafe impl
1032 fidl::encoding::Encode<CloneableCloneRequest, fdomain_client::fidl::FDomainResourceDialect>
1033 for &mut CloneableCloneRequest
1034 {
1035 #[inline]
1036 unsafe fn encode(
1037 self,
1038 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1039 offset: usize,
1040 _depth: fidl::encoding::Depth,
1041 ) -> fidl::Result<()> {
1042 encoder.debug_check_bounds::<CloneableCloneRequest>(offset);
1043 fidl::encoding::Encode::<CloneableCloneRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
1045 (
1046 <fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<CloneableMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.request),
1047 ),
1048 encoder, offset, _depth
1049 )
1050 }
1051 }
1052 unsafe impl<
1053 T0: fidl::encoding::Encode<
1054 fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<CloneableMarker>>,
1055 fdomain_client::fidl::FDomainResourceDialect,
1056 >,
1057 >
1058 fidl::encoding::Encode<CloneableCloneRequest, fdomain_client::fidl::FDomainResourceDialect>
1059 for (T0,)
1060 {
1061 #[inline]
1062 unsafe fn encode(
1063 self,
1064 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1065 offset: usize,
1066 depth: fidl::encoding::Depth,
1067 ) -> fidl::Result<()> {
1068 encoder.debug_check_bounds::<CloneableCloneRequest>(offset);
1069 self.0.encode(encoder, offset + 0, depth)?;
1073 Ok(())
1074 }
1075 }
1076
1077 impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
1078 for CloneableCloneRequest
1079 {
1080 #[inline(always)]
1081 fn new_empty() -> Self {
1082 Self {
1083 request: fidl::new_empty!(
1084 fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<CloneableMarker>>,
1085 fdomain_client::fidl::FDomainResourceDialect
1086 ),
1087 }
1088 }
1089
1090 #[inline]
1091 unsafe fn decode(
1092 &mut self,
1093 decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1094 offset: usize,
1095 _depth: fidl::encoding::Depth,
1096 ) -> fidl::Result<()> {
1097 decoder.debug_check_bounds::<Self>(offset);
1098 fidl::decode!(
1100 fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<CloneableMarker>>,
1101 fdomain_client::fidl::FDomainResourceDialect,
1102 &mut self.request,
1103 decoder,
1104 offset + 0,
1105 _depth
1106 )?;
1107 Ok(())
1108 }
1109 }
1110}