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_fuchsia_weave__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct BootstrapImportWeaveConfigRequest {
16 pub config_json: fidl_fuchsia_mem::Buffer,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
20 for BootstrapImportWeaveConfigRequest
21{
22}
23
24#[derive(Debug, PartialEq)]
25pub struct FactoryDataManagerGetWeaveCertificateResponse {
26 pub certificate: fidl_fuchsia_mem::Buffer,
27}
28
29impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
30 for FactoryDataManagerGetWeaveCertificateResponse
31{
32}
33
34#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
35pub struct StackGetPairingStateWatcherRequest {
36 pub watcher: fidl::endpoints::ServerEnd<PairingStateWatcherMarker>,
37}
38
39impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
40 for StackGetPairingStateWatcherRequest
41{
42}
43
44#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
45pub struct StackGetSvcDirectoryWatcherRequest {
46 pub endpoint_id: u64,
47 pub watcher: fidl::endpoints::ServerEnd<SvcDirectoryWatcherMarker>,
48}
49
50impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
51 for StackGetSvcDirectoryWatcherRequest
52{
53}
54
55#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
56pub struct StackProviderSetWlanNetworkConfigProviderRequest {
57 pub provider: fidl::endpoints::ClientEnd<WlanNetworkConfigProviderMarker>,
58}
59
60impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
61 for StackProviderSetWlanNetworkConfigProviderRequest
62{
63}
64
65#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
66pub struct BootstrapMarker;
67
68impl fidl::endpoints::ProtocolMarker for BootstrapMarker {
69 type Proxy = BootstrapProxy;
70 type RequestStream = BootstrapRequestStream;
71 #[cfg(target_os = "fuchsia")]
72 type SynchronousProxy = BootstrapSynchronousProxy;
73
74 const DEBUG_NAME: &'static str = "fuchsia.weave.Bootstrap";
75}
76impl fidl::endpoints::DiscoverableProtocolMarker for BootstrapMarker {}
77pub type BootstrapImportWeaveConfigResult = Result<(), i32>;
78
79pub trait BootstrapProxyInterface: Send + Sync {
80 type ImportWeaveConfigResponseFut: std::future::Future<Output = Result<BootstrapImportWeaveConfigResult, fidl::Error>>
81 + Send;
82 fn r#import_weave_config(
83 &self,
84 config_json: fidl_fuchsia_mem::Buffer,
85 ) -> Self::ImportWeaveConfigResponseFut;
86}
87#[derive(Debug)]
88#[cfg(target_os = "fuchsia")]
89pub struct BootstrapSynchronousProxy {
90 client: fidl::client::sync::Client,
91}
92
93#[cfg(target_os = "fuchsia")]
94impl fidl::endpoints::SynchronousProxy for BootstrapSynchronousProxy {
95 type Proxy = BootstrapProxy;
96 type Protocol = BootstrapMarker;
97
98 fn from_channel(inner: fidl::Channel) -> Self {
99 Self::new(inner)
100 }
101
102 fn into_channel(self) -> fidl::Channel {
103 self.client.into_channel()
104 }
105
106 fn as_channel(&self) -> &fidl::Channel {
107 self.client.as_channel()
108 }
109}
110
111#[cfg(target_os = "fuchsia")]
112impl BootstrapSynchronousProxy {
113 pub fn new(channel: fidl::Channel) -> Self {
114 let protocol_name = <BootstrapMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
115 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
116 }
117
118 pub fn into_channel(self) -> fidl::Channel {
119 self.client.into_channel()
120 }
121
122 pub fn wait_for_event(
125 &self,
126 deadline: zx::MonotonicInstant,
127 ) -> Result<BootstrapEvent, fidl::Error> {
128 BootstrapEvent::decode(self.client.wait_for_event(deadline)?)
129 }
130
131 pub fn r#import_weave_config(
138 &self,
139 mut config_json: fidl_fuchsia_mem::Buffer,
140 ___deadline: zx::MonotonicInstant,
141 ) -> Result<BootstrapImportWeaveConfigResult, fidl::Error> {
142 let _response = self.client.send_query::<
143 BootstrapImportWeaveConfigRequest,
144 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
145 >(
146 (&mut config_json,),
147 0x3cba680ade22f738,
148 fidl::encoding::DynamicFlags::empty(),
149 ___deadline,
150 )?;
151 Ok(_response.map(|x| x))
152 }
153}
154
155#[cfg(target_os = "fuchsia")]
156impl From<BootstrapSynchronousProxy> for zx::NullableHandle {
157 fn from(value: BootstrapSynchronousProxy) -> Self {
158 value.into_channel().into()
159 }
160}
161
162#[cfg(target_os = "fuchsia")]
163impl From<fidl::Channel> for BootstrapSynchronousProxy {
164 fn from(value: fidl::Channel) -> Self {
165 Self::new(value)
166 }
167}
168
169#[cfg(target_os = "fuchsia")]
170impl fidl::endpoints::FromClient for BootstrapSynchronousProxy {
171 type Protocol = BootstrapMarker;
172
173 fn from_client(value: fidl::endpoints::ClientEnd<BootstrapMarker>) -> Self {
174 Self::new(value.into_channel())
175 }
176}
177
178#[derive(Debug, Clone)]
179pub struct BootstrapProxy {
180 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
181}
182
183impl fidl::endpoints::Proxy for BootstrapProxy {
184 type Protocol = BootstrapMarker;
185
186 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
187 Self::new(inner)
188 }
189
190 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
191 self.client.into_channel().map_err(|client| Self { client })
192 }
193
194 fn as_channel(&self) -> &::fidl::AsyncChannel {
195 self.client.as_channel()
196 }
197}
198
199impl BootstrapProxy {
200 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
202 let protocol_name = <BootstrapMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
203 Self { client: fidl::client::Client::new(channel, protocol_name) }
204 }
205
206 pub fn take_event_stream(&self) -> BootstrapEventStream {
212 BootstrapEventStream { event_receiver: self.client.take_event_receiver() }
213 }
214
215 pub fn r#import_weave_config(
222 &self,
223 mut config_json: fidl_fuchsia_mem::Buffer,
224 ) -> fidl::client::QueryResponseFut<
225 BootstrapImportWeaveConfigResult,
226 fidl::encoding::DefaultFuchsiaResourceDialect,
227 > {
228 BootstrapProxyInterface::r#import_weave_config(self, config_json)
229 }
230}
231
232impl BootstrapProxyInterface for BootstrapProxy {
233 type ImportWeaveConfigResponseFut = fidl::client::QueryResponseFut<
234 BootstrapImportWeaveConfigResult,
235 fidl::encoding::DefaultFuchsiaResourceDialect,
236 >;
237 fn r#import_weave_config(
238 &self,
239 mut config_json: fidl_fuchsia_mem::Buffer,
240 ) -> Self::ImportWeaveConfigResponseFut {
241 fn _decode(
242 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
243 ) -> Result<BootstrapImportWeaveConfigResult, fidl::Error> {
244 let _response = fidl::client::decode_transaction_body::<
245 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
246 fidl::encoding::DefaultFuchsiaResourceDialect,
247 0x3cba680ade22f738,
248 >(_buf?)?;
249 Ok(_response.map(|x| x))
250 }
251 self.client.send_query_and_decode::<
252 BootstrapImportWeaveConfigRequest,
253 BootstrapImportWeaveConfigResult,
254 >(
255 (&mut config_json,),
256 0x3cba680ade22f738,
257 fidl::encoding::DynamicFlags::empty(),
258 _decode,
259 )
260 }
261}
262
263pub struct BootstrapEventStream {
264 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
265}
266
267impl std::marker::Unpin for BootstrapEventStream {}
268
269impl futures::stream::FusedStream for BootstrapEventStream {
270 fn is_terminated(&self) -> bool {
271 self.event_receiver.is_terminated()
272 }
273}
274
275impl futures::Stream for BootstrapEventStream {
276 type Item = Result<BootstrapEvent, fidl::Error>;
277
278 fn poll_next(
279 mut self: std::pin::Pin<&mut Self>,
280 cx: &mut std::task::Context<'_>,
281 ) -> std::task::Poll<Option<Self::Item>> {
282 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
283 &mut self.event_receiver,
284 cx
285 )?) {
286 Some(buf) => std::task::Poll::Ready(Some(BootstrapEvent::decode(buf))),
287 None => std::task::Poll::Ready(None),
288 }
289 }
290}
291
292#[derive(Debug)]
293pub enum BootstrapEvent {}
294
295impl BootstrapEvent {
296 fn decode(
298 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
299 ) -> Result<BootstrapEvent, fidl::Error> {
300 let (bytes, _handles) = buf.split_mut();
301 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
302 debug_assert_eq!(tx_header.tx_id, 0);
303 match tx_header.ordinal {
304 _ => Err(fidl::Error::UnknownOrdinal {
305 ordinal: tx_header.ordinal,
306 protocol_name: <BootstrapMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
307 }),
308 }
309 }
310}
311
312pub struct BootstrapRequestStream {
314 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
315 is_terminated: bool,
316}
317
318impl std::marker::Unpin for BootstrapRequestStream {}
319
320impl futures::stream::FusedStream for BootstrapRequestStream {
321 fn is_terminated(&self) -> bool {
322 self.is_terminated
323 }
324}
325
326impl fidl::endpoints::RequestStream for BootstrapRequestStream {
327 type Protocol = BootstrapMarker;
328 type ControlHandle = BootstrapControlHandle;
329
330 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
331 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
332 }
333
334 fn control_handle(&self) -> Self::ControlHandle {
335 BootstrapControlHandle { inner: self.inner.clone() }
336 }
337
338 fn into_inner(
339 self,
340 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
341 {
342 (self.inner, self.is_terminated)
343 }
344
345 fn from_inner(
346 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
347 is_terminated: bool,
348 ) -> Self {
349 Self { inner, is_terminated }
350 }
351}
352
353impl futures::Stream for BootstrapRequestStream {
354 type Item = Result<BootstrapRequest, fidl::Error>;
355
356 fn poll_next(
357 mut self: std::pin::Pin<&mut Self>,
358 cx: &mut std::task::Context<'_>,
359 ) -> std::task::Poll<Option<Self::Item>> {
360 let this = &mut *self;
361 if this.inner.check_shutdown(cx) {
362 this.is_terminated = true;
363 return std::task::Poll::Ready(None);
364 }
365 if this.is_terminated {
366 panic!("polled BootstrapRequestStream after completion");
367 }
368 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
369 |bytes, handles| {
370 match this.inner.channel().read_etc(cx, bytes, handles) {
371 std::task::Poll::Ready(Ok(())) => {}
372 std::task::Poll::Pending => return std::task::Poll::Pending,
373 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
374 this.is_terminated = true;
375 return std::task::Poll::Ready(None);
376 }
377 std::task::Poll::Ready(Err(e)) => {
378 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
379 e.into(),
380 ))));
381 }
382 }
383
384 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
386
387 std::task::Poll::Ready(Some(match header.ordinal {
388 0x3cba680ade22f738 => {
389 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
390 let mut req = fidl::new_empty!(
391 BootstrapImportWeaveConfigRequest,
392 fidl::encoding::DefaultFuchsiaResourceDialect
393 );
394 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BootstrapImportWeaveConfigRequest>(&header, _body_bytes, handles, &mut req)?;
395 let control_handle = BootstrapControlHandle { inner: this.inner.clone() };
396 Ok(BootstrapRequest::ImportWeaveConfig {
397 config_json: req.config_json,
398
399 responder: BootstrapImportWeaveConfigResponder {
400 control_handle: std::mem::ManuallyDrop::new(control_handle),
401 tx_id: header.tx_id,
402 },
403 })
404 }
405 _ => Err(fidl::Error::UnknownOrdinal {
406 ordinal: header.ordinal,
407 protocol_name:
408 <BootstrapMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
409 }),
410 }))
411 },
412 )
413 }
414}
415
416#[derive(Debug)]
420pub enum BootstrapRequest {
421 ImportWeaveConfig {
428 config_json: fidl_fuchsia_mem::Buffer,
429 responder: BootstrapImportWeaveConfigResponder,
430 },
431}
432
433impl BootstrapRequest {
434 #[allow(irrefutable_let_patterns)]
435 pub fn into_import_weave_config(
436 self,
437 ) -> Option<(fidl_fuchsia_mem::Buffer, BootstrapImportWeaveConfigResponder)> {
438 if let BootstrapRequest::ImportWeaveConfig { config_json, responder } = self {
439 Some((config_json, responder))
440 } else {
441 None
442 }
443 }
444
445 pub fn method_name(&self) -> &'static str {
447 match *self {
448 BootstrapRequest::ImportWeaveConfig { .. } => "import_weave_config",
449 }
450 }
451}
452
453#[derive(Debug, Clone)]
454pub struct BootstrapControlHandle {
455 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
456}
457
458impl fidl::endpoints::ControlHandle for BootstrapControlHandle {
459 fn shutdown(&self) {
460 self.inner.shutdown()
461 }
462
463 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
464 self.inner.shutdown_with_epitaph(status)
465 }
466
467 fn is_closed(&self) -> bool {
468 self.inner.channel().is_closed()
469 }
470 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
471 self.inner.channel().on_closed()
472 }
473
474 #[cfg(target_os = "fuchsia")]
475 fn signal_peer(
476 &self,
477 clear_mask: zx::Signals,
478 set_mask: zx::Signals,
479 ) -> Result<(), zx_status::Status> {
480 use fidl::Peered;
481 self.inner.channel().signal_peer(clear_mask, set_mask)
482 }
483}
484
485impl BootstrapControlHandle {}
486
487#[must_use = "FIDL methods require a response to be sent"]
488#[derive(Debug)]
489pub struct BootstrapImportWeaveConfigResponder {
490 control_handle: std::mem::ManuallyDrop<BootstrapControlHandle>,
491 tx_id: u32,
492}
493
494impl std::ops::Drop for BootstrapImportWeaveConfigResponder {
498 fn drop(&mut self) {
499 self.control_handle.shutdown();
500 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
502 }
503}
504
505impl fidl::endpoints::Responder for BootstrapImportWeaveConfigResponder {
506 type ControlHandle = BootstrapControlHandle;
507
508 fn control_handle(&self) -> &BootstrapControlHandle {
509 &self.control_handle
510 }
511
512 fn drop_without_shutdown(mut self) {
513 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
515 std::mem::forget(self);
517 }
518}
519
520impl BootstrapImportWeaveConfigResponder {
521 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
525 let _result = self.send_raw(result);
526 if _result.is_err() {
527 self.control_handle.shutdown();
528 }
529 self.drop_without_shutdown();
530 _result
531 }
532
533 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
535 let _result = self.send_raw(result);
536 self.drop_without_shutdown();
537 _result
538 }
539
540 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
541 self.control_handle
542 .inner
543 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
544 result,
545 self.tx_id,
546 0x3cba680ade22f738,
547 fidl::encoding::DynamicFlags::empty(),
548 )
549 }
550}
551
552#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
553pub struct FactoryDataManagerMarker;
554
555impl fidl::endpoints::ProtocolMarker for FactoryDataManagerMarker {
556 type Proxy = FactoryDataManagerProxy;
557 type RequestStream = FactoryDataManagerRequestStream;
558 #[cfg(target_os = "fuchsia")]
559 type SynchronousProxy = FactoryDataManagerSynchronousProxy;
560
561 const DEBUG_NAME: &'static str = "fuchsia.weave.FactoryDataManager";
562}
563impl fidl::endpoints::DiscoverableProtocolMarker for FactoryDataManagerMarker {}
564pub type FactoryDataManagerGetPairingCodeResult = Result<Vec<u8>, ErrorCode>;
565pub type FactoryDataManagerGetWeaveCertificateResult = Result<fidl_fuchsia_mem::Buffer, ErrorCode>;
566
567pub trait FactoryDataManagerProxyInterface: Send + Sync {
568 type GetPairingCodeResponseFut: std::future::Future<Output = Result<FactoryDataManagerGetPairingCodeResult, fidl::Error>>
569 + Send;
570 fn r#get_pairing_code(&self) -> Self::GetPairingCodeResponseFut;
571 type GetWeaveCertificateResponseFut: std::future::Future<
572 Output = Result<FactoryDataManagerGetWeaveCertificateResult, fidl::Error>,
573 > + Send;
574 fn r#get_weave_certificate(&self) -> Self::GetWeaveCertificateResponseFut;
575}
576#[derive(Debug)]
577#[cfg(target_os = "fuchsia")]
578pub struct FactoryDataManagerSynchronousProxy {
579 client: fidl::client::sync::Client,
580}
581
582#[cfg(target_os = "fuchsia")]
583impl fidl::endpoints::SynchronousProxy for FactoryDataManagerSynchronousProxy {
584 type Proxy = FactoryDataManagerProxy;
585 type Protocol = FactoryDataManagerMarker;
586
587 fn from_channel(inner: fidl::Channel) -> Self {
588 Self::new(inner)
589 }
590
591 fn into_channel(self) -> fidl::Channel {
592 self.client.into_channel()
593 }
594
595 fn as_channel(&self) -> &fidl::Channel {
596 self.client.as_channel()
597 }
598}
599
600#[cfg(target_os = "fuchsia")]
601impl FactoryDataManagerSynchronousProxy {
602 pub fn new(channel: fidl::Channel) -> Self {
603 let protocol_name =
604 <FactoryDataManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
605 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
606 }
607
608 pub fn into_channel(self) -> fidl::Channel {
609 self.client.into_channel()
610 }
611
612 pub fn wait_for_event(
615 &self,
616 deadline: zx::MonotonicInstant,
617 ) -> Result<FactoryDataManagerEvent, fidl::Error> {
618 FactoryDataManagerEvent::decode(self.client.wait_for_event(deadline)?)
619 }
620
621 pub fn r#get_pairing_code(
623 &self,
624 ___deadline: zx::MonotonicInstant,
625 ) -> Result<FactoryDataManagerGetPairingCodeResult, fidl::Error> {
626 let _response =
627 self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
628 FactoryDataManagerGetPairingCodeResponse,
629 ErrorCode,
630 >>(
631 (),
632 0x75630bcd80418a0f,
633 fidl::encoding::DynamicFlags::empty(),
634 ___deadline,
635 )?;
636 Ok(_response.map(|x| x.pairing_code))
637 }
638
639 pub fn r#get_weave_certificate(
641 &self,
642 ___deadline: zx::MonotonicInstant,
643 ) -> Result<FactoryDataManagerGetWeaveCertificateResult, fidl::Error> {
644 let _response =
645 self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
646 FactoryDataManagerGetWeaveCertificateResponse,
647 ErrorCode,
648 >>(
649 (),
650 0x1b4feca8bc141380,
651 fidl::encoding::DynamicFlags::empty(),
652 ___deadline,
653 )?;
654 Ok(_response.map(|x| x.certificate))
655 }
656}
657
658#[cfg(target_os = "fuchsia")]
659impl From<FactoryDataManagerSynchronousProxy> for zx::NullableHandle {
660 fn from(value: FactoryDataManagerSynchronousProxy) -> Self {
661 value.into_channel().into()
662 }
663}
664
665#[cfg(target_os = "fuchsia")]
666impl From<fidl::Channel> for FactoryDataManagerSynchronousProxy {
667 fn from(value: fidl::Channel) -> Self {
668 Self::new(value)
669 }
670}
671
672#[cfg(target_os = "fuchsia")]
673impl fidl::endpoints::FromClient for FactoryDataManagerSynchronousProxy {
674 type Protocol = FactoryDataManagerMarker;
675
676 fn from_client(value: fidl::endpoints::ClientEnd<FactoryDataManagerMarker>) -> Self {
677 Self::new(value.into_channel())
678 }
679}
680
681#[derive(Debug, Clone)]
682pub struct FactoryDataManagerProxy {
683 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
684}
685
686impl fidl::endpoints::Proxy for FactoryDataManagerProxy {
687 type Protocol = FactoryDataManagerMarker;
688
689 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
690 Self::new(inner)
691 }
692
693 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
694 self.client.into_channel().map_err(|client| Self { client })
695 }
696
697 fn as_channel(&self) -> &::fidl::AsyncChannel {
698 self.client.as_channel()
699 }
700}
701
702impl FactoryDataManagerProxy {
703 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
705 let protocol_name =
706 <FactoryDataManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
707 Self { client: fidl::client::Client::new(channel, protocol_name) }
708 }
709
710 pub fn take_event_stream(&self) -> FactoryDataManagerEventStream {
716 FactoryDataManagerEventStream { event_receiver: self.client.take_event_receiver() }
717 }
718
719 pub fn r#get_pairing_code(
721 &self,
722 ) -> fidl::client::QueryResponseFut<
723 FactoryDataManagerGetPairingCodeResult,
724 fidl::encoding::DefaultFuchsiaResourceDialect,
725 > {
726 FactoryDataManagerProxyInterface::r#get_pairing_code(self)
727 }
728
729 pub fn r#get_weave_certificate(
731 &self,
732 ) -> fidl::client::QueryResponseFut<
733 FactoryDataManagerGetWeaveCertificateResult,
734 fidl::encoding::DefaultFuchsiaResourceDialect,
735 > {
736 FactoryDataManagerProxyInterface::r#get_weave_certificate(self)
737 }
738}
739
740impl FactoryDataManagerProxyInterface for FactoryDataManagerProxy {
741 type GetPairingCodeResponseFut = fidl::client::QueryResponseFut<
742 FactoryDataManagerGetPairingCodeResult,
743 fidl::encoding::DefaultFuchsiaResourceDialect,
744 >;
745 fn r#get_pairing_code(&self) -> Self::GetPairingCodeResponseFut {
746 fn _decode(
747 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
748 ) -> Result<FactoryDataManagerGetPairingCodeResult, fidl::Error> {
749 let _response = fidl::client::decode_transaction_body::<
750 fidl::encoding::ResultType<FactoryDataManagerGetPairingCodeResponse, ErrorCode>,
751 fidl::encoding::DefaultFuchsiaResourceDialect,
752 0x75630bcd80418a0f,
753 >(_buf?)?;
754 Ok(_response.map(|x| x.pairing_code))
755 }
756 self.client.send_query_and_decode::<
757 fidl::encoding::EmptyPayload,
758 FactoryDataManagerGetPairingCodeResult,
759 >(
760 (),
761 0x75630bcd80418a0f,
762 fidl::encoding::DynamicFlags::empty(),
763 _decode,
764 )
765 }
766
767 type GetWeaveCertificateResponseFut = fidl::client::QueryResponseFut<
768 FactoryDataManagerGetWeaveCertificateResult,
769 fidl::encoding::DefaultFuchsiaResourceDialect,
770 >;
771 fn r#get_weave_certificate(&self) -> Self::GetWeaveCertificateResponseFut {
772 fn _decode(
773 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
774 ) -> Result<FactoryDataManagerGetWeaveCertificateResult, fidl::Error> {
775 let _response = fidl::client::decode_transaction_body::<
776 fidl::encoding::ResultType<
777 FactoryDataManagerGetWeaveCertificateResponse,
778 ErrorCode,
779 >,
780 fidl::encoding::DefaultFuchsiaResourceDialect,
781 0x1b4feca8bc141380,
782 >(_buf?)?;
783 Ok(_response.map(|x| x.certificate))
784 }
785 self.client.send_query_and_decode::<
786 fidl::encoding::EmptyPayload,
787 FactoryDataManagerGetWeaveCertificateResult,
788 >(
789 (),
790 0x1b4feca8bc141380,
791 fidl::encoding::DynamicFlags::empty(),
792 _decode,
793 )
794 }
795}
796
797pub struct FactoryDataManagerEventStream {
798 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
799}
800
801impl std::marker::Unpin for FactoryDataManagerEventStream {}
802
803impl futures::stream::FusedStream for FactoryDataManagerEventStream {
804 fn is_terminated(&self) -> bool {
805 self.event_receiver.is_terminated()
806 }
807}
808
809impl futures::Stream for FactoryDataManagerEventStream {
810 type Item = Result<FactoryDataManagerEvent, fidl::Error>;
811
812 fn poll_next(
813 mut self: std::pin::Pin<&mut Self>,
814 cx: &mut std::task::Context<'_>,
815 ) -> std::task::Poll<Option<Self::Item>> {
816 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
817 &mut self.event_receiver,
818 cx
819 )?) {
820 Some(buf) => std::task::Poll::Ready(Some(FactoryDataManagerEvent::decode(buf))),
821 None => std::task::Poll::Ready(None),
822 }
823 }
824}
825
826#[derive(Debug)]
827pub enum FactoryDataManagerEvent {}
828
829impl FactoryDataManagerEvent {
830 fn decode(
832 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
833 ) -> Result<FactoryDataManagerEvent, fidl::Error> {
834 let (bytes, _handles) = buf.split_mut();
835 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
836 debug_assert_eq!(tx_header.tx_id, 0);
837 match tx_header.ordinal {
838 _ => Err(fidl::Error::UnknownOrdinal {
839 ordinal: tx_header.ordinal,
840 protocol_name:
841 <FactoryDataManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
842 }),
843 }
844 }
845}
846
847pub struct FactoryDataManagerRequestStream {
849 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
850 is_terminated: bool,
851}
852
853impl std::marker::Unpin for FactoryDataManagerRequestStream {}
854
855impl futures::stream::FusedStream for FactoryDataManagerRequestStream {
856 fn is_terminated(&self) -> bool {
857 self.is_terminated
858 }
859}
860
861impl fidl::endpoints::RequestStream for FactoryDataManagerRequestStream {
862 type Protocol = FactoryDataManagerMarker;
863 type ControlHandle = FactoryDataManagerControlHandle;
864
865 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
866 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
867 }
868
869 fn control_handle(&self) -> Self::ControlHandle {
870 FactoryDataManagerControlHandle { inner: self.inner.clone() }
871 }
872
873 fn into_inner(
874 self,
875 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
876 {
877 (self.inner, self.is_terminated)
878 }
879
880 fn from_inner(
881 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
882 is_terminated: bool,
883 ) -> Self {
884 Self { inner, is_terminated }
885 }
886}
887
888impl futures::Stream for FactoryDataManagerRequestStream {
889 type Item = Result<FactoryDataManagerRequest, fidl::Error>;
890
891 fn poll_next(
892 mut self: std::pin::Pin<&mut Self>,
893 cx: &mut std::task::Context<'_>,
894 ) -> std::task::Poll<Option<Self::Item>> {
895 let this = &mut *self;
896 if this.inner.check_shutdown(cx) {
897 this.is_terminated = true;
898 return std::task::Poll::Ready(None);
899 }
900 if this.is_terminated {
901 panic!("polled FactoryDataManagerRequestStream after completion");
902 }
903 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
904 |bytes, handles| {
905 match this.inner.channel().read_etc(cx, bytes, handles) {
906 std::task::Poll::Ready(Ok(())) => {}
907 std::task::Poll::Pending => return std::task::Poll::Pending,
908 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
909 this.is_terminated = true;
910 return std::task::Poll::Ready(None);
911 }
912 std::task::Poll::Ready(Err(e)) => {
913 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
914 e.into(),
915 ))));
916 }
917 }
918
919 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
921
922 std::task::Poll::Ready(Some(match header.ordinal {
923 0x75630bcd80418a0f => {
924 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
925 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
926 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
927 let control_handle = FactoryDataManagerControlHandle {
928 inner: this.inner.clone(),
929 };
930 Ok(FactoryDataManagerRequest::GetPairingCode {
931 responder: FactoryDataManagerGetPairingCodeResponder {
932 control_handle: std::mem::ManuallyDrop::new(control_handle),
933 tx_id: header.tx_id,
934 },
935 })
936 }
937 0x1b4feca8bc141380 => {
938 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
939 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
940 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
941 let control_handle = FactoryDataManagerControlHandle {
942 inner: this.inner.clone(),
943 };
944 Ok(FactoryDataManagerRequest::GetWeaveCertificate {
945 responder: FactoryDataManagerGetWeaveCertificateResponder {
946 control_handle: std::mem::ManuallyDrop::new(control_handle),
947 tx_id: header.tx_id,
948 },
949 })
950 }
951 _ => Err(fidl::Error::UnknownOrdinal {
952 ordinal: header.ordinal,
953 protocol_name: <FactoryDataManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
954 }),
955 }))
956 },
957 )
958 }
959}
960
961#[derive(Debug)]
964pub enum FactoryDataManagerRequest {
965 GetPairingCode { responder: FactoryDataManagerGetPairingCodeResponder },
967 GetWeaveCertificate { responder: FactoryDataManagerGetWeaveCertificateResponder },
969}
970
971impl FactoryDataManagerRequest {
972 #[allow(irrefutable_let_patterns)]
973 pub fn into_get_pairing_code(self) -> Option<(FactoryDataManagerGetPairingCodeResponder)> {
974 if let FactoryDataManagerRequest::GetPairingCode { responder } = self {
975 Some((responder))
976 } else {
977 None
978 }
979 }
980
981 #[allow(irrefutable_let_patterns)]
982 pub fn into_get_weave_certificate(
983 self,
984 ) -> Option<(FactoryDataManagerGetWeaveCertificateResponder)> {
985 if let FactoryDataManagerRequest::GetWeaveCertificate { responder } = self {
986 Some((responder))
987 } else {
988 None
989 }
990 }
991
992 pub fn method_name(&self) -> &'static str {
994 match *self {
995 FactoryDataManagerRequest::GetPairingCode { .. } => "get_pairing_code",
996 FactoryDataManagerRequest::GetWeaveCertificate { .. } => "get_weave_certificate",
997 }
998 }
999}
1000
1001#[derive(Debug, Clone)]
1002pub struct FactoryDataManagerControlHandle {
1003 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1004}
1005
1006impl fidl::endpoints::ControlHandle for FactoryDataManagerControlHandle {
1007 fn shutdown(&self) {
1008 self.inner.shutdown()
1009 }
1010
1011 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1012 self.inner.shutdown_with_epitaph(status)
1013 }
1014
1015 fn is_closed(&self) -> bool {
1016 self.inner.channel().is_closed()
1017 }
1018 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1019 self.inner.channel().on_closed()
1020 }
1021
1022 #[cfg(target_os = "fuchsia")]
1023 fn signal_peer(
1024 &self,
1025 clear_mask: zx::Signals,
1026 set_mask: zx::Signals,
1027 ) -> Result<(), zx_status::Status> {
1028 use fidl::Peered;
1029 self.inner.channel().signal_peer(clear_mask, set_mask)
1030 }
1031}
1032
1033impl FactoryDataManagerControlHandle {}
1034
1035#[must_use = "FIDL methods require a response to be sent"]
1036#[derive(Debug)]
1037pub struct FactoryDataManagerGetPairingCodeResponder {
1038 control_handle: std::mem::ManuallyDrop<FactoryDataManagerControlHandle>,
1039 tx_id: u32,
1040}
1041
1042impl std::ops::Drop for FactoryDataManagerGetPairingCodeResponder {
1046 fn drop(&mut self) {
1047 self.control_handle.shutdown();
1048 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1050 }
1051}
1052
1053impl fidl::endpoints::Responder for FactoryDataManagerGetPairingCodeResponder {
1054 type ControlHandle = FactoryDataManagerControlHandle;
1055
1056 fn control_handle(&self) -> &FactoryDataManagerControlHandle {
1057 &self.control_handle
1058 }
1059
1060 fn drop_without_shutdown(mut self) {
1061 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1063 std::mem::forget(self);
1065 }
1066}
1067
1068impl FactoryDataManagerGetPairingCodeResponder {
1069 pub fn send(self, mut result: Result<&[u8], ErrorCode>) -> Result<(), fidl::Error> {
1073 let _result = self.send_raw(result);
1074 if _result.is_err() {
1075 self.control_handle.shutdown();
1076 }
1077 self.drop_without_shutdown();
1078 _result
1079 }
1080
1081 pub fn send_no_shutdown_on_err(
1083 self,
1084 mut result: Result<&[u8], ErrorCode>,
1085 ) -> Result<(), fidl::Error> {
1086 let _result = self.send_raw(result);
1087 self.drop_without_shutdown();
1088 _result
1089 }
1090
1091 fn send_raw(&self, mut result: Result<&[u8], ErrorCode>) -> Result<(), fidl::Error> {
1092 self.control_handle.inner.send::<fidl::encoding::ResultType<
1093 FactoryDataManagerGetPairingCodeResponse,
1094 ErrorCode,
1095 >>(
1096 result.map(|pairing_code| (pairing_code,)),
1097 self.tx_id,
1098 0x75630bcd80418a0f,
1099 fidl::encoding::DynamicFlags::empty(),
1100 )
1101 }
1102}
1103
1104#[must_use = "FIDL methods require a response to be sent"]
1105#[derive(Debug)]
1106pub struct FactoryDataManagerGetWeaveCertificateResponder {
1107 control_handle: std::mem::ManuallyDrop<FactoryDataManagerControlHandle>,
1108 tx_id: u32,
1109}
1110
1111impl std::ops::Drop for FactoryDataManagerGetWeaveCertificateResponder {
1115 fn drop(&mut self) {
1116 self.control_handle.shutdown();
1117 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1119 }
1120}
1121
1122impl fidl::endpoints::Responder for FactoryDataManagerGetWeaveCertificateResponder {
1123 type ControlHandle = FactoryDataManagerControlHandle;
1124
1125 fn control_handle(&self) -> &FactoryDataManagerControlHandle {
1126 &self.control_handle
1127 }
1128
1129 fn drop_without_shutdown(mut self) {
1130 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1132 std::mem::forget(self);
1134 }
1135}
1136
1137impl FactoryDataManagerGetWeaveCertificateResponder {
1138 pub fn send(
1142 self,
1143 mut result: Result<fidl_fuchsia_mem::Buffer, ErrorCode>,
1144 ) -> Result<(), fidl::Error> {
1145 let _result = self.send_raw(result);
1146 if _result.is_err() {
1147 self.control_handle.shutdown();
1148 }
1149 self.drop_without_shutdown();
1150 _result
1151 }
1152
1153 pub fn send_no_shutdown_on_err(
1155 self,
1156 mut result: Result<fidl_fuchsia_mem::Buffer, ErrorCode>,
1157 ) -> Result<(), fidl::Error> {
1158 let _result = self.send_raw(result);
1159 self.drop_without_shutdown();
1160 _result
1161 }
1162
1163 fn send_raw(
1164 &self,
1165 mut result: Result<fidl_fuchsia_mem::Buffer, ErrorCode>,
1166 ) -> Result<(), fidl::Error> {
1167 self.control_handle.inner.send::<fidl::encoding::ResultType<
1168 FactoryDataManagerGetWeaveCertificateResponse,
1169 ErrorCode,
1170 >>(
1171 result.as_mut().map_err(|e| *e).map(|certificate| (certificate,)),
1172 self.tx_id,
1173 0x1b4feca8bc141380,
1174 fidl::encoding::DynamicFlags::empty(),
1175 )
1176 }
1177}
1178
1179#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1180pub struct PairingStateWatcherMarker;
1181
1182impl fidl::endpoints::ProtocolMarker for PairingStateWatcherMarker {
1183 type Proxy = PairingStateWatcherProxy;
1184 type RequestStream = PairingStateWatcherRequestStream;
1185 #[cfg(target_os = "fuchsia")]
1186 type SynchronousProxy = PairingStateWatcherSynchronousProxy;
1187
1188 const DEBUG_NAME: &'static str = "(anonymous) PairingStateWatcher";
1189}
1190
1191pub trait PairingStateWatcherProxyInterface: Send + Sync {
1192 type WatchPairingStateResponseFut: std::future::Future<Output = Result<PairingState, fidl::Error>>
1193 + Send;
1194 fn r#watch_pairing_state(&self) -> Self::WatchPairingStateResponseFut;
1195}
1196#[derive(Debug)]
1197#[cfg(target_os = "fuchsia")]
1198pub struct PairingStateWatcherSynchronousProxy {
1199 client: fidl::client::sync::Client,
1200}
1201
1202#[cfg(target_os = "fuchsia")]
1203impl fidl::endpoints::SynchronousProxy for PairingStateWatcherSynchronousProxy {
1204 type Proxy = PairingStateWatcherProxy;
1205 type Protocol = PairingStateWatcherMarker;
1206
1207 fn from_channel(inner: fidl::Channel) -> Self {
1208 Self::new(inner)
1209 }
1210
1211 fn into_channel(self) -> fidl::Channel {
1212 self.client.into_channel()
1213 }
1214
1215 fn as_channel(&self) -> &fidl::Channel {
1216 self.client.as_channel()
1217 }
1218}
1219
1220#[cfg(target_os = "fuchsia")]
1221impl PairingStateWatcherSynchronousProxy {
1222 pub fn new(channel: fidl::Channel) -> Self {
1223 let protocol_name =
1224 <PairingStateWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1225 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1226 }
1227
1228 pub fn into_channel(self) -> fidl::Channel {
1229 self.client.into_channel()
1230 }
1231
1232 pub fn wait_for_event(
1235 &self,
1236 deadline: zx::MonotonicInstant,
1237 ) -> Result<PairingStateWatcherEvent, fidl::Error> {
1238 PairingStateWatcherEvent::decode(self.client.wait_for_event(deadline)?)
1239 }
1240
1241 pub fn r#watch_pairing_state(
1250 &self,
1251 ___deadline: zx::MonotonicInstant,
1252 ) -> Result<PairingState, fidl::Error> {
1253 let _response = self.client.send_query::<
1254 fidl::encoding::EmptyPayload,
1255 PairingStateWatcherWatchPairingStateResponse,
1256 >(
1257 (),
1258 0x1b3889b65cea014e,
1259 fidl::encoding::DynamicFlags::empty(),
1260 ___deadline,
1261 )?;
1262 Ok(_response.state)
1263 }
1264}
1265
1266#[cfg(target_os = "fuchsia")]
1267impl From<PairingStateWatcherSynchronousProxy> for zx::NullableHandle {
1268 fn from(value: PairingStateWatcherSynchronousProxy) -> Self {
1269 value.into_channel().into()
1270 }
1271}
1272
1273#[cfg(target_os = "fuchsia")]
1274impl From<fidl::Channel> for PairingStateWatcherSynchronousProxy {
1275 fn from(value: fidl::Channel) -> Self {
1276 Self::new(value)
1277 }
1278}
1279
1280#[cfg(target_os = "fuchsia")]
1281impl fidl::endpoints::FromClient for PairingStateWatcherSynchronousProxy {
1282 type Protocol = PairingStateWatcherMarker;
1283
1284 fn from_client(value: fidl::endpoints::ClientEnd<PairingStateWatcherMarker>) -> Self {
1285 Self::new(value.into_channel())
1286 }
1287}
1288
1289#[derive(Debug, Clone)]
1290pub struct PairingStateWatcherProxy {
1291 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1292}
1293
1294impl fidl::endpoints::Proxy for PairingStateWatcherProxy {
1295 type Protocol = PairingStateWatcherMarker;
1296
1297 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1298 Self::new(inner)
1299 }
1300
1301 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1302 self.client.into_channel().map_err(|client| Self { client })
1303 }
1304
1305 fn as_channel(&self) -> &::fidl::AsyncChannel {
1306 self.client.as_channel()
1307 }
1308}
1309
1310impl PairingStateWatcherProxy {
1311 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1313 let protocol_name =
1314 <PairingStateWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1315 Self { client: fidl::client::Client::new(channel, protocol_name) }
1316 }
1317
1318 pub fn take_event_stream(&self) -> PairingStateWatcherEventStream {
1324 PairingStateWatcherEventStream { event_receiver: self.client.take_event_receiver() }
1325 }
1326
1327 pub fn r#watch_pairing_state(
1336 &self,
1337 ) -> fidl::client::QueryResponseFut<PairingState, fidl::encoding::DefaultFuchsiaResourceDialect>
1338 {
1339 PairingStateWatcherProxyInterface::r#watch_pairing_state(self)
1340 }
1341}
1342
1343impl PairingStateWatcherProxyInterface for PairingStateWatcherProxy {
1344 type WatchPairingStateResponseFut =
1345 fidl::client::QueryResponseFut<PairingState, fidl::encoding::DefaultFuchsiaResourceDialect>;
1346 fn r#watch_pairing_state(&self) -> Self::WatchPairingStateResponseFut {
1347 fn _decode(
1348 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1349 ) -> Result<PairingState, fidl::Error> {
1350 let _response = fidl::client::decode_transaction_body::<
1351 PairingStateWatcherWatchPairingStateResponse,
1352 fidl::encoding::DefaultFuchsiaResourceDialect,
1353 0x1b3889b65cea014e,
1354 >(_buf?)?;
1355 Ok(_response.state)
1356 }
1357 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PairingState>(
1358 (),
1359 0x1b3889b65cea014e,
1360 fidl::encoding::DynamicFlags::empty(),
1361 _decode,
1362 )
1363 }
1364}
1365
1366pub struct PairingStateWatcherEventStream {
1367 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1368}
1369
1370impl std::marker::Unpin for PairingStateWatcherEventStream {}
1371
1372impl futures::stream::FusedStream for PairingStateWatcherEventStream {
1373 fn is_terminated(&self) -> bool {
1374 self.event_receiver.is_terminated()
1375 }
1376}
1377
1378impl futures::Stream for PairingStateWatcherEventStream {
1379 type Item = Result<PairingStateWatcherEvent, fidl::Error>;
1380
1381 fn poll_next(
1382 mut self: std::pin::Pin<&mut Self>,
1383 cx: &mut std::task::Context<'_>,
1384 ) -> std::task::Poll<Option<Self::Item>> {
1385 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1386 &mut self.event_receiver,
1387 cx
1388 )?) {
1389 Some(buf) => std::task::Poll::Ready(Some(PairingStateWatcherEvent::decode(buf))),
1390 None => std::task::Poll::Ready(None),
1391 }
1392 }
1393}
1394
1395#[derive(Debug)]
1396pub enum PairingStateWatcherEvent {}
1397
1398impl PairingStateWatcherEvent {
1399 fn decode(
1401 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1402 ) -> Result<PairingStateWatcherEvent, fidl::Error> {
1403 let (bytes, _handles) = buf.split_mut();
1404 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1405 debug_assert_eq!(tx_header.tx_id, 0);
1406 match tx_header.ordinal {
1407 _ => Err(fidl::Error::UnknownOrdinal {
1408 ordinal: tx_header.ordinal,
1409 protocol_name:
1410 <PairingStateWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1411 }),
1412 }
1413 }
1414}
1415
1416pub struct PairingStateWatcherRequestStream {
1418 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1419 is_terminated: bool,
1420}
1421
1422impl std::marker::Unpin for PairingStateWatcherRequestStream {}
1423
1424impl futures::stream::FusedStream for PairingStateWatcherRequestStream {
1425 fn is_terminated(&self) -> bool {
1426 self.is_terminated
1427 }
1428}
1429
1430impl fidl::endpoints::RequestStream for PairingStateWatcherRequestStream {
1431 type Protocol = PairingStateWatcherMarker;
1432 type ControlHandle = PairingStateWatcherControlHandle;
1433
1434 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1435 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1436 }
1437
1438 fn control_handle(&self) -> Self::ControlHandle {
1439 PairingStateWatcherControlHandle { inner: self.inner.clone() }
1440 }
1441
1442 fn into_inner(
1443 self,
1444 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1445 {
1446 (self.inner, self.is_terminated)
1447 }
1448
1449 fn from_inner(
1450 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1451 is_terminated: bool,
1452 ) -> Self {
1453 Self { inner, is_terminated }
1454 }
1455}
1456
1457impl futures::Stream for PairingStateWatcherRequestStream {
1458 type Item = Result<PairingStateWatcherRequest, fidl::Error>;
1459
1460 fn poll_next(
1461 mut self: std::pin::Pin<&mut Self>,
1462 cx: &mut std::task::Context<'_>,
1463 ) -> std::task::Poll<Option<Self::Item>> {
1464 let this = &mut *self;
1465 if this.inner.check_shutdown(cx) {
1466 this.is_terminated = true;
1467 return std::task::Poll::Ready(None);
1468 }
1469 if this.is_terminated {
1470 panic!("polled PairingStateWatcherRequestStream after completion");
1471 }
1472 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1473 |bytes, handles| {
1474 match this.inner.channel().read_etc(cx, bytes, handles) {
1475 std::task::Poll::Ready(Ok(())) => {}
1476 std::task::Poll::Pending => return std::task::Poll::Pending,
1477 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1478 this.is_terminated = true;
1479 return std::task::Poll::Ready(None);
1480 }
1481 std::task::Poll::Ready(Err(e)) => {
1482 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1483 e.into(),
1484 ))));
1485 }
1486 }
1487
1488 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1490
1491 std::task::Poll::Ready(Some(match header.ordinal {
1492 0x1b3889b65cea014e => {
1493 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1494 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
1495 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1496 let control_handle = PairingStateWatcherControlHandle {
1497 inner: this.inner.clone(),
1498 };
1499 Ok(PairingStateWatcherRequest::WatchPairingState {
1500 responder: PairingStateWatcherWatchPairingStateResponder {
1501 control_handle: std::mem::ManuallyDrop::new(control_handle),
1502 tx_id: header.tx_id,
1503 },
1504 })
1505 }
1506 _ => Err(fidl::Error::UnknownOrdinal {
1507 ordinal: header.ordinal,
1508 protocol_name: <PairingStateWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1509 }),
1510 }))
1511 },
1512 )
1513 }
1514}
1515
1516#[derive(Debug)]
1519pub enum PairingStateWatcherRequest {
1520 WatchPairingState { responder: PairingStateWatcherWatchPairingStateResponder },
1529}
1530
1531impl PairingStateWatcherRequest {
1532 #[allow(irrefutable_let_patterns)]
1533 pub fn into_watch_pairing_state(
1534 self,
1535 ) -> Option<(PairingStateWatcherWatchPairingStateResponder)> {
1536 if let PairingStateWatcherRequest::WatchPairingState { responder } = self {
1537 Some((responder))
1538 } else {
1539 None
1540 }
1541 }
1542
1543 pub fn method_name(&self) -> &'static str {
1545 match *self {
1546 PairingStateWatcherRequest::WatchPairingState { .. } => "watch_pairing_state",
1547 }
1548 }
1549}
1550
1551#[derive(Debug, Clone)]
1552pub struct PairingStateWatcherControlHandle {
1553 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1554}
1555
1556impl fidl::endpoints::ControlHandle for PairingStateWatcherControlHandle {
1557 fn shutdown(&self) {
1558 self.inner.shutdown()
1559 }
1560
1561 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1562 self.inner.shutdown_with_epitaph(status)
1563 }
1564
1565 fn is_closed(&self) -> bool {
1566 self.inner.channel().is_closed()
1567 }
1568 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1569 self.inner.channel().on_closed()
1570 }
1571
1572 #[cfg(target_os = "fuchsia")]
1573 fn signal_peer(
1574 &self,
1575 clear_mask: zx::Signals,
1576 set_mask: zx::Signals,
1577 ) -> Result<(), zx_status::Status> {
1578 use fidl::Peered;
1579 self.inner.channel().signal_peer(clear_mask, set_mask)
1580 }
1581}
1582
1583impl PairingStateWatcherControlHandle {}
1584
1585#[must_use = "FIDL methods require a response to be sent"]
1586#[derive(Debug)]
1587pub struct PairingStateWatcherWatchPairingStateResponder {
1588 control_handle: std::mem::ManuallyDrop<PairingStateWatcherControlHandle>,
1589 tx_id: u32,
1590}
1591
1592impl std::ops::Drop for PairingStateWatcherWatchPairingStateResponder {
1596 fn drop(&mut self) {
1597 self.control_handle.shutdown();
1598 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1600 }
1601}
1602
1603impl fidl::endpoints::Responder for PairingStateWatcherWatchPairingStateResponder {
1604 type ControlHandle = PairingStateWatcherControlHandle;
1605
1606 fn control_handle(&self) -> &PairingStateWatcherControlHandle {
1607 &self.control_handle
1608 }
1609
1610 fn drop_without_shutdown(mut self) {
1611 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1613 std::mem::forget(self);
1615 }
1616}
1617
1618impl PairingStateWatcherWatchPairingStateResponder {
1619 pub fn send(self, mut state: &PairingState) -> Result<(), fidl::Error> {
1623 let _result = self.send_raw(state);
1624 if _result.is_err() {
1625 self.control_handle.shutdown();
1626 }
1627 self.drop_without_shutdown();
1628 _result
1629 }
1630
1631 pub fn send_no_shutdown_on_err(self, mut state: &PairingState) -> Result<(), fidl::Error> {
1633 let _result = self.send_raw(state);
1634 self.drop_without_shutdown();
1635 _result
1636 }
1637
1638 fn send_raw(&self, mut state: &PairingState) -> Result<(), fidl::Error> {
1639 self.control_handle.inner.send::<PairingStateWatcherWatchPairingStateResponse>(
1640 (state,),
1641 self.tx_id,
1642 0x1b3889b65cea014e,
1643 fidl::encoding::DynamicFlags::empty(),
1644 )
1645 }
1646}
1647
1648#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1649pub struct ProvisionerMarker;
1650
1651impl fidl::endpoints::ProtocolMarker for ProvisionerMarker {
1652 type Proxy = ProvisionerProxy;
1653 type RequestStream = ProvisionerRequestStream;
1654 #[cfg(target_os = "fuchsia")]
1655 type SynchronousProxy = ProvisionerSynchronousProxy;
1656
1657 const DEBUG_NAME: &'static str = "fuchsia.weave.Provisioner";
1658}
1659impl fidl::endpoints::DiscoverableProtocolMarker for ProvisionerMarker {}
1660pub type ProvisionerGenerateKeyPairResult = Result<(Vec<u8>, Vec<u8>), ErrorCode>;
1661
1662pub trait ProvisionerProxyInterface: Send + Sync {
1663 type GenerateKeyPairResponseFut: std::future::Future<Output = Result<ProvisionerGenerateKeyPairResult, fidl::Error>>
1664 + Send;
1665 fn r#generate_key_pair(&self) -> Self::GenerateKeyPairResponseFut;
1666}
1667#[derive(Debug)]
1668#[cfg(target_os = "fuchsia")]
1669pub struct ProvisionerSynchronousProxy {
1670 client: fidl::client::sync::Client,
1671}
1672
1673#[cfg(target_os = "fuchsia")]
1674impl fidl::endpoints::SynchronousProxy for ProvisionerSynchronousProxy {
1675 type Proxy = ProvisionerProxy;
1676 type Protocol = ProvisionerMarker;
1677
1678 fn from_channel(inner: fidl::Channel) -> Self {
1679 Self::new(inner)
1680 }
1681
1682 fn into_channel(self) -> fidl::Channel {
1683 self.client.into_channel()
1684 }
1685
1686 fn as_channel(&self) -> &fidl::Channel {
1687 self.client.as_channel()
1688 }
1689}
1690
1691#[cfg(target_os = "fuchsia")]
1692impl ProvisionerSynchronousProxy {
1693 pub fn new(channel: fidl::Channel) -> Self {
1694 let protocol_name = <ProvisionerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1695 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1696 }
1697
1698 pub fn into_channel(self) -> fidl::Channel {
1699 self.client.into_channel()
1700 }
1701
1702 pub fn wait_for_event(
1705 &self,
1706 deadline: zx::MonotonicInstant,
1707 ) -> Result<ProvisionerEvent, fidl::Error> {
1708 ProvisionerEvent::decode(self.client.wait_for_event(deadline)?)
1709 }
1710
1711 pub fn r#generate_key_pair(
1720 &self,
1721 ___deadline: zx::MonotonicInstant,
1722 ) -> Result<ProvisionerGenerateKeyPairResult, fidl::Error> {
1723 let _response = self.client.send_query::<
1724 fidl::encoding::EmptyPayload,
1725 fidl::encoding::ResultType<ProvisionerGenerateKeyPairResponse, ErrorCode>,
1726 >(
1727 (),
1728 0x9ba1ad04f47bd9f,
1729 fidl::encoding::DynamicFlags::empty(),
1730 ___deadline,
1731 )?;
1732 Ok(_response.map(|x| (x.wrapped_private_key, x.public_key)))
1733 }
1734}
1735
1736#[cfg(target_os = "fuchsia")]
1737impl From<ProvisionerSynchronousProxy> for zx::NullableHandle {
1738 fn from(value: ProvisionerSynchronousProxy) -> Self {
1739 value.into_channel().into()
1740 }
1741}
1742
1743#[cfg(target_os = "fuchsia")]
1744impl From<fidl::Channel> for ProvisionerSynchronousProxy {
1745 fn from(value: fidl::Channel) -> Self {
1746 Self::new(value)
1747 }
1748}
1749
1750#[cfg(target_os = "fuchsia")]
1751impl fidl::endpoints::FromClient for ProvisionerSynchronousProxy {
1752 type Protocol = ProvisionerMarker;
1753
1754 fn from_client(value: fidl::endpoints::ClientEnd<ProvisionerMarker>) -> Self {
1755 Self::new(value.into_channel())
1756 }
1757}
1758
1759#[derive(Debug, Clone)]
1760pub struct ProvisionerProxy {
1761 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1762}
1763
1764impl fidl::endpoints::Proxy for ProvisionerProxy {
1765 type Protocol = ProvisionerMarker;
1766
1767 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1768 Self::new(inner)
1769 }
1770
1771 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1772 self.client.into_channel().map_err(|client| Self { client })
1773 }
1774
1775 fn as_channel(&self) -> &::fidl::AsyncChannel {
1776 self.client.as_channel()
1777 }
1778}
1779
1780impl ProvisionerProxy {
1781 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1783 let protocol_name = <ProvisionerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1784 Self { client: fidl::client::Client::new(channel, protocol_name) }
1785 }
1786
1787 pub fn take_event_stream(&self) -> ProvisionerEventStream {
1793 ProvisionerEventStream { event_receiver: self.client.take_event_receiver() }
1794 }
1795
1796 pub fn r#generate_key_pair(
1805 &self,
1806 ) -> fidl::client::QueryResponseFut<
1807 ProvisionerGenerateKeyPairResult,
1808 fidl::encoding::DefaultFuchsiaResourceDialect,
1809 > {
1810 ProvisionerProxyInterface::r#generate_key_pair(self)
1811 }
1812}
1813
1814impl ProvisionerProxyInterface for ProvisionerProxy {
1815 type GenerateKeyPairResponseFut = fidl::client::QueryResponseFut<
1816 ProvisionerGenerateKeyPairResult,
1817 fidl::encoding::DefaultFuchsiaResourceDialect,
1818 >;
1819 fn r#generate_key_pair(&self) -> Self::GenerateKeyPairResponseFut {
1820 fn _decode(
1821 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1822 ) -> Result<ProvisionerGenerateKeyPairResult, fidl::Error> {
1823 let _response = fidl::client::decode_transaction_body::<
1824 fidl::encoding::ResultType<ProvisionerGenerateKeyPairResponse, ErrorCode>,
1825 fidl::encoding::DefaultFuchsiaResourceDialect,
1826 0x9ba1ad04f47bd9f,
1827 >(_buf?)?;
1828 Ok(_response.map(|x| (x.wrapped_private_key, x.public_key)))
1829 }
1830 self.client.send_query_and_decode::<
1831 fidl::encoding::EmptyPayload,
1832 ProvisionerGenerateKeyPairResult,
1833 >(
1834 (),
1835 0x9ba1ad04f47bd9f,
1836 fidl::encoding::DynamicFlags::empty(),
1837 _decode,
1838 )
1839 }
1840}
1841
1842pub struct ProvisionerEventStream {
1843 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1844}
1845
1846impl std::marker::Unpin for ProvisionerEventStream {}
1847
1848impl futures::stream::FusedStream for ProvisionerEventStream {
1849 fn is_terminated(&self) -> bool {
1850 self.event_receiver.is_terminated()
1851 }
1852}
1853
1854impl futures::Stream for ProvisionerEventStream {
1855 type Item = Result<ProvisionerEvent, fidl::Error>;
1856
1857 fn poll_next(
1858 mut self: std::pin::Pin<&mut Self>,
1859 cx: &mut std::task::Context<'_>,
1860 ) -> std::task::Poll<Option<Self::Item>> {
1861 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1862 &mut self.event_receiver,
1863 cx
1864 )?) {
1865 Some(buf) => std::task::Poll::Ready(Some(ProvisionerEvent::decode(buf))),
1866 None => std::task::Poll::Ready(None),
1867 }
1868 }
1869}
1870
1871#[derive(Debug)]
1872pub enum ProvisionerEvent {}
1873
1874impl ProvisionerEvent {
1875 fn decode(
1877 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1878 ) -> Result<ProvisionerEvent, fidl::Error> {
1879 let (bytes, _handles) = buf.split_mut();
1880 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1881 debug_assert_eq!(tx_header.tx_id, 0);
1882 match tx_header.ordinal {
1883 _ => Err(fidl::Error::UnknownOrdinal {
1884 ordinal: tx_header.ordinal,
1885 protocol_name: <ProvisionerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1886 }),
1887 }
1888 }
1889}
1890
1891pub struct ProvisionerRequestStream {
1893 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1894 is_terminated: bool,
1895}
1896
1897impl std::marker::Unpin for ProvisionerRequestStream {}
1898
1899impl futures::stream::FusedStream for ProvisionerRequestStream {
1900 fn is_terminated(&self) -> bool {
1901 self.is_terminated
1902 }
1903}
1904
1905impl fidl::endpoints::RequestStream for ProvisionerRequestStream {
1906 type Protocol = ProvisionerMarker;
1907 type ControlHandle = ProvisionerControlHandle;
1908
1909 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1910 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1911 }
1912
1913 fn control_handle(&self) -> Self::ControlHandle {
1914 ProvisionerControlHandle { inner: self.inner.clone() }
1915 }
1916
1917 fn into_inner(
1918 self,
1919 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1920 {
1921 (self.inner, self.is_terminated)
1922 }
1923
1924 fn from_inner(
1925 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1926 is_terminated: bool,
1927 ) -> Self {
1928 Self { inner, is_terminated }
1929 }
1930}
1931
1932impl futures::Stream for ProvisionerRequestStream {
1933 type Item = Result<ProvisionerRequest, fidl::Error>;
1934
1935 fn poll_next(
1936 mut self: std::pin::Pin<&mut Self>,
1937 cx: &mut std::task::Context<'_>,
1938 ) -> std::task::Poll<Option<Self::Item>> {
1939 let this = &mut *self;
1940 if this.inner.check_shutdown(cx) {
1941 this.is_terminated = true;
1942 return std::task::Poll::Ready(None);
1943 }
1944 if this.is_terminated {
1945 panic!("polled ProvisionerRequestStream after completion");
1946 }
1947 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1948 |bytes, handles| {
1949 match this.inner.channel().read_etc(cx, bytes, handles) {
1950 std::task::Poll::Ready(Ok(())) => {}
1951 std::task::Poll::Pending => return std::task::Poll::Pending,
1952 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1953 this.is_terminated = true;
1954 return std::task::Poll::Ready(None);
1955 }
1956 std::task::Poll::Ready(Err(e)) => {
1957 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1958 e.into(),
1959 ))));
1960 }
1961 }
1962
1963 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1965
1966 std::task::Poll::Ready(Some(match header.ordinal {
1967 0x9ba1ad04f47bd9f => {
1968 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1969 let mut req = fidl::new_empty!(
1970 fidl::encoding::EmptyPayload,
1971 fidl::encoding::DefaultFuchsiaResourceDialect
1972 );
1973 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1974 let control_handle = ProvisionerControlHandle { inner: this.inner.clone() };
1975 Ok(ProvisionerRequest::GenerateKeyPair {
1976 responder: ProvisionerGenerateKeyPairResponder {
1977 control_handle: std::mem::ManuallyDrop::new(control_handle),
1978 tx_id: header.tx_id,
1979 },
1980 })
1981 }
1982 _ => Err(fidl::Error::UnknownOrdinal {
1983 ordinal: header.ordinal,
1984 protocol_name:
1985 <ProvisionerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1986 }),
1987 }))
1988 },
1989 )
1990 }
1991}
1992
1993#[derive(Debug)]
1995pub enum ProvisionerRequest {
1996 GenerateKeyPair { responder: ProvisionerGenerateKeyPairResponder },
2005}
2006
2007impl ProvisionerRequest {
2008 #[allow(irrefutable_let_patterns)]
2009 pub fn into_generate_key_pair(self) -> Option<(ProvisionerGenerateKeyPairResponder)> {
2010 if let ProvisionerRequest::GenerateKeyPair { responder } = self {
2011 Some((responder))
2012 } else {
2013 None
2014 }
2015 }
2016
2017 pub fn method_name(&self) -> &'static str {
2019 match *self {
2020 ProvisionerRequest::GenerateKeyPair { .. } => "generate_key_pair",
2021 }
2022 }
2023}
2024
2025#[derive(Debug, Clone)]
2026pub struct ProvisionerControlHandle {
2027 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2028}
2029
2030impl fidl::endpoints::ControlHandle for ProvisionerControlHandle {
2031 fn shutdown(&self) {
2032 self.inner.shutdown()
2033 }
2034
2035 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2036 self.inner.shutdown_with_epitaph(status)
2037 }
2038
2039 fn is_closed(&self) -> bool {
2040 self.inner.channel().is_closed()
2041 }
2042 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2043 self.inner.channel().on_closed()
2044 }
2045
2046 #[cfg(target_os = "fuchsia")]
2047 fn signal_peer(
2048 &self,
2049 clear_mask: zx::Signals,
2050 set_mask: zx::Signals,
2051 ) -> Result<(), zx_status::Status> {
2052 use fidl::Peered;
2053 self.inner.channel().signal_peer(clear_mask, set_mask)
2054 }
2055}
2056
2057impl ProvisionerControlHandle {}
2058
2059#[must_use = "FIDL methods require a response to be sent"]
2060#[derive(Debug)]
2061pub struct ProvisionerGenerateKeyPairResponder {
2062 control_handle: std::mem::ManuallyDrop<ProvisionerControlHandle>,
2063 tx_id: u32,
2064}
2065
2066impl std::ops::Drop for ProvisionerGenerateKeyPairResponder {
2070 fn drop(&mut self) {
2071 self.control_handle.shutdown();
2072 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2074 }
2075}
2076
2077impl fidl::endpoints::Responder for ProvisionerGenerateKeyPairResponder {
2078 type ControlHandle = ProvisionerControlHandle;
2079
2080 fn control_handle(&self) -> &ProvisionerControlHandle {
2081 &self.control_handle
2082 }
2083
2084 fn drop_without_shutdown(mut self) {
2085 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2087 std::mem::forget(self);
2089 }
2090}
2091
2092impl ProvisionerGenerateKeyPairResponder {
2093 pub fn send(self, mut result: Result<(&[u8], &[u8]), ErrorCode>) -> Result<(), fidl::Error> {
2097 let _result = self.send_raw(result);
2098 if _result.is_err() {
2099 self.control_handle.shutdown();
2100 }
2101 self.drop_without_shutdown();
2102 _result
2103 }
2104
2105 pub fn send_no_shutdown_on_err(
2107 self,
2108 mut result: Result<(&[u8], &[u8]), ErrorCode>,
2109 ) -> Result<(), fidl::Error> {
2110 let _result = self.send_raw(result);
2111 self.drop_without_shutdown();
2112 _result
2113 }
2114
2115 fn send_raw(&self, mut result: Result<(&[u8], &[u8]), ErrorCode>) -> Result<(), fidl::Error> {
2116 self.control_handle.inner.send::<fidl::encoding::ResultType<
2117 ProvisionerGenerateKeyPairResponse,
2118 ErrorCode,
2119 >>(
2120 result,
2121 self.tx_id,
2122 0x9ba1ad04f47bd9f,
2123 fidl::encoding::DynamicFlags::empty(),
2124 )
2125 }
2126}
2127
2128#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2129pub struct SignerMarker;
2130
2131impl fidl::endpoints::ProtocolMarker for SignerMarker {
2132 type Proxy = SignerProxy;
2133 type RequestStream = SignerRequestStream;
2134 #[cfg(target_os = "fuchsia")]
2135 type SynchronousProxy = SignerSynchronousProxy;
2136
2137 const DEBUG_NAME: &'static str = "fuchsia.weave.Signer";
2138}
2139impl fidl::endpoints::DiscoverableProtocolMarker for SignerMarker {}
2140pub type SignerSignHashResult = Result<Vec<u8>, ErrorCode>;
2141pub type SignerSignHashWithPrivateKeyResult = Result<Vec<u8>, ErrorCode>;
2142
2143pub trait SignerProxyInterface: Send + Sync {
2144 type SignHashResponseFut: std::future::Future<Output = Result<SignerSignHashResult, fidl::Error>>
2145 + Send;
2146 fn r#sign_hash(&self, hash: &[u8]) -> Self::SignHashResponseFut;
2147 type SignHashWithPrivateKeyResponseFut: std::future::Future<Output = Result<SignerSignHashWithPrivateKeyResult, fidl::Error>>
2148 + Send;
2149 fn r#sign_hash_with_private_key(
2150 &self,
2151 hash: &[u8],
2152 wrapped_private_key: &[u8],
2153 ) -> Self::SignHashWithPrivateKeyResponseFut;
2154}
2155#[derive(Debug)]
2156#[cfg(target_os = "fuchsia")]
2157pub struct SignerSynchronousProxy {
2158 client: fidl::client::sync::Client,
2159}
2160
2161#[cfg(target_os = "fuchsia")]
2162impl fidl::endpoints::SynchronousProxy for SignerSynchronousProxy {
2163 type Proxy = SignerProxy;
2164 type Protocol = SignerMarker;
2165
2166 fn from_channel(inner: fidl::Channel) -> Self {
2167 Self::new(inner)
2168 }
2169
2170 fn into_channel(self) -> fidl::Channel {
2171 self.client.into_channel()
2172 }
2173
2174 fn as_channel(&self) -> &fidl::Channel {
2175 self.client.as_channel()
2176 }
2177}
2178
2179#[cfg(target_os = "fuchsia")]
2180impl SignerSynchronousProxy {
2181 pub fn new(channel: fidl::Channel) -> Self {
2182 let protocol_name = <SignerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2183 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2184 }
2185
2186 pub fn into_channel(self) -> fidl::Channel {
2187 self.client.into_channel()
2188 }
2189
2190 pub fn wait_for_event(
2193 &self,
2194 deadline: zx::MonotonicInstant,
2195 ) -> Result<SignerEvent, fidl::Error> {
2196 SignerEvent::decode(self.client.wait_for_event(deadline)?)
2197 }
2198
2199 pub fn r#sign_hash(
2204 &self,
2205 mut hash: &[u8],
2206 ___deadline: zx::MonotonicInstant,
2207 ) -> Result<SignerSignHashResult, fidl::Error> {
2208 let _response = self.client.send_query::<
2209 SignerSignHashRequest,
2210 fidl::encoding::ResultType<SignerSignHashResponse, ErrorCode>,
2211 >(
2212 (hash,),
2213 0x3bfb1667fc4fe864,
2214 fidl::encoding::DynamicFlags::empty(),
2215 ___deadline,
2216 )?;
2217 Ok(_response.map(|x| x.signature))
2218 }
2219
2220 pub fn r#sign_hash_with_private_key(
2226 &self,
2227 mut hash: &[u8],
2228 mut wrapped_private_key: &[u8],
2229 ___deadline: zx::MonotonicInstant,
2230 ) -> Result<SignerSignHashWithPrivateKeyResult, fidl::Error> {
2231 let _response = self.client.send_query::<
2232 SignerSignHashWithPrivateKeyRequest,
2233 fidl::encoding::ResultType<SignerSignHashWithPrivateKeyResponse, ErrorCode>,
2234 >(
2235 (hash, wrapped_private_key,),
2236 0x23e8ae3490affc11,
2237 fidl::encoding::DynamicFlags::empty(),
2238 ___deadline,
2239 )?;
2240 Ok(_response.map(|x| x.signature))
2241 }
2242}
2243
2244#[cfg(target_os = "fuchsia")]
2245impl From<SignerSynchronousProxy> for zx::NullableHandle {
2246 fn from(value: SignerSynchronousProxy) -> Self {
2247 value.into_channel().into()
2248 }
2249}
2250
2251#[cfg(target_os = "fuchsia")]
2252impl From<fidl::Channel> for SignerSynchronousProxy {
2253 fn from(value: fidl::Channel) -> Self {
2254 Self::new(value)
2255 }
2256}
2257
2258#[cfg(target_os = "fuchsia")]
2259impl fidl::endpoints::FromClient for SignerSynchronousProxy {
2260 type Protocol = SignerMarker;
2261
2262 fn from_client(value: fidl::endpoints::ClientEnd<SignerMarker>) -> Self {
2263 Self::new(value.into_channel())
2264 }
2265}
2266
2267#[derive(Debug, Clone)]
2268pub struct SignerProxy {
2269 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2270}
2271
2272impl fidl::endpoints::Proxy for SignerProxy {
2273 type Protocol = SignerMarker;
2274
2275 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2276 Self::new(inner)
2277 }
2278
2279 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2280 self.client.into_channel().map_err(|client| Self { client })
2281 }
2282
2283 fn as_channel(&self) -> &::fidl::AsyncChannel {
2284 self.client.as_channel()
2285 }
2286}
2287
2288impl SignerProxy {
2289 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2291 let protocol_name = <SignerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2292 Self { client: fidl::client::Client::new(channel, protocol_name) }
2293 }
2294
2295 pub fn take_event_stream(&self) -> SignerEventStream {
2301 SignerEventStream { event_receiver: self.client.take_event_receiver() }
2302 }
2303
2304 pub fn r#sign_hash(
2309 &self,
2310 mut hash: &[u8],
2311 ) -> fidl::client::QueryResponseFut<
2312 SignerSignHashResult,
2313 fidl::encoding::DefaultFuchsiaResourceDialect,
2314 > {
2315 SignerProxyInterface::r#sign_hash(self, hash)
2316 }
2317
2318 pub fn r#sign_hash_with_private_key(
2324 &self,
2325 mut hash: &[u8],
2326 mut wrapped_private_key: &[u8],
2327 ) -> fidl::client::QueryResponseFut<
2328 SignerSignHashWithPrivateKeyResult,
2329 fidl::encoding::DefaultFuchsiaResourceDialect,
2330 > {
2331 SignerProxyInterface::r#sign_hash_with_private_key(self, hash, wrapped_private_key)
2332 }
2333}
2334
2335impl SignerProxyInterface for SignerProxy {
2336 type SignHashResponseFut = fidl::client::QueryResponseFut<
2337 SignerSignHashResult,
2338 fidl::encoding::DefaultFuchsiaResourceDialect,
2339 >;
2340 fn r#sign_hash(&self, mut hash: &[u8]) -> Self::SignHashResponseFut {
2341 fn _decode(
2342 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2343 ) -> Result<SignerSignHashResult, fidl::Error> {
2344 let _response = fidl::client::decode_transaction_body::<
2345 fidl::encoding::ResultType<SignerSignHashResponse, ErrorCode>,
2346 fidl::encoding::DefaultFuchsiaResourceDialect,
2347 0x3bfb1667fc4fe864,
2348 >(_buf?)?;
2349 Ok(_response.map(|x| x.signature))
2350 }
2351 self.client.send_query_and_decode::<SignerSignHashRequest, SignerSignHashResult>(
2352 (hash,),
2353 0x3bfb1667fc4fe864,
2354 fidl::encoding::DynamicFlags::empty(),
2355 _decode,
2356 )
2357 }
2358
2359 type SignHashWithPrivateKeyResponseFut = fidl::client::QueryResponseFut<
2360 SignerSignHashWithPrivateKeyResult,
2361 fidl::encoding::DefaultFuchsiaResourceDialect,
2362 >;
2363 fn r#sign_hash_with_private_key(
2364 &self,
2365 mut hash: &[u8],
2366 mut wrapped_private_key: &[u8],
2367 ) -> Self::SignHashWithPrivateKeyResponseFut {
2368 fn _decode(
2369 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2370 ) -> Result<SignerSignHashWithPrivateKeyResult, fidl::Error> {
2371 let _response = fidl::client::decode_transaction_body::<
2372 fidl::encoding::ResultType<SignerSignHashWithPrivateKeyResponse, ErrorCode>,
2373 fidl::encoding::DefaultFuchsiaResourceDialect,
2374 0x23e8ae3490affc11,
2375 >(_buf?)?;
2376 Ok(_response.map(|x| x.signature))
2377 }
2378 self.client.send_query_and_decode::<
2379 SignerSignHashWithPrivateKeyRequest,
2380 SignerSignHashWithPrivateKeyResult,
2381 >(
2382 (hash, wrapped_private_key,),
2383 0x23e8ae3490affc11,
2384 fidl::encoding::DynamicFlags::empty(),
2385 _decode,
2386 )
2387 }
2388}
2389
2390pub struct SignerEventStream {
2391 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2392}
2393
2394impl std::marker::Unpin for SignerEventStream {}
2395
2396impl futures::stream::FusedStream for SignerEventStream {
2397 fn is_terminated(&self) -> bool {
2398 self.event_receiver.is_terminated()
2399 }
2400}
2401
2402impl futures::Stream for SignerEventStream {
2403 type Item = Result<SignerEvent, fidl::Error>;
2404
2405 fn poll_next(
2406 mut self: std::pin::Pin<&mut Self>,
2407 cx: &mut std::task::Context<'_>,
2408 ) -> std::task::Poll<Option<Self::Item>> {
2409 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2410 &mut self.event_receiver,
2411 cx
2412 )?) {
2413 Some(buf) => std::task::Poll::Ready(Some(SignerEvent::decode(buf))),
2414 None => std::task::Poll::Ready(None),
2415 }
2416 }
2417}
2418
2419#[derive(Debug)]
2420pub enum SignerEvent {}
2421
2422impl SignerEvent {
2423 fn decode(
2425 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2426 ) -> Result<SignerEvent, fidl::Error> {
2427 let (bytes, _handles) = buf.split_mut();
2428 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2429 debug_assert_eq!(tx_header.tx_id, 0);
2430 match tx_header.ordinal {
2431 _ => Err(fidl::Error::UnknownOrdinal {
2432 ordinal: tx_header.ordinal,
2433 protocol_name: <SignerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2434 }),
2435 }
2436 }
2437}
2438
2439pub struct SignerRequestStream {
2441 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2442 is_terminated: bool,
2443}
2444
2445impl std::marker::Unpin for SignerRequestStream {}
2446
2447impl futures::stream::FusedStream for SignerRequestStream {
2448 fn is_terminated(&self) -> bool {
2449 self.is_terminated
2450 }
2451}
2452
2453impl fidl::endpoints::RequestStream for SignerRequestStream {
2454 type Protocol = SignerMarker;
2455 type ControlHandle = SignerControlHandle;
2456
2457 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2458 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2459 }
2460
2461 fn control_handle(&self) -> Self::ControlHandle {
2462 SignerControlHandle { inner: self.inner.clone() }
2463 }
2464
2465 fn into_inner(
2466 self,
2467 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2468 {
2469 (self.inner, self.is_terminated)
2470 }
2471
2472 fn from_inner(
2473 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2474 is_terminated: bool,
2475 ) -> Self {
2476 Self { inner, is_terminated }
2477 }
2478}
2479
2480impl futures::Stream for SignerRequestStream {
2481 type Item = Result<SignerRequest, fidl::Error>;
2482
2483 fn poll_next(
2484 mut self: std::pin::Pin<&mut Self>,
2485 cx: &mut std::task::Context<'_>,
2486 ) -> std::task::Poll<Option<Self::Item>> {
2487 let this = &mut *self;
2488 if this.inner.check_shutdown(cx) {
2489 this.is_terminated = true;
2490 return std::task::Poll::Ready(None);
2491 }
2492 if this.is_terminated {
2493 panic!("polled SignerRequestStream after completion");
2494 }
2495 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2496 |bytes, handles| {
2497 match this.inner.channel().read_etc(cx, bytes, handles) {
2498 std::task::Poll::Ready(Ok(())) => {}
2499 std::task::Poll::Pending => return std::task::Poll::Pending,
2500 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2501 this.is_terminated = true;
2502 return std::task::Poll::Ready(None);
2503 }
2504 std::task::Poll::Ready(Err(e)) => {
2505 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2506 e.into(),
2507 ))));
2508 }
2509 }
2510
2511 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2513
2514 std::task::Poll::Ready(Some(match header.ordinal {
2515 0x3bfb1667fc4fe864 => {
2516 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2517 let mut req = fidl::new_empty!(
2518 SignerSignHashRequest,
2519 fidl::encoding::DefaultFuchsiaResourceDialect
2520 );
2521 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SignerSignHashRequest>(&header, _body_bytes, handles, &mut req)?;
2522 let control_handle = SignerControlHandle { inner: this.inner.clone() };
2523 Ok(SignerRequest::SignHash {
2524 hash: req.hash,
2525
2526 responder: SignerSignHashResponder {
2527 control_handle: std::mem::ManuallyDrop::new(control_handle),
2528 tx_id: header.tx_id,
2529 },
2530 })
2531 }
2532 0x23e8ae3490affc11 => {
2533 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2534 let mut req = fidl::new_empty!(
2535 SignerSignHashWithPrivateKeyRequest,
2536 fidl::encoding::DefaultFuchsiaResourceDialect
2537 );
2538 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SignerSignHashWithPrivateKeyRequest>(&header, _body_bytes, handles, &mut req)?;
2539 let control_handle = SignerControlHandle { inner: this.inner.clone() };
2540 Ok(SignerRequest::SignHashWithPrivateKey {
2541 hash: req.hash,
2542 wrapped_private_key: req.wrapped_private_key,
2543
2544 responder: SignerSignHashWithPrivateKeyResponder {
2545 control_handle: std::mem::ManuallyDrop::new(control_handle),
2546 tx_id: header.tx_id,
2547 },
2548 })
2549 }
2550 _ => Err(fidl::Error::UnknownOrdinal {
2551 ordinal: header.ordinal,
2552 protocol_name:
2553 <SignerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2554 }),
2555 }))
2556 },
2557 )
2558 }
2559}
2560
2561#[derive(Debug)]
2564pub enum SignerRequest {
2565 SignHash { hash: Vec<u8>, responder: SignerSignHashResponder },
2570 SignHashWithPrivateKey {
2576 hash: Vec<u8>,
2577 wrapped_private_key: Vec<u8>,
2578 responder: SignerSignHashWithPrivateKeyResponder,
2579 },
2580}
2581
2582impl SignerRequest {
2583 #[allow(irrefutable_let_patterns)]
2584 pub fn into_sign_hash(self) -> Option<(Vec<u8>, SignerSignHashResponder)> {
2585 if let SignerRequest::SignHash { hash, responder } = self {
2586 Some((hash, responder))
2587 } else {
2588 None
2589 }
2590 }
2591
2592 #[allow(irrefutable_let_patterns)]
2593 pub fn into_sign_hash_with_private_key(
2594 self,
2595 ) -> Option<(Vec<u8>, Vec<u8>, SignerSignHashWithPrivateKeyResponder)> {
2596 if let SignerRequest::SignHashWithPrivateKey { hash, wrapped_private_key, responder } = self
2597 {
2598 Some((hash, wrapped_private_key, responder))
2599 } else {
2600 None
2601 }
2602 }
2603
2604 pub fn method_name(&self) -> &'static str {
2606 match *self {
2607 SignerRequest::SignHash { .. } => "sign_hash",
2608 SignerRequest::SignHashWithPrivateKey { .. } => "sign_hash_with_private_key",
2609 }
2610 }
2611}
2612
2613#[derive(Debug, Clone)]
2614pub struct SignerControlHandle {
2615 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2616}
2617
2618impl fidl::endpoints::ControlHandle for SignerControlHandle {
2619 fn shutdown(&self) {
2620 self.inner.shutdown()
2621 }
2622
2623 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2624 self.inner.shutdown_with_epitaph(status)
2625 }
2626
2627 fn is_closed(&self) -> bool {
2628 self.inner.channel().is_closed()
2629 }
2630 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2631 self.inner.channel().on_closed()
2632 }
2633
2634 #[cfg(target_os = "fuchsia")]
2635 fn signal_peer(
2636 &self,
2637 clear_mask: zx::Signals,
2638 set_mask: zx::Signals,
2639 ) -> Result<(), zx_status::Status> {
2640 use fidl::Peered;
2641 self.inner.channel().signal_peer(clear_mask, set_mask)
2642 }
2643}
2644
2645impl SignerControlHandle {}
2646
2647#[must_use = "FIDL methods require a response to be sent"]
2648#[derive(Debug)]
2649pub struct SignerSignHashResponder {
2650 control_handle: std::mem::ManuallyDrop<SignerControlHandle>,
2651 tx_id: u32,
2652}
2653
2654impl std::ops::Drop for SignerSignHashResponder {
2658 fn drop(&mut self) {
2659 self.control_handle.shutdown();
2660 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2662 }
2663}
2664
2665impl fidl::endpoints::Responder for SignerSignHashResponder {
2666 type ControlHandle = SignerControlHandle;
2667
2668 fn control_handle(&self) -> &SignerControlHandle {
2669 &self.control_handle
2670 }
2671
2672 fn drop_without_shutdown(mut self) {
2673 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2675 std::mem::forget(self);
2677 }
2678}
2679
2680impl SignerSignHashResponder {
2681 pub fn send(self, mut result: Result<&[u8], ErrorCode>) -> Result<(), fidl::Error> {
2685 let _result = self.send_raw(result);
2686 if _result.is_err() {
2687 self.control_handle.shutdown();
2688 }
2689 self.drop_without_shutdown();
2690 _result
2691 }
2692
2693 pub fn send_no_shutdown_on_err(
2695 self,
2696 mut result: Result<&[u8], ErrorCode>,
2697 ) -> Result<(), fidl::Error> {
2698 let _result = self.send_raw(result);
2699 self.drop_without_shutdown();
2700 _result
2701 }
2702
2703 fn send_raw(&self, mut result: Result<&[u8], ErrorCode>) -> Result<(), fidl::Error> {
2704 self.control_handle
2705 .inner
2706 .send::<fidl::encoding::ResultType<SignerSignHashResponse, ErrorCode>>(
2707 result.map(|signature| (signature,)),
2708 self.tx_id,
2709 0x3bfb1667fc4fe864,
2710 fidl::encoding::DynamicFlags::empty(),
2711 )
2712 }
2713}
2714
2715#[must_use = "FIDL methods require a response to be sent"]
2716#[derive(Debug)]
2717pub struct SignerSignHashWithPrivateKeyResponder {
2718 control_handle: std::mem::ManuallyDrop<SignerControlHandle>,
2719 tx_id: u32,
2720}
2721
2722impl std::ops::Drop for SignerSignHashWithPrivateKeyResponder {
2726 fn drop(&mut self) {
2727 self.control_handle.shutdown();
2728 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2730 }
2731}
2732
2733impl fidl::endpoints::Responder for SignerSignHashWithPrivateKeyResponder {
2734 type ControlHandle = SignerControlHandle;
2735
2736 fn control_handle(&self) -> &SignerControlHandle {
2737 &self.control_handle
2738 }
2739
2740 fn drop_without_shutdown(mut self) {
2741 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2743 std::mem::forget(self);
2745 }
2746}
2747
2748impl SignerSignHashWithPrivateKeyResponder {
2749 pub fn send(self, mut result: Result<&[u8], ErrorCode>) -> Result<(), fidl::Error> {
2753 let _result = self.send_raw(result);
2754 if _result.is_err() {
2755 self.control_handle.shutdown();
2756 }
2757 self.drop_without_shutdown();
2758 _result
2759 }
2760
2761 pub fn send_no_shutdown_on_err(
2763 self,
2764 mut result: Result<&[u8], ErrorCode>,
2765 ) -> Result<(), fidl::Error> {
2766 let _result = self.send_raw(result);
2767 self.drop_without_shutdown();
2768 _result
2769 }
2770
2771 fn send_raw(&self, mut result: Result<&[u8], ErrorCode>) -> Result<(), fidl::Error> {
2772 self.control_handle.inner.send::<fidl::encoding::ResultType<
2773 SignerSignHashWithPrivateKeyResponse,
2774 ErrorCode,
2775 >>(
2776 result.map(|signature| (signature,)),
2777 self.tx_id,
2778 0x23e8ae3490affc11,
2779 fidl::encoding::DynamicFlags::empty(),
2780 )
2781 }
2782}
2783
2784#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2785pub struct StackMarker;
2786
2787impl fidl::endpoints::ProtocolMarker for StackMarker {
2788 type Proxy = StackProxy;
2789 type RequestStream = StackRequestStream;
2790 #[cfg(target_os = "fuchsia")]
2791 type SynchronousProxy = StackSynchronousProxy;
2792
2793 const DEBUG_NAME: &'static str = "fuchsia.weave.Stack";
2794}
2795impl fidl::endpoints::DiscoverableProtocolMarker for StackMarker {}
2796pub type StackGetQrCodeResult = Result<QrCode, ErrorCode>;
2797pub type StackResetConfigResult = Result<(), ErrorCode>;
2798
2799pub trait StackProxyInterface: Send + Sync {
2800 fn r#get_pairing_state_watcher(
2801 &self,
2802 watcher: fidl::endpoints::ServerEnd<PairingStateWatcherMarker>,
2803 ) -> Result<(), fidl::Error>;
2804 fn r#get_svc_directory_watcher(
2805 &self,
2806 endpoint_id: u64,
2807 watcher: fidl::endpoints::ServerEnd<SvcDirectoryWatcherMarker>,
2808 ) -> Result<(), fidl::Error>;
2809 type GetQrCodeResponseFut: std::future::Future<Output = Result<StackGetQrCodeResult, fidl::Error>>
2810 + Send;
2811 fn r#get_qr_code(&self) -> Self::GetQrCodeResponseFut;
2812 type ResetConfigResponseFut: std::future::Future<Output = Result<StackResetConfigResult, fidl::Error>>
2813 + Send;
2814 fn r#reset_config(&self, flags: ResetConfigFlags) -> Self::ResetConfigResponseFut;
2815}
2816#[derive(Debug)]
2817#[cfg(target_os = "fuchsia")]
2818pub struct StackSynchronousProxy {
2819 client: fidl::client::sync::Client,
2820}
2821
2822#[cfg(target_os = "fuchsia")]
2823impl fidl::endpoints::SynchronousProxy for StackSynchronousProxy {
2824 type Proxy = StackProxy;
2825 type Protocol = StackMarker;
2826
2827 fn from_channel(inner: fidl::Channel) -> Self {
2828 Self::new(inner)
2829 }
2830
2831 fn into_channel(self) -> fidl::Channel {
2832 self.client.into_channel()
2833 }
2834
2835 fn as_channel(&self) -> &fidl::Channel {
2836 self.client.as_channel()
2837 }
2838}
2839
2840#[cfg(target_os = "fuchsia")]
2841impl StackSynchronousProxy {
2842 pub fn new(channel: fidl::Channel) -> Self {
2843 let protocol_name = <StackMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2844 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2845 }
2846
2847 pub fn into_channel(self) -> fidl::Channel {
2848 self.client.into_channel()
2849 }
2850
2851 pub fn wait_for_event(
2854 &self,
2855 deadline: zx::MonotonicInstant,
2856 ) -> Result<StackEvent, fidl::Error> {
2857 StackEvent::decode(self.client.wait_for_event(deadline)?)
2858 }
2859
2860 pub fn r#get_pairing_state_watcher(
2862 &self,
2863 mut watcher: fidl::endpoints::ServerEnd<PairingStateWatcherMarker>,
2864 ) -> Result<(), fidl::Error> {
2865 self.client.send::<StackGetPairingStateWatcherRequest>(
2866 (watcher,),
2867 0x674bbfa106efdc8d,
2868 fidl::encoding::DynamicFlags::empty(),
2869 )
2870 }
2871
2872 pub fn r#get_svc_directory_watcher(
2875 &self,
2876 mut endpoint_id: u64,
2877 mut watcher: fidl::endpoints::ServerEnd<SvcDirectoryWatcherMarker>,
2878 ) -> Result<(), fidl::Error> {
2879 self.client.send::<StackGetSvcDirectoryWatcherRequest>(
2880 (endpoint_id, watcher),
2881 0x261fdbc7a8447180,
2882 fidl::encoding::DynamicFlags::empty(),
2883 )
2884 }
2885
2886 pub fn r#get_qr_code(
2888 &self,
2889 ___deadline: zx::MonotonicInstant,
2890 ) -> Result<StackGetQrCodeResult, fidl::Error> {
2891 let _response = self.client.send_query::<
2892 fidl::encoding::EmptyPayload,
2893 fidl::encoding::ResultType<StackGetQrCodeResponse, ErrorCode>,
2894 >(
2895 (),
2896 0x79e435f04eb8d342,
2897 fidl::encoding::DynamicFlags::empty(),
2898 ___deadline,
2899 )?;
2900 Ok(_response.map(|x| x.qr_code))
2901 }
2902
2903 pub fn r#reset_config(
2905 &self,
2906 mut flags: ResetConfigFlags,
2907 ___deadline: zx::MonotonicInstant,
2908 ) -> Result<StackResetConfigResult, fidl::Error> {
2909 let _response = self.client.send_query::<
2910 StackResetConfigRequest,
2911 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ErrorCode>,
2912 >(
2913 (flags,),
2914 0x7a009a9b62d35c10,
2915 fidl::encoding::DynamicFlags::empty(),
2916 ___deadline,
2917 )?;
2918 Ok(_response.map(|x| x))
2919 }
2920}
2921
2922#[cfg(target_os = "fuchsia")]
2923impl From<StackSynchronousProxy> for zx::NullableHandle {
2924 fn from(value: StackSynchronousProxy) -> Self {
2925 value.into_channel().into()
2926 }
2927}
2928
2929#[cfg(target_os = "fuchsia")]
2930impl From<fidl::Channel> for StackSynchronousProxy {
2931 fn from(value: fidl::Channel) -> Self {
2932 Self::new(value)
2933 }
2934}
2935
2936#[cfg(target_os = "fuchsia")]
2937impl fidl::endpoints::FromClient for StackSynchronousProxy {
2938 type Protocol = StackMarker;
2939
2940 fn from_client(value: fidl::endpoints::ClientEnd<StackMarker>) -> Self {
2941 Self::new(value.into_channel())
2942 }
2943}
2944
2945#[derive(Debug, Clone)]
2946pub struct StackProxy {
2947 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2948}
2949
2950impl fidl::endpoints::Proxy for StackProxy {
2951 type Protocol = StackMarker;
2952
2953 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2954 Self::new(inner)
2955 }
2956
2957 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2958 self.client.into_channel().map_err(|client| Self { client })
2959 }
2960
2961 fn as_channel(&self) -> &::fidl::AsyncChannel {
2962 self.client.as_channel()
2963 }
2964}
2965
2966impl StackProxy {
2967 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2969 let protocol_name = <StackMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2970 Self { client: fidl::client::Client::new(channel, protocol_name) }
2971 }
2972
2973 pub fn take_event_stream(&self) -> StackEventStream {
2979 StackEventStream { event_receiver: self.client.take_event_receiver() }
2980 }
2981
2982 pub fn r#get_pairing_state_watcher(
2984 &self,
2985 mut watcher: fidl::endpoints::ServerEnd<PairingStateWatcherMarker>,
2986 ) -> Result<(), fidl::Error> {
2987 StackProxyInterface::r#get_pairing_state_watcher(self, watcher)
2988 }
2989
2990 pub fn r#get_svc_directory_watcher(
2993 &self,
2994 mut endpoint_id: u64,
2995 mut watcher: fidl::endpoints::ServerEnd<SvcDirectoryWatcherMarker>,
2996 ) -> Result<(), fidl::Error> {
2997 StackProxyInterface::r#get_svc_directory_watcher(self, endpoint_id, watcher)
2998 }
2999
3000 pub fn r#get_qr_code(
3002 &self,
3003 ) -> fidl::client::QueryResponseFut<
3004 StackGetQrCodeResult,
3005 fidl::encoding::DefaultFuchsiaResourceDialect,
3006 > {
3007 StackProxyInterface::r#get_qr_code(self)
3008 }
3009
3010 pub fn r#reset_config(
3012 &self,
3013 mut flags: ResetConfigFlags,
3014 ) -> fidl::client::QueryResponseFut<
3015 StackResetConfigResult,
3016 fidl::encoding::DefaultFuchsiaResourceDialect,
3017 > {
3018 StackProxyInterface::r#reset_config(self, flags)
3019 }
3020}
3021
3022impl StackProxyInterface for StackProxy {
3023 fn r#get_pairing_state_watcher(
3024 &self,
3025 mut watcher: fidl::endpoints::ServerEnd<PairingStateWatcherMarker>,
3026 ) -> Result<(), fidl::Error> {
3027 self.client.send::<StackGetPairingStateWatcherRequest>(
3028 (watcher,),
3029 0x674bbfa106efdc8d,
3030 fidl::encoding::DynamicFlags::empty(),
3031 )
3032 }
3033
3034 fn r#get_svc_directory_watcher(
3035 &self,
3036 mut endpoint_id: u64,
3037 mut watcher: fidl::endpoints::ServerEnd<SvcDirectoryWatcherMarker>,
3038 ) -> Result<(), fidl::Error> {
3039 self.client.send::<StackGetSvcDirectoryWatcherRequest>(
3040 (endpoint_id, watcher),
3041 0x261fdbc7a8447180,
3042 fidl::encoding::DynamicFlags::empty(),
3043 )
3044 }
3045
3046 type GetQrCodeResponseFut = fidl::client::QueryResponseFut<
3047 StackGetQrCodeResult,
3048 fidl::encoding::DefaultFuchsiaResourceDialect,
3049 >;
3050 fn r#get_qr_code(&self) -> Self::GetQrCodeResponseFut {
3051 fn _decode(
3052 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3053 ) -> Result<StackGetQrCodeResult, fidl::Error> {
3054 let _response = fidl::client::decode_transaction_body::<
3055 fidl::encoding::ResultType<StackGetQrCodeResponse, ErrorCode>,
3056 fidl::encoding::DefaultFuchsiaResourceDialect,
3057 0x79e435f04eb8d342,
3058 >(_buf?)?;
3059 Ok(_response.map(|x| x.qr_code))
3060 }
3061 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, StackGetQrCodeResult>(
3062 (),
3063 0x79e435f04eb8d342,
3064 fidl::encoding::DynamicFlags::empty(),
3065 _decode,
3066 )
3067 }
3068
3069 type ResetConfigResponseFut = fidl::client::QueryResponseFut<
3070 StackResetConfigResult,
3071 fidl::encoding::DefaultFuchsiaResourceDialect,
3072 >;
3073 fn r#reset_config(&self, mut flags: ResetConfigFlags) -> Self::ResetConfigResponseFut {
3074 fn _decode(
3075 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3076 ) -> Result<StackResetConfigResult, fidl::Error> {
3077 let _response = fidl::client::decode_transaction_body::<
3078 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ErrorCode>,
3079 fidl::encoding::DefaultFuchsiaResourceDialect,
3080 0x7a009a9b62d35c10,
3081 >(_buf?)?;
3082 Ok(_response.map(|x| x))
3083 }
3084 self.client.send_query_and_decode::<StackResetConfigRequest, StackResetConfigResult>(
3085 (flags,),
3086 0x7a009a9b62d35c10,
3087 fidl::encoding::DynamicFlags::empty(),
3088 _decode,
3089 )
3090 }
3091}
3092
3093pub struct StackEventStream {
3094 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3095}
3096
3097impl std::marker::Unpin for StackEventStream {}
3098
3099impl futures::stream::FusedStream for StackEventStream {
3100 fn is_terminated(&self) -> bool {
3101 self.event_receiver.is_terminated()
3102 }
3103}
3104
3105impl futures::Stream for StackEventStream {
3106 type Item = Result<StackEvent, fidl::Error>;
3107
3108 fn poll_next(
3109 mut self: std::pin::Pin<&mut Self>,
3110 cx: &mut std::task::Context<'_>,
3111 ) -> std::task::Poll<Option<Self::Item>> {
3112 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3113 &mut self.event_receiver,
3114 cx
3115 )?) {
3116 Some(buf) => std::task::Poll::Ready(Some(StackEvent::decode(buf))),
3117 None => std::task::Poll::Ready(None),
3118 }
3119 }
3120}
3121
3122#[derive(Debug)]
3123pub enum StackEvent {}
3124
3125impl StackEvent {
3126 fn decode(
3128 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3129 ) -> Result<StackEvent, fidl::Error> {
3130 let (bytes, _handles) = buf.split_mut();
3131 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3132 debug_assert_eq!(tx_header.tx_id, 0);
3133 match tx_header.ordinal {
3134 _ => Err(fidl::Error::UnknownOrdinal {
3135 ordinal: tx_header.ordinal,
3136 protocol_name: <StackMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3137 }),
3138 }
3139 }
3140}
3141
3142pub struct StackRequestStream {
3144 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3145 is_terminated: bool,
3146}
3147
3148impl std::marker::Unpin for StackRequestStream {}
3149
3150impl futures::stream::FusedStream for StackRequestStream {
3151 fn is_terminated(&self) -> bool {
3152 self.is_terminated
3153 }
3154}
3155
3156impl fidl::endpoints::RequestStream for StackRequestStream {
3157 type Protocol = StackMarker;
3158 type ControlHandle = StackControlHandle;
3159
3160 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3161 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3162 }
3163
3164 fn control_handle(&self) -> Self::ControlHandle {
3165 StackControlHandle { inner: self.inner.clone() }
3166 }
3167
3168 fn into_inner(
3169 self,
3170 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3171 {
3172 (self.inner, self.is_terminated)
3173 }
3174
3175 fn from_inner(
3176 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3177 is_terminated: bool,
3178 ) -> Self {
3179 Self { inner, is_terminated }
3180 }
3181}
3182
3183impl futures::Stream for StackRequestStream {
3184 type Item = Result<StackRequest, fidl::Error>;
3185
3186 fn poll_next(
3187 mut self: std::pin::Pin<&mut Self>,
3188 cx: &mut std::task::Context<'_>,
3189 ) -> std::task::Poll<Option<Self::Item>> {
3190 let this = &mut *self;
3191 if this.inner.check_shutdown(cx) {
3192 this.is_terminated = true;
3193 return std::task::Poll::Ready(None);
3194 }
3195 if this.is_terminated {
3196 panic!("polled StackRequestStream after completion");
3197 }
3198 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3199 |bytes, handles| {
3200 match this.inner.channel().read_etc(cx, bytes, handles) {
3201 std::task::Poll::Ready(Ok(())) => {}
3202 std::task::Poll::Pending => return std::task::Poll::Pending,
3203 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3204 this.is_terminated = true;
3205 return std::task::Poll::Ready(None);
3206 }
3207 std::task::Poll::Ready(Err(e)) => {
3208 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3209 e.into(),
3210 ))));
3211 }
3212 }
3213
3214 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3216
3217 std::task::Poll::Ready(Some(match header.ordinal {
3218 0x674bbfa106efdc8d => {
3219 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3220 let mut req = fidl::new_empty!(
3221 StackGetPairingStateWatcherRequest,
3222 fidl::encoding::DefaultFuchsiaResourceDialect
3223 );
3224 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StackGetPairingStateWatcherRequest>(&header, _body_bytes, handles, &mut req)?;
3225 let control_handle = StackControlHandle { inner: this.inner.clone() };
3226 Ok(StackRequest::GetPairingStateWatcher {
3227 watcher: req.watcher,
3228
3229 control_handle,
3230 })
3231 }
3232 0x261fdbc7a8447180 => {
3233 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3234 let mut req = fidl::new_empty!(
3235 StackGetSvcDirectoryWatcherRequest,
3236 fidl::encoding::DefaultFuchsiaResourceDialect
3237 );
3238 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StackGetSvcDirectoryWatcherRequest>(&header, _body_bytes, handles, &mut req)?;
3239 let control_handle = StackControlHandle { inner: this.inner.clone() };
3240 Ok(StackRequest::GetSvcDirectoryWatcher {
3241 endpoint_id: req.endpoint_id,
3242 watcher: req.watcher,
3243
3244 control_handle,
3245 })
3246 }
3247 0x79e435f04eb8d342 => {
3248 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3249 let mut req = fidl::new_empty!(
3250 fidl::encoding::EmptyPayload,
3251 fidl::encoding::DefaultFuchsiaResourceDialect
3252 );
3253 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3254 let control_handle = StackControlHandle { inner: this.inner.clone() };
3255 Ok(StackRequest::GetQrCode {
3256 responder: StackGetQrCodeResponder {
3257 control_handle: std::mem::ManuallyDrop::new(control_handle),
3258 tx_id: header.tx_id,
3259 },
3260 })
3261 }
3262 0x7a009a9b62d35c10 => {
3263 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3264 let mut req = fidl::new_empty!(
3265 StackResetConfigRequest,
3266 fidl::encoding::DefaultFuchsiaResourceDialect
3267 );
3268 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StackResetConfigRequest>(&header, _body_bytes, handles, &mut req)?;
3269 let control_handle = StackControlHandle { inner: this.inner.clone() };
3270 Ok(StackRequest::ResetConfig {
3271 flags: req.flags,
3272
3273 responder: StackResetConfigResponder {
3274 control_handle: std::mem::ManuallyDrop::new(control_handle),
3275 tx_id: header.tx_id,
3276 },
3277 })
3278 }
3279 _ => Err(fidl::Error::UnknownOrdinal {
3280 ordinal: header.ordinal,
3281 protocol_name: <StackMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3282 }),
3283 }))
3284 },
3285 )
3286 }
3287}
3288
3289#[derive(Debug)]
3294pub enum StackRequest {
3295 GetPairingStateWatcher {
3297 watcher: fidl::endpoints::ServerEnd<PairingStateWatcherMarker>,
3298 control_handle: StackControlHandle,
3299 },
3300 GetSvcDirectoryWatcher {
3303 endpoint_id: u64,
3304 watcher: fidl::endpoints::ServerEnd<SvcDirectoryWatcherMarker>,
3305 control_handle: StackControlHandle,
3306 },
3307 GetQrCode { responder: StackGetQrCodeResponder },
3309 ResetConfig { flags: ResetConfigFlags, responder: StackResetConfigResponder },
3311}
3312
3313impl StackRequest {
3314 #[allow(irrefutable_let_patterns)]
3315 pub fn into_get_pairing_state_watcher(
3316 self,
3317 ) -> Option<(fidl::endpoints::ServerEnd<PairingStateWatcherMarker>, StackControlHandle)> {
3318 if let StackRequest::GetPairingStateWatcher { watcher, control_handle } = self {
3319 Some((watcher, control_handle))
3320 } else {
3321 None
3322 }
3323 }
3324
3325 #[allow(irrefutable_let_patterns)]
3326 pub fn into_get_svc_directory_watcher(
3327 self,
3328 ) -> Option<(u64, fidl::endpoints::ServerEnd<SvcDirectoryWatcherMarker>, StackControlHandle)>
3329 {
3330 if let StackRequest::GetSvcDirectoryWatcher { endpoint_id, watcher, control_handle } = self
3331 {
3332 Some((endpoint_id, watcher, control_handle))
3333 } else {
3334 None
3335 }
3336 }
3337
3338 #[allow(irrefutable_let_patterns)]
3339 pub fn into_get_qr_code(self) -> Option<(StackGetQrCodeResponder)> {
3340 if let StackRequest::GetQrCode { responder } = self { Some((responder)) } else { None }
3341 }
3342
3343 #[allow(irrefutable_let_patterns)]
3344 pub fn into_reset_config(self) -> Option<(ResetConfigFlags, StackResetConfigResponder)> {
3345 if let StackRequest::ResetConfig { flags, responder } = self {
3346 Some((flags, responder))
3347 } else {
3348 None
3349 }
3350 }
3351
3352 pub fn method_name(&self) -> &'static str {
3354 match *self {
3355 StackRequest::GetPairingStateWatcher { .. } => "get_pairing_state_watcher",
3356 StackRequest::GetSvcDirectoryWatcher { .. } => "get_svc_directory_watcher",
3357 StackRequest::GetQrCode { .. } => "get_qr_code",
3358 StackRequest::ResetConfig { .. } => "reset_config",
3359 }
3360 }
3361}
3362
3363#[derive(Debug, Clone)]
3364pub struct StackControlHandle {
3365 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3366}
3367
3368impl fidl::endpoints::ControlHandle for StackControlHandle {
3369 fn shutdown(&self) {
3370 self.inner.shutdown()
3371 }
3372
3373 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3374 self.inner.shutdown_with_epitaph(status)
3375 }
3376
3377 fn is_closed(&self) -> bool {
3378 self.inner.channel().is_closed()
3379 }
3380 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3381 self.inner.channel().on_closed()
3382 }
3383
3384 #[cfg(target_os = "fuchsia")]
3385 fn signal_peer(
3386 &self,
3387 clear_mask: zx::Signals,
3388 set_mask: zx::Signals,
3389 ) -> Result<(), zx_status::Status> {
3390 use fidl::Peered;
3391 self.inner.channel().signal_peer(clear_mask, set_mask)
3392 }
3393}
3394
3395impl StackControlHandle {}
3396
3397#[must_use = "FIDL methods require a response to be sent"]
3398#[derive(Debug)]
3399pub struct StackGetQrCodeResponder {
3400 control_handle: std::mem::ManuallyDrop<StackControlHandle>,
3401 tx_id: u32,
3402}
3403
3404impl std::ops::Drop for StackGetQrCodeResponder {
3408 fn drop(&mut self) {
3409 self.control_handle.shutdown();
3410 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3412 }
3413}
3414
3415impl fidl::endpoints::Responder for StackGetQrCodeResponder {
3416 type ControlHandle = StackControlHandle;
3417
3418 fn control_handle(&self) -> &StackControlHandle {
3419 &self.control_handle
3420 }
3421
3422 fn drop_without_shutdown(mut self) {
3423 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3425 std::mem::forget(self);
3427 }
3428}
3429
3430impl StackGetQrCodeResponder {
3431 pub fn send(self, mut result: Result<&QrCode, ErrorCode>) -> Result<(), fidl::Error> {
3435 let _result = self.send_raw(result);
3436 if _result.is_err() {
3437 self.control_handle.shutdown();
3438 }
3439 self.drop_without_shutdown();
3440 _result
3441 }
3442
3443 pub fn send_no_shutdown_on_err(
3445 self,
3446 mut result: Result<&QrCode, ErrorCode>,
3447 ) -> Result<(), fidl::Error> {
3448 let _result = self.send_raw(result);
3449 self.drop_without_shutdown();
3450 _result
3451 }
3452
3453 fn send_raw(&self, mut result: Result<&QrCode, ErrorCode>) -> Result<(), fidl::Error> {
3454 self.control_handle
3455 .inner
3456 .send::<fidl::encoding::ResultType<StackGetQrCodeResponse, ErrorCode>>(
3457 result.map(|qr_code| (qr_code,)),
3458 self.tx_id,
3459 0x79e435f04eb8d342,
3460 fidl::encoding::DynamicFlags::empty(),
3461 )
3462 }
3463}
3464
3465#[must_use = "FIDL methods require a response to be sent"]
3466#[derive(Debug)]
3467pub struct StackResetConfigResponder {
3468 control_handle: std::mem::ManuallyDrop<StackControlHandle>,
3469 tx_id: u32,
3470}
3471
3472impl std::ops::Drop for StackResetConfigResponder {
3476 fn drop(&mut self) {
3477 self.control_handle.shutdown();
3478 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3480 }
3481}
3482
3483impl fidl::endpoints::Responder for StackResetConfigResponder {
3484 type ControlHandle = StackControlHandle;
3485
3486 fn control_handle(&self) -> &StackControlHandle {
3487 &self.control_handle
3488 }
3489
3490 fn drop_without_shutdown(mut self) {
3491 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3493 std::mem::forget(self);
3495 }
3496}
3497
3498impl StackResetConfigResponder {
3499 pub fn send(self, mut result: Result<(), ErrorCode>) -> Result<(), fidl::Error> {
3503 let _result = self.send_raw(result);
3504 if _result.is_err() {
3505 self.control_handle.shutdown();
3506 }
3507 self.drop_without_shutdown();
3508 _result
3509 }
3510
3511 pub fn send_no_shutdown_on_err(
3513 self,
3514 mut result: Result<(), ErrorCode>,
3515 ) -> Result<(), fidl::Error> {
3516 let _result = self.send_raw(result);
3517 self.drop_without_shutdown();
3518 _result
3519 }
3520
3521 fn send_raw(&self, mut result: Result<(), ErrorCode>) -> Result<(), fidl::Error> {
3522 self.control_handle
3523 .inner
3524 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ErrorCode>>(
3525 result,
3526 self.tx_id,
3527 0x7a009a9b62d35c10,
3528 fidl::encoding::DynamicFlags::empty(),
3529 )
3530 }
3531}
3532
3533#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3534pub struct StackProviderMarker;
3535
3536impl fidl::endpoints::ProtocolMarker for StackProviderMarker {
3537 type Proxy = StackProviderProxy;
3538 type RequestStream = StackProviderRequestStream;
3539 #[cfg(target_os = "fuchsia")]
3540 type SynchronousProxy = StackProviderSynchronousProxy;
3541
3542 const DEBUG_NAME: &'static str = "fuchsia.weave.StackProvider";
3543}
3544impl fidl::endpoints::DiscoverableProtocolMarker for StackProviderMarker {}
3545
3546pub trait StackProviderProxyInterface: Send + Sync {
3547 fn r#set_wlan_network_config_provider(
3548 &self,
3549 provider: fidl::endpoints::ClientEnd<WlanNetworkConfigProviderMarker>,
3550 ) -> Result<(), fidl::Error>;
3551}
3552#[derive(Debug)]
3553#[cfg(target_os = "fuchsia")]
3554pub struct StackProviderSynchronousProxy {
3555 client: fidl::client::sync::Client,
3556}
3557
3558#[cfg(target_os = "fuchsia")]
3559impl fidl::endpoints::SynchronousProxy for StackProviderSynchronousProxy {
3560 type Proxy = StackProviderProxy;
3561 type Protocol = StackProviderMarker;
3562
3563 fn from_channel(inner: fidl::Channel) -> Self {
3564 Self::new(inner)
3565 }
3566
3567 fn into_channel(self) -> fidl::Channel {
3568 self.client.into_channel()
3569 }
3570
3571 fn as_channel(&self) -> &fidl::Channel {
3572 self.client.as_channel()
3573 }
3574}
3575
3576#[cfg(target_os = "fuchsia")]
3577impl StackProviderSynchronousProxy {
3578 pub fn new(channel: fidl::Channel) -> Self {
3579 let protocol_name = <StackProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3580 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3581 }
3582
3583 pub fn into_channel(self) -> fidl::Channel {
3584 self.client.into_channel()
3585 }
3586
3587 pub fn wait_for_event(
3590 &self,
3591 deadline: zx::MonotonicInstant,
3592 ) -> Result<StackProviderEvent, fidl::Error> {
3593 StackProviderEvent::decode(self.client.wait_for_event(deadline)?)
3594 }
3595
3596 pub fn r#set_wlan_network_config_provider(
3606 &self,
3607 mut provider: fidl::endpoints::ClientEnd<WlanNetworkConfigProviderMarker>,
3608 ) -> Result<(), fidl::Error> {
3609 self.client.send::<StackProviderSetWlanNetworkConfigProviderRequest>(
3610 (provider,),
3611 0x60f817738f6028b4,
3612 fidl::encoding::DynamicFlags::empty(),
3613 )
3614 }
3615}
3616
3617#[cfg(target_os = "fuchsia")]
3618impl From<StackProviderSynchronousProxy> for zx::NullableHandle {
3619 fn from(value: StackProviderSynchronousProxy) -> Self {
3620 value.into_channel().into()
3621 }
3622}
3623
3624#[cfg(target_os = "fuchsia")]
3625impl From<fidl::Channel> for StackProviderSynchronousProxy {
3626 fn from(value: fidl::Channel) -> Self {
3627 Self::new(value)
3628 }
3629}
3630
3631#[cfg(target_os = "fuchsia")]
3632impl fidl::endpoints::FromClient for StackProviderSynchronousProxy {
3633 type Protocol = StackProviderMarker;
3634
3635 fn from_client(value: fidl::endpoints::ClientEnd<StackProviderMarker>) -> Self {
3636 Self::new(value.into_channel())
3637 }
3638}
3639
3640#[derive(Debug, Clone)]
3641pub struct StackProviderProxy {
3642 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3643}
3644
3645impl fidl::endpoints::Proxy for StackProviderProxy {
3646 type Protocol = StackProviderMarker;
3647
3648 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3649 Self::new(inner)
3650 }
3651
3652 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3653 self.client.into_channel().map_err(|client| Self { client })
3654 }
3655
3656 fn as_channel(&self) -> &::fidl::AsyncChannel {
3657 self.client.as_channel()
3658 }
3659}
3660
3661impl StackProviderProxy {
3662 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3664 let protocol_name = <StackProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3665 Self { client: fidl::client::Client::new(channel, protocol_name) }
3666 }
3667
3668 pub fn take_event_stream(&self) -> StackProviderEventStream {
3674 StackProviderEventStream { event_receiver: self.client.take_event_receiver() }
3675 }
3676
3677 pub fn r#set_wlan_network_config_provider(
3687 &self,
3688 mut provider: fidl::endpoints::ClientEnd<WlanNetworkConfigProviderMarker>,
3689 ) -> Result<(), fidl::Error> {
3690 StackProviderProxyInterface::r#set_wlan_network_config_provider(self, provider)
3691 }
3692}
3693
3694impl StackProviderProxyInterface for StackProviderProxy {
3695 fn r#set_wlan_network_config_provider(
3696 &self,
3697 mut provider: fidl::endpoints::ClientEnd<WlanNetworkConfigProviderMarker>,
3698 ) -> Result<(), fidl::Error> {
3699 self.client.send::<StackProviderSetWlanNetworkConfigProviderRequest>(
3700 (provider,),
3701 0x60f817738f6028b4,
3702 fidl::encoding::DynamicFlags::empty(),
3703 )
3704 }
3705}
3706
3707pub struct StackProviderEventStream {
3708 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3709}
3710
3711impl std::marker::Unpin for StackProviderEventStream {}
3712
3713impl futures::stream::FusedStream for StackProviderEventStream {
3714 fn is_terminated(&self) -> bool {
3715 self.event_receiver.is_terminated()
3716 }
3717}
3718
3719impl futures::Stream for StackProviderEventStream {
3720 type Item = Result<StackProviderEvent, fidl::Error>;
3721
3722 fn poll_next(
3723 mut self: std::pin::Pin<&mut Self>,
3724 cx: &mut std::task::Context<'_>,
3725 ) -> std::task::Poll<Option<Self::Item>> {
3726 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3727 &mut self.event_receiver,
3728 cx
3729 )?) {
3730 Some(buf) => std::task::Poll::Ready(Some(StackProviderEvent::decode(buf))),
3731 None => std::task::Poll::Ready(None),
3732 }
3733 }
3734}
3735
3736#[derive(Debug)]
3737pub enum StackProviderEvent {}
3738
3739impl StackProviderEvent {
3740 fn decode(
3742 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3743 ) -> Result<StackProviderEvent, fidl::Error> {
3744 let (bytes, _handles) = buf.split_mut();
3745 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3746 debug_assert_eq!(tx_header.tx_id, 0);
3747 match tx_header.ordinal {
3748 _ => Err(fidl::Error::UnknownOrdinal {
3749 ordinal: tx_header.ordinal,
3750 protocol_name: <StackProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3751 }),
3752 }
3753 }
3754}
3755
3756pub struct StackProviderRequestStream {
3758 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3759 is_terminated: bool,
3760}
3761
3762impl std::marker::Unpin for StackProviderRequestStream {}
3763
3764impl futures::stream::FusedStream for StackProviderRequestStream {
3765 fn is_terminated(&self) -> bool {
3766 self.is_terminated
3767 }
3768}
3769
3770impl fidl::endpoints::RequestStream for StackProviderRequestStream {
3771 type Protocol = StackProviderMarker;
3772 type ControlHandle = StackProviderControlHandle;
3773
3774 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3775 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3776 }
3777
3778 fn control_handle(&self) -> Self::ControlHandle {
3779 StackProviderControlHandle { inner: self.inner.clone() }
3780 }
3781
3782 fn into_inner(
3783 self,
3784 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3785 {
3786 (self.inner, self.is_terminated)
3787 }
3788
3789 fn from_inner(
3790 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3791 is_terminated: bool,
3792 ) -> Self {
3793 Self { inner, is_terminated }
3794 }
3795}
3796
3797impl futures::Stream for StackProviderRequestStream {
3798 type Item = Result<StackProviderRequest, fidl::Error>;
3799
3800 fn poll_next(
3801 mut self: std::pin::Pin<&mut Self>,
3802 cx: &mut std::task::Context<'_>,
3803 ) -> std::task::Poll<Option<Self::Item>> {
3804 let this = &mut *self;
3805 if this.inner.check_shutdown(cx) {
3806 this.is_terminated = true;
3807 return std::task::Poll::Ready(None);
3808 }
3809 if this.is_terminated {
3810 panic!("polled StackProviderRequestStream after completion");
3811 }
3812 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3813 |bytes, handles| {
3814 match this.inner.channel().read_etc(cx, bytes, handles) {
3815 std::task::Poll::Ready(Ok(())) => {}
3816 std::task::Poll::Pending => return std::task::Poll::Pending,
3817 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3818 this.is_terminated = true;
3819 return std::task::Poll::Ready(None);
3820 }
3821 std::task::Poll::Ready(Err(e)) => {
3822 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3823 e.into(),
3824 ))));
3825 }
3826 }
3827
3828 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3830
3831 std::task::Poll::Ready(Some(match header.ordinal {
3832 0x60f817738f6028b4 => {
3833 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3834 let mut req = fidl::new_empty!(
3835 StackProviderSetWlanNetworkConfigProviderRequest,
3836 fidl::encoding::DefaultFuchsiaResourceDialect
3837 );
3838 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StackProviderSetWlanNetworkConfigProviderRequest>(&header, _body_bytes, handles, &mut req)?;
3839 let control_handle =
3840 StackProviderControlHandle { inner: this.inner.clone() };
3841 Ok(StackProviderRequest::SetWlanNetworkConfigProvider {
3842 provider: req.provider,
3843
3844 control_handle,
3845 })
3846 }
3847 _ => Err(fidl::Error::UnknownOrdinal {
3848 ordinal: header.ordinal,
3849 protocol_name:
3850 <StackProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3851 }),
3852 }))
3853 },
3854 )
3855 }
3856}
3857
3858#[derive(Debug)]
3860pub enum StackProviderRequest {
3861 SetWlanNetworkConfigProvider {
3871 provider: fidl::endpoints::ClientEnd<WlanNetworkConfigProviderMarker>,
3872 control_handle: StackProviderControlHandle,
3873 },
3874}
3875
3876impl StackProviderRequest {
3877 #[allow(irrefutable_let_patterns)]
3878 pub fn into_set_wlan_network_config_provider(
3879 self,
3880 ) -> Option<(
3881 fidl::endpoints::ClientEnd<WlanNetworkConfigProviderMarker>,
3882 StackProviderControlHandle,
3883 )> {
3884 if let StackProviderRequest::SetWlanNetworkConfigProvider { provider, control_handle } =
3885 self
3886 {
3887 Some((provider, control_handle))
3888 } else {
3889 None
3890 }
3891 }
3892
3893 pub fn method_name(&self) -> &'static str {
3895 match *self {
3896 StackProviderRequest::SetWlanNetworkConfigProvider { .. } => {
3897 "set_wlan_network_config_provider"
3898 }
3899 }
3900 }
3901}
3902
3903#[derive(Debug, Clone)]
3904pub struct StackProviderControlHandle {
3905 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3906}
3907
3908impl fidl::endpoints::ControlHandle for StackProviderControlHandle {
3909 fn shutdown(&self) {
3910 self.inner.shutdown()
3911 }
3912
3913 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3914 self.inner.shutdown_with_epitaph(status)
3915 }
3916
3917 fn is_closed(&self) -> bool {
3918 self.inner.channel().is_closed()
3919 }
3920 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3921 self.inner.channel().on_closed()
3922 }
3923
3924 #[cfg(target_os = "fuchsia")]
3925 fn signal_peer(
3926 &self,
3927 clear_mask: zx::Signals,
3928 set_mask: zx::Signals,
3929 ) -> Result<(), zx_status::Status> {
3930 use fidl::Peered;
3931 self.inner.channel().signal_peer(clear_mask, set_mask)
3932 }
3933}
3934
3935impl StackProviderControlHandle {}
3936
3937#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3938pub struct SvcDirectoryWatcherMarker;
3939
3940impl fidl::endpoints::ProtocolMarker for SvcDirectoryWatcherMarker {
3941 type Proxy = SvcDirectoryWatcherProxy;
3942 type RequestStream = SvcDirectoryWatcherRequestStream;
3943 #[cfg(target_os = "fuchsia")]
3944 type SynchronousProxy = SvcDirectoryWatcherSynchronousProxy;
3945
3946 const DEBUG_NAME: &'static str = "(anonymous) SvcDirectoryWatcher";
3947}
3948
3949pub trait SvcDirectoryWatcherProxyInterface: Send + Sync {
3950 type WatchServiceDirectoryResponseFut: std::future::Future<Output = Result<Vec<HostPort>, fidl::Error>>
3951 + Send;
3952 fn r#watch_service_directory(&self) -> Self::WatchServiceDirectoryResponseFut;
3953}
3954#[derive(Debug)]
3955#[cfg(target_os = "fuchsia")]
3956pub struct SvcDirectoryWatcherSynchronousProxy {
3957 client: fidl::client::sync::Client,
3958}
3959
3960#[cfg(target_os = "fuchsia")]
3961impl fidl::endpoints::SynchronousProxy for SvcDirectoryWatcherSynchronousProxy {
3962 type Proxy = SvcDirectoryWatcherProxy;
3963 type Protocol = SvcDirectoryWatcherMarker;
3964
3965 fn from_channel(inner: fidl::Channel) -> Self {
3966 Self::new(inner)
3967 }
3968
3969 fn into_channel(self) -> fidl::Channel {
3970 self.client.into_channel()
3971 }
3972
3973 fn as_channel(&self) -> &fidl::Channel {
3974 self.client.as_channel()
3975 }
3976}
3977
3978#[cfg(target_os = "fuchsia")]
3979impl SvcDirectoryWatcherSynchronousProxy {
3980 pub fn new(channel: fidl::Channel) -> Self {
3981 let protocol_name =
3982 <SvcDirectoryWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3983 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3984 }
3985
3986 pub fn into_channel(self) -> fidl::Channel {
3987 self.client.into_channel()
3988 }
3989
3990 pub fn wait_for_event(
3993 &self,
3994 deadline: zx::MonotonicInstant,
3995 ) -> Result<SvcDirectoryWatcherEvent, fidl::Error> {
3996 SvcDirectoryWatcherEvent::decode(self.client.wait_for_event(deadline)?)
3997 }
3998
3999 pub fn r#watch_service_directory(
4009 &self,
4010 ___deadline: zx::MonotonicInstant,
4011 ) -> Result<Vec<HostPort>, fidl::Error> {
4012 let _response = self.client.send_query::<
4013 fidl::encoding::EmptyPayload,
4014 SvcDirectoryWatcherWatchServiceDirectoryResponse,
4015 >(
4016 (),
4017 0x4c1000286a01a142,
4018 fidl::encoding::DynamicFlags::empty(),
4019 ___deadline,
4020 )?;
4021 Ok(_response.host_port_list)
4022 }
4023}
4024
4025#[cfg(target_os = "fuchsia")]
4026impl From<SvcDirectoryWatcherSynchronousProxy> for zx::NullableHandle {
4027 fn from(value: SvcDirectoryWatcherSynchronousProxy) -> Self {
4028 value.into_channel().into()
4029 }
4030}
4031
4032#[cfg(target_os = "fuchsia")]
4033impl From<fidl::Channel> for SvcDirectoryWatcherSynchronousProxy {
4034 fn from(value: fidl::Channel) -> Self {
4035 Self::new(value)
4036 }
4037}
4038
4039#[cfg(target_os = "fuchsia")]
4040impl fidl::endpoints::FromClient for SvcDirectoryWatcherSynchronousProxy {
4041 type Protocol = SvcDirectoryWatcherMarker;
4042
4043 fn from_client(value: fidl::endpoints::ClientEnd<SvcDirectoryWatcherMarker>) -> Self {
4044 Self::new(value.into_channel())
4045 }
4046}
4047
4048#[derive(Debug, Clone)]
4049pub struct SvcDirectoryWatcherProxy {
4050 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4051}
4052
4053impl fidl::endpoints::Proxy for SvcDirectoryWatcherProxy {
4054 type Protocol = SvcDirectoryWatcherMarker;
4055
4056 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4057 Self::new(inner)
4058 }
4059
4060 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4061 self.client.into_channel().map_err(|client| Self { client })
4062 }
4063
4064 fn as_channel(&self) -> &::fidl::AsyncChannel {
4065 self.client.as_channel()
4066 }
4067}
4068
4069impl SvcDirectoryWatcherProxy {
4070 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4072 let protocol_name =
4073 <SvcDirectoryWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4074 Self { client: fidl::client::Client::new(channel, protocol_name) }
4075 }
4076
4077 pub fn take_event_stream(&self) -> SvcDirectoryWatcherEventStream {
4083 SvcDirectoryWatcherEventStream { event_receiver: self.client.take_event_receiver() }
4084 }
4085
4086 pub fn r#watch_service_directory(
4096 &self,
4097 ) -> fidl::client::QueryResponseFut<Vec<HostPort>, fidl::encoding::DefaultFuchsiaResourceDialect>
4098 {
4099 SvcDirectoryWatcherProxyInterface::r#watch_service_directory(self)
4100 }
4101}
4102
4103impl SvcDirectoryWatcherProxyInterface for SvcDirectoryWatcherProxy {
4104 type WatchServiceDirectoryResponseFut = fidl::client::QueryResponseFut<
4105 Vec<HostPort>,
4106 fidl::encoding::DefaultFuchsiaResourceDialect,
4107 >;
4108 fn r#watch_service_directory(&self) -> Self::WatchServiceDirectoryResponseFut {
4109 fn _decode(
4110 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4111 ) -> Result<Vec<HostPort>, fidl::Error> {
4112 let _response = fidl::client::decode_transaction_body::<
4113 SvcDirectoryWatcherWatchServiceDirectoryResponse,
4114 fidl::encoding::DefaultFuchsiaResourceDialect,
4115 0x4c1000286a01a142,
4116 >(_buf?)?;
4117 Ok(_response.host_port_list)
4118 }
4119 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<HostPort>>(
4120 (),
4121 0x4c1000286a01a142,
4122 fidl::encoding::DynamicFlags::empty(),
4123 _decode,
4124 )
4125 }
4126}
4127
4128pub struct SvcDirectoryWatcherEventStream {
4129 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4130}
4131
4132impl std::marker::Unpin for SvcDirectoryWatcherEventStream {}
4133
4134impl futures::stream::FusedStream for SvcDirectoryWatcherEventStream {
4135 fn is_terminated(&self) -> bool {
4136 self.event_receiver.is_terminated()
4137 }
4138}
4139
4140impl futures::Stream for SvcDirectoryWatcherEventStream {
4141 type Item = Result<SvcDirectoryWatcherEvent, fidl::Error>;
4142
4143 fn poll_next(
4144 mut self: std::pin::Pin<&mut Self>,
4145 cx: &mut std::task::Context<'_>,
4146 ) -> std::task::Poll<Option<Self::Item>> {
4147 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4148 &mut self.event_receiver,
4149 cx
4150 )?) {
4151 Some(buf) => std::task::Poll::Ready(Some(SvcDirectoryWatcherEvent::decode(buf))),
4152 None => std::task::Poll::Ready(None),
4153 }
4154 }
4155}
4156
4157#[derive(Debug)]
4158pub enum SvcDirectoryWatcherEvent {}
4159
4160impl SvcDirectoryWatcherEvent {
4161 fn decode(
4163 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4164 ) -> Result<SvcDirectoryWatcherEvent, fidl::Error> {
4165 let (bytes, _handles) = buf.split_mut();
4166 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4167 debug_assert_eq!(tx_header.tx_id, 0);
4168 match tx_header.ordinal {
4169 _ => Err(fidl::Error::UnknownOrdinal {
4170 ordinal: tx_header.ordinal,
4171 protocol_name:
4172 <SvcDirectoryWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4173 }),
4174 }
4175 }
4176}
4177
4178pub struct SvcDirectoryWatcherRequestStream {
4180 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4181 is_terminated: bool,
4182}
4183
4184impl std::marker::Unpin for SvcDirectoryWatcherRequestStream {}
4185
4186impl futures::stream::FusedStream for SvcDirectoryWatcherRequestStream {
4187 fn is_terminated(&self) -> bool {
4188 self.is_terminated
4189 }
4190}
4191
4192impl fidl::endpoints::RequestStream for SvcDirectoryWatcherRequestStream {
4193 type Protocol = SvcDirectoryWatcherMarker;
4194 type ControlHandle = SvcDirectoryWatcherControlHandle;
4195
4196 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4197 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4198 }
4199
4200 fn control_handle(&self) -> Self::ControlHandle {
4201 SvcDirectoryWatcherControlHandle { inner: self.inner.clone() }
4202 }
4203
4204 fn into_inner(
4205 self,
4206 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4207 {
4208 (self.inner, self.is_terminated)
4209 }
4210
4211 fn from_inner(
4212 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4213 is_terminated: bool,
4214 ) -> Self {
4215 Self { inner, is_terminated }
4216 }
4217}
4218
4219impl futures::Stream for SvcDirectoryWatcherRequestStream {
4220 type Item = Result<SvcDirectoryWatcherRequest, fidl::Error>;
4221
4222 fn poll_next(
4223 mut self: std::pin::Pin<&mut Self>,
4224 cx: &mut std::task::Context<'_>,
4225 ) -> std::task::Poll<Option<Self::Item>> {
4226 let this = &mut *self;
4227 if this.inner.check_shutdown(cx) {
4228 this.is_terminated = true;
4229 return std::task::Poll::Ready(None);
4230 }
4231 if this.is_terminated {
4232 panic!("polled SvcDirectoryWatcherRequestStream after completion");
4233 }
4234 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4235 |bytes, handles| {
4236 match this.inner.channel().read_etc(cx, bytes, handles) {
4237 std::task::Poll::Ready(Ok(())) => {}
4238 std::task::Poll::Pending => return std::task::Poll::Pending,
4239 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4240 this.is_terminated = true;
4241 return std::task::Poll::Ready(None);
4242 }
4243 std::task::Poll::Ready(Err(e)) => {
4244 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4245 e.into(),
4246 ))));
4247 }
4248 }
4249
4250 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4252
4253 std::task::Poll::Ready(Some(match header.ordinal {
4254 0x4c1000286a01a142 => {
4255 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4256 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
4257 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4258 let control_handle = SvcDirectoryWatcherControlHandle {
4259 inner: this.inner.clone(),
4260 };
4261 Ok(SvcDirectoryWatcherRequest::WatchServiceDirectory {
4262 responder: SvcDirectoryWatcherWatchServiceDirectoryResponder {
4263 control_handle: std::mem::ManuallyDrop::new(control_handle),
4264 tx_id: header.tx_id,
4265 },
4266 })
4267 }
4268 _ => Err(fidl::Error::UnknownOrdinal {
4269 ordinal: header.ordinal,
4270 protocol_name: <SvcDirectoryWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4271 }),
4272 }))
4273 },
4274 )
4275 }
4276}
4277
4278#[derive(Debug)]
4282pub enum SvcDirectoryWatcherRequest {
4283 WatchServiceDirectory { responder: SvcDirectoryWatcherWatchServiceDirectoryResponder },
4293}
4294
4295impl SvcDirectoryWatcherRequest {
4296 #[allow(irrefutable_let_patterns)]
4297 pub fn into_watch_service_directory(
4298 self,
4299 ) -> Option<(SvcDirectoryWatcherWatchServiceDirectoryResponder)> {
4300 if let SvcDirectoryWatcherRequest::WatchServiceDirectory { responder } = self {
4301 Some((responder))
4302 } else {
4303 None
4304 }
4305 }
4306
4307 pub fn method_name(&self) -> &'static str {
4309 match *self {
4310 SvcDirectoryWatcherRequest::WatchServiceDirectory { .. } => "watch_service_directory",
4311 }
4312 }
4313}
4314
4315#[derive(Debug, Clone)]
4316pub struct SvcDirectoryWatcherControlHandle {
4317 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4318}
4319
4320impl fidl::endpoints::ControlHandle for SvcDirectoryWatcherControlHandle {
4321 fn shutdown(&self) {
4322 self.inner.shutdown()
4323 }
4324
4325 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4326 self.inner.shutdown_with_epitaph(status)
4327 }
4328
4329 fn is_closed(&self) -> bool {
4330 self.inner.channel().is_closed()
4331 }
4332 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4333 self.inner.channel().on_closed()
4334 }
4335
4336 #[cfg(target_os = "fuchsia")]
4337 fn signal_peer(
4338 &self,
4339 clear_mask: zx::Signals,
4340 set_mask: zx::Signals,
4341 ) -> Result<(), zx_status::Status> {
4342 use fidl::Peered;
4343 self.inner.channel().signal_peer(clear_mask, set_mask)
4344 }
4345}
4346
4347impl SvcDirectoryWatcherControlHandle {}
4348
4349#[must_use = "FIDL methods require a response to be sent"]
4350#[derive(Debug)]
4351pub struct SvcDirectoryWatcherWatchServiceDirectoryResponder {
4352 control_handle: std::mem::ManuallyDrop<SvcDirectoryWatcherControlHandle>,
4353 tx_id: u32,
4354}
4355
4356impl std::ops::Drop for SvcDirectoryWatcherWatchServiceDirectoryResponder {
4360 fn drop(&mut self) {
4361 self.control_handle.shutdown();
4362 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4364 }
4365}
4366
4367impl fidl::endpoints::Responder for SvcDirectoryWatcherWatchServiceDirectoryResponder {
4368 type ControlHandle = SvcDirectoryWatcherControlHandle;
4369
4370 fn control_handle(&self) -> &SvcDirectoryWatcherControlHandle {
4371 &self.control_handle
4372 }
4373
4374 fn drop_without_shutdown(mut self) {
4375 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4377 std::mem::forget(self);
4379 }
4380}
4381
4382impl SvcDirectoryWatcherWatchServiceDirectoryResponder {
4383 pub fn send(self, mut host_port_list: &[HostPort]) -> Result<(), fidl::Error> {
4387 let _result = self.send_raw(host_port_list);
4388 if _result.is_err() {
4389 self.control_handle.shutdown();
4390 }
4391 self.drop_without_shutdown();
4392 _result
4393 }
4394
4395 pub fn send_no_shutdown_on_err(
4397 self,
4398 mut host_port_list: &[HostPort],
4399 ) -> Result<(), fidl::Error> {
4400 let _result = self.send_raw(host_port_list);
4401 self.drop_without_shutdown();
4402 _result
4403 }
4404
4405 fn send_raw(&self, mut host_port_list: &[HostPort]) -> Result<(), fidl::Error> {
4406 self.control_handle.inner.send::<SvcDirectoryWatcherWatchServiceDirectoryResponse>(
4407 (host_port_list,),
4408 self.tx_id,
4409 0x4c1000286a01a142,
4410 fidl::encoding::DynamicFlags::empty(),
4411 )
4412 }
4413}
4414
4415#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4416pub struct WlanNetworkConfigProviderMarker;
4417
4418impl fidl::endpoints::ProtocolMarker for WlanNetworkConfigProviderMarker {
4419 type Proxy = WlanNetworkConfigProviderProxy;
4420 type RequestStream = WlanNetworkConfigProviderRequestStream;
4421 #[cfg(target_os = "fuchsia")]
4422 type SynchronousProxy = WlanNetworkConfigProviderSynchronousProxy;
4423
4424 const DEBUG_NAME: &'static str = "(anonymous) WlanNetworkConfigProvider";
4425}
4426
4427pub trait WlanNetworkConfigProviderProxyInterface: Send + Sync {
4428 type WatchConnectedNetworkResponseFut: std::future::Future<Output = Result<fidl_fuchsia_wlan_policy::NetworkConfig, fidl::Error>>
4429 + Send;
4430 fn r#watch_connected_network(&self) -> Self::WatchConnectedNetworkResponseFut;
4431}
4432#[derive(Debug)]
4433#[cfg(target_os = "fuchsia")]
4434pub struct WlanNetworkConfigProviderSynchronousProxy {
4435 client: fidl::client::sync::Client,
4436}
4437
4438#[cfg(target_os = "fuchsia")]
4439impl fidl::endpoints::SynchronousProxy for WlanNetworkConfigProviderSynchronousProxy {
4440 type Proxy = WlanNetworkConfigProviderProxy;
4441 type Protocol = WlanNetworkConfigProviderMarker;
4442
4443 fn from_channel(inner: fidl::Channel) -> Self {
4444 Self::new(inner)
4445 }
4446
4447 fn into_channel(self) -> fidl::Channel {
4448 self.client.into_channel()
4449 }
4450
4451 fn as_channel(&self) -> &fidl::Channel {
4452 self.client.as_channel()
4453 }
4454}
4455
4456#[cfg(target_os = "fuchsia")]
4457impl WlanNetworkConfigProviderSynchronousProxy {
4458 pub fn new(channel: fidl::Channel) -> Self {
4459 let protocol_name =
4460 <WlanNetworkConfigProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4461 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4462 }
4463
4464 pub fn into_channel(self) -> fidl::Channel {
4465 self.client.into_channel()
4466 }
4467
4468 pub fn wait_for_event(
4471 &self,
4472 deadline: zx::MonotonicInstant,
4473 ) -> Result<WlanNetworkConfigProviderEvent, fidl::Error> {
4474 WlanNetworkConfigProviderEvent::decode(self.client.wait_for_event(deadline)?)
4475 }
4476
4477 pub fn r#watch_connected_network(
4483 &self,
4484 ___deadline: zx::MonotonicInstant,
4485 ) -> Result<fidl_fuchsia_wlan_policy::NetworkConfig, fidl::Error> {
4486 let _response = self.client.send_query::<
4487 fidl::encoding::EmptyPayload,
4488 WlanNetworkConfigProviderWatchConnectedNetworkResponse,
4489 >(
4490 (),
4491 0x966c5bf4d6dfce1,
4492 fidl::encoding::DynamicFlags::empty(),
4493 ___deadline,
4494 )?;
4495 Ok(_response.network_config)
4496 }
4497}
4498
4499#[cfg(target_os = "fuchsia")]
4500impl From<WlanNetworkConfigProviderSynchronousProxy> for zx::NullableHandle {
4501 fn from(value: WlanNetworkConfigProviderSynchronousProxy) -> Self {
4502 value.into_channel().into()
4503 }
4504}
4505
4506#[cfg(target_os = "fuchsia")]
4507impl From<fidl::Channel> for WlanNetworkConfigProviderSynchronousProxy {
4508 fn from(value: fidl::Channel) -> Self {
4509 Self::new(value)
4510 }
4511}
4512
4513#[cfg(target_os = "fuchsia")]
4514impl fidl::endpoints::FromClient for WlanNetworkConfigProviderSynchronousProxy {
4515 type Protocol = WlanNetworkConfigProviderMarker;
4516
4517 fn from_client(value: fidl::endpoints::ClientEnd<WlanNetworkConfigProviderMarker>) -> Self {
4518 Self::new(value.into_channel())
4519 }
4520}
4521
4522#[derive(Debug, Clone)]
4523pub struct WlanNetworkConfigProviderProxy {
4524 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4525}
4526
4527impl fidl::endpoints::Proxy for WlanNetworkConfigProviderProxy {
4528 type Protocol = WlanNetworkConfigProviderMarker;
4529
4530 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4531 Self::new(inner)
4532 }
4533
4534 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4535 self.client.into_channel().map_err(|client| Self { client })
4536 }
4537
4538 fn as_channel(&self) -> &::fidl::AsyncChannel {
4539 self.client.as_channel()
4540 }
4541}
4542
4543impl WlanNetworkConfigProviderProxy {
4544 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4546 let protocol_name =
4547 <WlanNetworkConfigProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4548 Self { client: fidl::client::Client::new(channel, protocol_name) }
4549 }
4550
4551 pub fn take_event_stream(&self) -> WlanNetworkConfigProviderEventStream {
4557 WlanNetworkConfigProviderEventStream { event_receiver: self.client.take_event_receiver() }
4558 }
4559
4560 pub fn r#watch_connected_network(
4566 &self,
4567 ) -> fidl::client::QueryResponseFut<
4568 fidl_fuchsia_wlan_policy::NetworkConfig,
4569 fidl::encoding::DefaultFuchsiaResourceDialect,
4570 > {
4571 WlanNetworkConfigProviderProxyInterface::r#watch_connected_network(self)
4572 }
4573}
4574
4575impl WlanNetworkConfigProviderProxyInterface for WlanNetworkConfigProviderProxy {
4576 type WatchConnectedNetworkResponseFut = fidl::client::QueryResponseFut<
4577 fidl_fuchsia_wlan_policy::NetworkConfig,
4578 fidl::encoding::DefaultFuchsiaResourceDialect,
4579 >;
4580 fn r#watch_connected_network(&self) -> Self::WatchConnectedNetworkResponseFut {
4581 fn _decode(
4582 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4583 ) -> Result<fidl_fuchsia_wlan_policy::NetworkConfig, fidl::Error> {
4584 let _response = fidl::client::decode_transaction_body::<
4585 WlanNetworkConfigProviderWatchConnectedNetworkResponse,
4586 fidl::encoding::DefaultFuchsiaResourceDialect,
4587 0x966c5bf4d6dfce1,
4588 >(_buf?)?;
4589 Ok(_response.network_config)
4590 }
4591 self.client.send_query_and_decode::<
4592 fidl::encoding::EmptyPayload,
4593 fidl_fuchsia_wlan_policy::NetworkConfig,
4594 >(
4595 (),
4596 0x966c5bf4d6dfce1,
4597 fidl::encoding::DynamicFlags::empty(),
4598 _decode,
4599 )
4600 }
4601}
4602
4603pub struct WlanNetworkConfigProviderEventStream {
4604 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4605}
4606
4607impl std::marker::Unpin for WlanNetworkConfigProviderEventStream {}
4608
4609impl futures::stream::FusedStream for WlanNetworkConfigProviderEventStream {
4610 fn is_terminated(&self) -> bool {
4611 self.event_receiver.is_terminated()
4612 }
4613}
4614
4615impl futures::Stream for WlanNetworkConfigProviderEventStream {
4616 type Item = Result<WlanNetworkConfigProviderEvent, fidl::Error>;
4617
4618 fn poll_next(
4619 mut self: std::pin::Pin<&mut Self>,
4620 cx: &mut std::task::Context<'_>,
4621 ) -> std::task::Poll<Option<Self::Item>> {
4622 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4623 &mut self.event_receiver,
4624 cx
4625 )?) {
4626 Some(buf) => std::task::Poll::Ready(Some(WlanNetworkConfigProviderEvent::decode(buf))),
4627 None => std::task::Poll::Ready(None),
4628 }
4629 }
4630}
4631
4632#[derive(Debug)]
4633pub enum WlanNetworkConfigProviderEvent {}
4634
4635impl WlanNetworkConfigProviderEvent {
4636 fn decode(
4638 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4639 ) -> Result<WlanNetworkConfigProviderEvent, fidl::Error> {
4640 let (bytes, _handles) = buf.split_mut();
4641 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4642 debug_assert_eq!(tx_header.tx_id, 0);
4643 match tx_header.ordinal {
4644 _ => Err(fidl::Error::UnknownOrdinal {
4645 ordinal: tx_header.ordinal,
4646 protocol_name:
4647 <WlanNetworkConfigProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4648 }),
4649 }
4650 }
4651}
4652
4653pub struct WlanNetworkConfigProviderRequestStream {
4655 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4656 is_terminated: bool,
4657}
4658
4659impl std::marker::Unpin for WlanNetworkConfigProviderRequestStream {}
4660
4661impl futures::stream::FusedStream for WlanNetworkConfigProviderRequestStream {
4662 fn is_terminated(&self) -> bool {
4663 self.is_terminated
4664 }
4665}
4666
4667impl fidl::endpoints::RequestStream for WlanNetworkConfigProviderRequestStream {
4668 type Protocol = WlanNetworkConfigProviderMarker;
4669 type ControlHandle = WlanNetworkConfigProviderControlHandle;
4670
4671 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4672 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4673 }
4674
4675 fn control_handle(&self) -> Self::ControlHandle {
4676 WlanNetworkConfigProviderControlHandle { inner: self.inner.clone() }
4677 }
4678
4679 fn into_inner(
4680 self,
4681 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4682 {
4683 (self.inner, self.is_terminated)
4684 }
4685
4686 fn from_inner(
4687 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4688 is_terminated: bool,
4689 ) -> Self {
4690 Self { inner, is_terminated }
4691 }
4692}
4693
4694impl futures::Stream for WlanNetworkConfigProviderRequestStream {
4695 type Item = Result<WlanNetworkConfigProviderRequest, fidl::Error>;
4696
4697 fn poll_next(
4698 mut self: std::pin::Pin<&mut Self>,
4699 cx: &mut std::task::Context<'_>,
4700 ) -> std::task::Poll<Option<Self::Item>> {
4701 let this = &mut *self;
4702 if this.inner.check_shutdown(cx) {
4703 this.is_terminated = true;
4704 return std::task::Poll::Ready(None);
4705 }
4706 if this.is_terminated {
4707 panic!("polled WlanNetworkConfigProviderRequestStream after completion");
4708 }
4709 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4710 |bytes, handles| {
4711 match this.inner.channel().read_etc(cx, bytes, handles) {
4712 std::task::Poll::Ready(Ok(())) => {}
4713 std::task::Poll::Pending => return std::task::Poll::Pending,
4714 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4715 this.is_terminated = true;
4716 return std::task::Poll::Ready(None);
4717 }
4718 std::task::Poll::Ready(Err(e)) => {
4719 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4720 e.into(),
4721 ))));
4722 }
4723 }
4724
4725 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4727
4728 std::task::Poll::Ready(Some(match header.ordinal {
4729 0x966c5bf4d6dfce1 => {
4730 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4731 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
4732 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4733 let control_handle = WlanNetworkConfigProviderControlHandle {
4734 inner: this.inner.clone(),
4735 };
4736 Ok(WlanNetworkConfigProviderRequest::WatchConnectedNetwork {
4737 responder: WlanNetworkConfigProviderWatchConnectedNetworkResponder {
4738 control_handle: std::mem::ManuallyDrop::new(control_handle),
4739 tx_id: header.tx_id,
4740 },
4741 })
4742 }
4743 _ => Err(fidl::Error::UnknownOrdinal {
4744 ordinal: header.ordinal,
4745 protocol_name: <WlanNetworkConfigProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4746 }),
4747 }))
4748 },
4749 )
4750 }
4751}
4752
4753#[derive(Debug)]
4756pub enum WlanNetworkConfigProviderRequest {
4757 WatchConnectedNetwork { responder: WlanNetworkConfigProviderWatchConnectedNetworkResponder },
4763}
4764
4765impl WlanNetworkConfigProviderRequest {
4766 #[allow(irrefutable_let_patterns)]
4767 pub fn into_watch_connected_network(
4768 self,
4769 ) -> Option<(WlanNetworkConfigProviderWatchConnectedNetworkResponder)> {
4770 if let WlanNetworkConfigProviderRequest::WatchConnectedNetwork { responder } = self {
4771 Some((responder))
4772 } else {
4773 None
4774 }
4775 }
4776
4777 pub fn method_name(&self) -> &'static str {
4779 match *self {
4780 WlanNetworkConfigProviderRequest::WatchConnectedNetwork { .. } => {
4781 "watch_connected_network"
4782 }
4783 }
4784 }
4785}
4786
4787#[derive(Debug, Clone)]
4788pub struct WlanNetworkConfigProviderControlHandle {
4789 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4790}
4791
4792impl fidl::endpoints::ControlHandle for WlanNetworkConfigProviderControlHandle {
4793 fn shutdown(&self) {
4794 self.inner.shutdown()
4795 }
4796
4797 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4798 self.inner.shutdown_with_epitaph(status)
4799 }
4800
4801 fn is_closed(&self) -> bool {
4802 self.inner.channel().is_closed()
4803 }
4804 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4805 self.inner.channel().on_closed()
4806 }
4807
4808 #[cfg(target_os = "fuchsia")]
4809 fn signal_peer(
4810 &self,
4811 clear_mask: zx::Signals,
4812 set_mask: zx::Signals,
4813 ) -> Result<(), zx_status::Status> {
4814 use fidl::Peered;
4815 self.inner.channel().signal_peer(clear_mask, set_mask)
4816 }
4817}
4818
4819impl WlanNetworkConfigProviderControlHandle {}
4820
4821#[must_use = "FIDL methods require a response to be sent"]
4822#[derive(Debug)]
4823pub struct WlanNetworkConfigProviderWatchConnectedNetworkResponder {
4824 control_handle: std::mem::ManuallyDrop<WlanNetworkConfigProviderControlHandle>,
4825 tx_id: u32,
4826}
4827
4828impl std::ops::Drop for WlanNetworkConfigProviderWatchConnectedNetworkResponder {
4832 fn drop(&mut self) {
4833 self.control_handle.shutdown();
4834 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4836 }
4837}
4838
4839impl fidl::endpoints::Responder for WlanNetworkConfigProviderWatchConnectedNetworkResponder {
4840 type ControlHandle = WlanNetworkConfigProviderControlHandle;
4841
4842 fn control_handle(&self) -> &WlanNetworkConfigProviderControlHandle {
4843 &self.control_handle
4844 }
4845
4846 fn drop_without_shutdown(mut self) {
4847 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4849 std::mem::forget(self);
4851 }
4852}
4853
4854impl WlanNetworkConfigProviderWatchConnectedNetworkResponder {
4855 pub fn send(
4859 self,
4860 mut network_config: &fidl_fuchsia_wlan_policy::NetworkConfig,
4861 ) -> Result<(), fidl::Error> {
4862 let _result = self.send_raw(network_config);
4863 if _result.is_err() {
4864 self.control_handle.shutdown();
4865 }
4866 self.drop_without_shutdown();
4867 _result
4868 }
4869
4870 pub fn send_no_shutdown_on_err(
4872 self,
4873 mut network_config: &fidl_fuchsia_wlan_policy::NetworkConfig,
4874 ) -> Result<(), fidl::Error> {
4875 let _result = self.send_raw(network_config);
4876 self.drop_without_shutdown();
4877 _result
4878 }
4879
4880 fn send_raw(
4881 &self,
4882 mut network_config: &fidl_fuchsia_wlan_policy::NetworkConfig,
4883 ) -> Result<(), fidl::Error> {
4884 self.control_handle.inner.send::<WlanNetworkConfigProviderWatchConnectedNetworkResponse>(
4885 (network_config,),
4886 self.tx_id,
4887 0x966c5bf4d6dfce1,
4888 fidl::encoding::DynamicFlags::empty(),
4889 )
4890 }
4891}
4892
4893mod internal {
4894 use super::*;
4895
4896 impl fidl::encoding::ResourceTypeMarker for BootstrapImportWeaveConfigRequest {
4897 type Borrowed<'a> = &'a mut Self;
4898 fn take_or_borrow<'a>(
4899 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4900 ) -> Self::Borrowed<'a> {
4901 value
4902 }
4903 }
4904
4905 unsafe impl fidl::encoding::TypeMarker for BootstrapImportWeaveConfigRequest {
4906 type Owned = Self;
4907
4908 #[inline(always)]
4909 fn inline_align(_context: fidl::encoding::Context) -> usize {
4910 8
4911 }
4912
4913 #[inline(always)]
4914 fn inline_size(_context: fidl::encoding::Context) -> usize {
4915 16
4916 }
4917 }
4918
4919 unsafe impl
4920 fidl::encoding::Encode<
4921 BootstrapImportWeaveConfigRequest,
4922 fidl::encoding::DefaultFuchsiaResourceDialect,
4923 > for &mut BootstrapImportWeaveConfigRequest
4924 {
4925 #[inline]
4926 unsafe fn encode(
4927 self,
4928 encoder: &mut fidl::encoding::Encoder<
4929 '_,
4930 fidl::encoding::DefaultFuchsiaResourceDialect,
4931 >,
4932 offset: usize,
4933 _depth: fidl::encoding::Depth,
4934 ) -> fidl::Result<()> {
4935 encoder.debug_check_bounds::<BootstrapImportWeaveConfigRequest>(offset);
4936 fidl::encoding::Encode::<
4938 BootstrapImportWeaveConfigRequest,
4939 fidl::encoding::DefaultFuchsiaResourceDialect,
4940 >::encode(
4941 (<fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4942 &mut self.config_json,
4943 ),),
4944 encoder,
4945 offset,
4946 _depth,
4947 )
4948 }
4949 }
4950 unsafe impl<
4951 T0: fidl::encoding::Encode<
4952 fidl_fuchsia_mem::Buffer,
4953 fidl::encoding::DefaultFuchsiaResourceDialect,
4954 >,
4955 >
4956 fidl::encoding::Encode<
4957 BootstrapImportWeaveConfigRequest,
4958 fidl::encoding::DefaultFuchsiaResourceDialect,
4959 > for (T0,)
4960 {
4961 #[inline]
4962 unsafe fn encode(
4963 self,
4964 encoder: &mut fidl::encoding::Encoder<
4965 '_,
4966 fidl::encoding::DefaultFuchsiaResourceDialect,
4967 >,
4968 offset: usize,
4969 depth: fidl::encoding::Depth,
4970 ) -> fidl::Result<()> {
4971 encoder.debug_check_bounds::<BootstrapImportWeaveConfigRequest>(offset);
4972 self.0.encode(encoder, offset + 0, depth)?;
4976 Ok(())
4977 }
4978 }
4979
4980 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4981 for BootstrapImportWeaveConfigRequest
4982 {
4983 #[inline(always)]
4984 fn new_empty() -> Self {
4985 Self {
4986 config_json: fidl::new_empty!(
4987 fidl_fuchsia_mem::Buffer,
4988 fidl::encoding::DefaultFuchsiaResourceDialect
4989 ),
4990 }
4991 }
4992
4993 #[inline]
4994 unsafe fn decode(
4995 &mut self,
4996 decoder: &mut fidl::encoding::Decoder<
4997 '_,
4998 fidl::encoding::DefaultFuchsiaResourceDialect,
4999 >,
5000 offset: usize,
5001 _depth: fidl::encoding::Depth,
5002 ) -> fidl::Result<()> {
5003 decoder.debug_check_bounds::<Self>(offset);
5004 fidl::decode!(
5006 fidl_fuchsia_mem::Buffer,
5007 fidl::encoding::DefaultFuchsiaResourceDialect,
5008 &mut self.config_json,
5009 decoder,
5010 offset + 0,
5011 _depth
5012 )?;
5013 Ok(())
5014 }
5015 }
5016
5017 impl fidl::encoding::ResourceTypeMarker for FactoryDataManagerGetWeaveCertificateResponse {
5018 type Borrowed<'a> = &'a mut Self;
5019 fn take_or_borrow<'a>(
5020 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5021 ) -> Self::Borrowed<'a> {
5022 value
5023 }
5024 }
5025
5026 unsafe impl fidl::encoding::TypeMarker for FactoryDataManagerGetWeaveCertificateResponse {
5027 type Owned = Self;
5028
5029 #[inline(always)]
5030 fn inline_align(_context: fidl::encoding::Context) -> usize {
5031 8
5032 }
5033
5034 #[inline(always)]
5035 fn inline_size(_context: fidl::encoding::Context) -> usize {
5036 16
5037 }
5038 }
5039
5040 unsafe impl
5041 fidl::encoding::Encode<
5042 FactoryDataManagerGetWeaveCertificateResponse,
5043 fidl::encoding::DefaultFuchsiaResourceDialect,
5044 > for &mut FactoryDataManagerGetWeaveCertificateResponse
5045 {
5046 #[inline]
5047 unsafe fn encode(
5048 self,
5049 encoder: &mut fidl::encoding::Encoder<
5050 '_,
5051 fidl::encoding::DefaultFuchsiaResourceDialect,
5052 >,
5053 offset: usize,
5054 _depth: fidl::encoding::Depth,
5055 ) -> fidl::Result<()> {
5056 encoder.debug_check_bounds::<FactoryDataManagerGetWeaveCertificateResponse>(offset);
5057 fidl::encoding::Encode::<
5059 FactoryDataManagerGetWeaveCertificateResponse,
5060 fidl::encoding::DefaultFuchsiaResourceDialect,
5061 >::encode(
5062 (<fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
5063 &mut self.certificate,
5064 ),),
5065 encoder,
5066 offset,
5067 _depth,
5068 )
5069 }
5070 }
5071 unsafe impl<
5072 T0: fidl::encoding::Encode<
5073 fidl_fuchsia_mem::Buffer,
5074 fidl::encoding::DefaultFuchsiaResourceDialect,
5075 >,
5076 >
5077 fidl::encoding::Encode<
5078 FactoryDataManagerGetWeaveCertificateResponse,
5079 fidl::encoding::DefaultFuchsiaResourceDialect,
5080 > for (T0,)
5081 {
5082 #[inline]
5083 unsafe fn encode(
5084 self,
5085 encoder: &mut fidl::encoding::Encoder<
5086 '_,
5087 fidl::encoding::DefaultFuchsiaResourceDialect,
5088 >,
5089 offset: usize,
5090 depth: fidl::encoding::Depth,
5091 ) -> fidl::Result<()> {
5092 encoder.debug_check_bounds::<FactoryDataManagerGetWeaveCertificateResponse>(offset);
5093 self.0.encode(encoder, offset + 0, depth)?;
5097 Ok(())
5098 }
5099 }
5100
5101 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5102 for FactoryDataManagerGetWeaveCertificateResponse
5103 {
5104 #[inline(always)]
5105 fn new_empty() -> Self {
5106 Self {
5107 certificate: fidl::new_empty!(
5108 fidl_fuchsia_mem::Buffer,
5109 fidl::encoding::DefaultFuchsiaResourceDialect
5110 ),
5111 }
5112 }
5113
5114 #[inline]
5115 unsafe fn decode(
5116 &mut self,
5117 decoder: &mut fidl::encoding::Decoder<
5118 '_,
5119 fidl::encoding::DefaultFuchsiaResourceDialect,
5120 >,
5121 offset: usize,
5122 _depth: fidl::encoding::Depth,
5123 ) -> fidl::Result<()> {
5124 decoder.debug_check_bounds::<Self>(offset);
5125 fidl::decode!(
5127 fidl_fuchsia_mem::Buffer,
5128 fidl::encoding::DefaultFuchsiaResourceDialect,
5129 &mut self.certificate,
5130 decoder,
5131 offset + 0,
5132 _depth
5133 )?;
5134 Ok(())
5135 }
5136 }
5137
5138 impl fidl::encoding::ResourceTypeMarker for StackGetPairingStateWatcherRequest {
5139 type Borrowed<'a> = &'a mut Self;
5140 fn take_or_borrow<'a>(
5141 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5142 ) -> Self::Borrowed<'a> {
5143 value
5144 }
5145 }
5146
5147 unsafe impl fidl::encoding::TypeMarker for StackGetPairingStateWatcherRequest {
5148 type Owned = Self;
5149
5150 #[inline(always)]
5151 fn inline_align(_context: fidl::encoding::Context) -> usize {
5152 4
5153 }
5154
5155 #[inline(always)]
5156 fn inline_size(_context: fidl::encoding::Context) -> usize {
5157 4
5158 }
5159 }
5160
5161 unsafe impl
5162 fidl::encoding::Encode<
5163 StackGetPairingStateWatcherRequest,
5164 fidl::encoding::DefaultFuchsiaResourceDialect,
5165 > for &mut StackGetPairingStateWatcherRequest
5166 {
5167 #[inline]
5168 unsafe fn encode(
5169 self,
5170 encoder: &mut fidl::encoding::Encoder<
5171 '_,
5172 fidl::encoding::DefaultFuchsiaResourceDialect,
5173 >,
5174 offset: usize,
5175 _depth: fidl::encoding::Depth,
5176 ) -> fidl::Result<()> {
5177 encoder.debug_check_bounds::<StackGetPairingStateWatcherRequest>(offset);
5178 fidl::encoding::Encode::<StackGetPairingStateWatcherRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
5180 (
5181 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PairingStateWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.watcher),
5182 ),
5183 encoder, offset, _depth
5184 )
5185 }
5186 }
5187 unsafe impl<
5188 T0: fidl::encoding::Encode<
5189 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PairingStateWatcherMarker>>,
5190 fidl::encoding::DefaultFuchsiaResourceDialect,
5191 >,
5192 >
5193 fidl::encoding::Encode<
5194 StackGetPairingStateWatcherRequest,
5195 fidl::encoding::DefaultFuchsiaResourceDialect,
5196 > for (T0,)
5197 {
5198 #[inline]
5199 unsafe fn encode(
5200 self,
5201 encoder: &mut fidl::encoding::Encoder<
5202 '_,
5203 fidl::encoding::DefaultFuchsiaResourceDialect,
5204 >,
5205 offset: usize,
5206 depth: fidl::encoding::Depth,
5207 ) -> fidl::Result<()> {
5208 encoder.debug_check_bounds::<StackGetPairingStateWatcherRequest>(offset);
5209 self.0.encode(encoder, offset + 0, depth)?;
5213 Ok(())
5214 }
5215 }
5216
5217 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5218 for StackGetPairingStateWatcherRequest
5219 {
5220 #[inline(always)]
5221 fn new_empty() -> Self {
5222 Self {
5223 watcher: fidl::new_empty!(
5224 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PairingStateWatcherMarker>>,
5225 fidl::encoding::DefaultFuchsiaResourceDialect
5226 ),
5227 }
5228 }
5229
5230 #[inline]
5231 unsafe fn decode(
5232 &mut self,
5233 decoder: &mut fidl::encoding::Decoder<
5234 '_,
5235 fidl::encoding::DefaultFuchsiaResourceDialect,
5236 >,
5237 offset: usize,
5238 _depth: fidl::encoding::Depth,
5239 ) -> fidl::Result<()> {
5240 decoder.debug_check_bounds::<Self>(offset);
5241 fidl::decode!(
5243 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PairingStateWatcherMarker>>,
5244 fidl::encoding::DefaultFuchsiaResourceDialect,
5245 &mut self.watcher,
5246 decoder,
5247 offset + 0,
5248 _depth
5249 )?;
5250 Ok(())
5251 }
5252 }
5253
5254 impl fidl::encoding::ResourceTypeMarker for StackGetSvcDirectoryWatcherRequest {
5255 type Borrowed<'a> = &'a mut Self;
5256 fn take_or_borrow<'a>(
5257 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5258 ) -> Self::Borrowed<'a> {
5259 value
5260 }
5261 }
5262
5263 unsafe impl fidl::encoding::TypeMarker for StackGetSvcDirectoryWatcherRequest {
5264 type Owned = Self;
5265
5266 #[inline(always)]
5267 fn inline_align(_context: fidl::encoding::Context) -> usize {
5268 8
5269 }
5270
5271 #[inline(always)]
5272 fn inline_size(_context: fidl::encoding::Context) -> usize {
5273 16
5274 }
5275 }
5276
5277 unsafe impl
5278 fidl::encoding::Encode<
5279 StackGetSvcDirectoryWatcherRequest,
5280 fidl::encoding::DefaultFuchsiaResourceDialect,
5281 > for &mut StackGetSvcDirectoryWatcherRequest
5282 {
5283 #[inline]
5284 unsafe fn encode(
5285 self,
5286 encoder: &mut fidl::encoding::Encoder<
5287 '_,
5288 fidl::encoding::DefaultFuchsiaResourceDialect,
5289 >,
5290 offset: usize,
5291 _depth: fidl::encoding::Depth,
5292 ) -> fidl::Result<()> {
5293 encoder.debug_check_bounds::<StackGetSvcDirectoryWatcherRequest>(offset);
5294 fidl::encoding::Encode::<StackGetSvcDirectoryWatcherRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
5296 (
5297 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.endpoint_id),
5298 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SvcDirectoryWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.watcher),
5299 ),
5300 encoder, offset, _depth
5301 )
5302 }
5303 }
5304 unsafe impl<
5305 T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
5306 T1: fidl::encoding::Encode<
5307 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SvcDirectoryWatcherMarker>>,
5308 fidl::encoding::DefaultFuchsiaResourceDialect,
5309 >,
5310 >
5311 fidl::encoding::Encode<
5312 StackGetSvcDirectoryWatcherRequest,
5313 fidl::encoding::DefaultFuchsiaResourceDialect,
5314 > for (T0, T1)
5315 {
5316 #[inline]
5317 unsafe fn encode(
5318 self,
5319 encoder: &mut fidl::encoding::Encoder<
5320 '_,
5321 fidl::encoding::DefaultFuchsiaResourceDialect,
5322 >,
5323 offset: usize,
5324 depth: fidl::encoding::Depth,
5325 ) -> fidl::Result<()> {
5326 encoder.debug_check_bounds::<StackGetSvcDirectoryWatcherRequest>(offset);
5327 unsafe {
5330 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
5331 (ptr as *mut u64).write_unaligned(0);
5332 }
5333 self.0.encode(encoder, offset + 0, depth)?;
5335 self.1.encode(encoder, offset + 8, depth)?;
5336 Ok(())
5337 }
5338 }
5339
5340 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5341 for StackGetSvcDirectoryWatcherRequest
5342 {
5343 #[inline(always)]
5344 fn new_empty() -> Self {
5345 Self {
5346 endpoint_id: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
5347 watcher: fidl::new_empty!(
5348 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SvcDirectoryWatcherMarker>>,
5349 fidl::encoding::DefaultFuchsiaResourceDialect
5350 ),
5351 }
5352 }
5353
5354 #[inline]
5355 unsafe fn decode(
5356 &mut self,
5357 decoder: &mut fidl::encoding::Decoder<
5358 '_,
5359 fidl::encoding::DefaultFuchsiaResourceDialect,
5360 >,
5361 offset: usize,
5362 _depth: fidl::encoding::Depth,
5363 ) -> fidl::Result<()> {
5364 decoder.debug_check_bounds::<Self>(offset);
5365 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
5367 let padval = unsafe { (ptr as *const u64).read_unaligned() };
5368 let mask = 0xffffffff00000000u64;
5369 let maskedval = padval & mask;
5370 if maskedval != 0 {
5371 return Err(fidl::Error::NonZeroPadding {
5372 padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
5373 });
5374 }
5375 fidl::decode!(
5376 u64,
5377 fidl::encoding::DefaultFuchsiaResourceDialect,
5378 &mut self.endpoint_id,
5379 decoder,
5380 offset + 0,
5381 _depth
5382 )?;
5383 fidl::decode!(
5384 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SvcDirectoryWatcherMarker>>,
5385 fidl::encoding::DefaultFuchsiaResourceDialect,
5386 &mut self.watcher,
5387 decoder,
5388 offset + 8,
5389 _depth
5390 )?;
5391 Ok(())
5392 }
5393 }
5394
5395 impl fidl::encoding::ResourceTypeMarker for StackProviderSetWlanNetworkConfigProviderRequest {
5396 type Borrowed<'a> = &'a mut Self;
5397 fn take_or_borrow<'a>(
5398 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5399 ) -> Self::Borrowed<'a> {
5400 value
5401 }
5402 }
5403
5404 unsafe impl fidl::encoding::TypeMarker for StackProviderSetWlanNetworkConfigProviderRequest {
5405 type Owned = Self;
5406
5407 #[inline(always)]
5408 fn inline_align(_context: fidl::encoding::Context) -> usize {
5409 4
5410 }
5411
5412 #[inline(always)]
5413 fn inline_size(_context: fidl::encoding::Context) -> usize {
5414 4
5415 }
5416 }
5417
5418 unsafe impl
5419 fidl::encoding::Encode<
5420 StackProviderSetWlanNetworkConfigProviderRequest,
5421 fidl::encoding::DefaultFuchsiaResourceDialect,
5422 > for &mut StackProviderSetWlanNetworkConfigProviderRequest
5423 {
5424 #[inline]
5425 unsafe fn encode(
5426 self,
5427 encoder: &mut fidl::encoding::Encoder<
5428 '_,
5429 fidl::encoding::DefaultFuchsiaResourceDialect,
5430 >,
5431 offset: usize,
5432 _depth: fidl::encoding::Depth,
5433 ) -> fidl::Result<()> {
5434 encoder.debug_check_bounds::<StackProviderSetWlanNetworkConfigProviderRequest>(offset);
5435 fidl::encoding::Encode::<
5437 StackProviderSetWlanNetworkConfigProviderRequest,
5438 fidl::encoding::DefaultFuchsiaResourceDialect,
5439 >::encode(
5440 (<fidl::encoding::Endpoint<
5441 fidl::endpoints::ClientEnd<WlanNetworkConfigProviderMarker>,
5442 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
5443 &mut self.provider
5444 ),),
5445 encoder,
5446 offset,
5447 _depth,
5448 )
5449 }
5450 }
5451 unsafe impl<
5452 T0: fidl::encoding::Encode<
5453 fidl::encoding::Endpoint<
5454 fidl::endpoints::ClientEnd<WlanNetworkConfigProviderMarker>,
5455 >,
5456 fidl::encoding::DefaultFuchsiaResourceDialect,
5457 >,
5458 >
5459 fidl::encoding::Encode<
5460 StackProviderSetWlanNetworkConfigProviderRequest,
5461 fidl::encoding::DefaultFuchsiaResourceDialect,
5462 > for (T0,)
5463 {
5464 #[inline]
5465 unsafe fn encode(
5466 self,
5467 encoder: &mut fidl::encoding::Encoder<
5468 '_,
5469 fidl::encoding::DefaultFuchsiaResourceDialect,
5470 >,
5471 offset: usize,
5472 depth: fidl::encoding::Depth,
5473 ) -> fidl::Result<()> {
5474 encoder.debug_check_bounds::<StackProviderSetWlanNetworkConfigProviderRequest>(offset);
5475 self.0.encode(encoder, offset + 0, depth)?;
5479 Ok(())
5480 }
5481 }
5482
5483 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5484 for StackProviderSetWlanNetworkConfigProviderRequest
5485 {
5486 #[inline(always)]
5487 fn new_empty() -> Self {
5488 Self {
5489 provider: fidl::new_empty!(
5490 fidl::encoding::Endpoint<
5491 fidl::endpoints::ClientEnd<WlanNetworkConfigProviderMarker>,
5492 >,
5493 fidl::encoding::DefaultFuchsiaResourceDialect
5494 ),
5495 }
5496 }
5497
5498 #[inline]
5499 unsafe fn decode(
5500 &mut self,
5501 decoder: &mut fidl::encoding::Decoder<
5502 '_,
5503 fidl::encoding::DefaultFuchsiaResourceDialect,
5504 >,
5505 offset: usize,
5506 _depth: fidl::encoding::Depth,
5507 ) -> fidl::Result<()> {
5508 decoder.debug_check_bounds::<Self>(offset);
5509 fidl::decode!(
5511 fidl::encoding::Endpoint<
5512 fidl::endpoints::ClientEnd<WlanNetworkConfigProviderMarker>,
5513 >,
5514 fidl::encoding::DefaultFuchsiaResourceDialect,
5515 &mut self.provider,
5516 decoder,
5517 offset + 0,
5518 _depth
5519 )?;
5520 Ok(())
5521 }
5522 }
5523}