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 let protocol_name = <ProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
70 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
71 }
72
73 pub fn into_channel(self) -> fidl::Channel {
74 self.client.into_channel()
75 }
76
77 pub fn wait_for_event(
80 &self,
81 deadline: zx::MonotonicInstant,
82 ) -> Result<ProtocolEvent, fidl::Error> {
83 ProtocolEvent::decode(self.client.wait_for_event(deadline)?)
84 }
85
86 pub fn r#do_action(
87 &self,
88 ___deadline: zx::MonotonicInstant,
89 ) -> Result<ProtocolDoActionResult, fidl::Error> {
90 let _response = self.client.send_query::<
91 fidl::encoding::EmptyPayload,
92 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
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 fidl::endpoints::ControlHandle for ProtocolControlHandle {
374 fn shutdown(&self) {
375 self.inner.shutdown()
376 }
377
378 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
379 self.inner.shutdown_with_epitaph(status)
380 }
381
382 fn is_closed(&self) -> bool {
383 self.inner.channel().is_closed()
384 }
385 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
386 self.inner.channel().on_closed()
387 }
388
389 #[cfg(target_os = "fuchsia")]
390 fn signal_peer(
391 &self,
392 clear_mask: zx::Signals,
393 set_mask: zx::Signals,
394 ) -> Result<(), zx_status::Status> {
395 use fidl::Peered;
396 self.inner.channel().signal_peer(clear_mask, set_mask)
397 }
398}
399
400impl ProtocolControlHandle {}
401
402#[must_use = "FIDL methods require a response to be sent"]
403#[derive(Debug)]
404pub struct ProtocolDoActionResponder {
405 control_handle: std::mem::ManuallyDrop<ProtocolControlHandle>,
406 tx_id: u32,
407}
408
409impl std::ops::Drop for ProtocolDoActionResponder {
413 fn drop(&mut self) {
414 self.control_handle.shutdown();
415 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
417 }
418}
419
420impl fidl::endpoints::Responder for ProtocolDoActionResponder {
421 type ControlHandle = ProtocolControlHandle;
422
423 fn control_handle(&self) -> &ProtocolControlHandle {
424 &self.control_handle
425 }
426
427 fn drop_without_shutdown(mut self) {
428 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
430 std::mem::forget(self);
432 }
433}
434
435impl ProtocolDoActionResponder {
436 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
440 let _result = self.send_raw(result);
441 if _result.is_err() {
442 self.control_handle.shutdown();
443 }
444 self.drop_without_shutdown();
445 _result
446 }
447
448 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
450 let _result = self.send_raw(result);
451 self.drop_without_shutdown();
452 _result
453 }
454
455 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
456 self.control_handle
457 .inner
458 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
459 result,
460 self.tx_id,
461 0x8831ffac41f0c9f,
462 fidl::encoding::DynamicFlags::empty(),
463 )
464 }
465}
466
467#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
468pub struct ProtocolFactoryMarker;
469
470impl fidl::endpoints::ProtocolMarker for ProtocolFactoryMarker {
471 type Proxy = ProtocolFactoryProxy;
472 type RequestStream = ProtocolFactoryRequestStream;
473 #[cfg(target_os = "fuchsia")]
474 type SynchronousProxy = ProtocolFactorySynchronousProxy;
475
476 const DEBUG_NAME: &'static str = "test.protocol.connector.ProtocolFactory";
477}
478impl fidl::endpoints::DiscoverableProtocolMarker for ProtocolFactoryMarker {}
479pub type ProtocolFactoryCreateProtocolResult = Result<(), Error>;
480
481pub trait ProtocolFactoryProxyInterface: Send + Sync {
482 type CreateProtocolResponseFut: std::future::Future<Output = Result<ProtocolFactoryCreateProtocolResult, fidl::Error>>
483 + Send;
484 fn r#create_protocol(
485 &self,
486 protocol: fidl::endpoints::ServerEnd<ProtocolMarker>,
487 ) -> Self::CreateProtocolResponseFut;
488}
489#[derive(Debug)]
490#[cfg(target_os = "fuchsia")]
491pub struct ProtocolFactorySynchronousProxy {
492 client: fidl::client::sync::Client,
493}
494
495#[cfg(target_os = "fuchsia")]
496impl fidl::endpoints::SynchronousProxy for ProtocolFactorySynchronousProxy {
497 type Proxy = ProtocolFactoryProxy;
498 type Protocol = ProtocolFactoryMarker;
499
500 fn from_channel(inner: fidl::Channel) -> Self {
501 Self::new(inner)
502 }
503
504 fn into_channel(self) -> fidl::Channel {
505 self.client.into_channel()
506 }
507
508 fn as_channel(&self) -> &fidl::Channel {
509 self.client.as_channel()
510 }
511}
512
513#[cfg(target_os = "fuchsia")]
514impl ProtocolFactorySynchronousProxy {
515 pub fn new(channel: fidl::Channel) -> Self {
516 let protocol_name = <ProtocolFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
517 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
518 }
519
520 pub fn into_channel(self) -> fidl::Channel {
521 self.client.into_channel()
522 }
523
524 pub fn wait_for_event(
527 &self,
528 deadline: zx::MonotonicInstant,
529 ) -> Result<ProtocolFactoryEvent, fidl::Error> {
530 ProtocolFactoryEvent::decode(self.client.wait_for_event(deadline)?)
531 }
532
533 pub fn r#create_protocol(
534 &self,
535 mut protocol: fidl::endpoints::ServerEnd<ProtocolMarker>,
536 ___deadline: zx::MonotonicInstant,
537 ) -> Result<ProtocolFactoryCreateProtocolResult, fidl::Error> {
538 let _response = self.client.send_query::<
539 ProtocolFactoryCreateProtocolRequest,
540 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
541 >(
542 (protocol,),
543 0x57fac7669eddfb24,
544 fidl::encoding::DynamicFlags::empty(),
545 ___deadline,
546 )?;
547 Ok(_response.map(|x| x))
548 }
549}
550
551#[cfg(target_os = "fuchsia")]
552impl From<ProtocolFactorySynchronousProxy> for zx::NullableHandle {
553 fn from(value: ProtocolFactorySynchronousProxy) -> Self {
554 value.into_channel().into()
555 }
556}
557
558#[cfg(target_os = "fuchsia")]
559impl From<fidl::Channel> for ProtocolFactorySynchronousProxy {
560 fn from(value: fidl::Channel) -> Self {
561 Self::new(value)
562 }
563}
564
565#[cfg(target_os = "fuchsia")]
566impl fidl::endpoints::FromClient for ProtocolFactorySynchronousProxy {
567 type Protocol = ProtocolFactoryMarker;
568
569 fn from_client(value: fidl::endpoints::ClientEnd<ProtocolFactoryMarker>) -> Self {
570 Self::new(value.into_channel())
571 }
572}
573
574#[derive(Debug, Clone)]
575pub struct ProtocolFactoryProxy {
576 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
577}
578
579impl fidl::endpoints::Proxy for ProtocolFactoryProxy {
580 type Protocol = ProtocolFactoryMarker;
581
582 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
583 Self::new(inner)
584 }
585
586 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
587 self.client.into_channel().map_err(|client| Self { client })
588 }
589
590 fn as_channel(&self) -> &::fidl::AsyncChannel {
591 self.client.as_channel()
592 }
593}
594
595impl ProtocolFactoryProxy {
596 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
598 let protocol_name = <ProtocolFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
599 Self { client: fidl::client::Client::new(channel, protocol_name) }
600 }
601
602 pub fn take_event_stream(&self) -> ProtocolFactoryEventStream {
608 ProtocolFactoryEventStream { event_receiver: self.client.take_event_receiver() }
609 }
610
611 pub fn r#create_protocol(
612 &self,
613 mut protocol: fidl::endpoints::ServerEnd<ProtocolMarker>,
614 ) -> fidl::client::QueryResponseFut<
615 ProtocolFactoryCreateProtocolResult,
616 fidl::encoding::DefaultFuchsiaResourceDialect,
617 > {
618 ProtocolFactoryProxyInterface::r#create_protocol(self, protocol)
619 }
620}
621
622impl ProtocolFactoryProxyInterface for ProtocolFactoryProxy {
623 type CreateProtocolResponseFut = fidl::client::QueryResponseFut<
624 ProtocolFactoryCreateProtocolResult,
625 fidl::encoding::DefaultFuchsiaResourceDialect,
626 >;
627 fn r#create_protocol(
628 &self,
629 mut protocol: fidl::endpoints::ServerEnd<ProtocolMarker>,
630 ) -> Self::CreateProtocolResponseFut {
631 fn _decode(
632 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
633 ) -> Result<ProtocolFactoryCreateProtocolResult, fidl::Error> {
634 let _response = fidl::client::decode_transaction_body::<
635 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
636 fidl::encoding::DefaultFuchsiaResourceDialect,
637 0x57fac7669eddfb24,
638 >(_buf?)?;
639 Ok(_response.map(|x| x))
640 }
641 self.client.send_query_and_decode::<
642 ProtocolFactoryCreateProtocolRequest,
643 ProtocolFactoryCreateProtocolResult,
644 >(
645 (protocol,),
646 0x57fac7669eddfb24,
647 fidl::encoding::DynamicFlags::empty(),
648 _decode,
649 )
650 }
651}
652
653pub struct ProtocolFactoryEventStream {
654 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
655}
656
657impl std::marker::Unpin for ProtocolFactoryEventStream {}
658
659impl futures::stream::FusedStream for ProtocolFactoryEventStream {
660 fn is_terminated(&self) -> bool {
661 self.event_receiver.is_terminated()
662 }
663}
664
665impl futures::Stream for ProtocolFactoryEventStream {
666 type Item = Result<ProtocolFactoryEvent, fidl::Error>;
667
668 fn poll_next(
669 mut self: std::pin::Pin<&mut Self>,
670 cx: &mut std::task::Context<'_>,
671 ) -> std::task::Poll<Option<Self::Item>> {
672 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
673 &mut self.event_receiver,
674 cx
675 )?) {
676 Some(buf) => std::task::Poll::Ready(Some(ProtocolFactoryEvent::decode(buf))),
677 None => std::task::Poll::Ready(None),
678 }
679 }
680}
681
682#[derive(Debug)]
683pub enum ProtocolFactoryEvent {}
684
685impl ProtocolFactoryEvent {
686 fn decode(
688 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
689 ) -> Result<ProtocolFactoryEvent, fidl::Error> {
690 let (bytes, _handles) = buf.split_mut();
691 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
692 debug_assert_eq!(tx_header.tx_id, 0);
693 match tx_header.ordinal {
694 _ => Err(fidl::Error::UnknownOrdinal {
695 ordinal: tx_header.ordinal,
696 protocol_name:
697 <ProtocolFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
698 }),
699 }
700 }
701}
702
703pub struct ProtocolFactoryRequestStream {
705 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
706 is_terminated: bool,
707}
708
709impl std::marker::Unpin for ProtocolFactoryRequestStream {}
710
711impl futures::stream::FusedStream for ProtocolFactoryRequestStream {
712 fn is_terminated(&self) -> bool {
713 self.is_terminated
714 }
715}
716
717impl fidl::endpoints::RequestStream for ProtocolFactoryRequestStream {
718 type Protocol = ProtocolFactoryMarker;
719 type ControlHandle = ProtocolFactoryControlHandle;
720
721 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
722 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
723 }
724
725 fn control_handle(&self) -> Self::ControlHandle {
726 ProtocolFactoryControlHandle { inner: self.inner.clone() }
727 }
728
729 fn into_inner(
730 self,
731 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
732 {
733 (self.inner, self.is_terminated)
734 }
735
736 fn from_inner(
737 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
738 is_terminated: bool,
739 ) -> Self {
740 Self { inner, is_terminated }
741 }
742}
743
744impl futures::Stream for ProtocolFactoryRequestStream {
745 type Item = Result<ProtocolFactoryRequest, fidl::Error>;
746
747 fn poll_next(
748 mut self: std::pin::Pin<&mut Self>,
749 cx: &mut std::task::Context<'_>,
750 ) -> std::task::Poll<Option<Self::Item>> {
751 let this = &mut *self;
752 if this.inner.check_shutdown(cx) {
753 this.is_terminated = true;
754 return std::task::Poll::Ready(None);
755 }
756 if this.is_terminated {
757 panic!("polled ProtocolFactoryRequestStream after completion");
758 }
759 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
760 |bytes, handles| {
761 match this.inner.channel().read_etc(cx, bytes, handles) {
762 std::task::Poll::Ready(Ok(())) => {}
763 std::task::Poll::Pending => return std::task::Poll::Pending,
764 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
765 this.is_terminated = true;
766 return std::task::Poll::Ready(None);
767 }
768 std::task::Poll::Ready(Err(e)) => {
769 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
770 e.into(),
771 ))));
772 }
773 }
774
775 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
777
778 std::task::Poll::Ready(Some(match header.ordinal {
779 0x57fac7669eddfb24 => {
780 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
781 let mut req = fidl::new_empty!(
782 ProtocolFactoryCreateProtocolRequest,
783 fidl::encoding::DefaultFuchsiaResourceDialect
784 );
785 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProtocolFactoryCreateProtocolRequest>(&header, _body_bytes, handles, &mut req)?;
786 let control_handle =
787 ProtocolFactoryControlHandle { inner: this.inner.clone() };
788 Ok(ProtocolFactoryRequest::CreateProtocol {
789 protocol: req.protocol,
790
791 responder: ProtocolFactoryCreateProtocolResponder {
792 control_handle: std::mem::ManuallyDrop::new(control_handle),
793 tx_id: header.tx_id,
794 },
795 })
796 }
797 _ => Err(fidl::Error::UnknownOrdinal {
798 ordinal: header.ordinal,
799 protocol_name:
800 <ProtocolFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
801 }),
802 }))
803 },
804 )
805 }
806}
807
808#[derive(Debug)]
809pub enum ProtocolFactoryRequest {
810 CreateProtocol {
811 protocol: fidl::endpoints::ServerEnd<ProtocolMarker>,
812 responder: ProtocolFactoryCreateProtocolResponder,
813 },
814}
815
816impl ProtocolFactoryRequest {
817 #[allow(irrefutable_let_patterns)]
818 pub fn into_create_protocol(
819 self,
820 ) -> Option<(fidl::endpoints::ServerEnd<ProtocolMarker>, ProtocolFactoryCreateProtocolResponder)>
821 {
822 if let ProtocolFactoryRequest::CreateProtocol { protocol, responder } = self {
823 Some((protocol, responder))
824 } else {
825 None
826 }
827 }
828
829 pub fn method_name(&self) -> &'static str {
831 match *self {
832 ProtocolFactoryRequest::CreateProtocol { .. } => "create_protocol",
833 }
834 }
835}
836
837#[derive(Debug, Clone)]
838pub struct ProtocolFactoryControlHandle {
839 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
840}
841
842impl fidl::endpoints::ControlHandle for ProtocolFactoryControlHandle {
843 fn shutdown(&self) {
844 self.inner.shutdown()
845 }
846
847 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
848 self.inner.shutdown_with_epitaph(status)
849 }
850
851 fn is_closed(&self) -> bool {
852 self.inner.channel().is_closed()
853 }
854 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
855 self.inner.channel().on_closed()
856 }
857
858 #[cfg(target_os = "fuchsia")]
859 fn signal_peer(
860 &self,
861 clear_mask: zx::Signals,
862 set_mask: zx::Signals,
863 ) -> Result<(), zx_status::Status> {
864 use fidl::Peered;
865 self.inner.channel().signal_peer(clear_mask, set_mask)
866 }
867}
868
869impl ProtocolFactoryControlHandle {}
870
871#[must_use = "FIDL methods require a response to be sent"]
872#[derive(Debug)]
873pub struct ProtocolFactoryCreateProtocolResponder {
874 control_handle: std::mem::ManuallyDrop<ProtocolFactoryControlHandle>,
875 tx_id: u32,
876}
877
878impl std::ops::Drop for ProtocolFactoryCreateProtocolResponder {
882 fn drop(&mut self) {
883 self.control_handle.shutdown();
884 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
886 }
887}
888
889impl fidl::endpoints::Responder for ProtocolFactoryCreateProtocolResponder {
890 type ControlHandle = ProtocolFactoryControlHandle;
891
892 fn control_handle(&self) -> &ProtocolFactoryControlHandle {
893 &self.control_handle
894 }
895
896 fn drop_without_shutdown(mut self) {
897 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
899 std::mem::forget(self);
901 }
902}
903
904impl ProtocolFactoryCreateProtocolResponder {
905 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
909 let _result = self.send_raw(result);
910 if _result.is_err() {
911 self.control_handle.shutdown();
912 }
913 self.drop_without_shutdown();
914 _result
915 }
916
917 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
919 let _result = self.send_raw(result);
920 self.drop_without_shutdown();
921 _result
922 }
923
924 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
925 self.control_handle
926 .inner
927 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
928 result,
929 self.tx_id,
930 0x57fac7669eddfb24,
931 fidl::encoding::DynamicFlags::empty(),
932 )
933 }
934}
935
936#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
937pub struct SimpleProtocolMarker;
938
939impl fidl::endpoints::ProtocolMarker for SimpleProtocolMarker {
940 type Proxy = SimpleProtocolProxy;
941 type RequestStream = SimpleProtocolRequestStream;
942 #[cfg(target_os = "fuchsia")]
943 type SynchronousProxy = SimpleProtocolSynchronousProxy;
944
945 const DEBUG_NAME: &'static str = "test.protocol.connector.SimpleProtocol";
946}
947impl fidl::endpoints::DiscoverableProtocolMarker for SimpleProtocolMarker {}
948pub type SimpleProtocolDoActionResult = Result<(), Error>;
949
950pub trait SimpleProtocolProxyInterface: Send + Sync {
951 type DoActionResponseFut: std::future::Future<Output = Result<SimpleProtocolDoActionResult, fidl::Error>>
952 + Send;
953 fn r#do_action(&self) -> Self::DoActionResponseFut;
954}
955#[derive(Debug)]
956#[cfg(target_os = "fuchsia")]
957pub struct SimpleProtocolSynchronousProxy {
958 client: fidl::client::sync::Client,
959}
960
961#[cfg(target_os = "fuchsia")]
962impl fidl::endpoints::SynchronousProxy for SimpleProtocolSynchronousProxy {
963 type Proxy = SimpleProtocolProxy;
964 type Protocol = SimpleProtocolMarker;
965
966 fn from_channel(inner: fidl::Channel) -> Self {
967 Self::new(inner)
968 }
969
970 fn into_channel(self) -> fidl::Channel {
971 self.client.into_channel()
972 }
973
974 fn as_channel(&self) -> &fidl::Channel {
975 self.client.as_channel()
976 }
977}
978
979#[cfg(target_os = "fuchsia")]
980impl SimpleProtocolSynchronousProxy {
981 pub fn new(channel: fidl::Channel) -> Self {
982 let protocol_name = <SimpleProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
983 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
984 }
985
986 pub fn into_channel(self) -> fidl::Channel {
987 self.client.into_channel()
988 }
989
990 pub fn wait_for_event(
993 &self,
994 deadline: zx::MonotonicInstant,
995 ) -> Result<SimpleProtocolEvent, fidl::Error> {
996 SimpleProtocolEvent::decode(self.client.wait_for_event(deadline)?)
997 }
998
999 pub fn r#do_action(
1000 &self,
1001 ___deadline: zx::MonotonicInstant,
1002 ) -> Result<SimpleProtocolDoActionResult, fidl::Error> {
1003 let _response = self.client.send_query::<
1004 fidl::encoding::EmptyPayload,
1005 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
1006 >(
1007 (),
1008 0x482e3c82af55ef30,
1009 fidl::encoding::DynamicFlags::empty(),
1010 ___deadline,
1011 )?;
1012 Ok(_response.map(|x| x))
1013 }
1014}
1015
1016#[cfg(target_os = "fuchsia")]
1017impl From<SimpleProtocolSynchronousProxy> for zx::NullableHandle {
1018 fn from(value: SimpleProtocolSynchronousProxy) -> Self {
1019 value.into_channel().into()
1020 }
1021}
1022
1023#[cfg(target_os = "fuchsia")]
1024impl From<fidl::Channel> for SimpleProtocolSynchronousProxy {
1025 fn from(value: fidl::Channel) -> Self {
1026 Self::new(value)
1027 }
1028}
1029
1030#[cfg(target_os = "fuchsia")]
1031impl fidl::endpoints::FromClient for SimpleProtocolSynchronousProxy {
1032 type Protocol = SimpleProtocolMarker;
1033
1034 fn from_client(value: fidl::endpoints::ClientEnd<SimpleProtocolMarker>) -> Self {
1035 Self::new(value.into_channel())
1036 }
1037}
1038
1039#[derive(Debug, Clone)]
1040pub struct SimpleProtocolProxy {
1041 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1042}
1043
1044impl fidl::endpoints::Proxy for SimpleProtocolProxy {
1045 type Protocol = SimpleProtocolMarker;
1046
1047 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1048 Self::new(inner)
1049 }
1050
1051 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1052 self.client.into_channel().map_err(|client| Self { client })
1053 }
1054
1055 fn as_channel(&self) -> &::fidl::AsyncChannel {
1056 self.client.as_channel()
1057 }
1058}
1059
1060impl SimpleProtocolProxy {
1061 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1063 let protocol_name = <SimpleProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1064 Self { client: fidl::client::Client::new(channel, protocol_name) }
1065 }
1066
1067 pub fn take_event_stream(&self) -> SimpleProtocolEventStream {
1073 SimpleProtocolEventStream { event_receiver: self.client.take_event_receiver() }
1074 }
1075
1076 pub fn r#do_action(
1077 &self,
1078 ) -> fidl::client::QueryResponseFut<
1079 SimpleProtocolDoActionResult,
1080 fidl::encoding::DefaultFuchsiaResourceDialect,
1081 > {
1082 SimpleProtocolProxyInterface::r#do_action(self)
1083 }
1084}
1085
1086impl SimpleProtocolProxyInterface for SimpleProtocolProxy {
1087 type DoActionResponseFut = fidl::client::QueryResponseFut<
1088 SimpleProtocolDoActionResult,
1089 fidl::encoding::DefaultFuchsiaResourceDialect,
1090 >;
1091 fn r#do_action(&self) -> Self::DoActionResponseFut {
1092 fn _decode(
1093 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1094 ) -> Result<SimpleProtocolDoActionResult, fidl::Error> {
1095 let _response = fidl::client::decode_transaction_body::<
1096 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
1097 fidl::encoding::DefaultFuchsiaResourceDialect,
1098 0x482e3c82af55ef30,
1099 >(_buf?)?;
1100 Ok(_response.map(|x| x))
1101 }
1102 self.client
1103 .send_query_and_decode::<fidl::encoding::EmptyPayload, SimpleProtocolDoActionResult>(
1104 (),
1105 0x482e3c82af55ef30,
1106 fidl::encoding::DynamicFlags::empty(),
1107 _decode,
1108 )
1109 }
1110}
1111
1112pub struct SimpleProtocolEventStream {
1113 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1114}
1115
1116impl std::marker::Unpin for SimpleProtocolEventStream {}
1117
1118impl futures::stream::FusedStream for SimpleProtocolEventStream {
1119 fn is_terminated(&self) -> bool {
1120 self.event_receiver.is_terminated()
1121 }
1122}
1123
1124impl futures::Stream for SimpleProtocolEventStream {
1125 type Item = Result<SimpleProtocolEvent, fidl::Error>;
1126
1127 fn poll_next(
1128 mut self: std::pin::Pin<&mut Self>,
1129 cx: &mut std::task::Context<'_>,
1130 ) -> std::task::Poll<Option<Self::Item>> {
1131 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1132 &mut self.event_receiver,
1133 cx
1134 )?) {
1135 Some(buf) => std::task::Poll::Ready(Some(SimpleProtocolEvent::decode(buf))),
1136 None => std::task::Poll::Ready(None),
1137 }
1138 }
1139}
1140
1141#[derive(Debug)]
1142pub enum SimpleProtocolEvent {}
1143
1144impl SimpleProtocolEvent {
1145 fn decode(
1147 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1148 ) -> Result<SimpleProtocolEvent, fidl::Error> {
1149 let (bytes, _handles) = buf.split_mut();
1150 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1151 debug_assert_eq!(tx_header.tx_id, 0);
1152 match tx_header.ordinal {
1153 _ => Err(fidl::Error::UnknownOrdinal {
1154 ordinal: tx_header.ordinal,
1155 protocol_name:
1156 <SimpleProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1157 }),
1158 }
1159 }
1160}
1161
1162pub struct SimpleProtocolRequestStream {
1164 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1165 is_terminated: bool,
1166}
1167
1168impl std::marker::Unpin for SimpleProtocolRequestStream {}
1169
1170impl futures::stream::FusedStream for SimpleProtocolRequestStream {
1171 fn is_terminated(&self) -> bool {
1172 self.is_terminated
1173 }
1174}
1175
1176impl fidl::endpoints::RequestStream for SimpleProtocolRequestStream {
1177 type Protocol = SimpleProtocolMarker;
1178 type ControlHandle = SimpleProtocolControlHandle;
1179
1180 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1181 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1182 }
1183
1184 fn control_handle(&self) -> Self::ControlHandle {
1185 SimpleProtocolControlHandle { inner: self.inner.clone() }
1186 }
1187
1188 fn into_inner(
1189 self,
1190 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1191 {
1192 (self.inner, self.is_terminated)
1193 }
1194
1195 fn from_inner(
1196 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1197 is_terminated: bool,
1198 ) -> Self {
1199 Self { inner, is_terminated }
1200 }
1201}
1202
1203impl futures::Stream for SimpleProtocolRequestStream {
1204 type Item = Result<SimpleProtocolRequest, fidl::Error>;
1205
1206 fn poll_next(
1207 mut self: std::pin::Pin<&mut Self>,
1208 cx: &mut std::task::Context<'_>,
1209 ) -> std::task::Poll<Option<Self::Item>> {
1210 let this = &mut *self;
1211 if this.inner.check_shutdown(cx) {
1212 this.is_terminated = true;
1213 return std::task::Poll::Ready(None);
1214 }
1215 if this.is_terminated {
1216 panic!("polled SimpleProtocolRequestStream after completion");
1217 }
1218 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1219 |bytes, handles| {
1220 match this.inner.channel().read_etc(cx, bytes, handles) {
1221 std::task::Poll::Ready(Ok(())) => {}
1222 std::task::Poll::Pending => return std::task::Poll::Pending,
1223 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1224 this.is_terminated = true;
1225 return std::task::Poll::Ready(None);
1226 }
1227 std::task::Poll::Ready(Err(e)) => {
1228 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1229 e.into(),
1230 ))));
1231 }
1232 }
1233
1234 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1236
1237 std::task::Poll::Ready(Some(match header.ordinal {
1238 0x482e3c82af55ef30 => {
1239 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1240 let mut req = fidl::new_empty!(
1241 fidl::encoding::EmptyPayload,
1242 fidl::encoding::DefaultFuchsiaResourceDialect
1243 );
1244 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1245 let control_handle =
1246 SimpleProtocolControlHandle { inner: this.inner.clone() };
1247 Ok(SimpleProtocolRequest::DoAction {
1248 responder: SimpleProtocolDoActionResponder {
1249 control_handle: std::mem::ManuallyDrop::new(control_handle),
1250 tx_id: header.tx_id,
1251 },
1252 })
1253 }
1254 _ => Err(fidl::Error::UnknownOrdinal {
1255 ordinal: header.ordinal,
1256 protocol_name:
1257 <SimpleProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1258 }),
1259 }))
1260 },
1261 )
1262 }
1263}
1264
1265#[derive(Debug)]
1266pub enum SimpleProtocolRequest {
1267 DoAction { responder: SimpleProtocolDoActionResponder },
1268}
1269
1270impl SimpleProtocolRequest {
1271 #[allow(irrefutable_let_patterns)]
1272 pub fn into_do_action(self) -> Option<(SimpleProtocolDoActionResponder)> {
1273 if let SimpleProtocolRequest::DoAction { responder } = self {
1274 Some((responder))
1275 } else {
1276 None
1277 }
1278 }
1279
1280 pub fn method_name(&self) -> &'static str {
1282 match *self {
1283 SimpleProtocolRequest::DoAction { .. } => "do_action",
1284 }
1285 }
1286}
1287
1288#[derive(Debug, Clone)]
1289pub struct SimpleProtocolControlHandle {
1290 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1291}
1292
1293impl fidl::endpoints::ControlHandle for SimpleProtocolControlHandle {
1294 fn shutdown(&self) {
1295 self.inner.shutdown()
1296 }
1297
1298 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1299 self.inner.shutdown_with_epitaph(status)
1300 }
1301
1302 fn is_closed(&self) -> bool {
1303 self.inner.channel().is_closed()
1304 }
1305 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1306 self.inner.channel().on_closed()
1307 }
1308
1309 #[cfg(target_os = "fuchsia")]
1310 fn signal_peer(
1311 &self,
1312 clear_mask: zx::Signals,
1313 set_mask: zx::Signals,
1314 ) -> Result<(), zx_status::Status> {
1315 use fidl::Peered;
1316 self.inner.channel().signal_peer(clear_mask, set_mask)
1317 }
1318}
1319
1320impl SimpleProtocolControlHandle {}
1321
1322#[must_use = "FIDL methods require a response to be sent"]
1323#[derive(Debug)]
1324pub struct SimpleProtocolDoActionResponder {
1325 control_handle: std::mem::ManuallyDrop<SimpleProtocolControlHandle>,
1326 tx_id: u32,
1327}
1328
1329impl std::ops::Drop for SimpleProtocolDoActionResponder {
1333 fn drop(&mut self) {
1334 self.control_handle.shutdown();
1335 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1337 }
1338}
1339
1340impl fidl::endpoints::Responder for SimpleProtocolDoActionResponder {
1341 type ControlHandle = SimpleProtocolControlHandle;
1342
1343 fn control_handle(&self) -> &SimpleProtocolControlHandle {
1344 &self.control_handle
1345 }
1346
1347 fn drop_without_shutdown(mut self) {
1348 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1350 std::mem::forget(self);
1352 }
1353}
1354
1355impl SimpleProtocolDoActionResponder {
1356 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1360 let _result = self.send_raw(result);
1361 if _result.is_err() {
1362 self.control_handle.shutdown();
1363 }
1364 self.drop_without_shutdown();
1365 _result
1366 }
1367
1368 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1370 let _result = self.send_raw(result);
1371 self.drop_without_shutdown();
1372 _result
1373 }
1374
1375 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1376 self.control_handle
1377 .inner
1378 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
1379 result,
1380 self.tx_id,
1381 0x482e3c82af55ef30,
1382 fidl::encoding::DynamicFlags::empty(),
1383 )
1384 }
1385}
1386
1387mod internal {
1388 use super::*;
1389
1390 impl fidl::encoding::ResourceTypeMarker for ProtocolFactoryCreateProtocolRequest {
1391 type Borrowed<'a> = &'a mut Self;
1392 fn take_or_borrow<'a>(
1393 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1394 ) -> Self::Borrowed<'a> {
1395 value
1396 }
1397 }
1398
1399 unsafe impl fidl::encoding::TypeMarker for ProtocolFactoryCreateProtocolRequest {
1400 type Owned = Self;
1401
1402 #[inline(always)]
1403 fn inline_align(_context: fidl::encoding::Context) -> usize {
1404 4
1405 }
1406
1407 #[inline(always)]
1408 fn inline_size(_context: fidl::encoding::Context) -> usize {
1409 4
1410 }
1411 }
1412
1413 unsafe impl
1414 fidl::encoding::Encode<
1415 ProtocolFactoryCreateProtocolRequest,
1416 fidl::encoding::DefaultFuchsiaResourceDialect,
1417 > for &mut ProtocolFactoryCreateProtocolRequest
1418 {
1419 #[inline]
1420 unsafe fn encode(
1421 self,
1422 encoder: &mut fidl::encoding::Encoder<
1423 '_,
1424 fidl::encoding::DefaultFuchsiaResourceDialect,
1425 >,
1426 offset: usize,
1427 _depth: fidl::encoding::Depth,
1428 ) -> fidl::Result<()> {
1429 encoder.debug_check_bounds::<ProtocolFactoryCreateProtocolRequest>(offset);
1430 fidl::encoding::Encode::<ProtocolFactoryCreateProtocolRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1432 (
1433 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProtocolMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.protocol),
1434 ),
1435 encoder, offset, _depth
1436 )
1437 }
1438 }
1439 unsafe impl<
1440 T0: fidl::encoding::Encode<
1441 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProtocolMarker>>,
1442 fidl::encoding::DefaultFuchsiaResourceDialect,
1443 >,
1444 >
1445 fidl::encoding::Encode<
1446 ProtocolFactoryCreateProtocolRequest,
1447 fidl::encoding::DefaultFuchsiaResourceDialect,
1448 > for (T0,)
1449 {
1450 #[inline]
1451 unsafe fn encode(
1452 self,
1453 encoder: &mut fidl::encoding::Encoder<
1454 '_,
1455 fidl::encoding::DefaultFuchsiaResourceDialect,
1456 >,
1457 offset: usize,
1458 depth: fidl::encoding::Depth,
1459 ) -> fidl::Result<()> {
1460 encoder.debug_check_bounds::<ProtocolFactoryCreateProtocolRequest>(offset);
1461 self.0.encode(encoder, offset + 0, depth)?;
1465 Ok(())
1466 }
1467 }
1468
1469 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1470 for ProtocolFactoryCreateProtocolRequest
1471 {
1472 #[inline(always)]
1473 fn new_empty() -> Self {
1474 Self {
1475 protocol: fidl::new_empty!(
1476 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProtocolMarker>>,
1477 fidl::encoding::DefaultFuchsiaResourceDialect
1478 ),
1479 }
1480 }
1481
1482 #[inline]
1483 unsafe fn decode(
1484 &mut self,
1485 decoder: &mut fidl::encoding::Decoder<
1486 '_,
1487 fidl::encoding::DefaultFuchsiaResourceDialect,
1488 >,
1489 offset: usize,
1490 _depth: fidl::encoding::Depth,
1491 ) -> fidl::Result<()> {
1492 decoder.debug_check_bounds::<Self>(offset);
1493 fidl::decode!(
1495 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProtocolMarker>>,
1496 fidl::encoding::DefaultFuchsiaResourceDialect,
1497 &mut self.protocol,
1498 decoder,
1499 offset + 0,
1500 _depth
1501 )?;
1502 Ok(())
1503 }
1504 }
1505}