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