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 _};
10use futures::future::{self, MaybeDone, TryFutureExt};
11use zx_status;
12
13pub type PrivateKey = Vec<u8>;
18
19pub type ServiceEndpointId = u64;
22
23pub const MAX_HOST_PORTS: u32 = 256;
26
27pub const MAX_PUBLIC_KEY_SIZE: u32 = 65;
29
30pub const MAX_QR_CODE_SIZE: u32 = 256;
32
33pub const MAX_SIGNATURE_SIZE: u32 = 139;
41
42pub const RESET_CONFIG_ALL: u16 = 255;
44
45bitflags! {
46 #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
48 pub struct ResetConfigFlags: u16 {
49 const NETWORK_CONFIG = 1;
51 const FABRIC_CONFIG = 2;
53 const SERVICE_CONFIG = 4;
55 const OPERATIONAL_CREDENTIALS = 8;
57 }
58}
59
60impl ResetConfigFlags {
61 #[deprecated = "Strict bits should not use `has_unknown_bits`"]
62 #[inline(always)]
63 pub fn has_unknown_bits(&self) -> bool {
64 false
65 }
66
67 #[deprecated = "Strict bits should not use `get_unknown_bits`"]
68 #[inline(always)]
69 pub fn get_unknown_bits(&self) -> u16 {
70 0
71 }
72}
73
74#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
75#[repr(u32)]
76pub enum ErrorCode {
77 FileNotFound = 1,
79 CryptoError = 2,
81 InvalidArgument = 3,
83 InvalidState = 4,
85 UnspecifiedError = 2147483647,
87}
88
89impl ErrorCode {
90 #[inline]
91 pub fn from_primitive(prim: u32) -> Option<Self> {
92 match prim {
93 1 => Some(Self::FileNotFound),
94 2 => Some(Self::CryptoError),
95 3 => Some(Self::InvalidArgument),
96 4 => Some(Self::InvalidState),
97 2147483647 => Some(Self::UnspecifiedError),
98 _ => None,
99 }
100 }
101
102 #[inline]
103 pub const fn into_primitive(self) -> u32 {
104 self as u32
105 }
106
107 #[deprecated = "Strict enums should not use `is_unknown`"]
108 #[inline]
109 pub fn is_unknown(&self) -> bool {
110 false
111 }
112}
113
114#[derive(Debug, PartialEq)]
115pub struct BootstrapImportWeaveConfigRequest {
116 pub config_json: fidl_fuchsia_mem::Buffer,
117}
118
119impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
120 for BootstrapImportWeaveConfigRequest
121{
122}
123
124#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
125pub struct FactoryDataManagerGetPairingCodeResponse {
126 pub pairing_code: Vec<u8>,
127}
128
129impl fidl::Persistable for FactoryDataManagerGetPairingCodeResponse {}
130
131#[derive(Debug, PartialEq)]
132pub struct FactoryDataManagerGetWeaveCertificateResponse {
133 pub certificate: fidl_fuchsia_mem::Buffer,
134}
135
136impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
137 for FactoryDataManagerGetWeaveCertificateResponse
138{
139}
140
141#[derive(Clone, Debug, PartialEq)]
143pub struct HostPort {
144 pub host: Host,
145 pub port: u16,
146}
147
148impl fidl::Persistable for HostPort {}
149
150#[derive(Clone, Debug, PartialEq)]
151pub struct PairingStateWatcherWatchPairingStateResponse {
152 pub state: PairingState,
153}
154
155impl fidl::Persistable for PairingStateWatcherWatchPairingStateResponse {}
156
157#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
158pub struct ProvisionerGenerateKeyPairResponse {
159 pub wrapped_private_key: Vec<u8>,
160 pub public_key: Vec<u8>,
161}
162
163impl fidl::Persistable for ProvisionerGenerateKeyPairResponse {}
164
165#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
167pub struct QrCode {
168 pub data: String,
171}
172
173impl fidl::Persistable for QrCode {}
174
175#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
176pub struct SignerSignHashRequest {
177 pub hash: Vec<u8>,
178}
179
180impl fidl::Persistable for SignerSignHashRequest {}
181
182#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
183pub struct SignerSignHashWithPrivateKeyRequest {
184 pub hash: Vec<u8>,
185 pub wrapped_private_key: Vec<u8>,
186}
187
188impl fidl::Persistable for SignerSignHashWithPrivateKeyRequest {}
189
190#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
191pub struct SignerSignHashWithPrivateKeyResponse {
192 pub signature: Vec<u8>,
193}
194
195impl fidl::Persistable for SignerSignHashWithPrivateKeyResponse {}
196
197#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
198pub struct SignerSignHashResponse {
199 pub signature: Vec<u8>,
200}
201
202impl fidl::Persistable for SignerSignHashResponse {}
203
204#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
205pub struct StackGetPairingStateWatcherRequest {
206 pub watcher: fidl::endpoints::ServerEnd<PairingStateWatcherMarker>,
207}
208
209impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
210 for StackGetPairingStateWatcherRequest
211{
212}
213
214#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
215pub struct StackGetSvcDirectoryWatcherRequest {
216 pub endpoint_id: u64,
217 pub watcher: fidl::endpoints::ServerEnd<SvcDirectoryWatcherMarker>,
218}
219
220impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
221 for StackGetSvcDirectoryWatcherRequest
222{
223}
224
225#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
226pub struct StackProviderSetWlanNetworkConfigProviderRequest {
227 pub provider: fidl::endpoints::ClientEnd<WlanNetworkConfigProviderMarker>,
228}
229
230impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
231 for StackProviderSetWlanNetworkConfigProviderRequest
232{
233}
234
235#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
236pub struct StackResetConfigRequest {
237 pub flags: ResetConfigFlags,
238}
239
240impl fidl::Persistable for StackResetConfigRequest {}
241
242#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
243pub struct StackGetQrCodeResponse {
244 pub qr_code: QrCode,
245}
246
247impl fidl::Persistable for StackGetQrCodeResponse {}
248
249#[derive(Clone, Debug, PartialEq)]
250pub struct SvcDirectoryWatcherWatchServiceDirectoryResponse {
251 pub host_port_list: Vec<HostPort>,
252}
253
254impl fidl::Persistable for SvcDirectoryWatcherWatchServiceDirectoryResponse {}
255
256#[derive(Clone, Debug, PartialEq)]
257pub struct WlanNetworkConfigProviderWatchConnectedNetworkResponse {
258 pub network_config: fidl_fuchsia_wlan_policy::NetworkConfig,
259}
260
261impl fidl::Persistable for WlanNetworkConfigProviderWatchConnectedNetworkResponse {}
262
263#[derive(Clone, Debug, Default, PartialEq)]
268pub struct PairingState {
269 pub is_weave_fully_provisioned: Option<bool>,
272 pub is_wlan_provisioned: Option<bool>,
274 pub is_thread_provisioned: Option<bool>,
276 pub is_fabric_provisioned: Option<bool>,
278 pub is_service_provisioned: Option<bool>,
280 #[doc(hidden)]
281 pub __source_breaking: fidl::marker::SourceBreaking,
282}
283
284impl fidl::Persistable for PairingState {}
285
286#[derive(Clone, Debug, PartialEq)]
288pub enum Host {
289 Hostname(String),
290 IpAddress(fidl_fuchsia_net::IpAddress),
291}
292
293impl Host {
294 #[inline]
295 pub fn ordinal(&self) -> u64 {
296 match *self {
297 Self::Hostname(_) => 1,
298 Self::IpAddress(_) => 2,
299 }
300 }
301
302 #[deprecated = "Strict unions should not use `is_unknown`"]
303 #[inline]
304 pub fn is_unknown(&self) -> bool {
305 false
306 }
307}
308
309impl fidl::Persistable for Host {}
310
311#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
312pub struct BootstrapMarker;
313
314impl fidl::endpoints::ProtocolMarker for BootstrapMarker {
315 type Proxy = BootstrapProxy;
316 type RequestStream = BootstrapRequestStream;
317 #[cfg(target_os = "fuchsia")]
318 type SynchronousProxy = BootstrapSynchronousProxy;
319
320 const DEBUG_NAME: &'static str = "fuchsia.weave.Bootstrap";
321}
322impl fidl::endpoints::DiscoverableProtocolMarker for BootstrapMarker {}
323pub type BootstrapImportWeaveConfigResult = Result<(), i32>;
324
325pub trait BootstrapProxyInterface: Send + Sync {
326 type ImportWeaveConfigResponseFut: std::future::Future<Output = Result<BootstrapImportWeaveConfigResult, fidl::Error>>
327 + Send;
328 fn r#import_weave_config(
329 &self,
330 config_json: fidl_fuchsia_mem::Buffer,
331 ) -> Self::ImportWeaveConfigResponseFut;
332}
333#[derive(Debug)]
334#[cfg(target_os = "fuchsia")]
335pub struct BootstrapSynchronousProxy {
336 client: fidl::client::sync::Client,
337}
338
339#[cfg(target_os = "fuchsia")]
340impl fidl::endpoints::SynchronousProxy for BootstrapSynchronousProxy {
341 type Proxy = BootstrapProxy;
342 type Protocol = BootstrapMarker;
343
344 fn from_channel(inner: fidl::Channel) -> Self {
345 Self::new(inner)
346 }
347
348 fn into_channel(self) -> fidl::Channel {
349 self.client.into_channel()
350 }
351
352 fn as_channel(&self) -> &fidl::Channel {
353 self.client.as_channel()
354 }
355}
356
357#[cfg(target_os = "fuchsia")]
358impl BootstrapSynchronousProxy {
359 pub fn new(channel: fidl::Channel) -> Self {
360 let protocol_name = <BootstrapMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
361 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
362 }
363
364 pub fn into_channel(self) -> fidl::Channel {
365 self.client.into_channel()
366 }
367
368 pub fn wait_for_event(
371 &self,
372 deadline: zx::MonotonicInstant,
373 ) -> Result<BootstrapEvent, fidl::Error> {
374 BootstrapEvent::decode(self.client.wait_for_event(deadline)?)
375 }
376
377 pub fn r#import_weave_config(
384 &self,
385 mut config_json: fidl_fuchsia_mem::Buffer,
386 ___deadline: zx::MonotonicInstant,
387 ) -> Result<BootstrapImportWeaveConfigResult, fidl::Error> {
388 let _response = self.client.send_query::<
389 BootstrapImportWeaveConfigRequest,
390 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
391 >(
392 (&mut config_json,),
393 0x3cba680ade22f738,
394 fidl::encoding::DynamicFlags::empty(),
395 ___deadline,
396 )?;
397 Ok(_response.map(|x| x))
398 }
399}
400
401#[derive(Debug, Clone)]
402pub struct BootstrapProxy {
403 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
404}
405
406impl fidl::endpoints::Proxy for BootstrapProxy {
407 type Protocol = BootstrapMarker;
408
409 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
410 Self::new(inner)
411 }
412
413 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
414 self.client.into_channel().map_err(|client| Self { client })
415 }
416
417 fn as_channel(&self) -> &::fidl::AsyncChannel {
418 self.client.as_channel()
419 }
420}
421
422impl BootstrapProxy {
423 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
425 let protocol_name = <BootstrapMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
426 Self { client: fidl::client::Client::new(channel, protocol_name) }
427 }
428
429 pub fn take_event_stream(&self) -> BootstrapEventStream {
435 BootstrapEventStream { event_receiver: self.client.take_event_receiver() }
436 }
437
438 pub fn r#import_weave_config(
445 &self,
446 mut config_json: fidl_fuchsia_mem::Buffer,
447 ) -> fidl::client::QueryResponseFut<
448 BootstrapImportWeaveConfigResult,
449 fidl::encoding::DefaultFuchsiaResourceDialect,
450 > {
451 BootstrapProxyInterface::r#import_weave_config(self, config_json)
452 }
453}
454
455impl BootstrapProxyInterface for BootstrapProxy {
456 type ImportWeaveConfigResponseFut = fidl::client::QueryResponseFut<
457 BootstrapImportWeaveConfigResult,
458 fidl::encoding::DefaultFuchsiaResourceDialect,
459 >;
460 fn r#import_weave_config(
461 &self,
462 mut config_json: fidl_fuchsia_mem::Buffer,
463 ) -> Self::ImportWeaveConfigResponseFut {
464 fn _decode(
465 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
466 ) -> Result<BootstrapImportWeaveConfigResult, fidl::Error> {
467 let _response = fidl::client::decode_transaction_body::<
468 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
469 fidl::encoding::DefaultFuchsiaResourceDialect,
470 0x3cba680ade22f738,
471 >(_buf?)?;
472 Ok(_response.map(|x| x))
473 }
474 self.client.send_query_and_decode::<
475 BootstrapImportWeaveConfigRequest,
476 BootstrapImportWeaveConfigResult,
477 >(
478 (&mut config_json,),
479 0x3cba680ade22f738,
480 fidl::encoding::DynamicFlags::empty(),
481 _decode,
482 )
483 }
484}
485
486pub struct BootstrapEventStream {
487 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
488}
489
490impl std::marker::Unpin for BootstrapEventStream {}
491
492impl futures::stream::FusedStream for BootstrapEventStream {
493 fn is_terminated(&self) -> bool {
494 self.event_receiver.is_terminated()
495 }
496}
497
498impl futures::Stream for BootstrapEventStream {
499 type Item = Result<BootstrapEvent, fidl::Error>;
500
501 fn poll_next(
502 mut self: std::pin::Pin<&mut Self>,
503 cx: &mut std::task::Context<'_>,
504 ) -> std::task::Poll<Option<Self::Item>> {
505 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
506 &mut self.event_receiver,
507 cx
508 )?) {
509 Some(buf) => std::task::Poll::Ready(Some(BootstrapEvent::decode(buf))),
510 None => std::task::Poll::Ready(None),
511 }
512 }
513}
514
515#[derive(Debug)]
516pub enum BootstrapEvent {}
517
518impl BootstrapEvent {
519 fn decode(
521 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
522 ) -> Result<BootstrapEvent, fidl::Error> {
523 let (bytes, _handles) = buf.split_mut();
524 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
525 debug_assert_eq!(tx_header.tx_id, 0);
526 match tx_header.ordinal {
527 _ => Err(fidl::Error::UnknownOrdinal {
528 ordinal: tx_header.ordinal,
529 protocol_name: <BootstrapMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
530 }),
531 }
532 }
533}
534
535pub struct BootstrapRequestStream {
537 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
538 is_terminated: bool,
539}
540
541impl std::marker::Unpin for BootstrapRequestStream {}
542
543impl futures::stream::FusedStream for BootstrapRequestStream {
544 fn is_terminated(&self) -> bool {
545 self.is_terminated
546 }
547}
548
549impl fidl::endpoints::RequestStream for BootstrapRequestStream {
550 type Protocol = BootstrapMarker;
551 type ControlHandle = BootstrapControlHandle;
552
553 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
554 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
555 }
556
557 fn control_handle(&self) -> Self::ControlHandle {
558 BootstrapControlHandle { inner: self.inner.clone() }
559 }
560
561 fn into_inner(
562 self,
563 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
564 {
565 (self.inner, self.is_terminated)
566 }
567
568 fn from_inner(
569 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
570 is_terminated: bool,
571 ) -> Self {
572 Self { inner, is_terminated }
573 }
574}
575
576impl futures::Stream for BootstrapRequestStream {
577 type Item = Result<BootstrapRequest, fidl::Error>;
578
579 fn poll_next(
580 mut self: std::pin::Pin<&mut Self>,
581 cx: &mut std::task::Context<'_>,
582 ) -> std::task::Poll<Option<Self::Item>> {
583 let this = &mut *self;
584 if this.inner.check_shutdown(cx) {
585 this.is_terminated = true;
586 return std::task::Poll::Ready(None);
587 }
588 if this.is_terminated {
589 panic!("polled BootstrapRequestStream after completion");
590 }
591 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
592 |bytes, handles| {
593 match this.inner.channel().read_etc(cx, bytes, handles) {
594 std::task::Poll::Ready(Ok(())) => {}
595 std::task::Poll::Pending => return std::task::Poll::Pending,
596 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
597 this.is_terminated = true;
598 return std::task::Poll::Ready(None);
599 }
600 std::task::Poll::Ready(Err(e)) => {
601 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
602 e.into(),
603 ))))
604 }
605 }
606
607 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
609
610 std::task::Poll::Ready(Some(match header.ordinal {
611 0x3cba680ade22f738 => {
612 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
613 let mut req = fidl::new_empty!(
614 BootstrapImportWeaveConfigRequest,
615 fidl::encoding::DefaultFuchsiaResourceDialect
616 );
617 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BootstrapImportWeaveConfigRequest>(&header, _body_bytes, handles, &mut req)?;
618 let control_handle = BootstrapControlHandle { inner: this.inner.clone() };
619 Ok(BootstrapRequest::ImportWeaveConfig {
620 config_json: req.config_json,
621
622 responder: BootstrapImportWeaveConfigResponder {
623 control_handle: std::mem::ManuallyDrop::new(control_handle),
624 tx_id: header.tx_id,
625 },
626 })
627 }
628 _ => Err(fidl::Error::UnknownOrdinal {
629 ordinal: header.ordinal,
630 protocol_name:
631 <BootstrapMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
632 }),
633 }))
634 },
635 )
636 }
637}
638
639#[derive(Debug)]
643pub enum BootstrapRequest {
644 ImportWeaveConfig {
651 config_json: fidl_fuchsia_mem::Buffer,
652 responder: BootstrapImportWeaveConfigResponder,
653 },
654}
655
656impl BootstrapRequest {
657 #[allow(irrefutable_let_patterns)]
658 pub fn into_import_weave_config(
659 self,
660 ) -> Option<(fidl_fuchsia_mem::Buffer, BootstrapImportWeaveConfigResponder)> {
661 if let BootstrapRequest::ImportWeaveConfig { config_json, responder } = self {
662 Some((config_json, responder))
663 } else {
664 None
665 }
666 }
667
668 pub fn method_name(&self) -> &'static str {
670 match *self {
671 BootstrapRequest::ImportWeaveConfig { .. } => "import_weave_config",
672 }
673 }
674}
675
676#[derive(Debug, Clone)]
677pub struct BootstrapControlHandle {
678 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
679}
680
681impl fidl::endpoints::ControlHandle for BootstrapControlHandle {
682 fn shutdown(&self) {
683 self.inner.shutdown()
684 }
685 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
686 self.inner.shutdown_with_epitaph(status)
687 }
688
689 fn is_closed(&self) -> bool {
690 self.inner.channel().is_closed()
691 }
692 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
693 self.inner.channel().on_closed()
694 }
695
696 #[cfg(target_os = "fuchsia")]
697 fn signal_peer(
698 &self,
699 clear_mask: zx::Signals,
700 set_mask: zx::Signals,
701 ) -> Result<(), zx_status::Status> {
702 use fidl::Peered;
703 self.inner.channel().signal_peer(clear_mask, set_mask)
704 }
705}
706
707impl BootstrapControlHandle {}
708
709#[must_use = "FIDL methods require a response to be sent"]
710#[derive(Debug)]
711pub struct BootstrapImportWeaveConfigResponder {
712 control_handle: std::mem::ManuallyDrop<BootstrapControlHandle>,
713 tx_id: u32,
714}
715
716impl std::ops::Drop for BootstrapImportWeaveConfigResponder {
720 fn drop(&mut self) {
721 self.control_handle.shutdown();
722 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
724 }
725}
726
727impl fidl::endpoints::Responder for BootstrapImportWeaveConfigResponder {
728 type ControlHandle = BootstrapControlHandle;
729
730 fn control_handle(&self) -> &BootstrapControlHandle {
731 &self.control_handle
732 }
733
734 fn drop_without_shutdown(mut self) {
735 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
737 std::mem::forget(self);
739 }
740}
741
742impl BootstrapImportWeaveConfigResponder {
743 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
747 let _result = self.send_raw(result);
748 if _result.is_err() {
749 self.control_handle.shutdown();
750 }
751 self.drop_without_shutdown();
752 _result
753 }
754
755 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
757 let _result = self.send_raw(result);
758 self.drop_without_shutdown();
759 _result
760 }
761
762 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
763 self.control_handle
764 .inner
765 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
766 result,
767 self.tx_id,
768 0x3cba680ade22f738,
769 fidl::encoding::DynamicFlags::empty(),
770 )
771 }
772}
773
774#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
775pub struct FactoryDataManagerMarker;
776
777impl fidl::endpoints::ProtocolMarker for FactoryDataManagerMarker {
778 type Proxy = FactoryDataManagerProxy;
779 type RequestStream = FactoryDataManagerRequestStream;
780 #[cfg(target_os = "fuchsia")]
781 type SynchronousProxy = FactoryDataManagerSynchronousProxy;
782
783 const DEBUG_NAME: &'static str = "fuchsia.weave.FactoryDataManager";
784}
785impl fidl::endpoints::DiscoverableProtocolMarker for FactoryDataManagerMarker {}
786pub type FactoryDataManagerGetPairingCodeResult = Result<Vec<u8>, ErrorCode>;
787pub type FactoryDataManagerGetWeaveCertificateResult = Result<fidl_fuchsia_mem::Buffer, ErrorCode>;
788
789pub trait FactoryDataManagerProxyInterface: Send + Sync {
790 type GetPairingCodeResponseFut: std::future::Future<Output = Result<FactoryDataManagerGetPairingCodeResult, fidl::Error>>
791 + Send;
792 fn r#get_pairing_code(&self) -> Self::GetPairingCodeResponseFut;
793 type GetWeaveCertificateResponseFut: std::future::Future<
794 Output = Result<FactoryDataManagerGetWeaveCertificateResult, fidl::Error>,
795 > + Send;
796 fn r#get_weave_certificate(&self) -> Self::GetWeaveCertificateResponseFut;
797}
798#[derive(Debug)]
799#[cfg(target_os = "fuchsia")]
800pub struct FactoryDataManagerSynchronousProxy {
801 client: fidl::client::sync::Client,
802}
803
804#[cfg(target_os = "fuchsia")]
805impl fidl::endpoints::SynchronousProxy for FactoryDataManagerSynchronousProxy {
806 type Proxy = FactoryDataManagerProxy;
807 type Protocol = FactoryDataManagerMarker;
808
809 fn from_channel(inner: fidl::Channel) -> Self {
810 Self::new(inner)
811 }
812
813 fn into_channel(self) -> fidl::Channel {
814 self.client.into_channel()
815 }
816
817 fn as_channel(&self) -> &fidl::Channel {
818 self.client.as_channel()
819 }
820}
821
822#[cfg(target_os = "fuchsia")]
823impl FactoryDataManagerSynchronousProxy {
824 pub fn new(channel: fidl::Channel) -> Self {
825 let protocol_name =
826 <FactoryDataManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
827 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
828 }
829
830 pub fn into_channel(self) -> fidl::Channel {
831 self.client.into_channel()
832 }
833
834 pub fn wait_for_event(
837 &self,
838 deadline: zx::MonotonicInstant,
839 ) -> Result<FactoryDataManagerEvent, fidl::Error> {
840 FactoryDataManagerEvent::decode(self.client.wait_for_event(deadline)?)
841 }
842
843 pub fn r#get_pairing_code(
845 &self,
846 ___deadline: zx::MonotonicInstant,
847 ) -> Result<FactoryDataManagerGetPairingCodeResult, fidl::Error> {
848 let _response =
849 self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
850 FactoryDataManagerGetPairingCodeResponse,
851 ErrorCode,
852 >>(
853 (),
854 0x75630bcd80418a0f,
855 fidl::encoding::DynamicFlags::empty(),
856 ___deadline,
857 )?;
858 Ok(_response.map(|x| x.pairing_code))
859 }
860
861 pub fn r#get_weave_certificate(
863 &self,
864 ___deadline: zx::MonotonicInstant,
865 ) -> Result<FactoryDataManagerGetWeaveCertificateResult, fidl::Error> {
866 let _response =
867 self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
868 FactoryDataManagerGetWeaveCertificateResponse,
869 ErrorCode,
870 >>(
871 (),
872 0x1b4feca8bc141380,
873 fidl::encoding::DynamicFlags::empty(),
874 ___deadline,
875 )?;
876 Ok(_response.map(|x| x.certificate))
877 }
878}
879
880#[derive(Debug, Clone)]
881pub struct FactoryDataManagerProxy {
882 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
883}
884
885impl fidl::endpoints::Proxy for FactoryDataManagerProxy {
886 type Protocol = FactoryDataManagerMarker;
887
888 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
889 Self::new(inner)
890 }
891
892 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
893 self.client.into_channel().map_err(|client| Self { client })
894 }
895
896 fn as_channel(&self) -> &::fidl::AsyncChannel {
897 self.client.as_channel()
898 }
899}
900
901impl FactoryDataManagerProxy {
902 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
904 let protocol_name =
905 <FactoryDataManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
906 Self { client: fidl::client::Client::new(channel, protocol_name) }
907 }
908
909 pub fn take_event_stream(&self) -> FactoryDataManagerEventStream {
915 FactoryDataManagerEventStream { event_receiver: self.client.take_event_receiver() }
916 }
917
918 pub fn r#get_pairing_code(
920 &self,
921 ) -> fidl::client::QueryResponseFut<
922 FactoryDataManagerGetPairingCodeResult,
923 fidl::encoding::DefaultFuchsiaResourceDialect,
924 > {
925 FactoryDataManagerProxyInterface::r#get_pairing_code(self)
926 }
927
928 pub fn r#get_weave_certificate(
930 &self,
931 ) -> fidl::client::QueryResponseFut<
932 FactoryDataManagerGetWeaveCertificateResult,
933 fidl::encoding::DefaultFuchsiaResourceDialect,
934 > {
935 FactoryDataManagerProxyInterface::r#get_weave_certificate(self)
936 }
937}
938
939impl FactoryDataManagerProxyInterface for FactoryDataManagerProxy {
940 type GetPairingCodeResponseFut = fidl::client::QueryResponseFut<
941 FactoryDataManagerGetPairingCodeResult,
942 fidl::encoding::DefaultFuchsiaResourceDialect,
943 >;
944 fn r#get_pairing_code(&self) -> Self::GetPairingCodeResponseFut {
945 fn _decode(
946 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
947 ) -> Result<FactoryDataManagerGetPairingCodeResult, fidl::Error> {
948 let _response = fidl::client::decode_transaction_body::<
949 fidl::encoding::ResultType<FactoryDataManagerGetPairingCodeResponse, ErrorCode>,
950 fidl::encoding::DefaultFuchsiaResourceDialect,
951 0x75630bcd80418a0f,
952 >(_buf?)?;
953 Ok(_response.map(|x| x.pairing_code))
954 }
955 self.client.send_query_and_decode::<
956 fidl::encoding::EmptyPayload,
957 FactoryDataManagerGetPairingCodeResult,
958 >(
959 (),
960 0x75630bcd80418a0f,
961 fidl::encoding::DynamicFlags::empty(),
962 _decode,
963 )
964 }
965
966 type GetWeaveCertificateResponseFut = fidl::client::QueryResponseFut<
967 FactoryDataManagerGetWeaveCertificateResult,
968 fidl::encoding::DefaultFuchsiaResourceDialect,
969 >;
970 fn r#get_weave_certificate(&self) -> Self::GetWeaveCertificateResponseFut {
971 fn _decode(
972 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
973 ) -> Result<FactoryDataManagerGetWeaveCertificateResult, fidl::Error> {
974 let _response = fidl::client::decode_transaction_body::<
975 fidl::encoding::ResultType<
976 FactoryDataManagerGetWeaveCertificateResponse,
977 ErrorCode,
978 >,
979 fidl::encoding::DefaultFuchsiaResourceDialect,
980 0x1b4feca8bc141380,
981 >(_buf?)?;
982 Ok(_response.map(|x| x.certificate))
983 }
984 self.client.send_query_and_decode::<
985 fidl::encoding::EmptyPayload,
986 FactoryDataManagerGetWeaveCertificateResult,
987 >(
988 (),
989 0x1b4feca8bc141380,
990 fidl::encoding::DynamicFlags::empty(),
991 _decode,
992 )
993 }
994}
995
996pub struct FactoryDataManagerEventStream {
997 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
998}
999
1000impl std::marker::Unpin for FactoryDataManagerEventStream {}
1001
1002impl futures::stream::FusedStream for FactoryDataManagerEventStream {
1003 fn is_terminated(&self) -> bool {
1004 self.event_receiver.is_terminated()
1005 }
1006}
1007
1008impl futures::Stream for FactoryDataManagerEventStream {
1009 type Item = Result<FactoryDataManagerEvent, fidl::Error>;
1010
1011 fn poll_next(
1012 mut self: std::pin::Pin<&mut Self>,
1013 cx: &mut std::task::Context<'_>,
1014 ) -> std::task::Poll<Option<Self::Item>> {
1015 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1016 &mut self.event_receiver,
1017 cx
1018 )?) {
1019 Some(buf) => std::task::Poll::Ready(Some(FactoryDataManagerEvent::decode(buf))),
1020 None => std::task::Poll::Ready(None),
1021 }
1022 }
1023}
1024
1025#[derive(Debug)]
1026pub enum FactoryDataManagerEvent {}
1027
1028impl FactoryDataManagerEvent {
1029 fn decode(
1031 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1032 ) -> Result<FactoryDataManagerEvent, fidl::Error> {
1033 let (bytes, _handles) = buf.split_mut();
1034 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1035 debug_assert_eq!(tx_header.tx_id, 0);
1036 match tx_header.ordinal {
1037 _ => Err(fidl::Error::UnknownOrdinal {
1038 ordinal: tx_header.ordinal,
1039 protocol_name:
1040 <FactoryDataManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1041 }),
1042 }
1043 }
1044}
1045
1046pub struct FactoryDataManagerRequestStream {
1048 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1049 is_terminated: bool,
1050}
1051
1052impl std::marker::Unpin for FactoryDataManagerRequestStream {}
1053
1054impl futures::stream::FusedStream for FactoryDataManagerRequestStream {
1055 fn is_terminated(&self) -> bool {
1056 self.is_terminated
1057 }
1058}
1059
1060impl fidl::endpoints::RequestStream for FactoryDataManagerRequestStream {
1061 type Protocol = FactoryDataManagerMarker;
1062 type ControlHandle = FactoryDataManagerControlHandle;
1063
1064 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1065 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1066 }
1067
1068 fn control_handle(&self) -> Self::ControlHandle {
1069 FactoryDataManagerControlHandle { inner: self.inner.clone() }
1070 }
1071
1072 fn into_inner(
1073 self,
1074 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1075 {
1076 (self.inner, self.is_terminated)
1077 }
1078
1079 fn from_inner(
1080 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1081 is_terminated: bool,
1082 ) -> Self {
1083 Self { inner, is_terminated }
1084 }
1085}
1086
1087impl futures::Stream for FactoryDataManagerRequestStream {
1088 type Item = Result<FactoryDataManagerRequest, fidl::Error>;
1089
1090 fn poll_next(
1091 mut self: std::pin::Pin<&mut Self>,
1092 cx: &mut std::task::Context<'_>,
1093 ) -> std::task::Poll<Option<Self::Item>> {
1094 let this = &mut *self;
1095 if this.inner.check_shutdown(cx) {
1096 this.is_terminated = true;
1097 return std::task::Poll::Ready(None);
1098 }
1099 if this.is_terminated {
1100 panic!("polled FactoryDataManagerRequestStream after completion");
1101 }
1102 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1103 |bytes, handles| {
1104 match this.inner.channel().read_etc(cx, bytes, handles) {
1105 std::task::Poll::Ready(Ok(())) => {}
1106 std::task::Poll::Pending => return std::task::Poll::Pending,
1107 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1108 this.is_terminated = true;
1109 return std::task::Poll::Ready(None);
1110 }
1111 std::task::Poll::Ready(Err(e)) => {
1112 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1113 e.into(),
1114 ))))
1115 }
1116 }
1117
1118 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1120
1121 std::task::Poll::Ready(Some(match header.ordinal {
1122 0x75630bcd80418a0f => {
1123 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1124 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
1125 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1126 let control_handle = FactoryDataManagerControlHandle {
1127 inner: this.inner.clone(),
1128 };
1129 Ok(FactoryDataManagerRequest::GetPairingCode {
1130 responder: FactoryDataManagerGetPairingCodeResponder {
1131 control_handle: std::mem::ManuallyDrop::new(control_handle),
1132 tx_id: header.tx_id,
1133 },
1134 })
1135 }
1136 0x1b4feca8bc141380 => {
1137 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1138 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
1139 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1140 let control_handle = FactoryDataManagerControlHandle {
1141 inner: this.inner.clone(),
1142 };
1143 Ok(FactoryDataManagerRequest::GetWeaveCertificate {
1144 responder: FactoryDataManagerGetWeaveCertificateResponder {
1145 control_handle: std::mem::ManuallyDrop::new(control_handle),
1146 tx_id: header.tx_id,
1147 },
1148 })
1149 }
1150 _ => Err(fidl::Error::UnknownOrdinal {
1151 ordinal: header.ordinal,
1152 protocol_name: <FactoryDataManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1153 }),
1154 }))
1155 },
1156 )
1157 }
1158}
1159
1160#[derive(Debug)]
1163pub enum FactoryDataManagerRequest {
1164 GetPairingCode { responder: FactoryDataManagerGetPairingCodeResponder },
1166 GetWeaveCertificate { responder: FactoryDataManagerGetWeaveCertificateResponder },
1168}
1169
1170impl FactoryDataManagerRequest {
1171 #[allow(irrefutable_let_patterns)]
1172 pub fn into_get_pairing_code(self) -> Option<(FactoryDataManagerGetPairingCodeResponder)> {
1173 if let FactoryDataManagerRequest::GetPairingCode { responder } = self {
1174 Some((responder))
1175 } else {
1176 None
1177 }
1178 }
1179
1180 #[allow(irrefutable_let_patterns)]
1181 pub fn into_get_weave_certificate(
1182 self,
1183 ) -> Option<(FactoryDataManagerGetWeaveCertificateResponder)> {
1184 if let FactoryDataManagerRequest::GetWeaveCertificate { responder } = self {
1185 Some((responder))
1186 } else {
1187 None
1188 }
1189 }
1190
1191 pub fn method_name(&self) -> &'static str {
1193 match *self {
1194 FactoryDataManagerRequest::GetPairingCode { .. } => "get_pairing_code",
1195 FactoryDataManagerRequest::GetWeaveCertificate { .. } => "get_weave_certificate",
1196 }
1197 }
1198}
1199
1200#[derive(Debug, Clone)]
1201pub struct FactoryDataManagerControlHandle {
1202 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1203}
1204
1205impl fidl::endpoints::ControlHandle for FactoryDataManagerControlHandle {
1206 fn shutdown(&self) {
1207 self.inner.shutdown()
1208 }
1209 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1210 self.inner.shutdown_with_epitaph(status)
1211 }
1212
1213 fn is_closed(&self) -> bool {
1214 self.inner.channel().is_closed()
1215 }
1216 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1217 self.inner.channel().on_closed()
1218 }
1219
1220 #[cfg(target_os = "fuchsia")]
1221 fn signal_peer(
1222 &self,
1223 clear_mask: zx::Signals,
1224 set_mask: zx::Signals,
1225 ) -> Result<(), zx_status::Status> {
1226 use fidl::Peered;
1227 self.inner.channel().signal_peer(clear_mask, set_mask)
1228 }
1229}
1230
1231impl FactoryDataManagerControlHandle {}
1232
1233#[must_use = "FIDL methods require a response to be sent"]
1234#[derive(Debug)]
1235pub struct FactoryDataManagerGetPairingCodeResponder {
1236 control_handle: std::mem::ManuallyDrop<FactoryDataManagerControlHandle>,
1237 tx_id: u32,
1238}
1239
1240impl std::ops::Drop for FactoryDataManagerGetPairingCodeResponder {
1244 fn drop(&mut self) {
1245 self.control_handle.shutdown();
1246 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1248 }
1249}
1250
1251impl fidl::endpoints::Responder for FactoryDataManagerGetPairingCodeResponder {
1252 type ControlHandle = FactoryDataManagerControlHandle;
1253
1254 fn control_handle(&self) -> &FactoryDataManagerControlHandle {
1255 &self.control_handle
1256 }
1257
1258 fn drop_without_shutdown(mut self) {
1259 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1261 std::mem::forget(self);
1263 }
1264}
1265
1266impl FactoryDataManagerGetPairingCodeResponder {
1267 pub fn send(self, mut result: Result<&[u8], ErrorCode>) -> Result<(), fidl::Error> {
1271 let _result = self.send_raw(result);
1272 if _result.is_err() {
1273 self.control_handle.shutdown();
1274 }
1275 self.drop_without_shutdown();
1276 _result
1277 }
1278
1279 pub fn send_no_shutdown_on_err(
1281 self,
1282 mut result: Result<&[u8], ErrorCode>,
1283 ) -> Result<(), fidl::Error> {
1284 let _result = self.send_raw(result);
1285 self.drop_without_shutdown();
1286 _result
1287 }
1288
1289 fn send_raw(&self, mut result: Result<&[u8], ErrorCode>) -> Result<(), fidl::Error> {
1290 self.control_handle.inner.send::<fidl::encoding::ResultType<
1291 FactoryDataManagerGetPairingCodeResponse,
1292 ErrorCode,
1293 >>(
1294 result.map(|pairing_code| (pairing_code,)),
1295 self.tx_id,
1296 0x75630bcd80418a0f,
1297 fidl::encoding::DynamicFlags::empty(),
1298 )
1299 }
1300}
1301
1302#[must_use = "FIDL methods require a response to be sent"]
1303#[derive(Debug)]
1304pub struct FactoryDataManagerGetWeaveCertificateResponder {
1305 control_handle: std::mem::ManuallyDrop<FactoryDataManagerControlHandle>,
1306 tx_id: u32,
1307}
1308
1309impl std::ops::Drop for FactoryDataManagerGetWeaveCertificateResponder {
1313 fn drop(&mut self) {
1314 self.control_handle.shutdown();
1315 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1317 }
1318}
1319
1320impl fidl::endpoints::Responder for FactoryDataManagerGetWeaveCertificateResponder {
1321 type ControlHandle = FactoryDataManagerControlHandle;
1322
1323 fn control_handle(&self) -> &FactoryDataManagerControlHandle {
1324 &self.control_handle
1325 }
1326
1327 fn drop_without_shutdown(mut self) {
1328 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1330 std::mem::forget(self);
1332 }
1333}
1334
1335impl FactoryDataManagerGetWeaveCertificateResponder {
1336 pub fn send(
1340 self,
1341 mut result: Result<fidl_fuchsia_mem::Buffer, ErrorCode>,
1342 ) -> Result<(), fidl::Error> {
1343 let _result = self.send_raw(result);
1344 if _result.is_err() {
1345 self.control_handle.shutdown();
1346 }
1347 self.drop_without_shutdown();
1348 _result
1349 }
1350
1351 pub fn send_no_shutdown_on_err(
1353 self,
1354 mut result: Result<fidl_fuchsia_mem::Buffer, ErrorCode>,
1355 ) -> Result<(), fidl::Error> {
1356 let _result = self.send_raw(result);
1357 self.drop_without_shutdown();
1358 _result
1359 }
1360
1361 fn send_raw(
1362 &self,
1363 mut result: Result<fidl_fuchsia_mem::Buffer, ErrorCode>,
1364 ) -> Result<(), fidl::Error> {
1365 self.control_handle.inner.send::<fidl::encoding::ResultType<
1366 FactoryDataManagerGetWeaveCertificateResponse,
1367 ErrorCode,
1368 >>(
1369 result.as_mut().map_err(|e| *e).map(|certificate| (certificate,)),
1370 self.tx_id,
1371 0x1b4feca8bc141380,
1372 fidl::encoding::DynamicFlags::empty(),
1373 )
1374 }
1375}
1376
1377#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1378pub struct PairingStateWatcherMarker;
1379
1380impl fidl::endpoints::ProtocolMarker for PairingStateWatcherMarker {
1381 type Proxy = PairingStateWatcherProxy;
1382 type RequestStream = PairingStateWatcherRequestStream;
1383 #[cfg(target_os = "fuchsia")]
1384 type SynchronousProxy = PairingStateWatcherSynchronousProxy;
1385
1386 const DEBUG_NAME: &'static str = "(anonymous) PairingStateWatcher";
1387}
1388
1389pub trait PairingStateWatcherProxyInterface: Send + Sync {
1390 type WatchPairingStateResponseFut: std::future::Future<Output = Result<PairingState, fidl::Error>>
1391 + Send;
1392 fn r#watch_pairing_state(&self) -> Self::WatchPairingStateResponseFut;
1393}
1394#[derive(Debug)]
1395#[cfg(target_os = "fuchsia")]
1396pub struct PairingStateWatcherSynchronousProxy {
1397 client: fidl::client::sync::Client,
1398}
1399
1400#[cfg(target_os = "fuchsia")]
1401impl fidl::endpoints::SynchronousProxy for PairingStateWatcherSynchronousProxy {
1402 type Proxy = PairingStateWatcherProxy;
1403 type Protocol = PairingStateWatcherMarker;
1404
1405 fn from_channel(inner: fidl::Channel) -> Self {
1406 Self::new(inner)
1407 }
1408
1409 fn into_channel(self) -> fidl::Channel {
1410 self.client.into_channel()
1411 }
1412
1413 fn as_channel(&self) -> &fidl::Channel {
1414 self.client.as_channel()
1415 }
1416}
1417
1418#[cfg(target_os = "fuchsia")]
1419impl PairingStateWatcherSynchronousProxy {
1420 pub fn new(channel: fidl::Channel) -> Self {
1421 let protocol_name =
1422 <PairingStateWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1423 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1424 }
1425
1426 pub fn into_channel(self) -> fidl::Channel {
1427 self.client.into_channel()
1428 }
1429
1430 pub fn wait_for_event(
1433 &self,
1434 deadline: zx::MonotonicInstant,
1435 ) -> Result<PairingStateWatcherEvent, fidl::Error> {
1436 PairingStateWatcherEvent::decode(self.client.wait_for_event(deadline)?)
1437 }
1438
1439 pub fn r#watch_pairing_state(
1448 &self,
1449 ___deadline: zx::MonotonicInstant,
1450 ) -> Result<PairingState, fidl::Error> {
1451 let _response = self.client.send_query::<
1452 fidl::encoding::EmptyPayload,
1453 PairingStateWatcherWatchPairingStateResponse,
1454 >(
1455 (),
1456 0x1b3889b65cea014e,
1457 fidl::encoding::DynamicFlags::empty(),
1458 ___deadline,
1459 )?;
1460 Ok(_response.state)
1461 }
1462}
1463
1464#[derive(Debug, Clone)]
1465pub struct PairingStateWatcherProxy {
1466 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1467}
1468
1469impl fidl::endpoints::Proxy for PairingStateWatcherProxy {
1470 type Protocol = PairingStateWatcherMarker;
1471
1472 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1473 Self::new(inner)
1474 }
1475
1476 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1477 self.client.into_channel().map_err(|client| Self { client })
1478 }
1479
1480 fn as_channel(&self) -> &::fidl::AsyncChannel {
1481 self.client.as_channel()
1482 }
1483}
1484
1485impl PairingStateWatcherProxy {
1486 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1488 let protocol_name =
1489 <PairingStateWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1490 Self { client: fidl::client::Client::new(channel, protocol_name) }
1491 }
1492
1493 pub fn take_event_stream(&self) -> PairingStateWatcherEventStream {
1499 PairingStateWatcherEventStream { event_receiver: self.client.take_event_receiver() }
1500 }
1501
1502 pub fn r#watch_pairing_state(
1511 &self,
1512 ) -> fidl::client::QueryResponseFut<PairingState, fidl::encoding::DefaultFuchsiaResourceDialect>
1513 {
1514 PairingStateWatcherProxyInterface::r#watch_pairing_state(self)
1515 }
1516}
1517
1518impl PairingStateWatcherProxyInterface for PairingStateWatcherProxy {
1519 type WatchPairingStateResponseFut =
1520 fidl::client::QueryResponseFut<PairingState, fidl::encoding::DefaultFuchsiaResourceDialect>;
1521 fn r#watch_pairing_state(&self) -> Self::WatchPairingStateResponseFut {
1522 fn _decode(
1523 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1524 ) -> Result<PairingState, fidl::Error> {
1525 let _response = fidl::client::decode_transaction_body::<
1526 PairingStateWatcherWatchPairingStateResponse,
1527 fidl::encoding::DefaultFuchsiaResourceDialect,
1528 0x1b3889b65cea014e,
1529 >(_buf?)?;
1530 Ok(_response.state)
1531 }
1532 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PairingState>(
1533 (),
1534 0x1b3889b65cea014e,
1535 fidl::encoding::DynamicFlags::empty(),
1536 _decode,
1537 )
1538 }
1539}
1540
1541pub struct PairingStateWatcherEventStream {
1542 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1543}
1544
1545impl std::marker::Unpin for PairingStateWatcherEventStream {}
1546
1547impl futures::stream::FusedStream for PairingStateWatcherEventStream {
1548 fn is_terminated(&self) -> bool {
1549 self.event_receiver.is_terminated()
1550 }
1551}
1552
1553impl futures::Stream for PairingStateWatcherEventStream {
1554 type Item = Result<PairingStateWatcherEvent, fidl::Error>;
1555
1556 fn poll_next(
1557 mut self: std::pin::Pin<&mut Self>,
1558 cx: &mut std::task::Context<'_>,
1559 ) -> std::task::Poll<Option<Self::Item>> {
1560 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1561 &mut self.event_receiver,
1562 cx
1563 )?) {
1564 Some(buf) => std::task::Poll::Ready(Some(PairingStateWatcherEvent::decode(buf))),
1565 None => std::task::Poll::Ready(None),
1566 }
1567 }
1568}
1569
1570#[derive(Debug)]
1571pub enum PairingStateWatcherEvent {}
1572
1573impl PairingStateWatcherEvent {
1574 fn decode(
1576 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1577 ) -> Result<PairingStateWatcherEvent, fidl::Error> {
1578 let (bytes, _handles) = buf.split_mut();
1579 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1580 debug_assert_eq!(tx_header.tx_id, 0);
1581 match tx_header.ordinal {
1582 _ => Err(fidl::Error::UnknownOrdinal {
1583 ordinal: tx_header.ordinal,
1584 protocol_name:
1585 <PairingStateWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1586 }),
1587 }
1588 }
1589}
1590
1591pub struct PairingStateWatcherRequestStream {
1593 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1594 is_terminated: bool,
1595}
1596
1597impl std::marker::Unpin for PairingStateWatcherRequestStream {}
1598
1599impl futures::stream::FusedStream for PairingStateWatcherRequestStream {
1600 fn is_terminated(&self) -> bool {
1601 self.is_terminated
1602 }
1603}
1604
1605impl fidl::endpoints::RequestStream for PairingStateWatcherRequestStream {
1606 type Protocol = PairingStateWatcherMarker;
1607 type ControlHandle = PairingStateWatcherControlHandle;
1608
1609 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1610 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1611 }
1612
1613 fn control_handle(&self) -> Self::ControlHandle {
1614 PairingStateWatcherControlHandle { inner: self.inner.clone() }
1615 }
1616
1617 fn into_inner(
1618 self,
1619 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1620 {
1621 (self.inner, self.is_terminated)
1622 }
1623
1624 fn from_inner(
1625 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1626 is_terminated: bool,
1627 ) -> Self {
1628 Self { inner, is_terminated }
1629 }
1630}
1631
1632impl futures::Stream for PairingStateWatcherRequestStream {
1633 type Item = Result<PairingStateWatcherRequest, fidl::Error>;
1634
1635 fn poll_next(
1636 mut self: std::pin::Pin<&mut Self>,
1637 cx: &mut std::task::Context<'_>,
1638 ) -> std::task::Poll<Option<Self::Item>> {
1639 let this = &mut *self;
1640 if this.inner.check_shutdown(cx) {
1641 this.is_terminated = true;
1642 return std::task::Poll::Ready(None);
1643 }
1644 if this.is_terminated {
1645 panic!("polled PairingStateWatcherRequestStream after completion");
1646 }
1647 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1648 |bytes, handles| {
1649 match this.inner.channel().read_etc(cx, bytes, handles) {
1650 std::task::Poll::Ready(Ok(())) => {}
1651 std::task::Poll::Pending => return std::task::Poll::Pending,
1652 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1653 this.is_terminated = true;
1654 return std::task::Poll::Ready(None);
1655 }
1656 std::task::Poll::Ready(Err(e)) => {
1657 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1658 e.into(),
1659 ))))
1660 }
1661 }
1662
1663 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1665
1666 std::task::Poll::Ready(Some(match header.ordinal {
1667 0x1b3889b65cea014e => {
1668 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1669 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
1670 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1671 let control_handle = PairingStateWatcherControlHandle {
1672 inner: this.inner.clone(),
1673 };
1674 Ok(PairingStateWatcherRequest::WatchPairingState {
1675 responder: PairingStateWatcherWatchPairingStateResponder {
1676 control_handle: std::mem::ManuallyDrop::new(control_handle),
1677 tx_id: header.tx_id,
1678 },
1679 })
1680 }
1681 _ => Err(fidl::Error::UnknownOrdinal {
1682 ordinal: header.ordinal,
1683 protocol_name: <PairingStateWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1684 }),
1685 }))
1686 },
1687 )
1688 }
1689}
1690
1691#[derive(Debug)]
1694pub enum PairingStateWatcherRequest {
1695 WatchPairingState { responder: PairingStateWatcherWatchPairingStateResponder },
1704}
1705
1706impl PairingStateWatcherRequest {
1707 #[allow(irrefutable_let_patterns)]
1708 pub fn into_watch_pairing_state(
1709 self,
1710 ) -> Option<(PairingStateWatcherWatchPairingStateResponder)> {
1711 if let PairingStateWatcherRequest::WatchPairingState { responder } = self {
1712 Some((responder))
1713 } else {
1714 None
1715 }
1716 }
1717
1718 pub fn method_name(&self) -> &'static str {
1720 match *self {
1721 PairingStateWatcherRequest::WatchPairingState { .. } => "watch_pairing_state",
1722 }
1723 }
1724}
1725
1726#[derive(Debug, Clone)]
1727pub struct PairingStateWatcherControlHandle {
1728 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1729}
1730
1731impl fidl::endpoints::ControlHandle for PairingStateWatcherControlHandle {
1732 fn shutdown(&self) {
1733 self.inner.shutdown()
1734 }
1735 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1736 self.inner.shutdown_with_epitaph(status)
1737 }
1738
1739 fn is_closed(&self) -> bool {
1740 self.inner.channel().is_closed()
1741 }
1742 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1743 self.inner.channel().on_closed()
1744 }
1745
1746 #[cfg(target_os = "fuchsia")]
1747 fn signal_peer(
1748 &self,
1749 clear_mask: zx::Signals,
1750 set_mask: zx::Signals,
1751 ) -> Result<(), zx_status::Status> {
1752 use fidl::Peered;
1753 self.inner.channel().signal_peer(clear_mask, set_mask)
1754 }
1755}
1756
1757impl PairingStateWatcherControlHandle {}
1758
1759#[must_use = "FIDL methods require a response to be sent"]
1760#[derive(Debug)]
1761pub struct PairingStateWatcherWatchPairingStateResponder {
1762 control_handle: std::mem::ManuallyDrop<PairingStateWatcherControlHandle>,
1763 tx_id: u32,
1764}
1765
1766impl std::ops::Drop for PairingStateWatcherWatchPairingStateResponder {
1770 fn drop(&mut self) {
1771 self.control_handle.shutdown();
1772 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1774 }
1775}
1776
1777impl fidl::endpoints::Responder for PairingStateWatcherWatchPairingStateResponder {
1778 type ControlHandle = PairingStateWatcherControlHandle;
1779
1780 fn control_handle(&self) -> &PairingStateWatcherControlHandle {
1781 &self.control_handle
1782 }
1783
1784 fn drop_without_shutdown(mut self) {
1785 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1787 std::mem::forget(self);
1789 }
1790}
1791
1792impl PairingStateWatcherWatchPairingStateResponder {
1793 pub fn send(self, mut state: &PairingState) -> Result<(), fidl::Error> {
1797 let _result = self.send_raw(state);
1798 if _result.is_err() {
1799 self.control_handle.shutdown();
1800 }
1801 self.drop_without_shutdown();
1802 _result
1803 }
1804
1805 pub fn send_no_shutdown_on_err(self, mut state: &PairingState) -> Result<(), fidl::Error> {
1807 let _result = self.send_raw(state);
1808 self.drop_without_shutdown();
1809 _result
1810 }
1811
1812 fn send_raw(&self, mut state: &PairingState) -> Result<(), fidl::Error> {
1813 self.control_handle.inner.send::<PairingStateWatcherWatchPairingStateResponse>(
1814 (state,),
1815 self.tx_id,
1816 0x1b3889b65cea014e,
1817 fidl::encoding::DynamicFlags::empty(),
1818 )
1819 }
1820}
1821
1822#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1823pub struct ProvisionerMarker;
1824
1825impl fidl::endpoints::ProtocolMarker for ProvisionerMarker {
1826 type Proxy = ProvisionerProxy;
1827 type RequestStream = ProvisionerRequestStream;
1828 #[cfg(target_os = "fuchsia")]
1829 type SynchronousProxy = ProvisionerSynchronousProxy;
1830
1831 const DEBUG_NAME: &'static str = "fuchsia.weave.Provisioner";
1832}
1833impl fidl::endpoints::DiscoverableProtocolMarker for ProvisionerMarker {}
1834pub type ProvisionerGenerateKeyPairResult = Result<(Vec<u8>, Vec<u8>), ErrorCode>;
1835
1836pub trait ProvisionerProxyInterface: Send + Sync {
1837 type GenerateKeyPairResponseFut: std::future::Future<Output = Result<ProvisionerGenerateKeyPairResult, fidl::Error>>
1838 + Send;
1839 fn r#generate_key_pair(&self) -> Self::GenerateKeyPairResponseFut;
1840}
1841#[derive(Debug)]
1842#[cfg(target_os = "fuchsia")]
1843pub struct ProvisionerSynchronousProxy {
1844 client: fidl::client::sync::Client,
1845}
1846
1847#[cfg(target_os = "fuchsia")]
1848impl fidl::endpoints::SynchronousProxy for ProvisionerSynchronousProxy {
1849 type Proxy = ProvisionerProxy;
1850 type Protocol = ProvisionerMarker;
1851
1852 fn from_channel(inner: fidl::Channel) -> Self {
1853 Self::new(inner)
1854 }
1855
1856 fn into_channel(self) -> fidl::Channel {
1857 self.client.into_channel()
1858 }
1859
1860 fn as_channel(&self) -> &fidl::Channel {
1861 self.client.as_channel()
1862 }
1863}
1864
1865#[cfg(target_os = "fuchsia")]
1866impl ProvisionerSynchronousProxy {
1867 pub fn new(channel: fidl::Channel) -> Self {
1868 let protocol_name = <ProvisionerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1869 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1870 }
1871
1872 pub fn into_channel(self) -> fidl::Channel {
1873 self.client.into_channel()
1874 }
1875
1876 pub fn wait_for_event(
1879 &self,
1880 deadline: zx::MonotonicInstant,
1881 ) -> Result<ProvisionerEvent, fidl::Error> {
1882 ProvisionerEvent::decode(self.client.wait_for_event(deadline)?)
1883 }
1884
1885 pub fn r#generate_key_pair(
1894 &self,
1895 ___deadline: zx::MonotonicInstant,
1896 ) -> Result<ProvisionerGenerateKeyPairResult, fidl::Error> {
1897 let _response = self.client.send_query::<
1898 fidl::encoding::EmptyPayload,
1899 fidl::encoding::ResultType<ProvisionerGenerateKeyPairResponse, ErrorCode>,
1900 >(
1901 (),
1902 0x9ba1ad04f47bd9f,
1903 fidl::encoding::DynamicFlags::empty(),
1904 ___deadline,
1905 )?;
1906 Ok(_response.map(|x| (x.wrapped_private_key, x.public_key)))
1907 }
1908}
1909
1910#[derive(Debug, Clone)]
1911pub struct ProvisionerProxy {
1912 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1913}
1914
1915impl fidl::endpoints::Proxy for ProvisionerProxy {
1916 type Protocol = ProvisionerMarker;
1917
1918 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1919 Self::new(inner)
1920 }
1921
1922 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1923 self.client.into_channel().map_err(|client| Self { client })
1924 }
1925
1926 fn as_channel(&self) -> &::fidl::AsyncChannel {
1927 self.client.as_channel()
1928 }
1929}
1930
1931impl ProvisionerProxy {
1932 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1934 let protocol_name = <ProvisionerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1935 Self { client: fidl::client::Client::new(channel, protocol_name) }
1936 }
1937
1938 pub fn take_event_stream(&self) -> ProvisionerEventStream {
1944 ProvisionerEventStream { event_receiver: self.client.take_event_receiver() }
1945 }
1946
1947 pub fn r#generate_key_pair(
1956 &self,
1957 ) -> fidl::client::QueryResponseFut<
1958 ProvisionerGenerateKeyPairResult,
1959 fidl::encoding::DefaultFuchsiaResourceDialect,
1960 > {
1961 ProvisionerProxyInterface::r#generate_key_pair(self)
1962 }
1963}
1964
1965impl ProvisionerProxyInterface for ProvisionerProxy {
1966 type GenerateKeyPairResponseFut = fidl::client::QueryResponseFut<
1967 ProvisionerGenerateKeyPairResult,
1968 fidl::encoding::DefaultFuchsiaResourceDialect,
1969 >;
1970 fn r#generate_key_pair(&self) -> Self::GenerateKeyPairResponseFut {
1971 fn _decode(
1972 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1973 ) -> Result<ProvisionerGenerateKeyPairResult, fidl::Error> {
1974 let _response = fidl::client::decode_transaction_body::<
1975 fidl::encoding::ResultType<ProvisionerGenerateKeyPairResponse, ErrorCode>,
1976 fidl::encoding::DefaultFuchsiaResourceDialect,
1977 0x9ba1ad04f47bd9f,
1978 >(_buf?)?;
1979 Ok(_response.map(|x| (x.wrapped_private_key, x.public_key)))
1980 }
1981 self.client.send_query_and_decode::<
1982 fidl::encoding::EmptyPayload,
1983 ProvisionerGenerateKeyPairResult,
1984 >(
1985 (),
1986 0x9ba1ad04f47bd9f,
1987 fidl::encoding::DynamicFlags::empty(),
1988 _decode,
1989 )
1990 }
1991}
1992
1993pub struct ProvisionerEventStream {
1994 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1995}
1996
1997impl std::marker::Unpin for ProvisionerEventStream {}
1998
1999impl futures::stream::FusedStream for ProvisionerEventStream {
2000 fn is_terminated(&self) -> bool {
2001 self.event_receiver.is_terminated()
2002 }
2003}
2004
2005impl futures::Stream for ProvisionerEventStream {
2006 type Item = Result<ProvisionerEvent, fidl::Error>;
2007
2008 fn poll_next(
2009 mut self: std::pin::Pin<&mut Self>,
2010 cx: &mut std::task::Context<'_>,
2011 ) -> std::task::Poll<Option<Self::Item>> {
2012 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2013 &mut self.event_receiver,
2014 cx
2015 )?) {
2016 Some(buf) => std::task::Poll::Ready(Some(ProvisionerEvent::decode(buf))),
2017 None => std::task::Poll::Ready(None),
2018 }
2019 }
2020}
2021
2022#[derive(Debug)]
2023pub enum ProvisionerEvent {}
2024
2025impl ProvisionerEvent {
2026 fn decode(
2028 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2029 ) -> Result<ProvisionerEvent, fidl::Error> {
2030 let (bytes, _handles) = buf.split_mut();
2031 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2032 debug_assert_eq!(tx_header.tx_id, 0);
2033 match tx_header.ordinal {
2034 _ => Err(fidl::Error::UnknownOrdinal {
2035 ordinal: tx_header.ordinal,
2036 protocol_name: <ProvisionerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2037 }),
2038 }
2039 }
2040}
2041
2042pub struct ProvisionerRequestStream {
2044 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2045 is_terminated: bool,
2046}
2047
2048impl std::marker::Unpin for ProvisionerRequestStream {}
2049
2050impl futures::stream::FusedStream for ProvisionerRequestStream {
2051 fn is_terminated(&self) -> bool {
2052 self.is_terminated
2053 }
2054}
2055
2056impl fidl::endpoints::RequestStream for ProvisionerRequestStream {
2057 type Protocol = ProvisionerMarker;
2058 type ControlHandle = ProvisionerControlHandle;
2059
2060 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2061 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2062 }
2063
2064 fn control_handle(&self) -> Self::ControlHandle {
2065 ProvisionerControlHandle { inner: self.inner.clone() }
2066 }
2067
2068 fn into_inner(
2069 self,
2070 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2071 {
2072 (self.inner, self.is_terminated)
2073 }
2074
2075 fn from_inner(
2076 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2077 is_terminated: bool,
2078 ) -> Self {
2079 Self { inner, is_terminated }
2080 }
2081}
2082
2083impl futures::Stream for ProvisionerRequestStream {
2084 type Item = Result<ProvisionerRequest, fidl::Error>;
2085
2086 fn poll_next(
2087 mut self: std::pin::Pin<&mut Self>,
2088 cx: &mut std::task::Context<'_>,
2089 ) -> std::task::Poll<Option<Self::Item>> {
2090 let this = &mut *self;
2091 if this.inner.check_shutdown(cx) {
2092 this.is_terminated = true;
2093 return std::task::Poll::Ready(None);
2094 }
2095 if this.is_terminated {
2096 panic!("polled ProvisionerRequestStream after completion");
2097 }
2098 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2099 |bytes, handles| {
2100 match this.inner.channel().read_etc(cx, bytes, handles) {
2101 std::task::Poll::Ready(Ok(())) => {}
2102 std::task::Poll::Pending => return std::task::Poll::Pending,
2103 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2104 this.is_terminated = true;
2105 return std::task::Poll::Ready(None);
2106 }
2107 std::task::Poll::Ready(Err(e)) => {
2108 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2109 e.into(),
2110 ))))
2111 }
2112 }
2113
2114 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2116
2117 std::task::Poll::Ready(Some(match header.ordinal {
2118 0x9ba1ad04f47bd9f => {
2119 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2120 let mut req = fidl::new_empty!(
2121 fidl::encoding::EmptyPayload,
2122 fidl::encoding::DefaultFuchsiaResourceDialect
2123 );
2124 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2125 let control_handle = ProvisionerControlHandle { inner: this.inner.clone() };
2126 Ok(ProvisionerRequest::GenerateKeyPair {
2127 responder: ProvisionerGenerateKeyPairResponder {
2128 control_handle: std::mem::ManuallyDrop::new(control_handle),
2129 tx_id: header.tx_id,
2130 },
2131 })
2132 }
2133 _ => Err(fidl::Error::UnknownOrdinal {
2134 ordinal: header.ordinal,
2135 protocol_name:
2136 <ProvisionerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2137 }),
2138 }))
2139 },
2140 )
2141 }
2142}
2143
2144#[derive(Debug)]
2146pub enum ProvisionerRequest {
2147 GenerateKeyPair { responder: ProvisionerGenerateKeyPairResponder },
2156}
2157
2158impl ProvisionerRequest {
2159 #[allow(irrefutable_let_patterns)]
2160 pub fn into_generate_key_pair(self) -> Option<(ProvisionerGenerateKeyPairResponder)> {
2161 if let ProvisionerRequest::GenerateKeyPair { responder } = self {
2162 Some((responder))
2163 } else {
2164 None
2165 }
2166 }
2167
2168 pub fn method_name(&self) -> &'static str {
2170 match *self {
2171 ProvisionerRequest::GenerateKeyPair { .. } => "generate_key_pair",
2172 }
2173 }
2174}
2175
2176#[derive(Debug, Clone)]
2177pub struct ProvisionerControlHandle {
2178 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2179}
2180
2181impl fidl::endpoints::ControlHandle for ProvisionerControlHandle {
2182 fn shutdown(&self) {
2183 self.inner.shutdown()
2184 }
2185 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2186 self.inner.shutdown_with_epitaph(status)
2187 }
2188
2189 fn is_closed(&self) -> bool {
2190 self.inner.channel().is_closed()
2191 }
2192 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2193 self.inner.channel().on_closed()
2194 }
2195
2196 #[cfg(target_os = "fuchsia")]
2197 fn signal_peer(
2198 &self,
2199 clear_mask: zx::Signals,
2200 set_mask: zx::Signals,
2201 ) -> Result<(), zx_status::Status> {
2202 use fidl::Peered;
2203 self.inner.channel().signal_peer(clear_mask, set_mask)
2204 }
2205}
2206
2207impl ProvisionerControlHandle {}
2208
2209#[must_use = "FIDL methods require a response to be sent"]
2210#[derive(Debug)]
2211pub struct ProvisionerGenerateKeyPairResponder {
2212 control_handle: std::mem::ManuallyDrop<ProvisionerControlHandle>,
2213 tx_id: u32,
2214}
2215
2216impl std::ops::Drop for ProvisionerGenerateKeyPairResponder {
2220 fn drop(&mut self) {
2221 self.control_handle.shutdown();
2222 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2224 }
2225}
2226
2227impl fidl::endpoints::Responder for ProvisionerGenerateKeyPairResponder {
2228 type ControlHandle = ProvisionerControlHandle;
2229
2230 fn control_handle(&self) -> &ProvisionerControlHandle {
2231 &self.control_handle
2232 }
2233
2234 fn drop_without_shutdown(mut self) {
2235 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2237 std::mem::forget(self);
2239 }
2240}
2241
2242impl ProvisionerGenerateKeyPairResponder {
2243 pub fn send(self, mut result: Result<(&[u8], &[u8]), ErrorCode>) -> Result<(), fidl::Error> {
2247 let _result = self.send_raw(result);
2248 if _result.is_err() {
2249 self.control_handle.shutdown();
2250 }
2251 self.drop_without_shutdown();
2252 _result
2253 }
2254
2255 pub fn send_no_shutdown_on_err(
2257 self,
2258 mut result: Result<(&[u8], &[u8]), ErrorCode>,
2259 ) -> Result<(), fidl::Error> {
2260 let _result = self.send_raw(result);
2261 self.drop_without_shutdown();
2262 _result
2263 }
2264
2265 fn send_raw(&self, mut result: Result<(&[u8], &[u8]), ErrorCode>) -> Result<(), fidl::Error> {
2266 self.control_handle.inner.send::<fidl::encoding::ResultType<
2267 ProvisionerGenerateKeyPairResponse,
2268 ErrorCode,
2269 >>(
2270 result,
2271 self.tx_id,
2272 0x9ba1ad04f47bd9f,
2273 fidl::encoding::DynamicFlags::empty(),
2274 )
2275 }
2276}
2277
2278#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2279pub struct SignerMarker;
2280
2281impl fidl::endpoints::ProtocolMarker for SignerMarker {
2282 type Proxy = SignerProxy;
2283 type RequestStream = SignerRequestStream;
2284 #[cfg(target_os = "fuchsia")]
2285 type SynchronousProxy = SignerSynchronousProxy;
2286
2287 const DEBUG_NAME: &'static str = "fuchsia.weave.Signer";
2288}
2289impl fidl::endpoints::DiscoverableProtocolMarker for SignerMarker {}
2290pub type SignerSignHashResult = Result<Vec<u8>, ErrorCode>;
2291pub type SignerSignHashWithPrivateKeyResult = Result<Vec<u8>, ErrorCode>;
2292
2293pub trait SignerProxyInterface: Send + Sync {
2294 type SignHashResponseFut: std::future::Future<Output = Result<SignerSignHashResult, fidl::Error>>
2295 + Send;
2296 fn r#sign_hash(&self, hash: &[u8]) -> Self::SignHashResponseFut;
2297 type SignHashWithPrivateKeyResponseFut: std::future::Future<Output = Result<SignerSignHashWithPrivateKeyResult, fidl::Error>>
2298 + Send;
2299 fn r#sign_hash_with_private_key(
2300 &self,
2301 hash: &[u8],
2302 wrapped_private_key: &[u8],
2303 ) -> Self::SignHashWithPrivateKeyResponseFut;
2304}
2305#[derive(Debug)]
2306#[cfg(target_os = "fuchsia")]
2307pub struct SignerSynchronousProxy {
2308 client: fidl::client::sync::Client,
2309}
2310
2311#[cfg(target_os = "fuchsia")]
2312impl fidl::endpoints::SynchronousProxy for SignerSynchronousProxy {
2313 type Proxy = SignerProxy;
2314 type Protocol = SignerMarker;
2315
2316 fn from_channel(inner: fidl::Channel) -> Self {
2317 Self::new(inner)
2318 }
2319
2320 fn into_channel(self) -> fidl::Channel {
2321 self.client.into_channel()
2322 }
2323
2324 fn as_channel(&self) -> &fidl::Channel {
2325 self.client.as_channel()
2326 }
2327}
2328
2329#[cfg(target_os = "fuchsia")]
2330impl SignerSynchronousProxy {
2331 pub fn new(channel: fidl::Channel) -> Self {
2332 let protocol_name = <SignerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2333 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2334 }
2335
2336 pub fn into_channel(self) -> fidl::Channel {
2337 self.client.into_channel()
2338 }
2339
2340 pub fn wait_for_event(
2343 &self,
2344 deadline: zx::MonotonicInstant,
2345 ) -> Result<SignerEvent, fidl::Error> {
2346 SignerEvent::decode(self.client.wait_for_event(deadline)?)
2347 }
2348
2349 pub fn r#sign_hash(
2354 &self,
2355 mut hash: &[u8],
2356 ___deadline: zx::MonotonicInstant,
2357 ) -> Result<SignerSignHashResult, fidl::Error> {
2358 let _response = self.client.send_query::<
2359 SignerSignHashRequest,
2360 fidl::encoding::ResultType<SignerSignHashResponse, ErrorCode>,
2361 >(
2362 (hash,),
2363 0x3bfb1667fc4fe864,
2364 fidl::encoding::DynamicFlags::empty(),
2365 ___deadline,
2366 )?;
2367 Ok(_response.map(|x| x.signature))
2368 }
2369
2370 pub fn r#sign_hash_with_private_key(
2376 &self,
2377 mut hash: &[u8],
2378 mut wrapped_private_key: &[u8],
2379 ___deadline: zx::MonotonicInstant,
2380 ) -> Result<SignerSignHashWithPrivateKeyResult, fidl::Error> {
2381 let _response = self.client.send_query::<
2382 SignerSignHashWithPrivateKeyRequest,
2383 fidl::encoding::ResultType<SignerSignHashWithPrivateKeyResponse, ErrorCode>,
2384 >(
2385 (hash, wrapped_private_key,),
2386 0x23e8ae3490affc11,
2387 fidl::encoding::DynamicFlags::empty(),
2388 ___deadline,
2389 )?;
2390 Ok(_response.map(|x| x.signature))
2391 }
2392}
2393
2394#[derive(Debug, Clone)]
2395pub struct SignerProxy {
2396 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2397}
2398
2399impl fidl::endpoints::Proxy for SignerProxy {
2400 type Protocol = SignerMarker;
2401
2402 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2403 Self::new(inner)
2404 }
2405
2406 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2407 self.client.into_channel().map_err(|client| Self { client })
2408 }
2409
2410 fn as_channel(&self) -> &::fidl::AsyncChannel {
2411 self.client.as_channel()
2412 }
2413}
2414
2415impl SignerProxy {
2416 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2418 let protocol_name = <SignerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2419 Self { client: fidl::client::Client::new(channel, protocol_name) }
2420 }
2421
2422 pub fn take_event_stream(&self) -> SignerEventStream {
2428 SignerEventStream { event_receiver: self.client.take_event_receiver() }
2429 }
2430
2431 pub fn r#sign_hash(
2436 &self,
2437 mut hash: &[u8],
2438 ) -> fidl::client::QueryResponseFut<
2439 SignerSignHashResult,
2440 fidl::encoding::DefaultFuchsiaResourceDialect,
2441 > {
2442 SignerProxyInterface::r#sign_hash(self, hash)
2443 }
2444
2445 pub fn r#sign_hash_with_private_key(
2451 &self,
2452 mut hash: &[u8],
2453 mut wrapped_private_key: &[u8],
2454 ) -> fidl::client::QueryResponseFut<
2455 SignerSignHashWithPrivateKeyResult,
2456 fidl::encoding::DefaultFuchsiaResourceDialect,
2457 > {
2458 SignerProxyInterface::r#sign_hash_with_private_key(self, hash, wrapped_private_key)
2459 }
2460}
2461
2462impl SignerProxyInterface for SignerProxy {
2463 type SignHashResponseFut = fidl::client::QueryResponseFut<
2464 SignerSignHashResult,
2465 fidl::encoding::DefaultFuchsiaResourceDialect,
2466 >;
2467 fn r#sign_hash(&self, mut hash: &[u8]) -> Self::SignHashResponseFut {
2468 fn _decode(
2469 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2470 ) -> Result<SignerSignHashResult, fidl::Error> {
2471 let _response = fidl::client::decode_transaction_body::<
2472 fidl::encoding::ResultType<SignerSignHashResponse, ErrorCode>,
2473 fidl::encoding::DefaultFuchsiaResourceDialect,
2474 0x3bfb1667fc4fe864,
2475 >(_buf?)?;
2476 Ok(_response.map(|x| x.signature))
2477 }
2478 self.client.send_query_and_decode::<SignerSignHashRequest, SignerSignHashResult>(
2479 (hash,),
2480 0x3bfb1667fc4fe864,
2481 fidl::encoding::DynamicFlags::empty(),
2482 _decode,
2483 )
2484 }
2485
2486 type SignHashWithPrivateKeyResponseFut = fidl::client::QueryResponseFut<
2487 SignerSignHashWithPrivateKeyResult,
2488 fidl::encoding::DefaultFuchsiaResourceDialect,
2489 >;
2490 fn r#sign_hash_with_private_key(
2491 &self,
2492 mut hash: &[u8],
2493 mut wrapped_private_key: &[u8],
2494 ) -> Self::SignHashWithPrivateKeyResponseFut {
2495 fn _decode(
2496 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2497 ) -> Result<SignerSignHashWithPrivateKeyResult, fidl::Error> {
2498 let _response = fidl::client::decode_transaction_body::<
2499 fidl::encoding::ResultType<SignerSignHashWithPrivateKeyResponse, ErrorCode>,
2500 fidl::encoding::DefaultFuchsiaResourceDialect,
2501 0x23e8ae3490affc11,
2502 >(_buf?)?;
2503 Ok(_response.map(|x| x.signature))
2504 }
2505 self.client.send_query_and_decode::<
2506 SignerSignHashWithPrivateKeyRequest,
2507 SignerSignHashWithPrivateKeyResult,
2508 >(
2509 (hash, wrapped_private_key,),
2510 0x23e8ae3490affc11,
2511 fidl::encoding::DynamicFlags::empty(),
2512 _decode,
2513 )
2514 }
2515}
2516
2517pub struct SignerEventStream {
2518 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2519}
2520
2521impl std::marker::Unpin for SignerEventStream {}
2522
2523impl futures::stream::FusedStream for SignerEventStream {
2524 fn is_terminated(&self) -> bool {
2525 self.event_receiver.is_terminated()
2526 }
2527}
2528
2529impl futures::Stream for SignerEventStream {
2530 type Item = Result<SignerEvent, fidl::Error>;
2531
2532 fn poll_next(
2533 mut self: std::pin::Pin<&mut Self>,
2534 cx: &mut std::task::Context<'_>,
2535 ) -> std::task::Poll<Option<Self::Item>> {
2536 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2537 &mut self.event_receiver,
2538 cx
2539 )?) {
2540 Some(buf) => std::task::Poll::Ready(Some(SignerEvent::decode(buf))),
2541 None => std::task::Poll::Ready(None),
2542 }
2543 }
2544}
2545
2546#[derive(Debug)]
2547pub enum SignerEvent {}
2548
2549impl SignerEvent {
2550 fn decode(
2552 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2553 ) -> Result<SignerEvent, fidl::Error> {
2554 let (bytes, _handles) = buf.split_mut();
2555 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2556 debug_assert_eq!(tx_header.tx_id, 0);
2557 match tx_header.ordinal {
2558 _ => Err(fidl::Error::UnknownOrdinal {
2559 ordinal: tx_header.ordinal,
2560 protocol_name: <SignerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2561 }),
2562 }
2563 }
2564}
2565
2566pub struct SignerRequestStream {
2568 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2569 is_terminated: bool,
2570}
2571
2572impl std::marker::Unpin for SignerRequestStream {}
2573
2574impl futures::stream::FusedStream for SignerRequestStream {
2575 fn is_terminated(&self) -> bool {
2576 self.is_terminated
2577 }
2578}
2579
2580impl fidl::endpoints::RequestStream for SignerRequestStream {
2581 type Protocol = SignerMarker;
2582 type ControlHandle = SignerControlHandle;
2583
2584 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2585 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2586 }
2587
2588 fn control_handle(&self) -> Self::ControlHandle {
2589 SignerControlHandle { inner: self.inner.clone() }
2590 }
2591
2592 fn into_inner(
2593 self,
2594 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2595 {
2596 (self.inner, self.is_terminated)
2597 }
2598
2599 fn from_inner(
2600 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2601 is_terminated: bool,
2602 ) -> Self {
2603 Self { inner, is_terminated }
2604 }
2605}
2606
2607impl futures::Stream for SignerRequestStream {
2608 type Item = Result<SignerRequest, fidl::Error>;
2609
2610 fn poll_next(
2611 mut self: std::pin::Pin<&mut Self>,
2612 cx: &mut std::task::Context<'_>,
2613 ) -> std::task::Poll<Option<Self::Item>> {
2614 let this = &mut *self;
2615 if this.inner.check_shutdown(cx) {
2616 this.is_terminated = true;
2617 return std::task::Poll::Ready(None);
2618 }
2619 if this.is_terminated {
2620 panic!("polled SignerRequestStream after completion");
2621 }
2622 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2623 |bytes, handles| {
2624 match this.inner.channel().read_etc(cx, bytes, handles) {
2625 std::task::Poll::Ready(Ok(())) => {}
2626 std::task::Poll::Pending => return std::task::Poll::Pending,
2627 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2628 this.is_terminated = true;
2629 return std::task::Poll::Ready(None);
2630 }
2631 std::task::Poll::Ready(Err(e)) => {
2632 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2633 e.into(),
2634 ))))
2635 }
2636 }
2637
2638 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2640
2641 std::task::Poll::Ready(Some(match header.ordinal {
2642 0x3bfb1667fc4fe864 => {
2643 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2644 let mut req = fidl::new_empty!(
2645 SignerSignHashRequest,
2646 fidl::encoding::DefaultFuchsiaResourceDialect
2647 );
2648 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SignerSignHashRequest>(&header, _body_bytes, handles, &mut req)?;
2649 let control_handle = SignerControlHandle { inner: this.inner.clone() };
2650 Ok(SignerRequest::SignHash {
2651 hash: req.hash,
2652
2653 responder: SignerSignHashResponder {
2654 control_handle: std::mem::ManuallyDrop::new(control_handle),
2655 tx_id: header.tx_id,
2656 },
2657 })
2658 }
2659 0x23e8ae3490affc11 => {
2660 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2661 let mut req = fidl::new_empty!(
2662 SignerSignHashWithPrivateKeyRequest,
2663 fidl::encoding::DefaultFuchsiaResourceDialect
2664 );
2665 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SignerSignHashWithPrivateKeyRequest>(&header, _body_bytes, handles, &mut req)?;
2666 let control_handle = SignerControlHandle { inner: this.inner.clone() };
2667 Ok(SignerRequest::SignHashWithPrivateKey {
2668 hash: req.hash,
2669 wrapped_private_key: req.wrapped_private_key,
2670
2671 responder: SignerSignHashWithPrivateKeyResponder {
2672 control_handle: std::mem::ManuallyDrop::new(control_handle),
2673 tx_id: header.tx_id,
2674 },
2675 })
2676 }
2677 _ => Err(fidl::Error::UnknownOrdinal {
2678 ordinal: header.ordinal,
2679 protocol_name:
2680 <SignerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2681 }),
2682 }))
2683 },
2684 )
2685 }
2686}
2687
2688#[derive(Debug)]
2691pub enum SignerRequest {
2692 SignHash { hash: Vec<u8>, responder: SignerSignHashResponder },
2697 SignHashWithPrivateKey {
2703 hash: Vec<u8>,
2704 wrapped_private_key: Vec<u8>,
2705 responder: SignerSignHashWithPrivateKeyResponder,
2706 },
2707}
2708
2709impl SignerRequest {
2710 #[allow(irrefutable_let_patterns)]
2711 pub fn into_sign_hash(self) -> Option<(Vec<u8>, SignerSignHashResponder)> {
2712 if let SignerRequest::SignHash { hash, responder } = self {
2713 Some((hash, responder))
2714 } else {
2715 None
2716 }
2717 }
2718
2719 #[allow(irrefutable_let_patterns)]
2720 pub fn into_sign_hash_with_private_key(
2721 self,
2722 ) -> Option<(Vec<u8>, Vec<u8>, SignerSignHashWithPrivateKeyResponder)> {
2723 if let SignerRequest::SignHashWithPrivateKey { hash, wrapped_private_key, responder } = self
2724 {
2725 Some((hash, wrapped_private_key, responder))
2726 } else {
2727 None
2728 }
2729 }
2730
2731 pub fn method_name(&self) -> &'static str {
2733 match *self {
2734 SignerRequest::SignHash { .. } => "sign_hash",
2735 SignerRequest::SignHashWithPrivateKey { .. } => "sign_hash_with_private_key",
2736 }
2737 }
2738}
2739
2740#[derive(Debug, Clone)]
2741pub struct SignerControlHandle {
2742 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2743}
2744
2745impl fidl::endpoints::ControlHandle for SignerControlHandle {
2746 fn shutdown(&self) {
2747 self.inner.shutdown()
2748 }
2749 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2750 self.inner.shutdown_with_epitaph(status)
2751 }
2752
2753 fn is_closed(&self) -> bool {
2754 self.inner.channel().is_closed()
2755 }
2756 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2757 self.inner.channel().on_closed()
2758 }
2759
2760 #[cfg(target_os = "fuchsia")]
2761 fn signal_peer(
2762 &self,
2763 clear_mask: zx::Signals,
2764 set_mask: zx::Signals,
2765 ) -> Result<(), zx_status::Status> {
2766 use fidl::Peered;
2767 self.inner.channel().signal_peer(clear_mask, set_mask)
2768 }
2769}
2770
2771impl SignerControlHandle {}
2772
2773#[must_use = "FIDL methods require a response to be sent"]
2774#[derive(Debug)]
2775pub struct SignerSignHashResponder {
2776 control_handle: std::mem::ManuallyDrop<SignerControlHandle>,
2777 tx_id: u32,
2778}
2779
2780impl std::ops::Drop for SignerSignHashResponder {
2784 fn drop(&mut self) {
2785 self.control_handle.shutdown();
2786 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2788 }
2789}
2790
2791impl fidl::endpoints::Responder for SignerSignHashResponder {
2792 type ControlHandle = SignerControlHandle;
2793
2794 fn control_handle(&self) -> &SignerControlHandle {
2795 &self.control_handle
2796 }
2797
2798 fn drop_without_shutdown(mut self) {
2799 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2801 std::mem::forget(self);
2803 }
2804}
2805
2806impl SignerSignHashResponder {
2807 pub fn send(self, mut result: Result<&[u8], ErrorCode>) -> Result<(), fidl::Error> {
2811 let _result = self.send_raw(result);
2812 if _result.is_err() {
2813 self.control_handle.shutdown();
2814 }
2815 self.drop_without_shutdown();
2816 _result
2817 }
2818
2819 pub fn send_no_shutdown_on_err(
2821 self,
2822 mut result: Result<&[u8], ErrorCode>,
2823 ) -> Result<(), fidl::Error> {
2824 let _result = self.send_raw(result);
2825 self.drop_without_shutdown();
2826 _result
2827 }
2828
2829 fn send_raw(&self, mut result: Result<&[u8], ErrorCode>) -> Result<(), fidl::Error> {
2830 self.control_handle
2831 .inner
2832 .send::<fidl::encoding::ResultType<SignerSignHashResponse, ErrorCode>>(
2833 result.map(|signature| (signature,)),
2834 self.tx_id,
2835 0x3bfb1667fc4fe864,
2836 fidl::encoding::DynamicFlags::empty(),
2837 )
2838 }
2839}
2840
2841#[must_use = "FIDL methods require a response to be sent"]
2842#[derive(Debug)]
2843pub struct SignerSignHashWithPrivateKeyResponder {
2844 control_handle: std::mem::ManuallyDrop<SignerControlHandle>,
2845 tx_id: u32,
2846}
2847
2848impl std::ops::Drop for SignerSignHashWithPrivateKeyResponder {
2852 fn drop(&mut self) {
2853 self.control_handle.shutdown();
2854 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2856 }
2857}
2858
2859impl fidl::endpoints::Responder for SignerSignHashWithPrivateKeyResponder {
2860 type ControlHandle = SignerControlHandle;
2861
2862 fn control_handle(&self) -> &SignerControlHandle {
2863 &self.control_handle
2864 }
2865
2866 fn drop_without_shutdown(mut self) {
2867 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2869 std::mem::forget(self);
2871 }
2872}
2873
2874impl SignerSignHashWithPrivateKeyResponder {
2875 pub fn send(self, mut result: Result<&[u8], ErrorCode>) -> Result<(), fidl::Error> {
2879 let _result = self.send_raw(result);
2880 if _result.is_err() {
2881 self.control_handle.shutdown();
2882 }
2883 self.drop_without_shutdown();
2884 _result
2885 }
2886
2887 pub fn send_no_shutdown_on_err(
2889 self,
2890 mut result: Result<&[u8], ErrorCode>,
2891 ) -> Result<(), fidl::Error> {
2892 let _result = self.send_raw(result);
2893 self.drop_without_shutdown();
2894 _result
2895 }
2896
2897 fn send_raw(&self, mut result: Result<&[u8], ErrorCode>) -> Result<(), fidl::Error> {
2898 self.control_handle.inner.send::<fidl::encoding::ResultType<
2899 SignerSignHashWithPrivateKeyResponse,
2900 ErrorCode,
2901 >>(
2902 result.map(|signature| (signature,)),
2903 self.tx_id,
2904 0x23e8ae3490affc11,
2905 fidl::encoding::DynamicFlags::empty(),
2906 )
2907 }
2908}
2909
2910#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2911pub struct StackMarker;
2912
2913impl fidl::endpoints::ProtocolMarker for StackMarker {
2914 type Proxy = StackProxy;
2915 type RequestStream = StackRequestStream;
2916 #[cfg(target_os = "fuchsia")]
2917 type SynchronousProxy = StackSynchronousProxy;
2918
2919 const DEBUG_NAME: &'static str = "fuchsia.weave.Stack";
2920}
2921impl fidl::endpoints::DiscoverableProtocolMarker for StackMarker {}
2922pub type StackGetQrCodeResult = Result<QrCode, ErrorCode>;
2923pub type StackResetConfigResult = Result<(), ErrorCode>;
2924
2925pub trait StackProxyInterface: Send + Sync {
2926 fn r#get_pairing_state_watcher(
2927 &self,
2928 watcher: fidl::endpoints::ServerEnd<PairingStateWatcherMarker>,
2929 ) -> Result<(), fidl::Error>;
2930 fn r#get_svc_directory_watcher(
2931 &self,
2932 endpoint_id: u64,
2933 watcher: fidl::endpoints::ServerEnd<SvcDirectoryWatcherMarker>,
2934 ) -> Result<(), fidl::Error>;
2935 type GetQrCodeResponseFut: std::future::Future<Output = Result<StackGetQrCodeResult, fidl::Error>>
2936 + Send;
2937 fn r#get_qr_code(&self) -> Self::GetQrCodeResponseFut;
2938 type ResetConfigResponseFut: std::future::Future<Output = Result<StackResetConfigResult, fidl::Error>>
2939 + Send;
2940 fn r#reset_config(&self, flags: ResetConfigFlags) -> Self::ResetConfigResponseFut;
2941}
2942#[derive(Debug)]
2943#[cfg(target_os = "fuchsia")]
2944pub struct StackSynchronousProxy {
2945 client: fidl::client::sync::Client,
2946}
2947
2948#[cfg(target_os = "fuchsia")]
2949impl fidl::endpoints::SynchronousProxy for StackSynchronousProxy {
2950 type Proxy = StackProxy;
2951 type Protocol = StackMarker;
2952
2953 fn from_channel(inner: fidl::Channel) -> Self {
2954 Self::new(inner)
2955 }
2956
2957 fn into_channel(self) -> fidl::Channel {
2958 self.client.into_channel()
2959 }
2960
2961 fn as_channel(&self) -> &fidl::Channel {
2962 self.client.as_channel()
2963 }
2964}
2965
2966#[cfg(target_os = "fuchsia")]
2967impl StackSynchronousProxy {
2968 pub fn new(channel: fidl::Channel) -> Self {
2969 let protocol_name = <StackMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2970 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2971 }
2972
2973 pub fn into_channel(self) -> fidl::Channel {
2974 self.client.into_channel()
2975 }
2976
2977 pub fn wait_for_event(
2980 &self,
2981 deadline: zx::MonotonicInstant,
2982 ) -> Result<StackEvent, fidl::Error> {
2983 StackEvent::decode(self.client.wait_for_event(deadline)?)
2984 }
2985
2986 pub fn r#get_pairing_state_watcher(
2988 &self,
2989 mut watcher: fidl::endpoints::ServerEnd<PairingStateWatcherMarker>,
2990 ) -> Result<(), fidl::Error> {
2991 self.client.send::<StackGetPairingStateWatcherRequest>(
2992 (watcher,),
2993 0x674bbfa106efdc8d,
2994 fidl::encoding::DynamicFlags::empty(),
2995 )
2996 }
2997
2998 pub fn r#get_svc_directory_watcher(
3001 &self,
3002 mut endpoint_id: u64,
3003 mut watcher: fidl::endpoints::ServerEnd<SvcDirectoryWatcherMarker>,
3004 ) -> Result<(), fidl::Error> {
3005 self.client.send::<StackGetSvcDirectoryWatcherRequest>(
3006 (endpoint_id, watcher),
3007 0x261fdbc7a8447180,
3008 fidl::encoding::DynamicFlags::empty(),
3009 )
3010 }
3011
3012 pub fn r#get_qr_code(
3014 &self,
3015 ___deadline: zx::MonotonicInstant,
3016 ) -> Result<StackGetQrCodeResult, fidl::Error> {
3017 let _response = self.client.send_query::<
3018 fidl::encoding::EmptyPayload,
3019 fidl::encoding::ResultType<StackGetQrCodeResponse, ErrorCode>,
3020 >(
3021 (),
3022 0x79e435f04eb8d342,
3023 fidl::encoding::DynamicFlags::empty(),
3024 ___deadline,
3025 )?;
3026 Ok(_response.map(|x| x.qr_code))
3027 }
3028
3029 pub fn r#reset_config(
3031 &self,
3032 mut flags: ResetConfigFlags,
3033 ___deadline: zx::MonotonicInstant,
3034 ) -> Result<StackResetConfigResult, fidl::Error> {
3035 let _response = self.client.send_query::<
3036 StackResetConfigRequest,
3037 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ErrorCode>,
3038 >(
3039 (flags,),
3040 0x7a009a9b62d35c10,
3041 fidl::encoding::DynamicFlags::empty(),
3042 ___deadline,
3043 )?;
3044 Ok(_response.map(|x| x))
3045 }
3046}
3047
3048#[derive(Debug, Clone)]
3049pub struct StackProxy {
3050 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3051}
3052
3053impl fidl::endpoints::Proxy for StackProxy {
3054 type Protocol = StackMarker;
3055
3056 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3057 Self::new(inner)
3058 }
3059
3060 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3061 self.client.into_channel().map_err(|client| Self { client })
3062 }
3063
3064 fn as_channel(&self) -> &::fidl::AsyncChannel {
3065 self.client.as_channel()
3066 }
3067}
3068
3069impl StackProxy {
3070 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3072 let protocol_name = <StackMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3073 Self { client: fidl::client::Client::new(channel, protocol_name) }
3074 }
3075
3076 pub fn take_event_stream(&self) -> StackEventStream {
3082 StackEventStream { event_receiver: self.client.take_event_receiver() }
3083 }
3084
3085 pub fn r#get_pairing_state_watcher(
3087 &self,
3088 mut watcher: fidl::endpoints::ServerEnd<PairingStateWatcherMarker>,
3089 ) -> Result<(), fidl::Error> {
3090 StackProxyInterface::r#get_pairing_state_watcher(self, watcher)
3091 }
3092
3093 pub fn r#get_svc_directory_watcher(
3096 &self,
3097 mut endpoint_id: u64,
3098 mut watcher: fidl::endpoints::ServerEnd<SvcDirectoryWatcherMarker>,
3099 ) -> Result<(), fidl::Error> {
3100 StackProxyInterface::r#get_svc_directory_watcher(self, endpoint_id, watcher)
3101 }
3102
3103 pub fn r#get_qr_code(
3105 &self,
3106 ) -> fidl::client::QueryResponseFut<
3107 StackGetQrCodeResult,
3108 fidl::encoding::DefaultFuchsiaResourceDialect,
3109 > {
3110 StackProxyInterface::r#get_qr_code(self)
3111 }
3112
3113 pub fn r#reset_config(
3115 &self,
3116 mut flags: ResetConfigFlags,
3117 ) -> fidl::client::QueryResponseFut<
3118 StackResetConfigResult,
3119 fidl::encoding::DefaultFuchsiaResourceDialect,
3120 > {
3121 StackProxyInterface::r#reset_config(self, flags)
3122 }
3123}
3124
3125impl StackProxyInterface for StackProxy {
3126 fn r#get_pairing_state_watcher(
3127 &self,
3128 mut watcher: fidl::endpoints::ServerEnd<PairingStateWatcherMarker>,
3129 ) -> Result<(), fidl::Error> {
3130 self.client.send::<StackGetPairingStateWatcherRequest>(
3131 (watcher,),
3132 0x674bbfa106efdc8d,
3133 fidl::encoding::DynamicFlags::empty(),
3134 )
3135 }
3136
3137 fn r#get_svc_directory_watcher(
3138 &self,
3139 mut endpoint_id: u64,
3140 mut watcher: fidl::endpoints::ServerEnd<SvcDirectoryWatcherMarker>,
3141 ) -> Result<(), fidl::Error> {
3142 self.client.send::<StackGetSvcDirectoryWatcherRequest>(
3143 (endpoint_id, watcher),
3144 0x261fdbc7a8447180,
3145 fidl::encoding::DynamicFlags::empty(),
3146 )
3147 }
3148
3149 type GetQrCodeResponseFut = fidl::client::QueryResponseFut<
3150 StackGetQrCodeResult,
3151 fidl::encoding::DefaultFuchsiaResourceDialect,
3152 >;
3153 fn r#get_qr_code(&self) -> Self::GetQrCodeResponseFut {
3154 fn _decode(
3155 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3156 ) -> Result<StackGetQrCodeResult, fidl::Error> {
3157 let _response = fidl::client::decode_transaction_body::<
3158 fidl::encoding::ResultType<StackGetQrCodeResponse, ErrorCode>,
3159 fidl::encoding::DefaultFuchsiaResourceDialect,
3160 0x79e435f04eb8d342,
3161 >(_buf?)?;
3162 Ok(_response.map(|x| x.qr_code))
3163 }
3164 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, StackGetQrCodeResult>(
3165 (),
3166 0x79e435f04eb8d342,
3167 fidl::encoding::DynamicFlags::empty(),
3168 _decode,
3169 )
3170 }
3171
3172 type ResetConfigResponseFut = fidl::client::QueryResponseFut<
3173 StackResetConfigResult,
3174 fidl::encoding::DefaultFuchsiaResourceDialect,
3175 >;
3176 fn r#reset_config(&self, mut flags: ResetConfigFlags) -> Self::ResetConfigResponseFut {
3177 fn _decode(
3178 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3179 ) -> Result<StackResetConfigResult, fidl::Error> {
3180 let _response = fidl::client::decode_transaction_body::<
3181 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ErrorCode>,
3182 fidl::encoding::DefaultFuchsiaResourceDialect,
3183 0x7a009a9b62d35c10,
3184 >(_buf?)?;
3185 Ok(_response.map(|x| x))
3186 }
3187 self.client.send_query_and_decode::<StackResetConfigRequest, StackResetConfigResult>(
3188 (flags,),
3189 0x7a009a9b62d35c10,
3190 fidl::encoding::DynamicFlags::empty(),
3191 _decode,
3192 )
3193 }
3194}
3195
3196pub struct StackEventStream {
3197 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3198}
3199
3200impl std::marker::Unpin for StackEventStream {}
3201
3202impl futures::stream::FusedStream for StackEventStream {
3203 fn is_terminated(&self) -> bool {
3204 self.event_receiver.is_terminated()
3205 }
3206}
3207
3208impl futures::Stream for StackEventStream {
3209 type Item = Result<StackEvent, fidl::Error>;
3210
3211 fn poll_next(
3212 mut self: std::pin::Pin<&mut Self>,
3213 cx: &mut std::task::Context<'_>,
3214 ) -> std::task::Poll<Option<Self::Item>> {
3215 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3216 &mut self.event_receiver,
3217 cx
3218 )?) {
3219 Some(buf) => std::task::Poll::Ready(Some(StackEvent::decode(buf))),
3220 None => std::task::Poll::Ready(None),
3221 }
3222 }
3223}
3224
3225#[derive(Debug)]
3226pub enum StackEvent {}
3227
3228impl StackEvent {
3229 fn decode(
3231 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3232 ) -> Result<StackEvent, fidl::Error> {
3233 let (bytes, _handles) = buf.split_mut();
3234 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3235 debug_assert_eq!(tx_header.tx_id, 0);
3236 match tx_header.ordinal {
3237 _ => Err(fidl::Error::UnknownOrdinal {
3238 ordinal: tx_header.ordinal,
3239 protocol_name: <StackMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3240 }),
3241 }
3242 }
3243}
3244
3245pub struct StackRequestStream {
3247 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3248 is_terminated: bool,
3249}
3250
3251impl std::marker::Unpin for StackRequestStream {}
3252
3253impl futures::stream::FusedStream for StackRequestStream {
3254 fn is_terminated(&self) -> bool {
3255 self.is_terminated
3256 }
3257}
3258
3259impl fidl::endpoints::RequestStream for StackRequestStream {
3260 type Protocol = StackMarker;
3261 type ControlHandle = StackControlHandle;
3262
3263 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3264 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3265 }
3266
3267 fn control_handle(&self) -> Self::ControlHandle {
3268 StackControlHandle { inner: self.inner.clone() }
3269 }
3270
3271 fn into_inner(
3272 self,
3273 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3274 {
3275 (self.inner, self.is_terminated)
3276 }
3277
3278 fn from_inner(
3279 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3280 is_terminated: bool,
3281 ) -> Self {
3282 Self { inner, is_terminated }
3283 }
3284}
3285
3286impl futures::Stream for StackRequestStream {
3287 type Item = Result<StackRequest, fidl::Error>;
3288
3289 fn poll_next(
3290 mut self: std::pin::Pin<&mut Self>,
3291 cx: &mut std::task::Context<'_>,
3292 ) -> std::task::Poll<Option<Self::Item>> {
3293 let this = &mut *self;
3294 if this.inner.check_shutdown(cx) {
3295 this.is_terminated = true;
3296 return std::task::Poll::Ready(None);
3297 }
3298 if this.is_terminated {
3299 panic!("polled StackRequestStream after completion");
3300 }
3301 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3302 |bytes, handles| {
3303 match this.inner.channel().read_etc(cx, bytes, handles) {
3304 std::task::Poll::Ready(Ok(())) => {}
3305 std::task::Poll::Pending => return std::task::Poll::Pending,
3306 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3307 this.is_terminated = true;
3308 return std::task::Poll::Ready(None);
3309 }
3310 std::task::Poll::Ready(Err(e)) => {
3311 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3312 e.into(),
3313 ))))
3314 }
3315 }
3316
3317 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3319
3320 std::task::Poll::Ready(Some(match header.ordinal {
3321 0x674bbfa106efdc8d => {
3322 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3323 let mut req = fidl::new_empty!(
3324 StackGetPairingStateWatcherRequest,
3325 fidl::encoding::DefaultFuchsiaResourceDialect
3326 );
3327 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StackGetPairingStateWatcherRequest>(&header, _body_bytes, handles, &mut req)?;
3328 let control_handle = StackControlHandle { inner: this.inner.clone() };
3329 Ok(StackRequest::GetPairingStateWatcher {
3330 watcher: req.watcher,
3331
3332 control_handle,
3333 })
3334 }
3335 0x261fdbc7a8447180 => {
3336 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3337 let mut req = fidl::new_empty!(
3338 StackGetSvcDirectoryWatcherRequest,
3339 fidl::encoding::DefaultFuchsiaResourceDialect
3340 );
3341 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StackGetSvcDirectoryWatcherRequest>(&header, _body_bytes, handles, &mut req)?;
3342 let control_handle = StackControlHandle { inner: this.inner.clone() };
3343 Ok(StackRequest::GetSvcDirectoryWatcher {
3344 endpoint_id: req.endpoint_id,
3345 watcher: req.watcher,
3346
3347 control_handle,
3348 })
3349 }
3350 0x79e435f04eb8d342 => {
3351 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3352 let mut req = fidl::new_empty!(
3353 fidl::encoding::EmptyPayload,
3354 fidl::encoding::DefaultFuchsiaResourceDialect
3355 );
3356 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3357 let control_handle = StackControlHandle { inner: this.inner.clone() };
3358 Ok(StackRequest::GetQrCode {
3359 responder: StackGetQrCodeResponder {
3360 control_handle: std::mem::ManuallyDrop::new(control_handle),
3361 tx_id: header.tx_id,
3362 },
3363 })
3364 }
3365 0x7a009a9b62d35c10 => {
3366 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3367 let mut req = fidl::new_empty!(
3368 StackResetConfigRequest,
3369 fidl::encoding::DefaultFuchsiaResourceDialect
3370 );
3371 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StackResetConfigRequest>(&header, _body_bytes, handles, &mut req)?;
3372 let control_handle = StackControlHandle { inner: this.inner.clone() };
3373 Ok(StackRequest::ResetConfig {
3374 flags: req.flags,
3375
3376 responder: StackResetConfigResponder {
3377 control_handle: std::mem::ManuallyDrop::new(control_handle),
3378 tx_id: header.tx_id,
3379 },
3380 })
3381 }
3382 _ => Err(fidl::Error::UnknownOrdinal {
3383 ordinal: header.ordinal,
3384 protocol_name: <StackMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3385 }),
3386 }))
3387 },
3388 )
3389 }
3390}
3391
3392#[derive(Debug)]
3397pub enum StackRequest {
3398 GetPairingStateWatcher {
3400 watcher: fidl::endpoints::ServerEnd<PairingStateWatcherMarker>,
3401 control_handle: StackControlHandle,
3402 },
3403 GetSvcDirectoryWatcher {
3406 endpoint_id: u64,
3407 watcher: fidl::endpoints::ServerEnd<SvcDirectoryWatcherMarker>,
3408 control_handle: StackControlHandle,
3409 },
3410 GetQrCode { responder: StackGetQrCodeResponder },
3412 ResetConfig { flags: ResetConfigFlags, responder: StackResetConfigResponder },
3414}
3415
3416impl StackRequest {
3417 #[allow(irrefutable_let_patterns)]
3418 pub fn into_get_pairing_state_watcher(
3419 self,
3420 ) -> Option<(fidl::endpoints::ServerEnd<PairingStateWatcherMarker>, StackControlHandle)> {
3421 if let StackRequest::GetPairingStateWatcher { watcher, control_handle } = self {
3422 Some((watcher, control_handle))
3423 } else {
3424 None
3425 }
3426 }
3427
3428 #[allow(irrefutable_let_patterns)]
3429 pub fn into_get_svc_directory_watcher(
3430 self,
3431 ) -> Option<(u64, fidl::endpoints::ServerEnd<SvcDirectoryWatcherMarker>, StackControlHandle)>
3432 {
3433 if let StackRequest::GetSvcDirectoryWatcher { endpoint_id, watcher, control_handle } = self
3434 {
3435 Some((endpoint_id, watcher, control_handle))
3436 } else {
3437 None
3438 }
3439 }
3440
3441 #[allow(irrefutable_let_patterns)]
3442 pub fn into_get_qr_code(self) -> Option<(StackGetQrCodeResponder)> {
3443 if let StackRequest::GetQrCode { responder } = self {
3444 Some((responder))
3445 } else {
3446 None
3447 }
3448 }
3449
3450 #[allow(irrefutable_let_patterns)]
3451 pub fn into_reset_config(self) -> Option<(ResetConfigFlags, StackResetConfigResponder)> {
3452 if let StackRequest::ResetConfig { flags, responder } = self {
3453 Some((flags, responder))
3454 } else {
3455 None
3456 }
3457 }
3458
3459 pub fn method_name(&self) -> &'static str {
3461 match *self {
3462 StackRequest::GetPairingStateWatcher { .. } => "get_pairing_state_watcher",
3463 StackRequest::GetSvcDirectoryWatcher { .. } => "get_svc_directory_watcher",
3464 StackRequest::GetQrCode { .. } => "get_qr_code",
3465 StackRequest::ResetConfig { .. } => "reset_config",
3466 }
3467 }
3468}
3469
3470#[derive(Debug, Clone)]
3471pub struct StackControlHandle {
3472 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3473}
3474
3475impl fidl::endpoints::ControlHandle for StackControlHandle {
3476 fn shutdown(&self) {
3477 self.inner.shutdown()
3478 }
3479 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3480 self.inner.shutdown_with_epitaph(status)
3481 }
3482
3483 fn is_closed(&self) -> bool {
3484 self.inner.channel().is_closed()
3485 }
3486 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3487 self.inner.channel().on_closed()
3488 }
3489
3490 #[cfg(target_os = "fuchsia")]
3491 fn signal_peer(
3492 &self,
3493 clear_mask: zx::Signals,
3494 set_mask: zx::Signals,
3495 ) -> Result<(), zx_status::Status> {
3496 use fidl::Peered;
3497 self.inner.channel().signal_peer(clear_mask, set_mask)
3498 }
3499}
3500
3501impl StackControlHandle {}
3502
3503#[must_use = "FIDL methods require a response to be sent"]
3504#[derive(Debug)]
3505pub struct StackGetQrCodeResponder {
3506 control_handle: std::mem::ManuallyDrop<StackControlHandle>,
3507 tx_id: u32,
3508}
3509
3510impl std::ops::Drop for StackGetQrCodeResponder {
3514 fn drop(&mut self) {
3515 self.control_handle.shutdown();
3516 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3518 }
3519}
3520
3521impl fidl::endpoints::Responder for StackGetQrCodeResponder {
3522 type ControlHandle = StackControlHandle;
3523
3524 fn control_handle(&self) -> &StackControlHandle {
3525 &self.control_handle
3526 }
3527
3528 fn drop_without_shutdown(mut self) {
3529 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3531 std::mem::forget(self);
3533 }
3534}
3535
3536impl StackGetQrCodeResponder {
3537 pub fn send(self, mut result: Result<&QrCode, ErrorCode>) -> Result<(), fidl::Error> {
3541 let _result = self.send_raw(result);
3542 if _result.is_err() {
3543 self.control_handle.shutdown();
3544 }
3545 self.drop_without_shutdown();
3546 _result
3547 }
3548
3549 pub fn send_no_shutdown_on_err(
3551 self,
3552 mut result: Result<&QrCode, ErrorCode>,
3553 ) -> Result<(), fidl::Error> {
3554 let _result = self.send_raw(result);
3555 self.drop_without_shutdown();
3556 _result
3557 }
3558
3559 fn send_raw(&self, mut result: Result<&QrCode, ErrorCode>) -> Result<(), fidl::Error> {
3560 self.control_handle
3561 .inner
3562 .send::<fidl::encoding::ResultType<StackGetQrCodeResponse, ErrorCode>>(
3563 result.map(|qr_code| (qr_code,)),
3564 self.tx_id,
3565 0x79e435f04eb8d342,
3566 fidl::encoding::DynamicFlags::empty(),
3567 )
3568 }
3569}
3570
3571#[must_use = "FIDL methods require a response to be sent"]
3572#[derive(Debug)]
3573pub struct StackResetConfigResponder {
3574 control_handle: std::mem::ManuallyDrop<StackControlHandle>,
3575 tx_id: u32,
3576}
3577
3578impl std::ops::Drop for StackResetConfigResponder {
3582 fn drop(&mut self) {
3583 self.control_handle.shutdown();
3584 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3586 }
3587}
3588
3589impl fidl::endpoints::Responder for StackResetConfigResponder {
3590 type ControlHandle = StackControlHandle;
3591
3592 fn control_handle(&self) -> &StackControlHandle {
3593 &self.control_handle
3594 }
3595
3596 fn drop_without_shutdown(mut self) {
3597 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3599 std::mem::forget(self);
3601 }
3602}
3603
3604impl StackResetConfigResponder {
3605 pub fn send(self, mut result: Result<(), ErrorCode>) -> Result<(), fidl::Error> {
3609 let _result = self.send_raw(result);
3610 if _result.is_err() {
3611 self.control_handle.shutdown();
3612 }
3613 self.drop_without_shutdown();
3614 _result
3615 }
3616
3617 pub fn send_no_shutdown_on_err(
3619 self,
3620 mut result: Result<(), ErrorCode>,
3621 ) -> Result<(), fidl::Error> {
3622 let _result = self.send_raw(result);
3623 self.drop_without_shutdown();
3624 _result
3625 }
3626
3627 fn send_raw(&self, mut result: Result<(), ErrorCode>) -> Result<(), fidl::Error> {
3628 self.control_handle
3629 .inner
3630 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ErrorCode>>(
3631 result,
3632 self.tx_id,
3633 0x7a009a9b62d35c10,
3634 fidl::encoding::DynamicFlags::empty(),
3635 )
3636 }
3637}
3638
3639#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3640pub struct StackProviderMarker;
3641
3642impl fidl::endpoints::ProtocolMarker for StackProviderMarker {
3643 type Proxy = StackProviderProxy;
3644 type RequestStream = StackProviderRequestStream;
3645 #[cfg(target_os = "fuchsia")]
3646 type SynchronousProxy = StackProviderSynchronousProxy;
3647
3648 const DEBUG_NAME: &'static str = "fuchsia.weave.StackProvider";
3649}
3650impl fidl::endpoints::DiscoverableProtocolMarker for StackProviderMarker {}
3651
3652pub trait StackProviderProxyInterface: Send + Sync {
3653 fn r#set_wlan_network_config_provider(
3654 &self,
3655 provider: fidl::endpoints::ClientEnd<WlanNetworkConfigProviderMarker>,
3656 ) -> Result<(), fidl::Error>;
3657}
3658#[derive(Debug)]
3659#[cfg(target_os = "fuchsia")]
3660pub struct StackProviderSynchronousProxy {
3661 client: fidl::client::sync::Client,
3662}
3663
3664#[cfg(target_os = "fuchsia")]
3665impl fidl::endpoints::SynchronousProxy for StackProviderSynchronousProxy {
3666 type Proxy = StackProviderProxy;
3667 type Protocol = StackProviderMarker;
3668
3669 fn from_channel(inner: fidl::Channel) -> Self {
3670 Self::new(inner)
3671 }
3672
3673 fn into_channel(self) -> fidl::Channel {
3674 self.client.into_channel()
3675 }
3676
3677 fn as_channel(&self) -> &fidl::Channel {
3678 self.client.as_channel()
3679 }
3680}
3681
3682#[cfg(target_os = "fuchsia")]
3683impl StackProviderSynchronousProxy {
3684 pub fn new(channel: fidl::Channel) -> Self {
3685 let protocol_name = <StackProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3686 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3687 }
3688
3689 pub fn into_channel(self) -> fidl::Channel {
3690 self.client.into_channel()
3691 }
3692
3693 pub fn wait_for_event(
3696 &self,
3697 deadline: zx::MonotonicInstant,
3698 ) -> Result<StackProviderEvent, fidl::Error> {
3699 StackProviderEvent::decode(self.client.wait_for_event(deadline)?)
3700 }
3701
3702 pub fn r#set_wlan_network_config_provider(
3712 &self,
3713 mut provider: fidl::endpoints::ClientEnd<WlanNetworkConfigProviderMarker>,
3714 ) -> Result<(), fidl::Error> {
3715 self.client.send::<StackProviderSetWlanNetworkConfigProviderRequest>(
3716 (provider,),
3717 0x60f817738f6028b4,
3718 fidl::encoding::DynamicFlags::empty(),
3719 )
3720 }
3721}
3722
3723#[derive(Debug, Clone)]
3724pub struct StackProviderProxy {
3725 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3726}
3727
3728impl fidl::endpoints::Proxy for StackProviderProxy {
3729 type Protocol = StackProviderMarker;
3730
3731 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3732 Self::new(inner)
3733 }
3734
3735 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3736 self.client.into_channel().map_err(|client| Self { client })
3737 }
3738
3739 fn as_channel(&self) -> &::fidl::AsyncChannel {
3740 self.client.as_channel()
3741 }
3742}
3743
3744impl StackProviderProxy {
3745 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3747 let protocol_name = <StackProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3748 Self { client: fidl::client::Client::new(channel, protocol_name) }
3749 }
3750
3751 pub fn take_event_stream(&self) -> StackProviderEventStream {
3757 StackProviderEventStream { event_receiver: self.client.take_event_receiver() }
3758 }
3759
3760 pub fn r#set_wlan_network_config_provider(
3770 &self,
3771 mut provider: fidl::endpoints::ClientEnd<WlanNetworkConfigProviderMarker>,
3772 ) -> Result<(), fidl::Error> {
3773 StackProviderProxyInterface::r#set_wlan_network_config_provider(self, provider)
3774 }
3775}
3776
3777impl StackProviderProxyInterface for StackProviderProxy {
3778 fn r#set_wlan_network_config_provider(
3779 &self,
3780 mut provider: fidl::endpoints::ClientEnd<WlanNetworkConfigProviderMarker>,
3781 ) -> Result<(), fidl::Error> {
3782 self.client.send::<StackProviderSetWlanNetworkConfigProviderRequest>(
3783 (provider,),
3784 0x60f817738f6028b4,
3785 fidl::encoding::DynamicFlags::empty(),
3786 )
3787 }
3788}
3789
3790pub struct StackProviderEventStream {
3791 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3792}
3793
3794impl std::marker::Unpin for StackProviderEventStream {}
3795
3796impl futures::stream::FusedStream for StackProviderEventStream {
3797 fn is_terminated(&self) -> bool {
3798 self.event_receiver.is_terminated()
3799 }
3800}
3801
3802impl futures::Stream for StackProviderEventStream {
3803 type Item = Result<StackProviderEvent, fidl::Error>;
3804
3805 fn poll_next(
3806 mut self: std::pin::Pin<&mut Self>,
3807 cx: &mut std::task::Context<'_>,
3808 ) -> std::task::Poll<Option<Self::Item>> {
3809 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3810 &mut self.event_receiver,
3811 cx
3812 )?) {
3813 Some(buf) => std::task::Poll::Ready(Some(StackProviderEvent::decode(buf))),
3814 None => std::task::Poll::Ready(None),
3815 }
3816 }
3817}
3818
3819#[derive(Debug)]
3820pub enum StackProviderEvent {}
3821
3822impl StackProviderEvent {
3823 fn decode(
3825 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3826 ) -> Result<StackProviderEvent, fidl::Error> {
3827 let (bytes, _handles) = buf.split_mut();
3828 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3829 debug_assert_eq!(tx_header.tx_id, 0);
3830 match tx_header.ordinal {
3831 _ => Err(fidl::Error::UnknownOrdinal {
3832 ordinal: tx_header.ordinal,
3833 protocol_name: <StackProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3834 }),
3835 }
3836 }
3837}
3838
3839pub struct StackProviderRequestStream {
3841 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3842 is_terminated: bool,
3843}
3844
3845impl std::marker::Unpin for StackProviderRequestStream {}
3846
3847impl futures::stream::FusedStream for StackProviderRequestStream {
3848 fn is_terminated(&self) -> bool {
3849 self.is_terminated
3850 }
3851}
3852
3853impl fidl::endpoints::RequestStream for StackProviderRequestStream {
3854 type Protocol = StackProviderMarker;
3855 type ControlHandle = StackProviderControlHandle;
3856
3857 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3858 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3859 }
3860
3861 fn control_handle(&self) -> Self::ControlHandle {
3862 StackProviderControlHandle { inner: self.inner.clone() }
3863 }
3864
3865 fn into_inner(
3866 self,
3867 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3868 {
3869 (self.inner, self.is_terminated)
3870 }
3871
3872 fn from_inner(
3873 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3874 is_terminated: bool,
3875 ) -> Self {
3876 Self { inner, is_terminated }
3877 }
3878}
3879
3880impl futures::Stream for StackProviderRequestStream {
3881 type Item = Result<StackProviderRequest, fidl::Error>;
3882
3883 fn poll_next(
3884 mut self: std::pin::Pin<&mut Self>,
3885 cx: &mut std::task::Context<'_>,
3886 ) -> std::task::Poll<Option<Self::Item>> {
3887 let this = &mut *self;
3888 if this.inner.check_shutdown(cx) {
3889 this.is_terminated = true;
3890 return std::task::Poll::Ready(None);
3891 }
3892 if this.is_terminated {
3893 panic!("polled StackProviderRequestStream after completion");
3894 }
3895 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3896 |bytes, handles| {
3897 match this.inner.channel().read_etc(cx, bytes, handles) {
3898 std::task::Poll::Ready(Ok(())) => {}
3899 std::task::Poll::Pending => return std::task::Poll::Pending,
3900 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3901 this.is_terminated = true;
3902 return std::task::Poll::Ready(None);
3903 }
3904 std::task::Poll::Ready(Err(e)) => {
3905 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3906 e.into(),
3907 ))))
3908 }
3909 }
3910
3911 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3913
3914 std::task::Poll::Ready(Some(match header.ordinal {
3915 0x60f817738f6028b4 => {
3916 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3917 let mut req = fidl::new_empty!(
3918 StackProviderSetWlanNetworkConfigProviderRequest,
3919 fidl::encoding::DefaultFuchsiaResourceDialect
3920 );
3921 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StackProviderSetWlanNetworkConfigProviderRequest>(&header, _body_bytes, handles, &mut req)?;
3922 let control_handle =
3923 StackProviderControlHandle { inner: this.inner.clone() };
3924 Ok(StackProviderRequest::SetWlanNetworkConfigProvider {
3925 provider: req.provider,
3926
3927 control_handle,
3928 })
3929 }
3930 _ => Err(fidl::Error::UnknownOrdinal {
3931 ordinal: header.ordinal,
3932 protocol_name:
3933 <StackProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3934 }),
3935 }))
3936 },
3937 )
3938 }
3939}
3940
3941#[derive(Debug)]
3943pub enum StackProviderRequest {
3944 SetWlanNetworkConfigProvider {
3954 provider: fidl::endpoints::ClientEnd<WlanNetworkConfigProviderMarker>,
3955 control_handle: StackProviderControlHandle,
3956 },
3957}
3958
3959impl StackProviderRequest {
3960 #[allow(irrefutable_let_patterns)]
3961 pub fn into_set_wlan_network_config_provider(
3962 self,
3963 ) -> Option<(
3964 fidl::endpoints::ClientEnd<WlanNetworkConfigProviderMarker>,
3965 StackProviderControlHandle,
3966 )> {
3967 if let StackProviderRequest::SetWlanNetworkConfigProvider { provider, control_handle } =
3968 self
3969 {
3970 Some((provider, control_handle))
3971 } else {
3972 None
3973 }
3974 }
3975
3976 pub fn method_name(&self) -> &'static str {
3978 match *self {
3979 StackProviderRequest::SetWlanNetworkConfigProvider { .. } => {
3980 "set_wlan_network_config_provider"
3981 }
3982 }
3983 }
3984}
3985
3986#[derive(Debug, Clone)]
3987pub struct StackProviderControlHandle {
3988 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3989}
3990
3991impl fidl::endpoints::ControlHandle for StackProviderControlHandle {
3992 fn shutdown(&self) {
3993 self.inner.shutdown()
3994 }
3995 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3996 self.inner.shutdown_with_epitaph(status)
3997 }
3998
3999 fn is_closed(&self) -> bool {
4000 self.inner.channel().is_closed()
4001 }
4002 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4003 self.inner.channel().on_closed()
4004 }
4005
4006 #[cfg(target_os = "fuchsia")]
4007 fn signal_peer(
4008 &self,
4009 clear_mask: zx::Signals,
4010 set_mask: zx::Signals,
4011 ) -> Result<(), zx_status::Status> {
4012 use fidl::Peered;
4013 self.inner.channel().signal_peer(clear_mask, set_mask)
4014 }
4015}
4016
4017impl StackProviderControlHandle {}
4018
4019#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4020pub struct SvcDirectoryWatcherMarker;
4021
4022impl fidl::endpoints::ProtocolMarker for SvcDirectoryWatcherMarker {
4023 type Proxy = SvcDirectoryWatcherProxy;
4024 type RequestStream = SvcDirectoryWatcherRequestStream;
4025 #[cfg(target_os = "fuchsia")]
4026 type SynchronousProxy = SvcDirectoryWatcherSynchronousProxy;
4027
4028 const DEBUG_NAME: &'static str = "(anonymous) SvcDirectoryWatcher";
4029}
4030
4031pub trait SvcDirectoryWatcherProxyInterface: Send + Sync {
4032 type WatchServiceDirectoryResponseFut: std::future::Future<Output = Result<Vec<HostPort>, fidl::Error>>
4033 + Send;
4034 fn r#watch_service_directory(&self) -> Self::WatchServiceDirectoryResponseFut;
4035}
4036#[derive(Debug)]
4037#[cfg(target_os = "fuchsia")]
4038pub struct SvcDirectoryWatcherSynchronousProxy {
4039 client: fidl::client::sync::Client,
4040}
4041
4042#[cfg(target_os = "fuchsia")]
4043impl fidl::endpoints::SynchronousProxy for SvcDirectoryWatcherSynchronousProxy {
4044 type Proxy = SvcDirectoryWatcherProxy;
4045 type Protocol = SvcDirectoryWatcherMarker;
4046
4047 fn from_channel(inner: fidl::Channel) -> Self {
4048 Self::new(inner)
4049 }
4050
4051 fn into_channel(self) -> fidl::Channel {
4052 self.client.into_channel()
4053 }
4054
4055 fn as_channel(&self) -> &fidl::Channel {
4056 self.client.as_channel()
4057 }
4058}
4059
4060#[cfg(target_os = "fuchsia")]
4061impl SvcDirectoryWatcherSynchronousProxy {
4062 pub fn new(channel: fidl::Channel) -> Self {
4063 let protocol_name =
4064 <SvcDirectoryWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4065 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4066 }
4067
4068 pub fn into_channel(self) -> fidl::Channel {
4069 self.client.into_channel()
4070 }
4071
4072 pub fn wait_for_event(
4075 &self,
4076 deadline: zx::MonotonicInstant,
4077 ) -> Result<SvcDirectoryWatcherEvent, fidl::Error> {
4078 SvcDirectoryWatcherEvent::decode(self.client.wait_for_event(deadline)?)
4079 }
4080
4081 pub fn r#watch_service_directory(
4091 &self,
4092 ___deadline: zx::MonotonicInstant,
4093 ) -> Result<Vec<HostPort>, fidl::Error> {
4094 let _response = self.client.send_query::<
4095 fidl::encoding::EmptyPayload,
4096 SvcDirectoryWatcherWatchServiceDirectoryResponse,
4097 >(
4098 (),
4099 0x4c1000286a01a142,
4100 fidl::encoding::DynamicFlags::empty(),
4101 ___deadline,
4102 )?;
4103 Ok(_response.host_port_list)
4104 }
4105}
4106
4107#[derive(Debug, Clone)]
4108pub struct SvcDirectoryWatcherProxy {
4109 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4110}
4111
4112impl fidl::endpoints::Proxy for SvcDirectoryWatcherProxy {
4113 type Protocol = SvcDirectoryWatcherMarker;
4114
4115 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4116 Self::new(inner)
4117 }
4118
4119 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4120 self.client.into_channel().map_err(|client| Self { client })
4121 }
4122
4123 fn as_channel(&self) -> &::fidl::AsyncChannel {
4124 self.client.as_channel()
4125 }
4126}
4127
4128impl SvcDirectoryWatcherProxy {
4129 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4131 let protocol_name =
4132 <SvcDirectoryWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4133 Self { client: fidl::client::Client::new(channel, protocol_name) }
4134 }
4135
4136 pub fn take_event_stream(&self) -> SvcDirectoryWatcherEventStream {
4142 SvcDirectoryWatcherEventStream { event_receiver: self.client.take_event_receiver() }
4143 }
4144
4145 pub fn r#watch_service_directory(
4155 &self,
4156 ) -> fidl::client::QueryResponseFut<Vec<HostPort>, fidl::encoding::DefaultFuchsiaResourceDialect>
4157 {
4158 SvcDirectoryWatcherProxyInterface::r#watch_service_directory(self)
4159 }
4160}
4161
4162impl SvcDirectoryWatcherProxyInterface for SvcDirectoryWatcherProxy {
4163 type WatchServiceDirectoryResponseFut = fidl::client::QueryResponseFut<
4164 Vec<HostPort>,
4165 fidl::encoding::DefaultFuchsiaResourceDialect,
4166 >;
4167 fn r#watch_service_directory(&self) -> Self::WatchServiceDirectoryResponseFut {
4168 fn _decode(
4169 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4170 ) -> Result<Vec<HostPort>, fidl::Error> {
4171 let _response = fidl::client::decode_transaction_body::<
4172 SvcDirectoryWatcherWatchServiceDirectoryResponse,
4173 fidl::encoding::DefaultFuchsiaResourceDialect,
4174 0x4c1000286a01a142,
4175 >(_buf?)?;
4176 Ok(_response.host_port_list)
4177 }
4178 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<HostPort>>(
4179 (),
4180 0x4c1000286a01a142,
4181 fidl::encoding::DynamicFlags::empty(),
4182 _decode,
4183 )
4184 }
4185}
4186
4187pub struct SvcDirectoryWatcherEventStream {
4188 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4189}
4190
4191impl std::marker::Unpin for SvcDirectoryWatcherEventStream {}
4192
4193impl futures::stream::FusedStream for SvcDirectoryWatcherEventStream {
4194 fn is_terminated(&self) -> bool {
4195 self.event_receiver.is_terminated()
4196 }
4197}
4198
4199impl futures::Stream for SvcDirectoryWatcherEventStream {
4200 type Item = Result<SvcDirectoryWatcherEvent, fidl::Error>;
4201
4202 fn poll_next(
4203 mut self: std::pin::Pin<&mut Self>,
4204 cx: &mut std::task::Context<'_>,
4205 ) -> std::task::Poll<Option<Self::Item>> {
4206 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4207 &mut self.event_receiver,
4208 cx
4209 )?) {
4210 Some(buf) => std::task::Poll::Ready(Some(SvcDirectoryWatcherEvent::decode(buf))),
4211 None => std::task::Poll::Ready(None),
4212 }
4213 }
4214}
4215
4216#[derive(Debug)]
4217pub enum SvcDirectoryWatcherEvent {}
4218
4219impl SvcDirectoryWatcherEvent {
4220 fn decode(
4222 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4223 ) -> Result<SvcDirectoryWatcherEvent, fidl::Error> {
4224 let (bytes, _handles) = buf.split_mut();
4225 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4226 debug_assert_eq!(tx_header.tx_id, 0);
4227 match tx_header.ordinal {
4228 _ => Err(fidl::Error::UnknownOrdinal {
4229 ordinal: tx_header.ordinal,
4230 protocol_name:
4231 <SvcDirectoryWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4232 }),
4233 }
4234 }
4235}
4236
4237pub struct SvcDirectoryWatcherRequestStream {
4239 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4240 is_terminated: bool,
4241}
4242
4243impl std::marker::Unpin for SvcDirectoryWatcherRequestStream {}
4244
4245impl futures::stream::FusedStream for SvcDirectoryWatcherRequestStream {
4246 fn is_terminated(&self) -> bool {
4247 self.is_terminated
4248 }
4249}
4250
4251impl fidl::endpoints::RequestStream for SvcDirectoryWatcherRequestStream {
4252 type Protocol = SvcDirectoryWatcherMarker;
4253 type ControlHandle = SvcDirectoryWatcherControlHandle;
4254
4255 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4256 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4257 }
4258
4259 fn control_handle(&self) -> Self::ControlHandle {
4260 SvcDirectoryWatcherControlHandle { inner: self.inner.clone() }
4261 }
4262
4263 fn into_inner(
4264 self,
4265 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4266 {
4267 (self.inner, self.is_terminated)
4268 }
4269
4270 fn from_inner(
4271 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4272 is_terminated: bool,
4273 ) -> Self {
4274 Self { inner, is_terminated }
4275 }
4276}
4277
4278impl futures::Stream for SvcDirectoryWatcherRequestStream {
4279 type Item = Result<SvcDirectoryWatcherRequest, fidl::Error>;
4280
4281 fn poll_next(
4282 mut self: std::pin::Pin<&mut Self>,
4283 cx: &mut std::task::Context<'_>,
4284 ) -> std::task::Poll<Option<Self::Item>> {
4285 let this = &mut *self;
4286 if this.inner.check_shutdown(cx) {
4287 this.is_terminated = true;
4288 return std::task::Poll::Ready(None);
4289 }
4290 if this.is_terminated {
4291 panic!("polled SvcDirectoryWatcherRequestStream after completion");
4292 }
4293 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4294 |bytes, handles| {
4295 match this.inner.channel().read_etc(cx, bytes, handles) {
4296 std::task::Poll::Ready(Ok(())) => {}
4297 std::task::Poll::Pending => return std::task::Poll::Pending,
4298 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4299 this.is_terminated = true;
4300 return std::task::Poll::Ready(None);
4301 }
4302 std::task::Poll::Ready(Err(e)) => {
4303 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4304 e.into(),
4305 ))))
4306 }
4307 }
4308
4309 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4311
4312 std::task::Poll::Ready(Some(match header.ordinal {
4313 0x4c1000286a01a142 => {
4314 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4315 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
4316 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4317 let control_handle = SvcDirectoryWatcherControlHandle {
4318 inner: this.inner.clone(),
4319 };
4320 Ok(SvcDirectoryWatcherRequest::WatchServiceDirectory {
4321 responder: SvcDirectoryWatcherWatchServiceDirectoryResponder {
4322 control_handle: std::mem::ManuallyDrop::new(control_handle),
4323 tx_id: header.tx_id,
4324 },
4325 })
4326 }
4327 _ => Err(fidl::Error::UnknownOrdinal {
4328 ordinal: header.ordinal,
4329 protocol_name: <SvcDirectoryWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4330 }),
4331 }))
4332 },
4333 )
4334 }
4335}
4336
4337#[derive(Debug)]
4341pub enum SvcDirectoryWatcherRequest {
4342 WatchServiceDirectory { responder: SvcDirectoryWatcherWatchServiceDirectoryResponder },
4352}
4353
4354impl SvcDirectoryWatcherRequest {
4355 #[allow(irrefutable_let_patterns)]
4356 pub fn into_watch_service_directory(
4357 self,
4358 ) -> Option<(SvcDirectoryWatcherWatchServiceDirectoryResponder)> {
4359 if let SvcDirectoryWatcherRequest::WatchServiceDirectory { responder } = self {
4360 Some((responder))
4361 } else {
4362 None
4363 }
4364 }
4365
4366 pub fn method_name(&self) -> &'static str {
4368 match *self {
4369 SvcDirectoryWatcherRequest::WatchServiceDirectory { .. } => "watch_service_directory",
4370 }
4371 }
4372}
4373
4374#[derive(Debug, Clone)]
4375pub struct SvcDirectoryWatcherControlHandle {
4376 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4377}
4378
4379impl fidl::endpoints::ControlHandle for SvcDirectoryWatcherControlHandle {
4380 fn shutdown(&self) {
4381 self.inner.shutdown()
4382 }
4383 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4384 self.inner.shutdown_with_epitaph(status)
4385 }
4386
4387 fn is_closed(&self) -> bool {
4388 self.inner.channel().is_closed()
4389 }
4390 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4391 self.inner.channel().on_closed()
4392 }
4393
4394 #[cfg(target_os = "fuchsia")]
4395 fn signal_peer(
4396 &self,
4397 clear_mask: zx::Signals,
4398 set_mask: zx::Signals,
4399 ) -> Result<(), zx_status::Status> {
4400 use fidl::Peered;
4401 self.inner.channel().signal_peer(clear_mask, set_mask)
4402 }
4403}
4404
4405impl SvcDirectoryWatcherControlHandle {}
4406
4407#[must_use = "FIDL methods require a response to be sent"]
4408#[derive(Debug)]
4409pub struct SvcDirectoryWatcherWatchServiceDirectoryResponder {
4410 control_handle: std::mem::ManuallyDrop<SvcDirectoryWatcherControlHandle>,
4411 tx_id: u32,
4412}
4413
4414impl std::ops::Drop for SvcDirectoryWatcherWatchServiceDirectoryResponder {
4418 fn drop(&mut self) {
4419 self.control_handle.shutdown();
4420 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4422 }
4423}
4424
4425impl fidl::endpoints::Responder for SvcDirectoryWatcherWatchServiceDirectoryResponder {
4426 type ControlHandle = SvcDirectoryWatcherControlHandle;
4427
4428 fn control_handle(&self) -> &SvcDirectoryWatcherControlHandle {
4429 &self.control_handle
4430 }
4431
4432 fn drop_without_shutdown(mut self) {
4433 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4435 std::mem::forget(self);
4437 }
4438}
4439
4440impl SvcDirectoryWatcherWatchServiceDirectoryResponder {
4441 pub fn send(self, mut host_port_list: &[HostPort]) -> Result<(), fidl::Error> {
4445 let _result = self.send_raw(host_port_list);
4446 if _result.is_err() {
4447 self.control_handle.shutdown();
4448 }
4449 self.drop_without_shutdown();
4450 _result
4451 }
4452
4453 pub fn send_no_shutdown_on_err(
4455 self,
4456 mut host_port_list: &[HostPort],
4457 ) -> Result<(), fidl::Error> {
4458 let _result = self.send_raw(host_port_list);
4459 self.drop_without_shutdown();
4460 _result
4461 }
4462
4463 fn send_raw(&self, mut host_port_list: &[HostPort]) -> Result<(), fidl::Error> {
4464 self.control_handle.inner.send::<SvcDirectoryWatcherWatchServiceDirectoryResponse>(
4465 (host_port_list,),
4466 self.tx_id,
4467 0x4c1000286a01a142,
4468 fidl::encoding::DynamicFlags::empty(),
4469 )
4470 }
4471}
4472
4473#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4474pub struct WlanNetworkConfigProviderMarker;
4475
4476impl fidl::endpoints::ProtocolMarker for WlanNetworkConfigProviderMarker {
4477 type Proxy = WlanNetworkConfigProviderProxy;
4478 type RequestStream = WlanNetworkConfigProviderRequestStream;
4479 #[cfg(target_os = "fuchsia")]
4480 type SynchronousProxy = WlanNetworkConfigProviderSynchronousProxy;
4481
4482 const DEBUG_NAME: &'static str = "(anonymous) WlanNetworkConfigProvider";
4483}
4484
4485pub trait WlanNetworkConfigProviderProxyInterface: Send + Sync {
4486 type WatchConnectedNetworkResponseFut: std::future::Future<Output = Result<fidl_fuchsia_wlan_policy::NetworkConfig, fidl::Error>>
4487 + Send;
4488 fn r#watch_connected_network(&self) -> Self::WatchConnectedNetworkResponseFut;
4489}
4490#[derive(Debug)]
4491#[cfg(target_os = "fuchsia")]
4492pub struct WlanNetworkConfigProviderSynchronousProxy {
4493 client: fidl::client::sync::Client,
4494}
4495
4496#[cfg(target_os = "fuchsia")]
4497impl fidl::endpoints::SynchronousProxy for WlanNetworkConfigProviderSynchronousProxy {
4498 type Proxy = WlanNetworkConfigProviderProxy;
4499 type Protocol = WlanNetworkConfigProviderMarker;
4500
4501 fn from_channel(inner: fidl::Channel) -> Self {
4502 Self::new(inner)
4503 }
4504
4505 fn into_channel(self) -> fidl::Channel {
4506 self.client.into_channel()
4507 }
4508
4509 fn as_channel(&self) -> &fidl::Channel {
4510 self.client.as_channel()
4511 }
4512}
4513
4514#[cfg(target_os = "fuchsia")]
4515impl WlanNetworkConfigProviderSynchronousProxy {
4516 pub fn new(channel: fidl::Channel) -> Self {
4517 let protocol_name =
4518 <WlanNetworkConfigProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4519 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4520 }
4521
4522 pub fn into_channel(self) -> fidl::Channel {
4523 self.client.into_channel()
4524 }
4525
4526 pub fn wait_for_event(
4529 &self,
4530 deadline: zx::MonotonicInstant,
4531 ) -> Result<WlanNetworkConfigProviderEvent, fidl::Error> {
4532 WlanNetworkConfigProviderEvent::decode(self.client.wait_for_event(deadline)?)
4533 }
4534
4535 pub fn r#watch_connected_network(
4541 &self,
4542 ___deadline: zx::MonotonicInstant,
4543 ) -> Result<fidl_fuchsia_wlan_policy::NetworkConfig, fidl::Error> {
4544 let _response = self.client.send_query::<
4545 fidl::encoding::EmptyPayload,
4546 WlanNetworkConfigProviderWatchConnectedNetworkResponse,
4547 >(
4548 (),
4549 0x966c5bf4d6dfce1,
4550 fidl::encoding::DynamicFlags::empty(),
4551 ___deadline,
4552 )?;
4553 Ok(_response.network_config)
4554 }
4555}
4556
4557#[derive(Debug, Clone)]
4558pub struct WlanNetworkConfigProviderProxy {
4559 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4560}
4561
4562impl fidl::endpoints::Proxy for WlanNetworkConfigProviderProxy {
4563 type Protocol = WlanNetworkConfigProviderMarker;
4564
4565 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4566 Self::new(inner)
4567 }
4568
4569 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4570 self.client.into_channel().map_err(|client| Self { client })
4571 }
4572
4573 fn as_channel(&self) -> &::fidl::AsyncChannel {
4574 self.client.as_channel()
4575 }
4576}
4577
4578impl WlanNetworkConfigProviderProxy {
4579 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4581 let protocol_name =
4582 <WlanNetworkConfigProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4583 Self { client: fidl::client::Client::new(channel, protocol_name) }
4584 }
4585
4586 pub fn take_event_stream(&self) -> WlanNetworkConfigProviderEventStream {
4592 WlanNetworkConfigProviderEventStream { event_receiver: self.client.take_event_receiver() }
4593 }
4594
4595 pub fn r#watch_connected_network(
4601 &self,
4602 ) -> fidl::client::QueryResponseFut<
4603 fidl_fuchsia_wlan_policy::NetworkConfig,
4604 fidl::encoding::DefaultFuchsiaResourceDialect,
4605 > {
4606 WlanNetworkConfigProviderProxyInterface::r#watch_connected_network(self)
4607 }
4608}
4609
4610impl WlanNetworkConfigProviderProxyInterface for WlanNetworkConfigProviderProxy {
4611 type WatchConnectedNetworkResponseFut = fidl::client::QueryResponseFut<
4612 fidl_fuchsia_wlan_policy::NetworkConfig,
4613 fidl::encoding::DefaultFuchsiaResourceDialect,
4614 >;
4615 fn r#watch_connected_network(&self) -> Self::WatchConnectedNetworkResponseFut {
4616 fn _decode(
4617 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4618 ) -> Result<fidl_fuchsia_wlan_policy::NetworkConfig, fidl::Error> {
4619 let _response = fidl::client::decode_transaction_body::<
4620 WlanNetworkConfigProviderWatchConnectedNetworkResponse,
4621 fidl::encoding::DefaultFuchsiaResourceDialect,
4622 0x966c5bf4d6dfce1,
4623 >(_buf?)?;
4624 Ok(_response.network_config)
4625 }
4626 self.client.send_query_and_decode::<
4627 fidl::encoding::EmptyPayload,
4628 fidl_fuchsia_wlan_policy::NetworkConfig,
4629 >(
4630 (),
4631 0x966c5bf4d6dfce1,
4632 fidl::encoding::DynamicFlags::empty(),
4633 _decode,
4634 )
4635 }
4636}
4637
4638pub struct WlanNetworkConfigProviderEventStream {
4639 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4640}
4641
4642impl std::marker::Unpin for WlanNetworkConfigProviderEventStream {}
4643
4644impl futures::stream::FusedStream for WlanNetworkConfigProviderEventStream {
4645 fn is_terminated(&self) -> bool {
4646 self.event_receiver.is_terminated()
4647 }
4648}
4649
4650impl futures::Stream for WlanNetworkConfigProviderEventStream {
4651 type Item = Result<WlanNetworkConfigProviderEvent, fidl::Error>;
4652
4653 fn poll_next(
4654 mut self: std::pin::Pin<&mut Self>,
4655 cx: &mut std::task::Context<'_>,
4656 ) -> std::task::Poll<Option<Self::Item>> {
4657 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4658 &mut self.event_receiver,
4659 cx
4660 )?) {
4661 Some(buf) => std::task::Poll::Ready(Some(WlanNetworkConfigProviderEvent::decode(buf))),
4662 None => std::task::Poll::Ready(None),
4663 }
4664 }
4665}
4666
4667#[derive(Debug)]
4668pub enum WlanNetworkConfigProviderEvent {}
4669
4670impl WlanNetworkConfigProviderEvent {
4671 fn decode(
4673 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4674 ) -> Result<WlanNetworkConfigProviderEvent, fidl::Error> {
4675 let (bytes, _handles) = buf.split_mut();
4676 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4677 debug_assert_eq!(tx_header.tx_id, 0);
4678 match tx_header.ordinal {
4679 _ => Err(fidl::Error::UnknownOrdinal {
4680 ordinal: tx_header.ordinal,
4681 protocol_name:
4682 <WlanNetworkConfigProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4683 }),
4684 }
4685 }
4686}
4687
4688pub struct WlanNetworkConfigProviderRequestStream {
4690 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4691 is_terminated: bool,
4692}
4693
4694impl std::marker::Unpin for WlanNetworkConfigProviderRequestStream {}
4695
4696impl futures::stream::FusedStream for WlanNetworkConfigProviderRequestStream {
4697 fn is_terminated(&self) -> bool {
4698 self.is_terminated
4699 }
4700}
4701
4702impl fidl::endpoints::RequestStream for WlanNetworkConfigProviderRequestStream {
4703 type Protocol = WlanNetworkConfigProviderMarker;
4704 type ControlHandle = WlanNetworkConfigProviderControlHandle;
4705
4706 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4707 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4708 }
4709
4710 fn control_handle(&self) -> Self::ControlHandle {
4711 WlanNetworkConfigProviderControlHandle { inner: self.inner.clone() }
4712 }
4713
4714 fn into_inner(
4715 self,
4716 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4717 {
4718 (self.inner, self.is_terminated)
4719 }
4720
4721 fn from_inner(
4722 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4723 is_terminated: bool,
4724 ) -> Self {
4725 Self { inner, is_terminated }
4726 }
4727}
4728
4729impl futures::Stream for WlanNetworkConfigProviderRequestStream {
4730 type Item = Result<WlanNetworkConfigProviderRequest, fidl::Error>;
4731
4732 fn poll_next(
4733 mut self: std::pin::Pin<&mut Self>,
4734 cx: &mut std::task::Context<'_>,
4735 ) -> std::task::Poll<Option<Self::Item>> {
4736 let this = &mut *self;
4737 if this.inner.check_shutdown(cx) {
4738 this.is_terminated = true;
4739 return std::task::Poll::Ready(None);
4740 }
4741 if this.is_terminated {
4742 panic!("polled WlanNetworkConfigProviderRequestStream after completion");
4743 }
4744 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4745 |bytes, handles| {
4746 match this.inner.channel().read_etc(cx, bytes, handles) {
4747 std::task::Poll::Ready(Ok(())) => {}
4748 std::task::Poll::Pending => return std::task::Poll::Pending,
4749 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4750 this.is_terminated = true;
4751 return std::task::Poll::Ready(None);
4752 }
4753 std::task::Poll::Ready(Err(e)) => {
4754 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4755 e.into(),
4756 ))))
4757 }
4758 }
4759
4760 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4762
4763 std::task::Poll::Ready(Some(match header.ordinal {
4764 0x966c5bf4d6dfce1 => {
4765 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4766 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
4767 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4768 let control_handle = WlanNetworkConfigProviderControlHandle {
4769 inner: this.inner.clone(),
4770 };
4771 Ok(WlanNetworkConfigProviderRequest::WatchConnectedNetwork {
4772 responder: WlanNetworkConfigProviderWatchConnectedNetworkResponder {
4773 control_handle: std::mem::ManuallyDrop::new(control_handle),
4774 tx_id: header.tx_id,
4775 },
4776 })
4777 }
4778 _ => Err(fidl::Error::UnknownOrdinal {
4779 ordinal: header.ordinal,
4780 protocol_name: <WlanNetworkConfigProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4781 }),
4782 }))
4783 },
4784 )
4785 }
4786}
4787
4788#[derive(Debug)]
4791pub enum WlanNetworkConfigProviderRequest {
4792 WatchConnectedNetwork { responder: WlanNetworkConfigProviderWatchConnectedNetworkResponder },
4798}
4799
4800impl WlanNetworkConfigProviderRequest {
4801 #[allow(irrefutable_let_patterns)]
4802 pub fn into_watch_connected_network(
4803 self,
4804 ) -> Option<(WlanNetworkConfigProviderWatchConnectedNetworkResponder)> {
4805 if let WlanNetworkConfigProviderRequest::WatchConnectedNetwork { responder } = self {
4806 Some((responder))
4807 } else {
4808 None
4809 }
4810 }
4811
4812 pub fn method_name(&self) -> &'static str {
4814 match *self {
4815 WlanNetworkConfigProviderRequest::WatchConnectedNetwork { .. } => {
4816 "watch_connected_network"
4817 }
4818 }
4819 }
4820}
4821
4822#[derive(Debug, Clone)]
4823pub struct WlanNetworkConfigProviderControlHandle {
4824 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4825}
4826
4827impl fidl::endpoints::ControlHandle for WlanNetworkConfigProviderControlHandle {
4828 fn shutdown(&self) {
4829 self.inner.shutdown()
4830 }
4831 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4832 self.inner.shutdown_with_epitaph(status)
4833 }
4834
4835 fn is_closed(&self) -> bool {
4836 self.inner.channel().is_closed()
4837 }
4838 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4839 self.inner.channel().on_closed()
4840 }
4841
4842 #[cfg(target_os = "fuchsia")]
4843 fn signal_peer(
4844 &self,
4845 clear_mask: zx::Signals,
4846 set_mask: zx::Signals,
4847 ) -> Result<(), zx_status::Status> {
4848 use fidl::Peered;
4849 self.inner.channel().signal_peer(clear_mask, set_mask)
4850 }
4851}
4852
4853impl WlanNetworkConfigProviderControlHandle {}
4854
4855#[must_use = "FIDL methods require a response to be sent"]
4856#[derive(Debug)]
4857pub struct WlanNetworkConfigProviderWatchConnectedNetworkResponder {
4858 control_handle: std::mem::ManuallyDrop<WlanNetworkConfigProviderControlHandle>,
4859 tx_id: u32,
4860}
4861
4862impl std::ops::Drop for WlanNetworkConfigProviderWatchConnectedNetworkResponder {
4866 fn drop(&mut self) {
4867 self.control_handle.shutdown();
4868 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4870 }
4871}
4872
4873impl fidl::endpoints::Responder for WlanNetworkConfigProviderWatchConnectedNetworkResponder {
4874 type ControlHandle = WlanNetworkConfigProviderControlHandle;
4875
4876 fn control_handle(&self) -> &WlanNetworkConfigProviderControlHandle {
4877 &self.control_handle
4878 }
4879
4880 fn drop_without_shutdown(mut self) {
4881 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4883 std::mem::forget(self);
4885 }
4886}
4887
4888impl WlanNetworkConfigProviderWatchConnectedNetworkResponder {
4889 pub fn send(
4893 self,
4894 mut network_config: &fidl_fuchsia_wlan_policy::NetworkConfig,
4895 ) -> Result<(), fidl::Error> {
4896 let _result = self.send_raw(network_config);
4897 if _result.is_err() {
4898 self.control_handle.shutdown();
4899 }
4900 self.drop_without_shutdown();
4901 _result
4902 }
4903
4904 pub fn send_no_shutdown_on_err(
4906 self,
4907 mut network_config: &fidl_fuchsia_wlan_policy::NetworkConfig,
4908 ) -> Result<(), fidl::Error> {
4909 let _result = self.send_raw(network_config);
4910 self.drop_without_shutdown();
4911 _result
4912 }
4913
4914 fn send_raw(
4915 &self,
4916 mut network_config: &fidl_fuchsia_wlan_policy::NetworkConfig,
4917 ) -> Result<(), fidl::Error> {
4918 self.control_handle.inner.send::<WlanNetworkConfigProviderWatchConnectedNetworkResponse>(
4919 (network_config,),
4920 self.tx_id,
4921 0x966c5bf4d6dfce1,
4922 fidl::encoding::DynamicFlags::empty(),
4923 )
4924 }
4925}
4926
4927mod internal {
4928 use super::*;
4929 unsafe impl fidl::encoding::TypeMarker for ResetConfigFlags {
4930 type Owned = Self;
4931
4932 #[inline(always)]
4933 fn inline_align(_context: fidl::encoding::Context) -> usize {
4934 2
4935 }
4936
4937 #[inline(always)]
4938 fn inline_size(_context: fidl::encoding::Context) -> usize {
4939 2
4940 }
4941 }
4942
4943 impl fidl::encoding::ValueTypeMarker for ResetConfigFlags {
4944 type Borrowed<'a> = Self;
4945 #[inline(always)]
4946 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4947 *value
4948 }
4949 }
4950
4951 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
4952 for ResetConfigFlags
4953 {
4954 #[inline]
4955 unsafe fn encode(
4956 self,
4957 encoder: &mut fidl::encoding::Encoder<'_, D>,
4958 offset: usize,
4959 _depth: fidl::encoding::Depth,
4960 ) -> fidl::Result<()> {
4961 encoder.debug_check_bounds::<Self>(offset);
4962 if self.bits() & Self::all().bits() != self.bits() {
4963 return Err(fidl::Error::InvalidBitsValue);
4964 }
4965 encoder.write_num(self.bits(), offset);
4966 Ok(())
4967 }
4968 }
4969
4970 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ResetConfigFlags {
4971 #[inline(always)]
4972 fn new_empty() -> Self {
4973 Self::empty()
4974 }
4975
4976 #[inline]
4977 unsafe fn decode(
4978 &mut self,
4979 decoder: &mut fidl::encoding::Decoder<'_, D>,
4980 offset: usize,
4981 _depth: fidl::encoding::Depth,
4982 ) -> fidl::Result<()> {
4983 decoder.debug_check_bounds::<Self>(offset);
4984 let prim = decoder.read_num::<u16>(offset);
4985 *self = Self::from_bits(prim).ok_or(fidl::Error::InvalidBitsValue)?;
4986 Ok(())
4987 }
4988 }
4989 unsafe impl fidl::encoding::TypeMarker for ErrorCode {
4990 type Owned = Self;
4991
4992 #[inline(always)]
4993 fn inline_align(_context: fidl::encoding::Context) -> usize {
4994 std::mem::align_of::<u32>()
4995 }
4996
4997 #[inline(always)]
4998 fn inline_size(_context: fidl::encoding::Context) -> usize {
4999 std::mem::size_of::<u32>()
5000 }
5001
5002 #[inline(always)]
5003 fn encode_is_copy() -> bool {
5004 true
5005 }
5006
5007 #[inline(always)]
5008 fn decode_is_copy() -> bool {
5009 false
5010 }
5011 }
5012
5013 impl fidl::encoding::ValueTypeMarker for ErrorCode {
5014 type Borrowed<'a> = Self;
5015 #[inline(always)]
5016 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5017 *value
5018 }
5019 }
5020
5021 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for ErrorCode {
5022 #[inline]
5023 unsafe fn encode(
5024 self,
5025 encoder: &mut fidl::encoding::Encoder<'_, D>,
5026 offset: usize,
5027 _depth: fidl::encoding::Depth,
5028 ) -> fidl::Result<()> {
5029 encoder.debug_check_bounds::<Self>(offset);
5030 encoder.write_num(self.into_primitive(), offset);
5031 Ok(())
5032 }
5033 }
5034
5035 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ErrorCode {
5036 #[inline(always)]
5037 fn new_empty() -> Self {
5038 Self::FileNotFound
5039 }
5040
5041 #[inline]
5042 unsafe fn decode(
5043 &mut self,
5044 decoder: &mut fidl::encoding::Decoder<'_, D>,
5045 offset: usize,
5046 _depth: fidl::encoding::Depth,
5047 ) -> fidl::Result<()> {
5048 decoder.debug_check_bounds::<Self>(offset);
5049 let prim = decoder.read_num::<u32>(offset);
5050
5051 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
5052 Ok(())
5053 }
5054 }
5055
5056 impl fidl::encoding::ResourceTypeMarker for BootstrapImportWeaveConfigRequest {
5057 type Borrowed<'a> = &'a mut Self;
5058 fn take_or_borrow<'a>(
5059 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5060 ) -> Self::Borrowed<'a> {
5061 value
5062 }
5063 }
5064
5065 unsafe impl fidl::encoding::TypeMarker for BootstrapImportWeaveConfigRequest {
5066 type Owned = Self;
5067
5068 #[inline(always)]
5069 fn inline_align(_context: fidl::encoding::Context) -> usize {
5070 8
5071 }
5072
5073 #[inline(always)]
5074 fn inline_size(_context: fidl::encoding::Context) -> usize {
5075 16
5076 }
5077 }
5078
5079 unsafe impl
5080 fidl::encoding::Encode<
5081 BootstrapImportWeaveConfigRequest,
5082 fidl::encoding::DefaultFuchsiaResourceDialect,
5083 > for &mut BootstrapImportWeaveConfigRequest
5084 {
5085 #[inline]
5086 unsafe fn encode(
5087 self,
5088 encoder: &mut fidl::encoding::Encoder<
5089 '_,
5090 fidl::encoding::DefaultFuchsiaResourceDialect,
5091 >,
5092 offset: usize,
5093 _depth: fidl::encoding::Depth,
5094 ) -> fidl::Result<()> {
5095 encoder.debug_check_bounds::<BootstrapImportWeaveConfigRequest>(offset);
5096 fidl::encoding::Encode::<
5098 BootstrapImportWeaveConfigRequest,
5099 fidl::encoding::DefaultFuchsiaResourceDialect,
5100 >::encode(
5101 (<fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
5102 &mut self.config_json,
5103 ),),
5104 encoder,
5105 offset,
5106 _depth,
5107 )
5108 }
5109 }
5110 unsafe impl<
5111 T0: fidl::encoding::Encode<
5112 fidl_fuchsia_mem::Buffer,
5113 fidl::encoding::DefaultFuchsiaResourceDialect,
5114 >,
5115 >
5116 fidl::encoding::Encode<
5117 BootstrapImportWeaveConfigRequest,
5118 fidl::encoding::DefaultFuchsiaResourceDialect,
5119 > for (T0,)
5120 {
5121 #[inline]
5122 unsafe fn encode(
5123 self,
5124 encoder: &mut fidl::encoding::Encoder<
5125 '_,
5126 fidl::encoding::DefaultFuchsiaResourceDialect,
5127 >,
5128 offset: usize,
5129 depth: fidl::encoding::Depth,
5130 ) -> fidl::Result<()> {
5131 encoder.debug_check_bounds::<BootstrapImportWeaveConfigRequest>(offset);
5132 self.0.encode(encoder, offset + 0, depth)?;
5136 Ok(())
5137 }
5138 }
5139
5140 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5141 for BootstrapImportWeaveConfigRequest
5142 {
5143 #[inline(always)]
5144 fn new_empty() -> Self {
5145 Self {
5146 config_json: fidl::new_empty!(
5147 fidl_fuchsia_mem::Buffer,
5148 fidl::encoding::DefaultFuchsiaResourceDialect
5149 ),
5150 }
5151 }
5152
5153 #[inline]
5154 unsafe fn decode(
5155 &mut self,
5156 decoder: &mut fidl::encoding::Decoder<
5157 '_,
5158 fidl::encoding::DefaultFuchsiaResourceDialect,
5159 >,
5160 offset: usize,
5161 _depth: fidl::encoding::Depth,
5162 ) -> fidl::Result<()> {
5163 decoder.debug_check_bounds::<Self>(offset);
5164 fidl::decode!(
5166 fidl_fuchsia_mem::Buffer,
5167 fidl::encoding::DefaultFuchsiaResourceDialect,
5168 &mut self.config_json,
5169 decoder,
5170 offset + 0,
5171 _depth
5172 )?;
5173 Ok(())
5174 }
5175 }
5176
5177 impl fidl::encoding::ValueTypeMarker for FactoryDataManagerGetPairingCodeResponse {
5178 type Borrowed<'a> = &'a Self;
5179 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5180 value
5181 }
5182 }
5183
5184 unsafe impl fidl::encoding::TypeMarker for FactoryDataManagerGetPairingCodeResponse {
5185 type Owned = Self;
5186
5187 #[inline(always)]
5188 fn inline_align(_context: fidl::encoding::Context) -> usize {
5189 8
5190 }
5191
5192 #[inline(always)]
5193 fn inline_size(_context: fidl::encoding::Context) -> usize {
5194 16
5195 }
5196 }
5197
5198 unsafe impl<D: fidl::encoding::ResourceDialect>
5199 fidl::encoding::Encode<FactoryDataManagerGetPairingCodeResponse, D>
5200 for &FactoryDataManagerGetPairingCodeResponse
5201 {
5202 #[inline]
5203 unsafe fn encode(
5204 self,
5205 encoder: &mut fidl::encoding::Encoder<'_, D>,
5206 offset: usize,
5207 _depth: fidl::encoding::Depth,
5208 ) -> fidl::Result<()> {
5209 encoder.debug_check_bounds::<FactoryDataManagerGetPairingCodeResponse>(offset);
5210 fidl::encoding::Encode::<FactoryDataManagerGetPairingCodeResponse, D>::encode(
5212 (<fidl::encoding::Vector<u8, 16> as fidl::encoding::ValueTypeMarker>::borrow(
5213 &self.pairing_code,
5214 ),),
5215 encoder,
5216 offset,
5217 _depth,
5218 )
5219 }
5220 }
5221 unsafe impl<
5222 D: fidl::encoding::ResourceDialect,
5223 T0: fidl::encoding::Encode<fidl::encoding::Vector<u8, 16>, D>,
5224 > fidl::encoding::Encode<FactoryDataManagerGetPairingCodeResponse, D> for (T0,)
5225 {
5226 #[inline]
5227 unsafe fn encode(
5228 self,
5229 encoder: &mut fidl::encoding::Encoder<'_, D>,
5230 offset: usize,
5231 depth: fidl::encoding::Depth,
5232 ) -> fidl::Result<()> {
5233 encoder.debug_check_bounds::<FactoryDataManagerGetPairingCodeResponse>(offset);
5234 self.0.encode(encoder, offset + 0, depth)?;
5238 Ok(())
5239 }
5240 }
5241
5242 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
5243 for FactoryDataManagerGetPairingCodeResponse
5244 {
5245 #[inline(always)]
5246 fn new_empty() -> Self {
5247 Self { pairing_code: fidl::new_empty!(fidl::encoding::Vector<u8, 16>, D) }
5248 }
5249
5250 #[inline]
5251 unsafe fn decode(
5252 &mut self,
5253 decoder: &mut fidl::encoding::Decoder<'_, D>,
5254 offset: usize,
5255 _depth: fidl::encoding::Depth,
5256 ) -> fidl::Result<()> {
5257 decoder.debug_check_bounds::<Self>(offset);
5258 fidl::decode!(fidl::encoding::Vector<u8, 16>, D, &mut self.pairing_code, decoder, offset + 0, _depth)?;
5260 Ok(())
5261 }
5262 }
5263
5264 impl fidl::encoding::ResourceTypeMarker for FactoryDataManagerGetWeaveCertificateResponse {
5265 type Borrowed<'a> = &'a mut Self;
5266 fn take_or_borrow<'a>(
5267 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5268 ) -> Self::Borrowed<'a> {
5269 value
5270 }
5271 }
5272
5273 unsafe impl fidl::encoding::TypeMarker for FactoryDataManagerGetWeaveCertificateResponse {
5274 type Owned = Self;
5275
5276 #[inline(always)]
5277 fn inline_align(_context: fidl::encoding::Context) -> usize {
5278 8
5279 }
5280
5281 #[inline(always)]
5282 fn inline_size(_context: fidl::encoding::Context) -> usize {
5283 16
5284 }
5285 }
5286
5287 unsafe impl
5288 fidl::encoding::Encode<
5289 FactoryDataManagerGetWeaveCertificateResponse,
5290 fidl::encoding::DefaultFuchsiaResourceDialect,
5291 > for &mut FactoryDataManagerGetWeaveCertificateResponse
5292 {
5293 #[inline]
5294 unsafe fn encode(
5295 self,
5296 encoder: &mut fidl::encoding::Encoder<
5297 '_,
5298 fidl::encoding::DefaultFuchsiaResourceDialect,
5299 >,
5300 offset: usize,
5301 _depth: fidl::encoding::Depth,
5302 ) -> fidl::Result<()> {
5303 encoder.debug_check_bounds::<FactoryDataManagerGetWeaveCertificateResponse>(offset);
5304 fidl::encoding::Encode::<
5306 FactoryDataManagerGetWeaveCertificateResponse,
5307 fidl::encoding::DefaultFuchsiaResourceDialect,
5308 >::encode(
5309 (<fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
5310 &mut self.certificate,
5311 ),),
5312 encoder,
5313 offset,
5314 _depth,
5315 )
5316 }
5317 }
5318 unsafe impl<
5319 T0: fidl::encoding::Encode<
5320 fidl_fuchsia_mem::Buffer,
5321 fidl::encoding::DefaultFuchsiaResourceDialect,
5322 >,
5323 >
5324 fidl::encoding::Encode<
5325 FactoryDataManagerGetWeaveCertificateResponse,
5326 fidl::encoding::DefaultFuchsiaResourceDialect,
5327 > for (T0,)
5328 {
5329 #[inline]
5330 unsafe fn encode(
5331 self,
5332 encoder: &mut fidl::encoding::Encoder<
5333 '_,
5334 fidl::encoding::DefaultFuchsiaResourceDialect,
5335 >,
5336 offset: usize,
5337 depth: fidl::encoding::Depth,
5338 ) -> fidl::Result<()> {
5339 encoder.debug_check_bounds::<FactoryDataManagerGetWeaveCertificateResponse>(offset);
5340 self.0.encode(encoder, offset + 0, depth)?;
5344 Ok(())
5345 }
5346 }
5347
5348 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5349 for FactoryDataManagerGetWeaveCertificateResponse
5350 {
5351 #[inline(always)]
5352 fn new_empty() -> Self {
5353 Self {
5354 certificate: fidl::new_empty!(
5355 fidl_fuchsia_mem::Buffer,
5356 fidl::encoding::DefaultFuchsiaResourceDialect
5357 ),
5358 }
5359 }
5360
5361 #[inline]
5362 unsafe fn decode(
5363 &mut self,
5364 decoder: &mut fidl::encoding::Decoder<
5365 '_,
5366 fidl::encoding::DefaultFuchsiaResourceDialect,
5367 >,
5368 offset: usize,
5369 _depth: fidl::encoding::Depth,
5370 ) -> fidl::Result<()> {
5371 decoder.debug_check_bounds::<Self>(offset);
5372 fidl::decode!(
5374 fidl_fuchsia_mem::Buffer,
5375 fidl::encoding::DefaultFuchsiaResourceDialect,
5376 &mut self.certificate,
5377 decoder,
5378 offset + 0,
5379 _depth
5380 )?;
5381 Ok(())
5382 }
5383 }
5384
5385 impl fidl::encoding::ValueTypeMarker for HostPort {
5386 type Borrowed<'a> = &'a Self;
5387 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5388 value
5389 }
5390 }
5391
5392 unsafe impl fidl::encoding::TypeMarker for HostPort {
5393 type Owned = Self;
5394
5395 #[inline(always)]
5396 fn inline_align(_context: fidl::encoding::Context) -> usize {
5397 8
5398 }
5399
5400 #[inline(always)]
5401 fn inline_size(_context: fidl::encoding::Context) -> usize {
5402 24
5403 }
5404 }
5405
5406 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<HostPort, D> for &HostPort {
5407 #[inline]
5408 unsafe fn encode(
5409 self,
5410 encoder: &mut fidl::encoding::Encoder<'_, D>,
5411 offset: usize,
5412 _depth: fidl::encoding::Depth,
5413 ) -> fidl::Result<()> {
5414 encoder.debug_check_bounds::<HostPort>(offset);
5415 fidl::encoding::Encode::<HostPort, D>::encode(
5417 (
5418 <Host as fidl::encoding::ValueTypeMarker>::borrow(&self.host),
5419 <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.port),
5420 ),
5421 encoder,
5422 offset,
5423 _depth,
5424 )
5425 }
5426 }
5427 unsafe impl<
5428 D: fidl::encoding::ResourceDialect,
5429 T0: fidl::encoding::Encode<Host, D>,
5430 T1: fidl::encoding::Encode<u16, D>,
5431 > fidl::encoding::Encode<HostPort, D> for (T0, T1)
5432 {
5433 #[inline]
5434 unsafe fn encode(
5435 self,
5436 encoder: &mut fidl::encoding::Encoder<'_, D>,
5437 offset: usize,
5438 depth: fidl::encoding::Depth,
5439 ) -> fidl::Result<()> {
5440 encoder.debug_check_bounds::<HostPort>(offset);
5441 unsafe {
5444 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
5445 (ptr as *mut u64).write_unaligned(0);
5446 }
5447 self.0.encode(encoder, offset + 0, depth)?;
5449 self.1.encode(encoder, offset + 16, depth)?;
5450 Ok(())
5451 }
5452 }
5453
5454 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for HostPort {
5455 #[inline(always)]
5456 fn new_empty() -> Self {
5457 Self { host: fidl::new_empty!(Host, D), port: fidl::new_empty!(u16, D) }
5458 }
5459
5460 #[inline]
5461 unsafe fn decode(
5462 &mut self,
5463 decoder: &mut fidl::encoding::Decoder<'_, D>,
5464 offset: usize,
5465 _depth: fidl::encoding::Depth,
5466 ) -> fidl::Result<()> {
5467 decoder.debug_check_bounds::<Self>(offset);
5468 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
5470 let padval = unsafe { (ptr as *const u64).read_unaligned() };
5471 let mask = 0xffffffffffff0000u64;
5472 let maskedval = padval & mask;
5473 if maskedval != 0 {
5474 return Err(fidl::Error::NonZeroPadding {
5475 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
5476 });
5477 }
5478 fidl::decode!(Host, D, &mut self.host, decoder, offset + 0, _depth)?;
5479 fidl::decode!(u16, D, &mut self.port, decoder, offset + 16, _depth)?;
5480 Ok(())
5481 }
5482 }
5483
5484 impl fidl::encoding::ValueTypeMarker for PairingStateWatcherWatchPairingStateResponse {
5485 type Borrowed<'a> = &'a Self;
5486 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5487 value
5488 }
5489 }
5490
5491 unsafe impl fidl::encoding::TypeMarker for PairingStateWatcherWatchPairingStateResponse {
5492 type Owned = Self;
5493
5494 #[inline(always)]
5495 fn inline_align(_context: fidl::encoding::Context) -> usize {
5496 8
5497 }
5498
5499 #[inline(always)]
5500 fn inline_size(_context: fidl::encoding::Context) -> usize {
5501 16
5502 }
5503 }
5504
5505 unsafe impl<D: fidl::encoding::ResourceDialect>
5506 fidl::encoding::Encode<PairingStateWatcherWatchPairingStateResponse, D>
5507 for &PairingStateWatcherWatchPairingStateResponse
5508 {
5509 #[inline]
5510 unsafe fn encode(
5511 self,
5512 encoder: &mut fidl::encoding::Encoder<'_, D>,
5513 offset: usize,
5514 _depth: fidl::encoding::Depth,
5515 ) -> fidl::Result<()> {
5516 encoder.debug_check_bounds::<PairingStateWatcherWatchPairingStateResponse>(offset);
5517 fidl::encoding::Encode::<PairingStateWatcherWatchPairingStateResponse, D>::encode(
5519 (<PairingState as fidl::encoding::ValueTypeMarker>::borrow(&self.state),),
5520 encoder,
5521 offset,
5522 _depth,
5523 )
5524 }
5525 }
5526 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<PairingState, D>>
5527 fidl::encoding::Encode<PairingStateWatcherWatchPairingStateResponse, D> for (T0,)
5528 {
5529 #[inline]
5530 unsafe fn encode(
5531 self,
5532 encoder: &mut fidl::encoding::Encoder<'_, D>,
5533 offset: usize,
5534 depth: fidl::encoding::Depth,
5535 ) -> fidl::Result<()> {
5536 encoder.debug_check_bounds::<PairingStateWatcherWatchPairingStateResponse>(offset);
5537 self.0.encode(encoder, offset + 0, depth)?;
5541 Ok(())
5542 }
5543 }
5544
5545 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
5546 for PairingStateWatcherWatchPairingStateResponse
5547 {
5548 #[inline(always)]
5549 fn new_empty() -> Self {
5550 Self { state: fidl::new_empty!(PairingState, D) }
5551 }
5552
5553 #[inline]
5554 unsafe fn decode(
5555 &mut self,
5556 decoder: &mut fidl::encoding::Decoder<'_, D>,
5557 offset: usize,
5558 _depth: fidl::encoding::Depth,
5559 ) -> fidl::Result<()> {
5560 decoder.debug_check_bounds::<Self>(offset);
5561 fidl::decode!(PairingState, D, &mut self.state, decoder, offset + 0, _depth)?;
5563 Ok(())
5564 }
5565 }
5566
5567 impl fidl::encoding::ValueTypeMarker for ProvisionerGenerateKeyPairResponse {
5568 type Borrowed<'a> = &'a Self;
5569 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5570 value
5571 }
5572 }
5573
5574 unsafe impl fidl::encoding::TypeMarker for ProvisionerGenerateKeyPairResponse {
5575 type Owned = Self;
5576
5577 #[inline(always)]
5578 fn inline_align(_context: fidl::encoding::Context) -> usize {
5579 8
5580 }
5581
5582 #[inline(always)]
5583 fn inline_size(_context: fidl::encoding::Context) -> usize {
5584 32
5585 }
5586 }
5587
5588 unsafe impl<D: fidl::encoding::ResourceDialect>
5589 fidl::encoding::Encode<ProvisionerGenerateKeyPairResponse, D>
5590 for &ProvisionerGenerateKeyPairResponse
5591 {
5592 #[inline]
5593 unsafe fn encode(
5594 self,
5595 encoder: &mut fidl::encoding::Encoder<'_, D>,
5596 offset: usize,
5597 _depth: fidl::encoding::Depth,
5598 ) -> fidl::Result<()> {
5599 encoder.debug_check_bounds::<ProvisionerGenerateKeyPairResponse>(offset);
5600 fidl::encoding::Encode::<ProvisionerGenerateKeyPairResponse, D>::encode(
5602 (
5603 <fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.wrapped_private_key),
5604 <fidl::encoding::Vector<u8, 65> as fidl::encoding::ValueTypeMarker>::borrow(&self.public_key),
5605 ),
5606 encoder, offset, _depth
5607 )
5608 }
5609 }
5610 unsafe impl<
5611 D: fidl::encoding::ResourceDialect,
5612 T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
5613 T1: fidl::encoding::Encode<fidl::encoding::Vector<u8, 65>, D>,
5614 > fidl::encoding::Encode<ProvisionerGenerateKeyPairResponse, D> for (T0, T1)
5615 {
5616 #[inline]
5617 unsafe fn encode(
5618 self,
5619 encoder: &mut fidl::encoding::Encoder<'_, D>,
5620 offset: usize,
5621 depth: fidl::encoding::Depth,
5622 ) -> fidl::Result<()> {
5623 encoder.debug_check_bounds::<ProvisionerGenerateKeyPairResponse>(offset);
5624 self.0.encode(encoder, offset + 0, depth)?;
5628 self.1.encode(encoder, offset + 16, depth)?;
5629 Ok(())
5630 }
5631 }
5632
5633 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
5634 for ProvisionerGenerateKeyPairResponse
5635 {
5636 #[inline(always)]
5637 fn new_empty() -> Self {
5638 Self {
5639 wrapped_private_key: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
5640 public_key: fidl::new_empty!(fidl::encoding::Vector<u8, 65>, D),
5641 }
5642 }
5643
5644 #[inline]
5645 unsafe fn decode(
5646 &mut self,
5647 decoder: &mut fidl::encoding::Decoder<'_, D>,
5648 offset: usize,
5649 _depth: fidl::encoding::Depth,
5650 ) -> fidl::Result<()> {
5651 decoder.debug_check_bounds::<Self>(offset);
5652 fidl::decode!(
5654 fidl::encoding::UnboundedVector<u8>,
5655 D,
5656 &mut self.wrapped_private_key,
5657 decoder,
5658 offset + 0,
5659 _depth
5660 )?;
5661 fidl::decode!(fidl::encoding::Vector<u8, 65>, D, &mut self.public_key, decoder, offset + 16, _depth)?;
5662 Ok(())
5663 }
5664 }
5665
5666 impl fidl::encoding::ValueTypeMarker for QrCode {
5667 type Borrowed<'a> = &'a Self;
5668 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5669 value
5670 }
5671 }
5672
5673 unsafe impl fidl::encoding::TypeMarker for QrCode {
5674 type Owned = Self;
5675
5676 #[inline(always)]
5677 fn inline_align(_context: fidl::encoding::Context) -> usize {
5678 8
5679 }
5680
5681 #[inline(always)]
5682 fn inline_size(_context: fidl::encoding::Context) -> usize {
5683 16
5684 }
5685 }
5686
5687 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<QrCode, D> for &QrCode {
5688 #[inline]
5689 unsafe fn encode(
5690 self,
5691 encoder: &mut fidl::encoding::Encoder<'_, D>,
5692 offset: usize,
5693 _depth: fidl::encoding::Depth,
5694 ) -> fidl::Result<()> {
5695 encoder.debug_check_bounds::<QrCode>(offset);
5696 fidl::encoding::Encode::<QrCode, D>::encode(
5698 (<fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow(
5699 &self.data,
5700 ),),
5701 encoder,
5702 offset,
5703 _depth,
5704 )
5705 }
5706 }
5707 unsafe impl<
5708 D: fidl::encoding::ResourceDialect,
5709 T0: fidl::encoding::Encode<fidl::encoding::BoundedString<256>, D>,
5710 > fidl::encoding::Encode<QrCode, D> for (T0,)
5711 {
5712 #[inline]
5713 unsafe fn encode(
5714 self,
5715 encoder: &mut fidl::encoding::Encoder<'_, D>,
5716 offset: usize,
5717 depth: fidl::encoding::Depth,
5718 ) -> fidl::Result<()> {
5719 encoder.debug_check_bounds::<QrCode>(offset);
5720 self.0.encode(encoder, offset + 0, depth)?;
5724 Ok(())
5725 }
5726 }
5727
5728 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for QrCode {
5729 #[inline(always)]
5730 fn new_empty() -> Self {
5731 Self { data: fidl::new_empty!(fidl::encoding::BoundedString<256>, D) }
5732 }
5733
5734 #[inline]
5735 unsafe fn decode(
5736 &mut self,
5737 decoder: &mut fidl::encoding::Decoder<'_, D>,
5738 offset: usize,
5739 _depth: fidl::encoding::Depth,
5740 ) -> fidl::Result<()> {
5741 decoder.debug_check_bounds::<Self>(offset);
5742 fidl::decode!(
5744 fidl::encoding::BoundedString<256>,
5745 D,
5746 &mut self.data,
5747 decoder,
5748 offset + 0,
5749 _depth
5750 )?;
5751 Ok(())
5752 }
5753 }
5754
5755 impl fidl::encoding::ValueTypeMarker for SignerSignHashRequest {
5756 type Borrowed<'a> = &'a Self;
5757 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5758 value
5759 }
5760 }
5761
5762 unsafe impl fidl::encoding::TypeMarker for SignerSignHashRequest {
5763 type Owned = Self;
5764
5765 #[inline(always)]
5766 fn inline_align(_context: fidl::encoding::Context) -> usize {
5767 8
5768 }
5769
5770 #[inline(always)]
5771 fn inline_size(_context: fidl::encoding::Context) -> usize {
5772 16
5773 }
5774 }
5775
5776 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SignerSignHashRequest, D>
5777 for &SignerSignHashRequest
5778 {
5779 #[inline]
5780 unsafe fn encode(
5781 self,
5782 encoder: &mut fidl::encoding::Encoder<'_, D>,
5783 offset: usize,
5784 _depth: fidl::encoding::Depth,
5785 ) -> fidl::Result<()> {
5786 encoder.debug_check_bounds::<SignerSignHashRequest>(offset);
5787 fidl::encoding::Encode::<SignerSignHashRequest, D>::encode(
5789 (<fidl::encoding::Vector<u8, 32> as fidl::encoding::ValueTypeMarker>::borrow(
5790 &self.hash,
5791 ),),
5792 encoder,
5793 offset,
5794 _depth,
5795 )
5796 }
5797 }
5798 unsafe impl<
5799 D: fidl::encoding::ResourceDialect,
5800 T0: fidl::encoding::Encode<fidl::encoding::Vector<u8, 32>, D>,
5801 > fidl::encoding::Encode<SignerSignHashRequest, D> for (T0,)
5802 {
5803 #[inline]
5804 unsafe fn encode(
5805 self,
5806 encoder: &mut fidl::encoding::Encoder<'_, D>,
5807 offset: usize,
5808 depth: fidl::encoding::Depth,
5809 ) -> fidl::Result<()> {
5810 encoder.debug_check_bounds::<SignerSignHashRequest>(offset);
5811 self.0.encode(encoder, offset + 0, depth)?;
5815 Ok(())
5816 }
5817 }
5818
5819 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SignerSignHashRequest {
5820 #[inline(always)]
5821 fn new_empty() -> Self {
5822 Self { hash: fidl::new_empty!(fidl::encoding::Vector<u8, 32>, D) }
5823 }
5824
5825 #[inline]
5826 unsafe fn decode(
5827 &mut self,
5828 decoder: &mut fidl::encoding::Decoder<'_, D>,
5829 offset: usize,
5830 _depth: fidl::encoding::Depth,
5831 ) -> fidl::Result<()> {
5832 decoder.debug_check_bounds::<Self>(offset);
5833 fidl::decode!(fidl::encoding::Vector<u8, 32>, D, &mut self.hash, decoder, offset + 0, _depth)?;
5835 Ok(())
5836 }
5837 }
5838
5839 impl fidl::encoding::ValueTypeMarker for SignerSignHashWithPrivateKeyRequest {
5840 type Borrowed<'a> = &'a Self;
5841 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5842 value
5843 }
5844 }
5845
5846 unsafe impl fidl::encoding::TypeMarker for SignerSignHashWithPrivateKeyRequest {
5847 type Owned = Self;
5848
5849 #[inline(always)]
5850 fn inline_align(_context: fidl::encoding::Context) -> usize {
5851 8
5852 }
5853
5854 #[inline(always)]
5855 fn inline_size(_context: fidl::encoding::Context) -> usize {
5856 32
5857 }
5858 }
5859
5860 unsafe impl<D: fidl::encoding::ResourceDialect>
5861 fidl::encoding::Encode<SignerSignHashWithPrivateKeyRequest, D>
5862 for &SignerSignHashWithPrivateKeyRequest
5863 {
5864 #[inline]
5865 unsafe fn encode(
5866 self,
5867 encoder: &mut fidl::encoding::Encoder<'_, D>,
5868 offset: usize,
5869 _depth: fidl::encoding::Depth,
5870 ) -> fidl::Result<()> {
5871 encoder.debug_check_bounds::<SignerSignHashWithPrivateKeyRequest>(offset);
5872 fidl::encoding::Encode::<SignerSignHashWithPrivateKeyRequest, D>::encode(
5874 (
5875 <fidl::encoding::Vector<u8, 32> as fidl::encoding::ValueTypeMarker>::borrow(&self.hash),
5876 <fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.wrapped_private_key),
5877 ),
5878 encoder, offset, _depth
5879 )
5880 }
5881 }
5882 unsafe impl<
5883 D: fidl::encoding::ResourceDialect,
5884 T0: fidl::encoding::Encode<fidl::encoding::Vector<u8, 32>, D>,
5885 T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
5886 > fidl::encoding::Encode<SignerSignHashWithPrivateKeyRequest, D> for (T0, T1)
5887 {
5888 #[inline]
5889 unsafe fn encode(
5890 self,
5891 encoder: &mut fidl::encoding::Encoder<'_, D>,
5892 offset: usize,
5893 depth: fidl::encoding::Depth,
5894 ) -> fidl::Result<()> {
5895 encoder.debug_check_bounds::<SignerSignHashWithPrivateKeyRequest>(offset);
5896 self.0.encode(encoder, offset + 0, depth)?;
5900 self.1.encode(encoder, offset + 16, depth)?;
5901 Ok(())
5902 }
5903 }
5904
5905 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
5906 for SignerSignHashWithPrivateKeyRequest
5907 {
5908 #[inline(always)]
5909 fn new_empty() -> Self {
5910 Self {
5911 hash: fidl::new_empty!(fidl::encoding::Vector<u8, 32>, D),
5912 wrapped_private_key: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
5913 }
5914 }
5915
5916 #[inline]
5917 unsafe fn decode(
5918 &mut self,
5919 decoder: &mut fidl::encoding::Decoder<'_, D>,
5920 offset: usize,
5921 _depth: fidl::encoding::Depth,
5922 ) -> fidl::Result<()> {
5923 decoder.debug_check_bounds::<Self>(offset);
5924 fidl::decode!(fidl::encoding::Vector<u8, 32>, D, &mut self.hash, decoder, offset + 0, _depth)?;
5926 fidl::decode!(
5927 fidl::encoding::UnboundedVector<u8>,
5928 D,
5929 &mut self.wrapped_private_key,
5930 decoder,
5931 offset + 16,
5932 _depth
5933 )?;
5934 Ok(())
5935 }
5936 }
5937
5938 impl fidl::encoding::ValueTypeMarker for SignerSignHashWithPrivateKeyResponse {
5939 type Borrowed<'a> = &'a Self;
5940 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5941 value
5942 }
5943 }
5944
5945 unsafe impl fidl::encoding::TypeMarker for SignerSignHashWithPrivateKeyResponse {
5946 type Owned = Self;
5947
5948 #[inline(always)]
5949 fn inline_align(_context: fidl::encoding::Context) -> usize {
5950 8
5951 }
5952
5953 #[inline(always)]
5954 fn inline_size(_context: fidl::encoding::Context) -> usize {
5955 16
5956 }
5957 }
5958
5959 unsafe impl<D: fidl::encoding::ResourceDialect>
5960 fidl::encoding::Encode<SignerSignHashWithPrivateKeyResponse, D>
5961 for &SignerSignHashWithPrivateKeyResponse
5962 {
5963 #[inline]
5964 unsafe fn encode(
5965 self,
5966 encoder: &mut fidl::encoding::Encoder<'_, D>,
5967 offset: usize,
5968 _depth: fidl::encoding::Depth,
5969 ) -> fidl::Result<()> {
5970 encoder.debug_check_bounds::<SignerSignHashWithPrivateKeyResponse>(offset);
5971 fidl::encoding::Encode::<SignerSignHashWithPrivateKeyResponse, D>::encode(
5973 (<fidl::encoding::Vector<u8, 139> as fidl::encoding::ValueTypeMarker>::borrow(
5974 &self.signature,
5975 ),),
5976 encoder,
5977 offset,
5978 _depth,
5979 )
5980 }
5981 }
5982 unsafe impl<
5983 D: fidl::encoding::ResourceDialect,
5984 T0: fidl::encoding::Encode<fidl::encoding::Vector<u8, 139>, D>,
5985 > fidl::encoding::Encode<SignerSignHashWithPrivateKeyResponse, D> for (T0,)
5986 {
5987 #[inline]
5988 unsafe fn encode(
5989 self,
5990 encoder: &mut fidl::encoding::Encoder<'_, D>,
5991 offset: usize,
5992 depth: fidl::encoding::Depth,
5993 ) -> fidl::Result<()> {
5994 encoder.debug_check_bounds::<SignerSignHashWithPrivateKeyResponse>(offset);
5995 self.0.encode(encoder, offset + 0, depth)?;
5999 Ok(())
6000 }
6001 }
6002
6003 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
6004 for SignerSignHashWithPrivateKeyResponse
6005 {
6006 #[inline(always)]
6007 fn new_empty() -> Self {
6008 Self { signature: fidl::new_empty!(fidl::encoding::Vector<u8, 139>, D) }
6009 }
6010
6011 #[inline]
6012 unsafe fn decode(
6013 &mut self,
6014 decoder: &mut fidl::encoding::Decoder<'_, D>,
6015 offset: usize,
6016 _depth: fidl::encoding::Depth,
6017 ) -> fidl::Result<()> {
6018 decoder.debug_check_bounds::<Self>(offset);
6019 fidl::decode!(fidl::encoding::Vector<u8, 139>, D, &mut self.signature, decoder, offset + 0, _depth)?;
6021 Ok(())
6022 }
6023 }
6024
6025 impl fidl::encoding::ValueTypeMarker for SignerSignHashResponse {
6026 type Borrowed<'a> = &'a Self;
6027 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6028 value
6029 }
6030 }
6031
6032 unsafe impl fidl::encoding::TypeMarker for SignerSignHashResponse {
6033 type Owned = Self;
6034
6035 #[inline(always)]
6036 fn inline_align(_context: fidl::encoding::Context) -> usize {
6037 8
6038 }
6039
6040 #[inline(always)]
6041 fn inline_size(_context: fidl::encoding::Context) -> usize {
6042 16
6043 }
6044 }
6045
6046 unsafe impl<D: fidl::encoding::ResourceDialect>
6047 fidl::encoding::Encode<SignerSignHashResponse, D> for &SignerSignHashResponse
6048 {
6049 #[inline]
6050 unsafe fn encode(
6051 self,
6052 encoder: &mut fidl::encoding::Encoder<'_, D>,
6053 offset: usize,
6054 _depth: fidl::encoding::Depth,
6055 ) -> fidl::Result<()> {
6056 encoder.debug_check_bounds::<SignerSignHashResponse>(offset);
6057 fidl::encoding::Encode::<SignerSignHashResponse, D>::encode(
6059 (<fidl::encoding::Vector<u8, 139> as fidl::encoding::ValueTypeMarker>::borrow(
6060 &self.signature,
6061 ),),
6062 encoder,
6063 offset,
6064 _depth,
6065 )
6066 }
6067 }
6068 unsafe impl<
6069 D: fidl::encoding::ResourceDialect,
6070 T0: fidl::encoding::Encode<fidl::encoding::Vector<u8, 139>, D>,
6071 > fidl::encoding::Encode<SignerSignHashResponse, D> for (T0,)
6072 {
6073 #[inline]
6074 unsafe fn encode(
6075 self,
6076 encoder: &mut fidl::encoding::Encoder<'_, D>,
6077 offset: usize,
6078 depth: fidl::encoding::Depth,
6079 ) -> fidl::Result<()> {
6080 encoder.debug_check_bounds::<SignerSignHashResponse>(offset);
6081 self.0.encode(encoder, offset + 0, depth)?;
6085 Ok(())
6086 }
6087 }
6088
6089 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
6090 for SignerSignHashResponse
6091 {
6092 #[inline(always)]
6093 fn new_empty() -> Self {
6094 Self { signature: fidl::new_empty!(fidl::encoding::Vector<u8, 139>, D) }
6095 }
6096
6097 #[inline]
6098 unsafe fn decode(
6099 &mut self,
6100 decoder: &mut fidl::encoding::Decoder<'_, D>,
6101 offset: usize,
6102 _depth: fidl::encoding::Depth,
6103 ) -> fidl::Result<()> {
6104 decoder.debug_check_bounds::<Self>(offset);
6105 fidl::decode!(fidl::encoding::Vector<u8, 139>, D, &mut self.signature, decoder, offset + 0, _depth)?;
6107 Ok(())
6108 }
6109 }
6110
6111 impl fidl::encoding::ResourceTypeMarker for StackGetPairingStateWatcherRequest {
6112 type Borrowed<'a> = &'a mut Self;
6113 fn take_or_borrow<'a>(
6114 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6115 ) -> Self::Borrowed<'a> {
6116 value
6117 }
6118 }
6119
6120 unsafe impl fidl::encoding::TypeMarker for StackGetPairingStateWatcherRequest {
6121 type Owned = Self;
6122
6123 #[inline(always)]
6124 fn inline_align(_context: fidl::encoding::Context) -> usize {
6125 4
6126 }
6127
6128 #[inline(always)]
6129 fn inline_size(_context: fidl::encoding::Context) -> usize {
6130 4
6131 }
6132 }
6133
6134 unsafe impl
6135 fidl::encoding::Encode<
6136 StackGetPairingStateWatcherRequest,
6137 fidl::encoding::DefaultFuchsiaResourceDialect,
6138 > for &mut StackGetPairingStateWatcherRequest
6139 {
6140 #[inline]
6141 unsafe fn encode(
6142 self,
6143 encoder: &mut fidl::encoding::Encoder<
6144 '_,
6145 fidl::encoding::DefaultFuchsiaResourceDialect,
6146 >,
6147 offset: usize,
6148 _depth: fidl::encoding::Depth,
6149 ) -> fidl::Result<()> {
6150 encoder.debug_check_bounds::<StackGetPairingStateWatcherRequest>(offset);
6151 fidl::encoding::Encode::<StackGetPairingStateWatcherRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6153 (
6154 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PairingStateWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.watcher),
6155 ),
6156 encoder, offset, _depth
6157 )
6158 }
6159 }
6160 unsafe impl<
6161 T0: fidl::encoding::Encode<
6162 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PairingStateWatcherMarker>>,
6163 fidl::encoding::DefaultFuchsiaResourceDialect,
6164 >,
6165 >
6166 fidl::encoding::Encode<
6167 StackGetPairingStateWatcherRequest,
6168 fidl::encoding::DefaultFuchsiaResourceDialect,
6169 > for (T0,)
6170 {
6171 #[inline]
6172 unsafe fn encode(
6173 self,
6174 encoder: &mut fidl::encoding::Encoder<
6175 '_,
6176 fidl::encoding::DefaultFuchsiaResourceDialect,
6177 >,
6178 offset: usize,
6179 depth: fidl::encoding::Depth,
6180 ) -> fidl::Result<()> {
6181 encoder.debug_check_bounds::<StackGetPairingStateWatcherRequest>(offset);
6182 self.0.encode(encoder, offset + 0, depth)?;
6186 Ok(())
6187 }
6188 }
6189
6190 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6191 for StackGetPairingStateWatcherRequest
6192 {
6193 #[inline(always)]
6194 fn new_empty() -> Self {
6195 Self {
6196 watcher: fidl::new_empty!(
6197 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PairingStateWatcherMarker>>,
6198 fidl::encoding::DefaultFuchsiaResourceDialect
6199 ),
6200 }
6201 }
6202
6203 #[inline]
6204 unsafe fn decode(
6205 &mut self,
6206 decoder: &mut fidl::encoding::Decoder<
6207 '_,
6208 fidl::encoding::DefaultFuchsiaResourceDialect,
6209 >,
6210 offset: usize,
6211 _depth: fidl::encoding::Depth,
6212 ) -> fidl::Result<()> {
6213 decoder.debug_check_bounds::<Self>(offset);
6214 fidl::decode!(
6216 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PairingStateWatcherMarker>>,
6217 fidl::encoding::DefaultFuchsiaResourceDialect,
6218 &mut self.watcher,
6219 decoder,
6220 offset + 0,
6221 _depth
6222 )?;
6223 Ok(())
6224 }
6225 }
6226
6227 impl fidl::encoding::ResourceTypeMarker for StackGetSvcDirectoryWatcherRequest {
6228 type Borrowed<'a> = &'a mut Self;
6229 fn take_or_borrow<'a>(
6230 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6231 ) -> Self::Borrowed<'a> {
6232 value
6233 }
6234 }
6235
6236 unsafe impl fidl::encoding::TypeMarker for StackGetSvcDirectoryWatcherRequest {
6237 type Owned = Self;
6238
6239 #[inline(always)]
6240 fn inline_align(_context: fidl::encoding::Context) -> usize {
6241 8
6242 }
6243
6244 #[inline(always)]
6245 fn inline_size(_context: fidl::encoding::Context) -> usize {
6246 16
6247 }
6248 }
6249
6250 unsafe impl
6251 fidl::encoding::Encode<
6252 StackGetSvcDirectoryWatcherRequest,
6253 fidl::encoding::DefaultFuchsiaResourceDialect,
6254 > for &mut StackGetSvcDirectoryWatcherRequest
6255 {
6256 #[inline]
6257 unsafe fn encode(
6258 self,
6259 encoder: &mut fidl::encoding::Encoder<
6260 '_,
6261 fidl::encoding::DefaultFuchsiaResourceDialect,
6262 >,
6263 offset: usize,
6264 _depth: fidl::encoding::Depth,
6265 ) -> fidl::Result<()> {
6266 encoder.debug_check_bounds::<StackGetSvcDirectoryWatcherRequest>(offset);
6267 fidl::encoding::Encode::<StackGetSvcDirectoryWatcherRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6269 (
6270 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.endpoint_id),
6271 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SvcDirectoryWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.watcher),
6272 ),
6273 encoder, offset, _depth
6274 )
6275 }
6276 }
6277 unsafe impl<
6278 T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
6279 T1: fidl::encoding::Encode<
6280 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SvcDirectoryWatcherMarker>>,
6281 fidl::encoding::DefaultFuchsiaResourceDialect,
6282 >,
6283 >
6284 fidl::encoding::Encode<
6285 StackGetSvcDirectoryWatcherRequest,
6286 fidl::encoding::DefaultFuchsiaResourceDialect,
6287 > for (T0, T1)
6288 {
6289 #[inline]
6290 unsafe fn encode(
6291 self,
6292 encoder: &mut fidl::encoding::Encoder<
6293 '_,
6294 fidl::encoding::DefaultFuchsiaResourceDialect,
6295 >,
6296 offset: usize,
6297 depth: fidl::encoding::Depth,
6298 ) -> fidl::Result<()> {
6299 encoder.debug_check_bounds::<StackGetSvcDirectoryWatcherRequest>(offset);
6300 unsafe {
6303 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
6304 (ptr as *mut u64).write_unaligned(0);
6305 }
6306 self.0.encode(encoder, offset + 0, depth)?;
6308 self.1.encode(encoder, offset + 8, depth)?;
6309 Ok(())
6310 }
6311 }
6312
6313 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6314 for StackGetSvcDirectoryWatcherRequest
6315 {
6316 #[inline(always)]
6317 fn new_empty() -> Self {
6318 Self {
6319 endpoint_id: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
6320 watcher: fidl::new_empty!(
6321 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SvcDirectoryWatcherMarker>>,
6322 fidl::encoding::DefaultFuchsiaResourceDialect
6323 ),
6324 }
6325 }
6326
6327 #[inline]
6328 unsafe fn decode(
6329 &mut self,
6330 decoder: &mut fidl::encoding::Decoder<
6331 '_,
6332 fidl::encoding::DefaultFuchsiaResourceDialect,
6333 >,
6334 offset: usize,
6335 _depth: fidl::encoding::Depth,
6336 ) -> fidl::Result<()> {
6337 decoder.debug_check_bounds::<Self>(offset);
6338 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
6340 let padval = unsafe { (ptr as *const u64).read_unaligned() };
6341 let mask = 0xffffffff00000000u64;
6342 let maskedval = padval & mask;
6343 if maskedval != 0 {
6344 return Err(fidl::Error::NonZeroPadding {
6345 padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
6346 });
6347 }
6348 fidl::decode!(
6349 u64,
6350 fidl::encoding::DefaultFuchsiaResourceDialect,
6351 &mut self.endpoint_id,
6352 decoder,
6353 offset + 0,
6354 _depth
6355 )?;
6356 fidl::decode!(
6357 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SvcDirectoryWatcherMarker>>,
6358 fidl::encoding::DefaultFuchsiaResourceDialect,
6359 &mut self.watcher,
6360 decoder,
6361 offset + 8,
6362 _depth
6363 )?;
6364 Ok(())
6365 }
6366 }
6367
6368 impl fidl::encoding::ResourceTypeMarker for StackProviderSetWlanNetworkConfigProviderRequest {
6369 type Borrowed<'a> = &'a mut Self;
6370 fn take_or_borrow<'a>(
6371 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6372 ) -> Self::Borrowed<'a> {
6373 value
6374 }
6375 }
6376
6377 unsafe impl fidl::encoding::TypeMarker for StackProviderSetWlanNetworkConfigProviderRequest {
6378 type Owned = Self;
6379
6380 #[inline(always)]
6381 fn inline_align(_context: fidl::encoding::Context) -> usize {
6382 4
6383 }
6384
6385 #[inline(always)]
6386 fn inline_size(_context: fidl::encoding::Context) -> usize {
6387 4
6388 }
6389 }
6390
6391 unsafe impl
6392 fidl::encoding::Encode<
6393 StackProviderSetWlanNetworkConfigProviderRequest,
6394 fidl::encoding::DefaultFuchsiaResourceDialect,
6395 > for &mut StackProviderSetWlanNetworkConfigProviderRequest
6396 {
6397 #[inline]
6398 unsafe fn encode(
6399 self,
6400 encoder: &mut fidl::encoding::Encoder<
6401 '_,
6402 fidl::encoding::DefaultFuchsiaResourceDialect,
6403 >,
6404 offset: usize,
6405 _depth: fidl::encoding::Depth,
6406 ) -> fidl::Result<()> {
6407 encoder.debug_check_bounds::<StackProviderSetWlanNetworkConfigProviderRequest>(offset);
6408 fidl::encoding::Encode::<
6410 StackProviderSetWlanNetworkConfigProviderRequest,
6411 fidl::encoding::DefaultFuchsiaResourceDialect,
6412 >::encode(
6413 (<fidl::encoding::Endpoint<
6414 fidl::endpoints::ClientEnd<WlanNetworkConfigProviderMarker>,
6415 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
6416 &mut self.provider
6417 ),),
6418 encoder,
6419 offset,
6420 _depth,
6421 )
6422 }
6423 }
6424 unsafe impl<
6425 T0: fidl::encoding::Encode<
6426 fidl::encoding::Endpoint<
6427 fidl::endpoints::ClientEnd<WlanNetworkConfigProviderMarker>,
6428 >,
6429 fidl::encoding::DefaultFuchsiaResourceDialect,
6430 >,
6431 >
6432 fidl::encoding::Encode<
6433 StackProviderSetWlanNetworkConfigProviderRequest,
6434 fidl::encoding::DefaultFuchsiaResourceDialect,
6435 > for (T0,)
6436 {
6437 #[inline]
6438 unsafe fn encode(
6439 self,
6440 encoder: &mut fidl::encoding::Encoder<
6441 '_,
6442 fidl::encoding::DefaultFuchsiaResourceDialect,
6443 >,
6444 offset: usize,
6445 depth: fidl::encoding::Depth,
6446 ) -> fidl::Result<()> {
6447 encoder.debug_check_bounds::<StackProviderSetWlanNetworkConfigProviderRequest>(offset);
6448 self.0.encode(encoder, offset + 0, depth)?;
6452 Ok(())
6453 }
6454 }
6455
6456 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6457 for StackProviderSetWlanNetworkConfigProviderRequest
6458 {
6459 #[inline(always)]
6460 fn new_empty() -> Self {
6461 Self {
6462 provider: fidl::new_empty!(
6463 fidl::encoding::Endpoint<
6464 fidl::endpoints::ClientEnd<WlanNetworkConfigProviderMarker>,
6465 >,
6466 fidl::encoding::DefaultFuchsiaResourceDialect
6467 ),
6468 }
6469 }
6470
6471 #[inline]
6472 unsafe fn decode(
6473 &mut self,
6474 decoder: &mut fidl::encoding::Decoder<
6475 '_,
6476 fidl::encoding::DefaultFuchsiaResourceDialect,
6477 >,
6478 offset: usize,
6479 _depth: fidl::encoding::Depth,
6480 ) -> fidl::Result<()> {
6481 decoder.debug_check_bounds::<Self>(offset);
6482 fidl::decode!(
6484 fidl::encoding::Endpoint<
6485 fidl::endpoints::ClientEnd<WlanNetworkConfigProviderMarker>,
6486 >,
6487 fidl::encoding::DefaultFuchsiaResourceDialect,
6488 &mut self.provider,
6489 decoder,
6490 offset + 0,
6491 _depth
6492 )?;
6493 Ok(())
6494 }
6495 }
6496
6497 impl fidl::encoding::ValueTypeMarker for StackResetConfigRequest {
6498 type Borrowed<'a> = &'a Self;
6499 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6500 value
6501 }
6502 }
6503
6504 unsafe impl fidl::encoding::TypeMarker for StackResetConfigRequest {
6505 type Owned = Self;
6506
6507 #[inline(always)]
6508 fn inline_align(_context: fidl::encoding::Context) -> usize {
6509 2
6510 }
6511
6512 #[inline(always)]
6513 fn inline_size(_context: fidl::encoding::Context) -> usize {
6514 2
6515 }
6516 }
6517
6518 unsafe impl<D: fidl::encoding::ResourceDialect>
6519 fidl::encoding::Encode<StackResetConfigRequest, D> for &StackResetConfigRequest
6520 {
6521 #[inline]
6522 unsafe fn encode(
6523 self,
6524 encoder: &mut fidl::encoding::Encoder<'_, D>,
6525 offset: usize,
6526 _depth: fidl::encoding::Depth,
6527 ) -> fidl::Result<()> {
6528 encoder.debug_check_bounds::<StackResetConfigRequest>(offset);
6529 fidl::encoding::Encode::<StackResetConfigRequest, D>::encode(
6531 (<ResetConfigFlags as fidl::encoding::ValueTypeMarker>::borrow(&self.flags),),
6532 encoder,
6533 offset,
6534 _depth,
6535 )
6536 }
6537 }
6538 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<ResetConfigFlags, D>>
6539 fidl::encoding::Encode<StackResetConfigRequest, D> for (T0,)
6540 {
6541 #[inline]
6542 unsafe fn encode(
6543 self,
6544 encoder: &mut fidl::encoding::Encoder<'_, D>,
6545 offset: usize,
6546 depth: fidl::encoding::Depth,
6547 ) -> fidl::Result<()> {
6548 encoder.debug_check_bounds::<StackResetConfigRequest>(offset);
6549 self.0.encode(encoder, offset + 0, depth)?;
6553 Ok(())
6554 }
6555 }
6556
6557 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
6558 for StackResetConfigRequest
6559 {
6560 #[inline(always)]
6561 fn new_empty() -> Self {
6562 Self { flags: fidl::new_empty!(ResetConfigFlags, D) }
6563 }
6564
6565 #[inline]
6566 unsafe fn decode(
6567 &mut self,
6568 decoder: &mut fidl::encoding::Decoder<'_, D>,
6569 offset: usize,
6570 _depth: fidl::encoding::Depth,
6571 ) -> fidl::Result<()> {
6572 decoder.debug_check_bounds::<Self>(offset);
6573 fidl::decode!(ResetConfigFlags, D, &mut self.flags, decoder, offset + 0, _depth)?;
6575 Ok(())
6576 }
6577 }
6578
6579 impl fidl::encoding::ValueTypeMarker for StackGetQrCodeResponse {
6580 type Borrowed<'a> = &'a Self;
6581 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6582 value
6583 }
6584 }
6585
6586 unsafe impl fidl::encoding::TypeMarker for StackGetQrCodeResponse {
6587 type Owned = Self;
6588
6589 #[inline(always)]
6590 fn inline_align(_context: fidl::encoding::Context) -> usize {
6591 8
6592 }
6593
6594 #[inline(always)]
6595 fn inline_size(_context: fidl::encoding::Context) -> usize {
6596 16
6597 }
6598 }
6599
6600 unsafe impl<D: fidl::encoding::ResourceDialect>
6601 fidl::encoding::Encode<StackGetQrCodeResponse, D> for &StackGetQrCodeResponse
6602 {
6603 #[inline]
6604 unsafe fn encode(
6605 self,
6606 encoder: &mut fidl::encoding::Encoder<'_, D>,
6607 offset: usize,
6608 _depth: fidl::encoding::Depth,
6609 ) -> fidl::Result<()> {
6610 encoder.debug_check_bounds::<StackGetQrCodeResponse>(offset);
6611 fidl::encoding::Encode::<StackGetQrCodeResponse, D>::encode(
6613 (<QrCode as fidl::encoding::ValueTypeMarker>::borrow(&self.qr_code),),
6614 encoder,
6615 offset,
6616 _depth,
6617 )
6618 }
6619 }
6620 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<QrCode, D>>
6621 fidl::encoding::Encode<StackGetQrCodeResponse, D> for (T0,)
6622 {
6623 #[inline]
6624 unsafe fn encode(
6625 self,
6626 encoder: &mut fidl::encoding::Encoder<'_, D>,
6627 offset: usize,
6628 depth: fidl::encoding::Depth,
6629 ) -> fidl::Result<()> {
6630 encoder.debug_check_bounds::<StackGetQrCodeResponse>(offset);
6631 self.0.encode(encoder, offset + 0, depth)?;
6635 Ok(())
6636 }
6637 }
6638
6639 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
6640 for StackGetQrCodeResponse
6641 {
6642 #[inline(always)]
6643 fn new_empty() -> Self {
6644 Self { qr_code: fidl::new_empty!(QrCode, D) }
6645 }
6646
6647 #[inline]
6648 unsafe fn decode(
6649 &mut self,
6650 decoder: &mut fidl::encoding::Decoder<'_, D>,
6651 offset: usize,
6652 _depth: fidl::encoding::Depth,
6653 ) -> fidl::Result<()> {
6654 decoder.debug_check_bounds::<Self>(offset);
6655 fidl::decode!(QrCode, D, &mut self.qr_code, decoder, offset + 0, _depth)?;
6657 Ok(())
6658 }
6659 }
6660
6661 impl fidl::encoding::ValueTypeMarker for SvcDirectoryWatcherWatchServiceDirectoryResponse {
6662 type Borrowed<'a> = &'a Self;
6663 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6664 value
6665 }
6666 }
6667
6668 unsafe impl fidl::encoding::TypeMarker for SvcDirectoryWatcherWatchServiceDirectoryResponse {
6669 type Owned = Self;
6670
6671 #[inline(always)]
6672 fn inline_align(_context: fidl::encoding::Context) -> usize {
6673 8
6674 }
6675
6676 #[inline(always)]
6677 fn inline_size(_context: fidl::encoding::Context) -> usize {
6678 16
6679 }
6680 }
6681
6682 unsafe impl<D: fidl::encoding::ResourceDialect>
6683 fidl::encoding::Encode<SvcDirectoryWatcherWatchServiceDirectoryResponse, D>
6684 for &SvcDirectoryWatcherWatchServiceDirectoryResponse
6685 {
6686 #[inline]
6687 unsafe fn encode(
6688 self,
6689 encoder: &mut fidl::encoding::Encoder<'_, D>,
6690 offset: usize,
6691 _depth: fidl::encoding::Depth,
6692 ) -> fidl::Result<()> {
6693 encoder.debug_check_bounds::<SvcDirectoryWatcherWatchServiceDirectoryResponse>(offset);
6694 fidl::encoding::Encode::<SvcDirectoryWatcherWatchServiceDirectoryResponse, D>::encode(
6696 (
6697 <fidl::encoding::Vector<HostPort, 256> as fidl::encoding::ValueTypeMarker>::borrow(&self.host_port_list),
6698 ),
6699 encoder, offset, _depth
6700 )
6701 }
6702 }
6703 unsafe impl<
6704 D: fidl::encoding::ResourceDialect,
6705 T0: fidl::encoding::Encode<fidl::encoding::Vector<HostPort, 256>, D>,
6706 > fidl::encoding::Encode<SvcDirectoryWatcherWatchServiceDirectoryResponse, D> for (T0,)
6707 {
6708 #[inline]
6709 unsafe fn encode(
6710 self,
6711 encoder: &mut fidl::encoding::Encoder<'_, D>,
6712 offset: usize,
6713 depth: fidl::encoding::Depth,
6714 ) -> fidl::Result<()> {
6715 encoder.debug_check_bounds::<SvcDirectoryWatcherWatchServiceDirectoryResponse>(offset);
6716 self.0.encode(encoder, offset + 0, depth)?;
6720 Ok(())
6721 }
6722 }
6723
6724 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
6725 for SvcDirectoryWatcherWatchServiceDirectoryResponse
6726 {
6727 #[inline(always)]
6728 fn new_empty() -> Self {
6729 Self { host_port_list: fidl::new_empty!(fidl::encoding::Vector<HostPort, 256>, D) }
6730 }
6731
6732 #[inline]
6733 unsafe fn decode(
6734 &mut self,
6735 decoder: &mut fidl::encoding::Decoder<'_, D>,
6736 offset: usize,
6737 _depth: fidl::encoding::Depth,
6738 ) -> fidl::Result<()> {
6739 decoder.debug_check_bounds::<Self>(offset);
6740 fidl::decode!(fidl::encoding::Vector<HostPort, 256>, D, &mut self.host_port_list, decoder, offset + 0, _depth)?;
6742 Ok(())
6743 }
6744 }
6745
6746 impl fidl::encoding::ValueTypeMarker for WlanNetworkConfigProviderWatchConnectedNetworkResponse {
6747 type Borrowed<'a> = &'a Self;
6748 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6749 value
6750 }
6751 }
6752
6753 unsafe impl fidl::encoding::TypeMarker for WlanNetworkConfigProviderWatchConnectedNetworkResponse {
6754 type Owned = Self;
6755
6756 #[inline(always)]
6757 fn inline_align(_context: fidl::encoding::Context) -> usize {
6758 8
6759 }
6760
6761 #[inline(always)]
6762 fn inline_size(_context: fidl::encoding::Context) -> usize {
6763 16
6764 }
6765 }
6766
6767 unsafe impl<D: fidl::encoding::ResourceDialect>
6768 fidl::encoding::Encode<WlanNetworkConfigProviderWatchConnectedNetworkResponse, D>
6769 for &WlanNetworkConfigProviderWatchConnectedNetworkResponse
6770 {
6771 #[inline]
6772 unsafe fn encode(
6773 self,
6774 encoder: &mut fidl::encoding::Encoder<'_, D>,
6775 offset: usize,
6776 _depth: fidl::encoding::Depth,
6777 ) -> fidl::Result<()> {
6778 encoder.debug_check_bounds::<WlanNetworkConfigProviderWatchConnectedNetworkResponse>(
6779 offset,
6780 );
6781 fidl::encoding::Encode::<WlanNetworkConfigProviderWatchConnectedNetworkResponse, D>::encode(
6783 (
6784 <fidl_fuchsia_wlan_policy::NetworkConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.network_config),
6785 ),
6786 encoder, offset, _depth
6787 )
6788 }
6789 }
6790 unsafe impl<
6791 D: fidl::encoding::ResourceDialect,
6792 T0: fidl::encoding::Encode<fidl_fuchsia_wlan_policy::NetworkConfig, D>,
6793 > fidl::encoding::Encode<WlanNetworkConfigProviderWatchConnectedNetworkResponse, D>
6794 for (T0,)
6795 {
6796 #[inline]
6797 unsafe fn encode(
6798 self,
6799 encoder: &mut fidl::encoding::Encoder<'_, D>,
6800 offset: usize,
6801 depth: fidl::encoding::Depth,
6802 ) -> fidl::Result<()> {
6803 encoder.debug_check_bounds::<WlanNetworkConfigProviderWatchConnectedNetworkResponse>(
6804 offset,
6805 );
6806 self.0.encode(encoder, offset + 0, depth)?;
6810 Ok(())
6811 }
6812 }
6813
6814 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
6815 for WlanNetworkConfigProviderWatchConnectedNetworkResponse
6816 {
6817 #[inline(always)]
6818 fn new_empty() -> Self {
6819 Self { network_config: fidl::new_empty!(fidl_fuchsia_wlan_policy::NetworkConfig, D) }
6820 }
6821
6822 #[inline]
6823 unsafe fn decode(
6824 &mut self,
6825 decoder: &mut fidl::encoding::Decoder<'_, D>,
6826 offset: usize,
6827 _depth: fidl::encoding::Depth,
6828 ) -> fidl::Result<()> {
6829 decoder.debug_check_bounds::<Self>(offset);
6830 fidl::decode!(
6832 fidl_fuchsia_wlan_policy::NetworkConfig,
6833 D,
6834 &mut self.network_config,
6835 decoder,
6836 offset + 0,
6837 _depth
6838 )?;
6839 Ok(())
6840 }
6841 }
6842
6843 impl PairingState {
6844 #[inline(always)]
6845 fn max_ordinal_present(&self) -> u64 {
6846 if let Some(_) = self.is_service_provisioned {
6847 return 5;
6848 }
6849 if let Some(_) = self.is_fabric_provisioned {
6850 return 4;
6851 }
6852 if let Some(_) = self.is_thread_provisioned {
6853 return 3;
6854 }
6855 if let Some(_) = self.is_wlan_provisioned {
6856 return 2;
6857 }
6858 if let Some(_) = self.is_weave_fully_provisioned {
6859 return 1;
6860 }
6861 0
6862 }
6863 }
6864
6865 impl fidl::encoding::ValueTypeMarker for PairingState {
6866 type Borrowed<'a> = &'a Self;
6867 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6868 value
6869 }
6870 }
6871
6872 unsafe impl fidl::encoding::TypeMarker for PairingState {
6873 type Owned = Self;
6874
6875 #[inline(always)]
6876 fn inline_align(_context: fidl::encoding::Context) -> usize {
6877 8
6878 }
6879
6880 #[inline(always)]
6881 fn inline_size(_context: fidl::encoding::Context) -> usize {
6882 16
6883 }
6884 }
6885
6886 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PairingState, D>
6887 for &PairingState
6888 {
6889 unsafe fn encode(
6890 self,
6891 encoder: &mut fidl::encoding::Encoder<'_, D>,
6892 offset: usize,
6893 mut depth: fidl::encoding::Depth,
6894 ) -> fidl::Result<()> {
6895 encoder.debug_check_bounds::<PairingState>(offset);
6896 let max_ordinal: u64 = self.max_ordinal_present();
6898 encoder.write_num(max_ordinal, offset);
6899 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6900 if max_ordinal == 0 {
6902 return Ok(());
6903 }
6904 depth.increment()?;
6905 let envelope_size = 8;
6906 let bytes_len = max_ordinal as usize * envelope_size;
6907 #[allow(unused_variables)]
6908 let offset = encoder.out_of_line_offset(bytes_len);
6909 let mut _prev_end_offset: usize = 0;
6910 if 1 > max_ordinal {
6911 return Ok(());
6912 }
6913
6914 let cur_offset: usize = (1 - 1) * envelope_size;
6917
6918 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6920
6921 fidl::encoding::encode_in_envelope_optional::<bool, D>(
6926 self.is_weave_fully_provisioned
6927 .as_ref()
6928 .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
6929 encoder,
6930 offset + cur_offset,
6931 depth,
6932 )?;
6933
6934 _prev_end_offset = cur_offset + envelope_size;
6935 if 2 > max_ordinal {
6936 return Ok(());
6937 }
6938
6939 let cur_offset: usize = (2 - 1) * envelope_size;
6942
6943 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6945
6946 fidl::encoding::encode_in_envelope_optional::<bool, D>(
6951 self.is_wlan_provisioned
6952 .as_ref()
6953 .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
6954 encoder,
6955 offset + cur_offset,
6956 depth,
6957 )?;
6958
6959 _prev_end_offset = cur_offset + envelope_size;
6960 if 3 > max_ordinal {
6961 return Ok(());
6962 }
6963
6964 let cur_offset: usize = (3 - 1) * envelope_size;
6967
6968 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6970
6971 fidl::encoding::encode_in_envelope_optional::<bool, D>(
6976 self.is_thread_provisioned
6977 .as_ref()
6978 .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
6979 encoder,
6980 offset + cur_offset,
6981 depth,
6982 )?;
6983
6984 _prev_end_offset = cur_offset + envelope_size;
6985 if 4 > max_ordinal {
6986 return Ok(());
6987 }
6988
6989 let cur_offset: usize = (4 - 1) * envelope_size;
6992
6993 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6995
6996 fidl::encoding::encode_in_envelope_optional::<bool, D>(
7001 self.is_fabric_provisioned
7002 .as_ref()
7003 .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
7004 encoder,
7005 offset + cur_offset,
7006 depth,
7007 )?;
7008
7009 _prev_end_offset = cur_offset + envelope_size;
7010 if 5 > max_ordinal {
7011 return Ok(());
7012 }
7013
7014 let cur_offset: usize = (5 - 1) * envelope_size;
7017
7018 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7020
7021 fidl::encoding::encode_in_envelope_optional::<bool, D>(
7026 self.is_service_provisioned
7027 .as_ref()
7028 .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
7029 encoder,
7030 offset + cur_offset,
7031 depth,
7032 )?;
7033
7034 _prev_end_offset = cur_offset + envelope_size;
7035
7036 Ok(())
7037 }
7038 }
7039
7040 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PairingState {
7041 #[inline(always)]
7042 fn new_empty() -> Self {
7043 Self::default()
7044 }
7045
7046 unsafe fn decode(
7047 &mut self,
7048 decoder: &mut fidl::encoding::Decoder<'_, D>,
7049 offset: usize,
7050 mut depth: fidl::encoding::Depth,
7051 ) -> fidl::Result<()> {
7052 decoder.debug_check_bounds::<Self>(offset);
7053 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7054 None => return Err(fidl::Error::NotNullable),
7055 Some(len) => len,
7056 };
7057 if len == 0 {
7059 return Ok(());
7060 };
7061 depth.increment()?;
7062 let envelope_size = 8;
7063 let bytes_len = len * envelope_size;
7064 let offset = decoder.out_of_line_offset(bytes_len)?;
7065 let mut _next_ordinal_to_read = 0;
7067 let mut next_offset = offset;
7068 let end_offset = offset + bytes_len;
7069 _next_ordinal_to_read += 1;
7070 if next_offset >= end_offset {
7071 return Ok(());
7072 }
7073
7074 while _next_ordinal_to_read < 1 {
7076 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7077 _next_ordinal_to_read += 1;
7078 next_offset += envelope_size;
7079 }
7080
7081 let next_out_of_line = decoder.next_out_of_line();
7082 let handles_before = decoder.remaining_handles();
7083 if let Some((inlined, num_bytes, num_handles)) =
7084 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7085 {
7086 let member_inline_size =
7087 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7088 if inlined != (member_inline_size <= 4) {
7089 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7090 }
7091 let inner_offset;
7092 let mut inner_depth = depth.clone();
7093 if inlined {
7094 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7095 inner_offset = next_offset;
7096 } else {
7097 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7098 inner_depth.increment()?;
7099 }
7100 let val_ref = self
7101 .is_weave_fully_provisioned
7102 .get_or_insert_with(|| fidl::new_empty!(bool, D));
7103 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
7104 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7105 {
7106 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7107 }
7108 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7109 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7110 }
7111 }
7112
7113 next_offset += envelope_size;
7114 _next_ordinal_to_read += 1;
7115 if next_offset >= end_offset {
7116 return Ok(());
7117 }
7118
7119 while _next_ordinal_to_read < 2 {
7121 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7122 _next_ordinal_to_read += 1;
7123 next_offset += envelope_size;
7124 }
7125
7126 let next_out_of_line = decoder.next_out_of_line();
7127 let handles_before = decoder.remaining_handles();
7128 if let Some((inlined, num_bytes, num_handles)) =
7129 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7130 {
7131 let member_inline_size =
7132 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7133 if inlined != (member_inline_size <= 4) {
7134 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7135 }
7136 let inner_offset;
7137 let mut inner_depth = depth.clone();
7138 if inlined {
7139 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7140 inner_offset = next_offset;
7141 } else {
7142 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7143 inner_depth.increment()?;
7144 }
7145 let val_ref =
7146 self.is_wlan_provisioned.get_or_insert_with(|| fidl::new_empty!(bool, D));
7147 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
7148 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7149 {
7150 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7151 }
7152 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7153 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7154 }
7155 }
7156
7157 next_offset += envelope_size;
7158 _next_ordinal_to_read += 1;
7159 if next_offset >= end_offset {
7160 return Ok(());
7161 }
7162
7163 while _next_ordinal_to_read < 3 {
7165 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7166 _next_ordinal_to_read += 1;
7167 next_offset += envelope_size;
7168 }
7169
7170 let next_out_of_line = decoder.next_out_of_line();
7171 let handles_before = decoder.remaining_handles();
7172 if let Some((inlined, num_bytes, num_handles)) =
7173 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7174 {
7175 let member_inline_size =
7176 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7177 if inlined != (member_inline_size <= 4) {
7178 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7179 }
7180 let inner_offset;
7181 let mut inner_depth = depth.clone();
7182 if inlined {
7183 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7184 inner_offset = next_offset;
7185 } else {
7186 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7187 inner_depth.increment()?;
7188 }
7189 let val_ref =
7190 self.is_thread_provisioned.get_or_insert_with(|| fidl::new_empty!(bool, D));
7191 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
7192 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7193 {
7194 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7195 }
7196 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7197 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7198 }
7199 }
7200
7201 next_offset += envelope_size;
7202 _next_ordinal_to_read += 1;
7203 if next_offset >= end_offset {
7204 return Ok(());
7205 }
7206
7207 while _next_ordinal_to_read < 4 {
7209 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7210 _next_ordinal_to_read += 1;
7211 next_offset += envelope_size;
7212 }
7213
7214 let next_out_of_line = decoder.next_out_of_line();
7215 let handles_before = decoder.remaining_handles();
7216 if let Some((inlined, num_bytes, num_handles)) =
7217 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7218 {
7219 let member_inline_size =
7220 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7221 if inlined != (member_inline_size <= 4) {
7222 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7223 }
7224 let inner_offset;
7225 let mut inner_depth = depth.clone();
7226 if inlined {
7227 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7228 inner_offset = next_offset;
7229 } else {
7230 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7231 inner_depth.increment()?;
7232 }
7233 let val_ref =
7234 self.is_fabric_provisioned.get_or_insert_with(|| fidl::new_empty!(bool, D));
7235 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
7236 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7237 {
7238 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7239 }
7240 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7241 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7242 }
7243 }
7244
7245 next_offset += envelope_size;
7246 _next_ordinal_to_read += 1;
7247 if next_offset >= end_offset {
7248 return Ok(());
7249 }
7250
7251 while _next_ordinal_to_read < 5 {
7253 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7254 _next_ordinal_to_read += 1;
7255 next_offset += envelope_size;
7256 }
7257
7258 let next_out_of_line = decoder.next_out_of_line();
7259 let handles_before = decoder.remaining_handles();
7260 if let Some((inlined, num_bytes, num_handles)) =
7261 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7262 {
7263 let member_inline_size =
7264 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7265 if inlined != (member_inline_size <= 4) {
7266 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7267 }
7268 let inner_offset;
7269 let mut inner_depth = depth.clone();
7270 if inlined {
7271 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7272 inner_offset = next_offset;
7273 } else {
7274 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7275 inner_depth.increment()?;
7276 }
7277 let val_ref =
7278 self.is_service_provisioned.get_or_insert_with(|| fidl::new_empty!(bool, D));
7279 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
7280 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7281 {
7282 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7283 }
7284 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7285 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7286 }
7287 }
7288
7289 next_offset += envelope_size;
7290
7291 while next_offset < end_offset {
7293 _next_ordinal_to_read += 1;
7294 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7295 next_offset += envelope_size;
7296 }
7297
7298 Ok(())
7299 }
7300 }
7301
7302 impl fidl::encoding::ValueTypeMarker for Host {
7303 type Borrowed<'a> = &'a Self;
7304 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7305 value
7306 }
7307 }
7308
7309 unsafe impl fidl::encoding::TypeMarker for Host {
7310 type Owned = Self;
7311
7312 #[inline(always)]
7313 fn inline_align(_context: fidl::encoding::Context) -> usize {
7314 8
7315 }
7316
7317 #[inline(always)]
7318 fn inline_size(_context: fidl::encoding::Context) -> usize {
7319 16
7320 }
7321 }
7322
7323 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Host, D> for &Host {
7324 #[inline]
7325 unsafe fn encode(
7326 self,
7327 encoder: &mut fidl::encoding::Encoder<'_, D>,
7328 offset: usize,
7329 _depth: fidl::encoding::Depth,
7330 ) -> fidl::Result<()> {
7331 encoder.debug_check_bounds::<Host>(offset);
7332 encoder.write_num::<u64>(self.ordinal(), offset);
7333 match self {
7334 Host::Hostname(ref val) => fidl::encoding::encode_in_envelope::<
7335 fidl::encoding::BoundedString<255>,
7336 D,
7337 >(
7338 <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
7339 val,
7340 ),
7341 encoder,
7342 offset + 8,
7343 _depth,
7344 ),
7345 Host::IpAddress(ref val) => fidl::encoding::encode_in_envelope::<
7346 fidl_fuchsia_net::IpAddress,
7347 D,
7348 >(
7349 <fidl_fuchsia_net::IpAddress as fidl::encoding::ValueTypeMarker>::borrow(val),
7350 encoder,
7351 offset + 8,
7352 _depth,
7353 ),
7354 }
7355 }
7356 }
7357
7358 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Host {
7359 #[inline(always)]
7360 fn new_empty() -> Self {
7361 Self::Hostname(fidl::new_empty!(fidl::encoding::BoundedString<255>, D))
7362 }
7363
7364 #[inline]
7365 unsafe fn decode(
7366 &mut self,
7367 decoder: &mut fidl::encoding::Decoder<'_, D>,
7368 offset: usize,
7369 mut depth: fidl::encoding::Depth,
7370 ) -> fidl::Result<()> {
7371 decoder.debug_check_bounds::<Self>(offset);
7372 #[allow(unused_variables)]
7373 let next_out_of_line = decoder.next_out_of_line();
7374 let handles_before = decoder.remaining_handles();
7375 let (ordinal, inlined, num_bytes, num_handles) =
7376 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
7377
7378 let member_inline_size = match ordinal {
7379 1 => {
7380 <fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
7381 decoder.context,
7382 )
7383 }
7384 2 => <fidl_fuchsia_net::IpAddress as fidl::encoding::TypeMarker>::inline_size(
7385 decoder.context,
7386 ),
7387 _ => return Err(fidl::Error::UnknownUnionTag),
7388 };
7389
7390 if inlined != (member_inline_size <= 4) {
7391 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7392 }
7393 let _inner_offset;
7394 if inlined {
7395 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
7396 _inner_offset = offset + 8;
7397 } else {
7398 depth.increment()?;
7399 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7400 }
7401 match ordinal {
7402 1 => {
7403 #[allow(irrefutable_let_patterns)]
7404 if let Host::Hostname(_) = self {
7405 } else {
7407 *self =
7409 Host::Hostname(fidl::new_empty!(fidl::encoding::BoundedString<255>, D));
7410 }
7411 #[allow(irrefutable_let_patterns)]
7412 if let Host::Hostname(ref mut val) = self {
7413 fidl::decode!(
7414 fidl::encoding::BoundedString<255>,
7415 D,
7416 val,
7417 decoder,
7418 _inner_offset,
7419 depth
7420 )?;
7421 } else {
7422 unreachable!()
7423 }
7424 }
7425 2 => {
7426 #[allow(irrefutable_let_patterns)]
7427 if let Host::IpAddress(_) = self {
7428 } else {
7430 *self = Host::IpAddress(fidl::new_empty!(fidl_fuchsia_net::IpAddress, D));
7432 }
7433 #[allow(irrefutable_let_patterns)]
7434 if let Host::IpAddress(ref mut val) = self {
7435 fidl::decode!(
7436 fidl_fuchsia_net::IpAddress,
7437 D,
7438 val,
7439 decoder,
7440 _inner_offset,
7441 depth
7442 )?;
7443 } else {
7444 unreachable!()
7445 }
7446 }
7447 ordinal => panic!("unexpected ordinal {:?}", ordinal),
7448 }
7449 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
7450 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7451 }
7452 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7453 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7454 }
7455 Ok(())
7456 }
7457 }
7458}