1#![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_test_protocol_connector_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct ProtocolFactoryCreateProtocolRequest {
16 pub protocol: fidl::endpoints::ServerEnd<ProtocolMarker>,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
20 for ProtocolFactoryCreateProtocolRequest
21{
22}
23
24#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
25pub struct ProtocolMarker;
26
27impl fidl::endpoints::ProtocolMarker for ProtocolMarker {
28 type Proxy = ProtocolProxy;
29 type RequestStream = ProtocolRequestStream;
30 #[cfg(target_os = "fuchsia")]
31 type SynchronousProxy = ProtocolSynchronousProxy;
32
33 const DEBUG_NAME: &'static str = "(anonymous) Protocol";
34}
35pub type ProtocolDoActionResult = Result<(), Error>;
36
37pub trait ProtocolProxyInterface: Send + Sync {
38 type DoActionResponseFut: std::future::Future<Output = Result<ProtocolDoActionResult, fidl::Error>>
39 + Send;
40 fn r#do_action(&self) -> Self::DoActionResponseFut;
41}
42#[derive(Debug)]
43#[cfg(target_os = "fuchsia")]
44pub struct ProtocolSynchronousProxy {
45 client: fidl::client::sync::Client,
46}
47
48#[cfg(target_os = "fuchsia")]
49impl fidl::endpoints::SynchronousProxy for ProtocolSynchronousProxy {
50 type Proxy = ProtocolProxy;
51 type Protocol = ProtocolMarker;
52
53 fn from_channel(inner: fidl::Channel) -> Self {
54 Self::new(inner)
55 }
56
57 fn into_channel(self) -> fidl::Channel {
58 self.client.into_channel()
59 }
60
61 fn as_channel(&self) -> &fidl::Channel {
62 self.client.as_channel()
63 }
64}
65
66#[cfg(target_os = "fuchsia")]
67impl ProtocolSynchronousProxy {
68 pub fn new(channel: fidl::Channel) -> Self {
69 Self { client: fidl::client::sync::Client::new(channel) }
70 }
71
72 pub fn into_channel(self) -> fidl::Channel {
73 self.client.into_channel()
74 }
75
76 pub fn wait_for_event(
79 &self,
80 deadline: zx::MonotonicInstant,
81 ) -> Result<ProtocolEvent, fidl::Error> {
82 ProtocolEvent::decode(self.client.wait_for_event::<ProtocolMarker>(deadline)?)
83 }
84
85 pub fn r#do_action(
86 &self,
87 ___deadline: zx::MonotonicInstant,
88 ) -> Result<ProtocolDoActionResult, fidl::Error> {
89 let _response = self.client.send_query::<
90 fidl::encoding::EmptyPayload,
91 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
92 ProtocolMarker,
93 >(
94 (),
95 0x8831ffac41f0c9f,
96 fidl::encoding::DynamicFlags::empty(),
97 ___deadline,
98 )?;
99 Ok(_response.map(|x| x))
100 }
101}
102
103#[cfg(target_os = "fuchsia")]
104impl From<ProtocolSynchronousProxy> for zx::NullableHandle {
105 fn from(value: ProtocolSynchronousProxy) -> Self {
106 value.into_channel().into()
107 }
108}
109
110#[cfg(target_os = "fuchsia")]
111impl From<fidl::Channel> for ProtocolSynchronousProxy {
112 fn from(value: fidl::Channel) -> Self {
113 Self::new(value)
114 }
115}
116
117#[cfg(target_os = "fuchsia")]
118impl fidl::endpoints::FromClient for ProtocolSynchronousProxy {
119 type Protocol = ProtocolMarker;
120
121 fn from_client(value: fidl::endpoints::ClientEnd<ProtocolMarker>) -> Self {
122 Self::new(value.into_channel())
123 }
124}
125
126#[derive(Debug, Clone)]
127pub struct ProtocolProxy {
128 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
129}
130
131impl fidl::endpoints::Proxy for ProtocolProxy {
132 type Protocol = ProtocolMarker;
133
134 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
135 Self::new(inner)
136 }
137
138 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
139 self.client.into_channel().map_err(|client| Self { client })
140 }
141
142 fn as_channel(&self) -> &::fidl::AsyncChannel {
143 self.client.as_channel()
144 }
145}
146
147impl ProtocolProxy {
148 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
150 let protocol_name = <ProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
151 Self { client: fidl::client::Client::new(channel, protocol_name) }
152 }
153
154 pub fn take_event_stream(&self) -> ProtocolEventStream {
160 ProtocolEventStream { event_receiver: self.client.take_event_receiver() }
161 }
162
163 pub fn r#do_action(
164 &self,
165 ) -> fidl::client::QueryResponseFut<
166 ProtocolDoActionResult,
167 fidl::encoding::DefaultFuchsiaResourceDialect,
168 > {
169 ProtocolProxyInterface::r#do_action(self)
170 }
171}
172
173impl ProtocolProxyInterface for ProtocolProxy {
174 type DoActionResponseFut = fidl::client::QueryResponseFut<
175 ProtocolDoActionResult,
176 fidl::encoding::DefaultFuchsiaResourceDialect,
177 >;
178 fn r#do_action(&self) -> Self::DoActionResponseFut {
179 fn _decode(
180 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
181 ) -> Result<ProtocolDoActionResult, fidl::Error> {
182 let _response = fidl::client::decode_transaction_body::<
183 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
184 fidl::encoding::DefaultFuchsiaResourceDialect,
185 0x8831ffac41f0c9f,
186 >(_buf?)?;
187 Ok(_response.map(|x| x))
188 }
189 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ProtocolDoActionResult>(
190 (),
191 0x8831ffac41f0c9f,
192 fidl::encoding::DynamicFlags::empty(),
193 _decode,
194 )
195 }
196}
197
198pub struct ProtocolEventStream {
199 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
200}
201
202impl std::marker::Unpin for ProtocolEventStream {}
203
204impl futures::stream::FusedStream for ProtocolEventStream {
205 fn is_terminated(&self) -> bool {
206 self.event_receiver.is_terminated()
207 }
208}
209
210impl futures::Stream for ProtocolEventStream {
211 type Item = Result<ProtocolEvent, fidl::Error>;
212
213 fn poll_next(
214 mut self: std::pin::Pin<&mut Self>,
215 cx: &mut std::task::Context<'_>,
216 ) -> std::task::Poll<Option<Self::Item>> {
217 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
218 &mut self.event_receiver,
219 cx
220 )?) {
221 Some(buf) => std::task::Poll::Ready(Some(ProtocolEvent::decode(buf))),
222 None => std::task::Poll::Ready(None),
223 }
224 }
225}
226
227#[derive(Debug)]
228pub enum ProtocolEvent {}
229
230impl ProtocolEvent {
231 fn decode(
233 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
234 ) -> Result<ProtocolEvent, fidl::Error> {
235 let (bytes, _handles) = buf.split_mut();
236 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
237 debug_assert_eq!(tx_header.tx_id, 0);
238 match tx_header.ordinal {
239 _ => Err(fidl::Error::UnknownOrdinal {
240 ordinal: tx_header.ordinal,
241 protocol_name: <ProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
242 }),
243 }
244 }
245}
246
247pub struct ProtocolRequestStream {
249 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
250 is_terminated: bool,
251}
252
253impl std::marker::Unpin for ProtocolRequestStream {}
254
255impl futures::stream::FusedStream for ProtocolRequestStream {
256 fn is_terminated(&self) -> bool {
257 self.is_terminated
258 }
259}
260
261impl fidl::endpoints::RequestStream for ProtocolRequestStream {
262 type Protocol = ProtocolMarker;
263 type ControlHandle = ProtocolControlHandle;
264
265 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
266 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
267 }
268
269 fn control_handle(&self) -> Self::ControlHandle {
270 ProtocolControlHandle { inner: self.inner.clone() }
271 }
272
273 fn into_inner(
274 self,
275 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
276 {
277 (self.inner, self.is_terminated)
278 }
279
280 fn from_inner(
281 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
282 is_terminated: bool,
283 ) -> Self {
284 Self { inner, is_terminated }
285 }
286}
287
288impl futures::Stream for ProtocolRequestStream {
289 type Item = Result<ProtocolRequest, fidl::Error>;
290
291 fn poll_next(
292 mut self: std::pin::Pin<&mut Self>,
293 cx: &mut std::task::Context<'_>,
294 ) -> std::task::Poll<Option<Self::Item>> {
295 let this = &mut *self;
296 if this.inner.check_shutdown(cx) {
297 this.is_terminated = true;
298 return std::task::Poll::Ready(None);
299 }
300 if this.is_terminated {
301 panic!("polled ProtocolRequestStream after completion");
302 }
303 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
304 |bytes, handles| {
305 match this.inner.channel().read_etc(cx, bytes, handles) {
306 std::task::Poll::Ready(Ok(())) => {}
307 std::task::Poll::Pending => return std::task::Poll::Pending,
308 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
309 this.is_terminated = true;
310 return std::task::Poll::Ready(None);
311 }
312 std::task::Poll::Ready(Err(e)) => {
313 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
314 e.into(),
315 ))));
316 }
317 }
318
319 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
321
322 std::task::Poll::Ready(Some(match header.ordinal {
323 0x8831ffac41f0c9f => {
324 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
325 let mut req = fidl::new_empty!(
326 fidl::encoding::EmptyPayload,
327 fidl::encoding::DefaultFuchsiaResourceDialect
328 );
329 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
330 let control_handle = ProtocolControlHandle { inner: this.inner.clone() };
331 Ok(ProtocolRequest::DoAction {
332 responder: ProtocolDoActionResponder {
333 control_handle: std::mem::ManuallyDrop::new(control_handle),
334 tx_id: header.tx_id,
335 },
336 })
337 }
338 _ => Err(fidl::Error::UnknownOrdinal {
339 ordinal: header.ordinal,
340 protocol_name:
341 <ProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
342 }),
343 }))
344 },
345 )
346 }
347}
348
349#[derive(Debug)]
350pub enum ProtocolRequest {
351 DoAction { responder: ProtocolDoActionResponder },
352}
353
354impl ProtocolRequest {
355 #[allow(irrefutable_let_patterns)]
356 pub fn into_do_action(self) -> Option<(ProtocolDoActionResponder)> {
357 if let ProtocolRequest::DoAction { responder } = self { Some((responder)) } else { None }
358 }
359
360 pub fn method_name(&self) -> &'static str {
362 match *self {
363 ProtocolRequest::DoAction { .. } => "do_action",
364 }
365 }
366}
367
368#[derive(Debug, Clone)]
369pub struct ProtocolControlHandle {
370 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
371}
372
373impl ProtocolControlHandle {
374 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
375 self.inner.shutdown_with_epitaph(status.into())
376 }
377}
378
379impl fidl::endpoints::ControlHandle for ProtocolControlHandle {
380 fn shutdown(&self) {
381 self.inner.shutdown()
382 }
383
384 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
385 self.inner.shutdown_with_epitaph(status)
386 }
387
388 fn is_closed(&self) -> bool {
389 self.inner.channel().is_closed()
390 }
391 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
392 self.inner.channel().on_closed()
393 }
394
395 #[cfg(target_os = "fuchsia")]
396 fn signal_peer(
397 &self,
398 clear_mask: zx::Signals,
399 set_mask: zx::Signals,
400 ) -> Result<(), zx_status::Status> {
401 use fidl::Peered;
402 self.inner.channel().signal_peer(clear_mask, set_mask)
403 }
404}
405
406impl ProtocolControlHandle {}
407
408#[must_use = "FIDL methods require a response to be sent"]
409#[derive(Debug)]
410pub struct ProtocolDoActionResponder {
411 control_handle: std::mem::ManuallyDrop<ProtocolControlHandle>,
412 tx_id: u32,
413}
414
415impl std::ops::Drop for ProtocolDoActionResponder {
419 fn drop(&mut self) {
420 self.control_handle.shutdown();
421 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
423 }
424}
425
426impl fidl::endpoints::Responder for ProtocolDoActionResponder {
427 type ControlHandle = ProtocolControlHandle;
428
429 fn control_handle(&self) -> &ProtocolControlHandle {
430 &self.control_handle
431 }
432
433 fn drop_without_shutdown(mut self) {
434 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
436 std::mem::forget(self);
438 }
439}
440
441impl ProtocolDoActionResponder {
442 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
446 let _result = self.send_raw(result);
447 if _result.is_err() {
448 self.control_handle.shutdown();
449 }
450 self.drop_without_shutdown();
451 _result
452 }
453
454 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
456 let _result = self.send_raw(result);
457 self.drop_without_shutdown();
458 _result
459 }
460
461 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
462 self.control_handle
463 .inner
464 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
465 result,
466 self.tx_id,
467 0x8831ffac41f0c9f,
468 fidl::encoding::DynamicFlags::empty(),
469 )
470 }
471}
472
473#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
474pub struct ProtocolFactoryMarker;
475
476impl fidl::endpoints::ProtocolMarker for ProtocolFactoryMarker {
477 type Proxy = ProtocolFactoryProxy;
478 type RequestStream = ProtocolFactoryRequestStream;
479 #[cfg(target_os = "fuchsia")]
480 type SynchronousProxy = ProtocolFactorySynchronousProxy;
481
482 const DEBUG_NAME: &'static str = "test.protocol.connector.ProtocolFactory";
483}
484impl fidl::endpoints::DiscoverableProtocolMarker for ProtocolFactoryMarker {}
485pub type ProtocolFactoryCreateProtocolResult = Result<(), Error>;
486
487pub trait ProtocolFactoryProxyInterface: Send + Sync {
488 type CreateProtocolResponseFut: std::future::Future<Output = Result<ProtocolFactoryCreateProtocolResult, fidl::Error>>
489 + Send;
490 fn r#create_protocol(
491 &self,
492 protocol: fidl::endpoints::ServerEnd<ProtocolMarker>,
493 ) -> Self::CreateProtocolResponseFut;
494}
495#[derive(Debug)]
496#[cfg(target_os = "fuchsia")]
497pub struct ProtocolFactorySynchronousProxy {
498 client: fidl::client::sync::Client,
499}
500
501#[cfg(target_os = "fuchsia")]
502impl fidl::endpoints::SynchronousProxy for ProtocolFactorySynchronousProxy {
503 type Proxy = ProtocolFactoryProxy;
504 type Protocol = ProtocolFactoryMarker;
505
506 fn from_channel(inner: fidl::Channel) -> Self {
507 Self::new(inner)
508 }
509
510 fn into_channel(self) -> fidl::Channel {
511 self.client.into_channel()
512 }
513
514 fn as_channel(&self) -> &fidl::Channel {
515 self.client.as_channel()
516 }
517}
518
519#[cfg(target_os = "fuchsia")]
520impl ProtocolFactorySynchronousProxy {
521 pub fn new(channel: fidl::Channel) -> Self {
522 Self { client: fidl::client::sync::Client::new(channel) }
523 }
524
525 pub fn into_channel(self) -> fidl::Channel {
526 self.client.into_channel()
527 }
528
529 pub fn wait_for_event(
532 &self,
533 deadline: zx::MonotonicInstant,
534 ) -> Result<ProtocolFactoryEvent, fidl::Error> {
535 ProtocolFactoryEvent::decode(self.client.wait_for_event::<ProtocolFactoryMarker>(deadline)?)
536 }
537
538 pub fn r#create_protocol(
539 &self,
540 mut protocol: fidl::endpoints::ServerEnd<ProtocolMarker>,
541 ___deadline: zx::MonotonicInstant,
542 ) -> Result<ProtocolFactoryCreateProtocolResult, fidl::Error> {
543 let _response = self.client.send_query::<
544 ProtocolFactoryCreateProtocolRequest,
545 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
546 ProtocolFactoryMarker,
547 >(
548 (protocol,),
549 0x57fac7669eddfb24,
550 fidl::encoding::DynamicFlags::empty(),
551 ___deadline,
552 )?;
553 Ok(_response.map(|x| x))
554 }
555}
556
557#[cfg(target_os = "fuchsia")]
558impl From<ProtocolFactorySynchronousProxy> for zx::NullableHandle {
559 fn from(value: ProtocolFactorySynchronousProxy) -> Self {
560 value.into_channel().into()
561 }
562}
563
564#[cfg(target_os = "fuchsia")]
565impl From<fidl::Channel> for ProtocolFactorySynchronousProxy {
566 fn from(value: fidl::Channel) -> Self {
567 Self::new(value)
568 }
569}
570
571#[cfg(target_os = "fuchsia")]
572impl fidl::endpoints::FromClient for ProtocolFactorySynchronousProxy {
573 type Protocol = ProtocolFactoryMarker;
574
575 fn from_client(value: fidl::endpoints::ClientEnd<ProtocolFactoryMarker>) -> Self {
576 Self::new(value.into_channel())
577 }
578}
579
580#[derive(Debug, Clone)]
581pub struct ProtocolFactoryProxy {
582 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
583}
584
585impl fidl::endpoints::Proxy for ProtocolFactoryProxy {
586 type Protocol = ProtocolFactoryMarker;
587
588 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
589 Self::new(inner)
590 }
591
592 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
593 self.client.into_channel().map_err(|client| Self { client })
594 }
595
596 fn as_channel(&self) -> &::fidl::AsyncChannel {
597 self.client.as_channel()
598 }
599}
600
601impl ProtocolFactoryProxy {
602 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
604 let protocol_name = <ProtocolFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
605 Self { client: fidl::client::Client::new(channel, protocol_name) }
606 }
607
608 pub fn take_event_stream(&self) -> ProtocolFactoryEventStream {
614 ProtocolFactoryEventStream { event_receiver: self.client.take_event_receiver() }
615 }
616
617 pub fn r#create_protocol(
618 &self,
619 mut protocol: fidl::endpoints::ServerEnd<ProtocolMarker>,
620 ) -> fidl::client::QueryResponseFut<
621 ProtocolFactoryCreateProtocolResult,
622 fidl::encoding::DefaultFuchsiaResourceDialect,
623 > {
624 ProtocolFactoryProxyInterface::r#create_protocol(self, protocol)
625 }
626}
627
628impl ProtocolFactoryProxyInterface for ProtocolFactoryProxy {
629 type CreateProtocolResponseFut = fidl::client::QueryResponseFut<
630 ProtocolFactoryCreateProtocolResult,
631 fidl::encoding::DefaultFuchsiaResourceDialect,
632 >;
633 fn r#create_protocol(
634 &self,
635 mut protocol: fidl::endpoints::ServerEnd<ProtocolMarker>,
636 ) -> Self::CreateProtocolResponseFut {
637 fn _decode(
638 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
639 ) -> Result<ProtocolFactoryCreateProtocolResult, fidl::Error> {
640 let _response = fidl::client::decode_transaction_body::<
641 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
642 fidl::encoding::DefaultFuchsiaResourceDialect,
643 0x57fac7669eddfb24,
644 >(_buf?)?;
645 Ok(_response.map(|x| x))
646 }
647 self.client.send_query_and_decode::<
648 ProtocolFactoryCreateProtocolRequest,
649 ProtocolFactoryCreateProtocolResult,
650 >(
651 (protocol,),
652 0x57fac7669eddfb24,
653 fidl::encoding::DynamicFlags::empty(),
654 _decode,
655 )
656 }
657}
658
659pub struct ProtocolFactoryEventStream {
660 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
661}
662
663impl std::marker::Unpin for ProtocolFactoryEventStream {}
664
665impl futures::stream::FusedStream for ProtocolFactoryEventStream {
666 fn is_terminated(&self) -> bool {
667 self.event_receiver.is_terminated()
668 }
669}
670
671impl futures::Stream for ProtocolFactoryEventStream {
672 type Item = Result<ProtocolFactoryEvent, fidl::Error>;
673
674 fn poll_next(
675 mut self: std::pin::Pin<&mut Self>,
676 cx: &mut std::task::Context<'_>,
677 ) -> std::task::Poll<Option<Self::Item>> {
678 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
679 &mut self.event_receiver,
680 cx
681 )?) {
682 Some(buf) => std::task::Poll::Ready(Some(ProtocolFactoryEvent::decode(buf))),
683 None => std::task::Poll::Ready(None),
684 }
685 }
686}
687
688#[derive(Debug)]
689pub enum ProtocolFactoryEvent {}
690
691impl ProtocolFactoryEvent {
692 fn decode(
694 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
695 ) -> Result<ProtocolFactoryEvent, fidl::Error> {
696 let (bytes, _handles) = buf.split_mut();
697 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
698 debug_assert_eq!(tx_header.tx_id, 0);
699 match tx_header.ordinal {
700 _ => Err(fidl::Error::UnknownOrdinal {
701 ordinal: tx_header.ordinal,
702 protocol_name:
703 <ProtocolFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
704 }),
705 }
706 }
707}
708
709pub struct ProtocolFactoryRequestStream {
711 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
712 is_terminated: bool,
713}
714
715impl std::marker::Unpin for ProtocolFactoryRequestStream {}
716
717impl futures::stream::FusedStream for ProtocolFactoryRequestStream {
718 fn is_terminated(&self) -> bool {
719 self.is_terminated
720 }
721}
722
723impl fidl::endpoints::RequestStream for ProtocolFactoryRequestStream {
724 type Protocol = ProtocolFactoryMarker;
725 type ControlHandle = ProtocolFactoryControlHandle;
726
727 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
728 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
729 }
730
731 fn control_handle(&self) -> Self::ControlHandle {
732 ProtocolFactoryControlHandle { inner: self.inner.clone() }
733 }
734
735 fn into_inner(
736 self,
737 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
738 {
739 (self.inner, self.is_terminated)
740 }
741
742 fn from_inner(
743 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
744 is_terminated: bool,
745 ) -> Self {
746 Self { inner, is_terminated }
747 }
748}
749
750impl futures::Stream for ProtocolFactoryRequestStream {
751 type Item = Result<ProtocolFactoryRequest, fidl::Error>;
752
753 fn poll_next(
754 mut self: std::pin::Pin<&mut Self>,
755 cx: &mut std::task::Context<'_>,
756 ) -> std::task::Poll<Option<Self::Item>> {
757 let this = &mut *self;
758 if this.inner.check_shutdown(cx) {
759 this.is_terminated = true;
760 return std::task::Poll::Ready(None);
761 }
762 if this.is_terminated {
763 panic!("polled ProtocolFactoryRequestStream after completion");
764 }
765 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
766 |bytes, handles| {
767 match this.inner.channel().read_etc(cx, bytes, handles) {
768 std::task::Poll::Ready(Ok(())) => {}
769 std::task::Poll::Pending => return std::task::Poll::Pending,
770 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
771 this.is_terminated = true;
772 return std::task::Poll::Ready(None);
773 }
774 std::task::Poll::Ready(Err(e)) => {
775 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
776 e.into(),
777 ))));
778 }
779 }
780
781 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
783
784 std::task::Poll::Ready(Some(match header.ordinal {
785 0x57fac7669eddfb24 => {
786 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
787 let mut req = fidl::new_empty!(
788 ProtocolFactoryCreateProtocolRequest,
789 fidl::encoding::DefaultFuchsiaResourceDialect
790 );
791 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProtocolFactoryCreateProtocolRequest>(&header, _body_bytes, handles, &mut req)?;
792 let control_handle =
793 ProtocolFactoryControlHandle { inner: this.inner.clone() };
794 Ok(ProtocolFactoryRequest::CreateProtocol {
795 protocol: req.protocol,
796
797 responder: ProtocolFactoryCreateProtocolResponder {
798 control_handle: std::mem::ManuallyDrop::new(control_handle),
799 tx_id: header.tx_id,
800 },
801 })
802 }
803 _ => Err(fidl::Error::UnknownOrdinal {
804 ordinal: header.ordinal,
805 protocol_name:
806 <ProtocolFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
807 }),
808 }))
809 },
810 )
811 }
812}
813
814#[derive(Debug)]
815pub enum ProtocolFactoryRequest {
816 CreateProtocol {
817 protocol: fidl::endpoints::ServerEnd<ProtocolMarker>,
818 responder: ProtocolFactoryCreateProtocolResponder,
819 },
820}
821
822impl ProtocolFactoryRequest {
823 #[allow(irrefutable_let_patterns)]
824 pub fn into_create_protocol(
825 self,
826 ) -> Option<(fidl::endpoints::ServerEnd<ProtocolMarker>, ProtocolFactoryCreateProtocolResponder)>
827 {
828 if let ProtocolFactoryRequest::CreateProtocol { protocol, responder } = self {
829 Some((protocol, responder))
830 } else {
831 None
832 }
833 }
834
835 pub fn method_name(&self) -> &'static str {
837 match *self {
838 ProtocolFactoryRequest::CreateProtocol { .. } => "create_protocol",
839 }
840 }
841}
842
843#[derive(Debug, Clone)]
844pub struct ProtocolFactoryControlHandle {
845 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
846}
847
848impl ProtocolFactoryControlHandle {
849 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
850 self.inner.shutdown_with_epitaph(status.into())
851 }
852}
853
854impl fidl::endpoints::ControlHandle for ProtocolFactoryControlHandle {
855 fn shutdown(&self) {
856 self.inner.shutdown()
857 }
858
859 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
860 self.inner.shutdown_with_epitaph(status)
861 }
862
863 fn is_closed(&self) -> bool {
864 self.inner.channel().is_closed()
865 }
866 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
867 self.inner.channel().on_closed()
868 }
869
870 #[cfg(target_os = "fuchsia")]
871 fn signal_peer(
872 &self,
873 clear_mask: zx::Signals,
874 set_mask: zx::Signals,
875 ) -> Result<(), zx_status::Status> {
876 use fidl::Peered;
877 self.inner.channel().signal_peer(clear_mask, set_mask)
878 }
879}
880
881impl ProtocolFactoryControlHandle {}
882
883#[must_use = "FIDL methods require a response to be sent"]
884#[derive(Debug)]
885pub struct ProtocolFactoryCreateProtocolResponder {
886 control_handle: std::mem::ManuallyDrop<ProtocolFactoryControlHandle>,
887 tx_id: u32,
888}
889
890impl std::ops::Drop for ProtocolFactoryCreateProtocolResponder {
894 fn drop(&mut self) {
895 self.control_handle.shutdown();
896 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
898 }
899}
900
901impl fidl::endpoints::Responder for ProtocolFactoryCreateProtocolResponder {
902 type ControlHandle = ProtocolFactoryControlHandle;
903
904 fn control_handle(&self) -> &ProtocolFactoryControlHandle {
905 &self.control_handle
906 }
907
908 fn drop_without_shutdown(mut self) {
909 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
911 std::mem::forget(self);
913 }
914}
915
916impl ProtocolFactoryCreateProtocolResponder {
917 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
921 let _result = self.send_raw(result);
922 if _result.is_err() {
923 self.control_handle.shutdown();
924 }
925 self.drop_without_shutdown();
926 _result
927 }
928
929 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
931 let _result = self.send_raw(result);
932 self.drop_without_shutdown();
933 _result
934 }
935
936 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
937 self.control_handle
938 .inner
939 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
940 result,
941 self.tx_id,
942 0x57fac7669eddfb24,
943 fidl::encoding::DynamicFlags::empty(),
944 )
945 }
946}
947
948#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
949pub struct SimpleProtocolMarker;
950
951impl fidl::endpoints::ProtocolMarker for SimpleProtocolMarker {
952 type Proxy = SimpleProtocolProxy;
953 type RequestStream = SimpleProtocolRequestStream;
954 #[cfg(target_os = "fuchsia")]
955 type SynchronousProxy = SimpleProtocolSynchronousProxy;
956
957 const DEBUG_NAME: &'static str = "test.protocol.connector.SimpleProtocol";
958}
959impl fidl::endpoints::DiscoverableProtocolMarker for SimpleProtocolMarker {}
960pub type SimpleProtocolDoActionResult = Result<(), Error>;
961
962pub trait SimpleProtocolProxyInterface: Send + Sync {
963 type DoActionResponseFut: std::future::Future<Output = Result<SimpleProtocolDoActionResult, fidl::Error>>
964 + Send;
965 fn r#do_action(&self) -> Self::DoActionResponseFut;
966}
967#[derive(Debug)]
968#[cfg(target_os = "fuchsia")]
969pub struct SimpleProtocolSynchronousProxy {
970 client: fidl::client::sync::Client,
971}
972
973#[cfg(target_os = "fuchsia")]
974impl fidl::endpoints::SynchronousProxy for SimpleProtocolSynchronousProxy {
975 type Proxy = SimpleProtocolProxy;
976 type Protocol = SimpleProtocolMarker;
977
978 fn from_channel(inner: fidl::Channel) -> Self {
979 Self::new(inner)
980 }
981
982 fn into_channel(self) -> fidl::Channel {
983 self.client.into_channel()
984 }
985
986 fn as_channel(&self) -> &fidl::Channel {
987 self.client.as_channel()
988 }
989}
990
991#[cfg(target_os = "fuchsia")]
992impl SimpleProtocolSynchronousProxy {
993 pub fn new(channel: fidl::Channel) -> Self {
994 Self { client: fidl::client::sync::Client::new(channel) }
995 }
996
997 pub fn into_channel(self) -> fidl::Channel {
998 self.client.into_channel()
999 }
1000
1001 pub fn wait_for_event(
1004 &self,
1005 deadline: zx::MonotonicInstant,
1006 ) -> Result<SimpleProtocolEvent, fidl::Error> {
1007 SimpleProtocolEvent::decode(self.client.wait_for_event::<SimpleProtocolMarker>(deadline)?)
1008 }
1009
1010 pub fn r#do_action(
1011 &self,
1012 ___deadline: zx::MonotonicInstant,
1013 ) -> Result<SimpleProtocolDoActionResult, fidl::Error> {
1014 let _response = self.client.send_query::<
1015 fidl::encoding::EmptyPayload,
1016 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
1017 SimpleProtocolMarker,
1018 >(
1019 (),
1020 0x482e3c82af55ef30,
1021 fidl::encoding::DynamicFlags::empty(),
1022 ___deadline,
1023 )?;
1024 Ok(_response.map(|x| x))
1025 }
1026}
1027
1028#[cfg(target_os = "fuchsia")]
1029impl From<SimpleProtocolSynchronousProxy> for zx::NullableHandle {
1030 fn from(value: SimpleProtocolSynchronousProxy) -> Self {
1031 value.into_channel().into()
1032 }
1033}
1034
1035#[cfg(target_os = "fuchsia")]
1036impl From<fidl::Channel> for SimpleProtocolSynchronousProxy {
1037 fn from(value: fidl::Channel) -> Self {
1038 Self::new(value)
1039 }
1040}
1041
1042#[cfg(target_os = "fuchsia")]
1043impl fidl::endpoints::FromClient for SimpleProtocolSynchronousProxy {
1044 type Protocol = SimpleProtocolMarker;
1045
1046 fn from_client(value: fidl::endpoints::ClientEnd<SimpleProtocolMarker>) -> Self {
1047 Self::new(value.into_channel())
1048 }
1049}
1050
1051#[derive(Debug, Clone)]
1052pub struct SimpleProtocolProxy {
1053 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1054}
1055
1056impl fidl::endpoints::Proxy for SimpleProtocolProxy {
1057 type Protocol = SimpleProtocolMarker;
1058
1059 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1060 Self::new(inner)
1061 }
1062
1063 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1064 self.client.into_channel().map_err(|client| Self { client })
1065 }
1066
1067 fn as_channel(&self) -> &::fidl::AsyncChannel {
1068 self.client.as_channel()
1069 }
1070}
1071
1072impl SimpleProtocolProxy {
1073 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1075 let protocol_name = <SimpleProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1076 Self { client: fidl::client::Client::new(channel, protocol_name) }
1077 }
1078
1079 pub fn take_event_stream(&self) -> SimpleProtocolEventStream {
1085 SimpleProtocolEventStream { event_receiver: self.client.take_event_receiver() }
1086 }
1087
1088 pub fn r#do_action(
1089 &self,
1090 ) -> fidl::client::QueryResponseFut<
1091 SimpleProtocolDoActionResult,
1092 fidl::encoding::DefaultFuchsiaResourceDialect,
1093 > {
1094 SimpleProtocolProxyInterface::r#do_action(self)
1095 }
1096}
1097
1098impl SimpleProtocolProxyInterface for SimpleProtocolProxy {
1099 type DoActionResponseFut = fidl::client::QueryResponseFut<
1100 SimpleProtocolDoActionResult,
1101 fidl::encoding::DefaultFuchsiaResourceDialect,
1102 >;
1103 fn r#do_action(&self) -> Self::DoActionResponseFut {
1104 fn _decode(
1105 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1106 ) -> Result<SimpleProtocolDoActionResult, fidl::Error> {
1107 let _response = fidl::client::decode_transaction_body::<
1108 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
1109 fidl::encoding::DefaultFuchsiaResourceDialect,
1110 0x482e3c82af55ef30,
1111 >(_buf?)?;
1112 Ok(_response.map(|x| x))
1113 }
1114 self.client
1115 .send_query_and_decode::<fidl::encoding::EmptyPayload, SimpleProtocolDoActionResult>(
1116 (),
1117 0x482e3c82af55ef30,
1118 fidl::encoding::DynamicFlags::empty(),
1119 _decode,
1120 )
1121 }
1122}
1123
1124pub struct SimpleProtocolEventStream {
1125 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1126}
1127
1128impl std::marker::Unpin for SimpleProtocolEventStream {}
1129
1130impl futures::stream::FusedStream for SimpleProtocolEventStream {
1131 fn is_terminated(&self) -> bool {
1132 self.event_receiver.is_terminated()
1133 }
1134}
1135
1136impl futures::Stream for SimpleProtocolEventStream {
1137 type Item = Result<SimpleProtocolEvent, fidl::Error>;
1138
1139 fn poll_next(
1140 mut self: std::pin::Pin<&mut Self>,
1141 cx: &mut std::task::Context<'_>,
1142 ) -> std::task::Poll<Option<Self::Item>> {
1143 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1144 &mut self.event_receiver,
1145 cx
1146 )?) {
1147 Some(buf) => std::task::Poll::Ready(Some(SimpleProtocolEvent::decode(buf))),
1148 None => std::task::Poll::Ready(None),
1149 }
1150 }
1151}
1152
1153#[derive(Debug)]
1154pub enum SimpleProtocolEvent {}
1155
1156impl SimpleProtocolEvent {
1157 fn decode(
1159 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1160 ) -> Result<SimpleProtocolEvent, fidl::Error> {
1161 let (bytes, _handles) = buf.split_mut();
1162 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1163 debug_assert_eq!(tx_header.tx_id, 0);
1164 match tx_header.ordinal {
1165 _ => Err(fidl::Error::UnknownOrdinal {
1166 ordinal: tx_header.ordinal,
1167 protocol_name:
1168 <SimpleProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1169 }),
1170 }
1171 }
1172}
1173
1174pub struct SimpleProtocolRequestStream {
1176 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1177 is_terminated: bool,
1178}
1179
1180impl std::marker::Unpin for SimpleProtocolRequestStream {}
1181
1182impl futures::stream::FusedStream for SimpleProtocolRequestStream {
1183 fn is_terminated(&self) -> bool {
1184 self.is_terminated
1185 }
1186}
1187
1188impl fidl::endpoints::RequestStream for SimpleProtocolRequestStream {
1189 type Protocol = SimpleProtocolMarker;
1190 type ControlHandle = SimpleProtocolControlHandle;
1191
1192 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1193 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1194 }
1195
1196 fn control_handle(&self) -> Self::ControlHandle {
1197 SimpleProtocolControlHandle { inner: self.inner.clone() }
1198 }
1199
1200 fn into_inner(
1201 self,
1202 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1203 {
1204 (self.inner, self.is_terminated)
1205 }
1206
1207 fn from_inner(
1208 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1209 is_terminated: bool,
1210 ) -> Self {
1211 Self { inner, is_terminated }
1212 }
1213}
1214
1215impl futures::Stream for SimpleProtocolRequestStream {
1216 type Item = Result<SimpleProtocolRequest, fidl::Error>;
1217
1218 fn poll_next(
1219 mut self: std::pin::Pin<&mut Self>,
1220 cx: &mut std::task::Context<'_>,
1221 ) -> std::task::Poll<Option<Self::Item>> {
1222 let this = &mut *self;
1223 if this.inner.check_shutdown(cx) {
1224 this.is_terminated = true;
1225 return std::task::Poll::Ready(None);
1226 }
1227 if this.is_terminated {
1228 panic!("polled SimpleProtocolRequestStream after completion");
1229 }
1230 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1231 |bytes, handles| {
1232 match this.inner.channel().read_etc(cx, bytes, handles) {
1233 std::task::Poll::Ready(Ok(())) => {}
1234 std::task::Poll::Pending => return std::task::Poll::Pending,
1235 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1236 this.is_terminated = true;
1237 return std::task::Poll::Ready(None);
1238 }
1239 std::task::Poll::Ready(Err(e)) => {
1240 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1241 e.into(),
1242 ))));
1243 }
1244 }
1245
1246 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1248
1249 std::task::Poll::Ready(Some(match header.ordinal {
1250 0x482e3c82af55ef30 => {
1251 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1252 let mut req = fidl::new_empty!(
1253 fidl::encoding::EmptyPayload,
1254 fidl::encoding::DefaultFuchsiaResourceDialect
1255 );
1256 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1257 let control_handle =
1258 SimpleProtocolControlHandle { inner: this.inner.clone() };
1259 Ok(SimpleProtocolRequest::DoAction {
1260 responder: SimpleProtocolDoActionResponder {
1261 control_handle: std::mem::ManuallyDrop::new(control_handle),
1262 tx_id: header.tx_id,
1263 },
1264 })
1265 }
1266 _ => Err(fidl::Error::UnknownOrdinal {
1267 ordinal: header.ordinal,
1268 protocol_name:
1269 <SimpleProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1270 }),
1271 }))
1272 },
1273 )
1274 }
1275}
1276
1277#[derive(Debug)]
1278pub enum SimpleProtocolRequest {
1279 DoAction { responder: SimpleProtocolDoActionResponder },
1280}
1281
1282impl SimpleProtocolRequest {
1283 #[allow(irrefutable_let_patterns)]
1284 pub fn into_do_action(self) -> Option<(SimpleProtocolDoActionResponder)> {
1285 if let SimpleProtocolRequest::DoAction { responder } = self {
1286 Some((responder))
1287 } else {
1288 None
1289 }
1290 }
1291
1292 pub fn method_name(&self) -> &'static str {
1294 match *self {
1295 SimpleProtocolRequest::DoAction { .. } => "do_action",
1296 }
1297 }
1298}
1299
1300#[derive(Debug, Clone)]
1301pub struct SimpleProtocolControlHandle {
1302 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1303}
1304
1305impl SimpleProtocolControlHandle {
1306 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1307 self.inner.shutdown_with_epitaph(status.into())
1308 }
1309}
1310
1311impl fidl::endpoints::ControlHandle for SimpleProtocolControlHandle {
1312 fn shutdown(&self) {
1313 self.inner.shutdown()
1314 }
1315
1316 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1317 self.inner.shutdown_with_epitaph(status)
1318 }
1319
1320 fn is_closed(&self) -> bool {
1321 self.inner.channel().is_closed()
1322 }
1323 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1324 self.inner.channel().on_closed()
1325 }
1326
1327 #[cfg(target_os = "fuchsia")]
1328 fn signal_peer(
1329 &self,
1330 clear_mask: zx::Signals,
1331 set_mask: zx::Signals,
1332 ) -> Result<(), zx_status::Status> {
1333 use fidl::Peered;
1334 self.inner.channel().signal_peer(clear_mask, set_mask)
1335 }
1336}
1337
1338impl SimpleProtocolControlHandle {}
1339
1340#[must_use = "FIDL methods require a response to be sent"]
1341#[derive(Debug)]
1342pub struct SimpleProtocolDoActionResponder {
1343 control_handle: std::mem::ManuallyDrop<SimpleProtocolControlHandle>,
1344 tx_id: u32,
1345}
1346
1347impl std::ops::Drop for SimpleProtocolDoActionResponder {
1351 fn drop(&mut self) {
1352 self.control_handle.shutdown();
1353 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1355 }
1356}
1357
1358impl fidl::endpoints::Responder for SimpleProtocolDoActionResponder {
1359 type ControlHandle = SimpleProtocolControlHandle;
1360
1361 fn control_handle(&self) -> &SimpleProtocolControlHandle {
1362 &self.control_handle
1363 }
1364
1365 fn drop_without_shutdown(mut self) {
1366 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1368 std::mem::forget(self);
1370 }
1371}
1372
1373impl SimpleProtocolDoActionResponder {
1374 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1378 let _result = self.send_raw(result);
1379 if _result.is_err() {
1380 self.control_handle.shutdown();
1381 }
1382 self.drop_without_shutdown();
1383 _result
1384 }
1385
1386 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1388 let _result = self.send_raw(result);
1389 self.drop_without_shutdown();
1390 _result
1391 }
1392
1393 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1394 self.control_handle
1395 .inner
1396 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
1397 result,
1398 self.tx_id,
1399 0x482e3c82af55ef30,
1400 fidl::encoding::DynamicFlags::empty(),
1401 )
1402 }
1403}
1404
1405mod internal {
1406 use super::*;
1407
1408 impl fidl::encoding::ResourceTypeMarker for ProtocolFactoryCreateProtocolRequest {
1409 type Borrowed<'a> = &'a mut Self;
1410 fn take_or_borrow<'a>(
1411 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1412 ) -> Self::Borrowed<'a> {
1413 value
1414 }
1415 }
1416
1417 unsafe impl fidl::encoding::TypeMarker for ProtocolFactoryCreateProtocolRequest {
1418 type Owned = Self;
1419
1420 #[inline(always)]
1421 fn inline_align(_context: fidl::encoding::Context) -> usize {
1422 4
1423 }
1424
1425 #[inline(always)]
1426 fn inline_size(_context: fidl::encoding::Context) -> usize {
1427 4
1428 }
1429 }
1430
1431 unsafe impl
1432 fidl::encoding::Encode<
1433 ProtocolFactoryCreateProtocolRequest,
1434 fidl::encoding::DefaultFuchsiaResourceDialect,
1435 > for &mut ProtocolFactoryCreateProtocolRequest
1436 {
1437 #[inline]
1438 unsafe fn encode(
1439 self,
1440 encoder: &mut fidl::encoding::Encoder<
1441 '_,
1442 fidl::encoding::DefaultFuchsiaResourceDialect,
1443 >,
1444 offset: usize,
1445 _depth: fidl::encoding::Depth,
1446 ) -> fidl::Result<()> {
1447 encoder.debug_check_bounds::<ProtocolFactoryCreateProtocolRequest>(offset);
1448 fidl::encoding::Encode::<ProtocolFactoryCreateProtocolRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1450 (
1451 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProtocolMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.protocol),
1452 ),
1453 encoder, offset, _depth
1454 )
1455 }
1456 }
1457 unsafe impl<
1458 T0: fidl::encoding::Encode<
1459 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProtocolMarker>>,
1460 fidl::encoding::DefaultFuchsiaResourceDialect,
1461 >,
1462 >
1463 fidl::encoding::Encode<
1464 ProtocolFactoryCreateProtocolRequest,
1465 fidl::encoding::DefaultFuchsiaResourceDialect,
1466 > for (T0,)
1467 {
1468 #[inline]
1469 unsafe fn encode(
1470 self,
1471 encoder: &mut fidl::encoding::Encoder<
1472 '_,
1473 fidl::encoding::DefaultFuchsiaResourceDialect,
1474 >,
1475 offset: usize,
1476 depth: fidl::encoding::Depth,
1477 ) -> fidl::Result<()> {
1478 encoder.debug_check_bounds::<ProtocolFactoryCreateProtocolRequest>(offset);
1479 self.0.encode(encoder, offset + 0, depth)?;
1483 Ok(())
1484 }
1485 }
1486
1487 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1488 for ProtocolFactoryCreateProtocolRequest
1489 {
1490 #[inline(always)]
1491 fn new_empty() -> Self {
1492 Self {
1493 protocol: fidl::new_empty!(
1494 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProtocolMarker>>,
1495 fidl::encoding::DefaultFuchsiaResourceDialect
1496 ),
1497 }
1498 }
1499
1500 #[inline]
1501 unsafe fn decode(
1502 &mut self,
1503 decoder: &mut fidl::encoding::Decoder<
1504 '_,
1505 fidl::encoding::DefaultFuchsiaResourceDialect,
1506 >,
1507 offset: usize,
1508 _depth: fidl::encoding::Depth,
1509 ) -> fidl::Result<()> {
1510 decoder.debug_check_bounds::<Self>(offset);
1511 fidl::decode!(
1513 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProtocolMarker>>,
1514 fidl::encoding::DefaultFuchsiaResourceDialect,
1515 &mut self.protocol,
1516 decoder,
1517 offset + 0,
1518 _depth
1519 )?;
1520 Ok(())
1521 }
1522 }
1523}