1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10pub use fidl_fuchsia_bluetooth_map_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Default, PartialEq)]
15pub struct AccessorSetNotificationRegistrationRequest {
16 pub mas_instance_ids: Option<Vec<u8>>,
17 pub server: Option<fidl::endpoints::ClientEnd<NotificationRegistrationMarker>>,
18 #[doc(hidden)]
19 pub __source_breaking: fidl::marker::SourceBreaking,
20}
21
22impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
23 for AccessorSetNotificationRegistrationRequest
24{
25}
26
27#[derive(Debug, Default, PartialEq)]
28pub struct MessagingClientWatchAccessorResponse {
29 pub peer_id: Option<fidl_fuchsia_bluetooth::PeerId>,
30 pub accessor: Option<fidl::endpoints::ClientEnd<AccessorMarker>>,
31 #[doc(hidden)]
32 pub __source_breaking: fidl::marker::SourceBreaking,
33}
34
35impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
36 for MessagingClientWatchAccessorResponse
37{
38}
39
40#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
41pub struct AccessorMarker;
42
43impl fidl::endpoints::ProtocolMarker for AccessorMarker {
44 type Proxy = AccessorProxy;
45 type RequestStream = AccessorRequestStream;
46 #[cfg(target_os = "fuchsia")]
47 type SynchronousProxy = AccessorSynchronousProxy;
48
49 const DEBUG_NAME: &'static str = "(anonymous) Accessor";
50}
51pub type AccessorListAllMasInstancesResult = Result<Vec<MasInstance>, Error>;
52pub type AccessorSetNotificationRegistrationResult = Result<(), Error>;
53
54pub trait AccessorProxyInterface: Send + Sync {
55 type GetDetailsResponseFut: std::future::Future<Output = Result<MessageControllerGetDetailsResult, fidl::Error>>
56 + Send;
57 fn r#get_details(&self, handle: u64, include_attachment: bool) -> Self::GetDetailsResponseFut;
58 type ListAllMasInstancesResponseFut: std::future::Future<Output = Result<AccessorListAllMasInstancesResult, fidl::Error>>
59 + Send;
60 fn r#list_all_mas_instances(&self) -> Self::ListAllMasInstancesResponseFut;
61 type SetNotificationRegistrationResponseFut: std::future::Future<Output = Result<AccessorSetNotificationRegistrationResult, fidl::Error>>
62 + Send;
63 fn r#set_notification_registration(
64 &self,
65 payload: AccessorSetNotificationRegistrationRequest,
66 ) -> Self::SetNotificationRegistrationResponseFut;
67}
68#[derive(Debug)]
69#[cfg(target_os = "fuchsia")]
70pub struct AccessorSynchronousProxy {
71 client: fidl::client::sync::Client,
72}
73
74#[cfg(target_os = "fuchsia")]
75impl fidl::endpoints::SynchronousProxy for AccessorSynchronousProxy {
76 type Proxy = AccessorProxy;
77 type Protocol = AccessorMarker;
78
79 fn from_channel(inner: fidl::Channel) -> Self {
80 Self::new(inner)
81 }
82
83 fn into_channel(self) -> fidl::Channel {
84 self.client.into_channel()
85 }
86
87 fn as_channel(&self) -> &fidl::Channel {
88 self.client.as_channel()
89 }
90}
91
92#[cfg(target_os = "fuchsia")]
93impl AccessorSynchronousProxy {
94 pub fn new(channel: fidl::Channel) -> Self {
95 let protocol_name = <AccessorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
96 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
97 }
98
99 pub fn into_channel(self) -> fidl::Channel {
100 self.client.into_channel()
101 }
102
103 pub fn wait_for_event(
106 &self,
107 deadline: zx::MonotonicInstant,
108 ) -> Result<AccessorEvent, fidl::Error> {
109 AccessorEvent::decode(self.client.wait_for_event(deadline)?)
110 }
111
112 pub fn r#get_details(
118 &self,
119 mut handle: u64,
120 mut include_attachment: bool,
121 ___deadline: zx::MonotonicInstant,
122 ) -> Result<MessageControllerGetDetailsResult, fidl::Error> {
123 let _response = self.client.send_query::<
124 MessageControllerGetDetailsRequest,
125 fidl::encoding::FlexibleResultType<Message, Error>,
126 >(
127 (handle, include_attachment,),
128 0x7c3667b69d66691e,
129 fidl::encoding::DynamicFlags::FLEXIBLE,
130 ___deadline,
131 )?
132 .into_result::<AccessorMarker>("get_details")?;
133 Ok(_response.map(|x| x))
134 }
135
136 pub fn r#list_all_mas_instances(
137 &self,
138 ___deadline: zx::MonotonicInstant,
139 ) -> Result<AccessorListAllMasInstancesResult, fidl::Error> {
140 let _response = self.client.send_query::<
141 fidl::encoding::EmptyPayload,
142 fidl::encoding::FlexibleResultType<AccessorListAllMasInstancesResponse, Error>,
143 >(
144 (),
145 0x6c78ebf9ba9780bd,
146 fidl::encoding::DynamicFlags::FLEXIBLE,
147 ___deadline,
148 )?
149 .into_result::<AccessorMarker>("list_all_mas_instances")?;
150 Ok(_response.map(|x| x.instances))
151 }
152
153 pub fn r#set_notification_registration(
166 &self,
167 mut payload: AccessorSetNotificationRegistrationRequest,
168 ___deadline: zx::MonotonicInstant,
169 ) -> Result<AccessorSetNotificationRegistrationResult, fidl::Error> {
170 let _response = self.client.send_query::<
171 AccessorSetNotificationRegistrationRequest,
172 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
173 >(
174 &mut payload,
175 0x3d764e196f83bd7c,
176 fidl::encoding::DynamicFlags::FLEXIBLE,
177 ___deadline,
178 )?
179 .into_result::<AccessorMarker>("set_notification_registration")?;
180 Ok(_response.map(|x| x))
181 }
182}
183
184#[cfg(target_os = "fuchsia")]
185impl From<AccessorSynchronousProxy> for zx::Handle {
186 fn from(value: AccessorSynchronousProxy) -> Self {
187 value.into_channel().into()
188 }
189}
190
191#[cfg(target_os = "fuchsia")]
192impl From<fidl::Channel> for AccessorSynchronousProxy {
193 fn from(value: fidl::Channel) -> Self {
194 Self::new(value)
195 }
196}
197
198#[derive(Debug, Clone)]
199pub struct AccessorProxy {
200 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
201}
202
203impl fidl::endpoints::Proxy for AccessorProxy {
204 type Protocol = AccessorMarker;
205
206 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
207 Self::new(inner)
208 }
209
210 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
211 self.client.into_channel().map_err(|client| Self { client })
212 }
213
214 fn as_channel(&self) -> &::fidl::AsyncChannel {
215 self.client.as_channel()
216 }
217}
218
219impl AccessorProxy {
220 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
222 let protocol_name = <AccessorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
223 Self { client: fidl::client::Client::new(channel, protocol_name) }
224 }
225
226 pub fn take_event_stream(&self) -> AccessorEventStream {
232 AccessorEventStream { event_receiver: self.client.take_event_receiver() }
233 }
234
235 pub fn r#get_details(
241 &self,
242 mut handle: u64,
243 mut include_attachment: bool,
244 ) -> fidl::client::QueryResponseFut<
245 MessageControllerGetDetailsResult,
246 fidl::encoding::DefaultFuchsiaResourceDialect,
247 > {
248 AccessorProxyInterface::r#get_details(self, handle, include_attachment)
249 }
250
251 pub fn r#list_all_mas_instances(
252 &self,
253 ) -> fidl::client::QueryResponseFut<
254 AccessorListAllMasInstancesResult,
255 fidl::encoding::DefaultFuchsiaResourceDialect,
256 > {
257 AccessorProxyInterface::r#list_all_mas_instances(self)
258 }
259
260 pub fn r#set_notification_registration(
273 &self,
274 mut payload: AccessorSetNotificationRegistrationRequest,
275 ) -> fidl::client::QueryResponseFut<
276 AccessorSetNotificationRegistrationResult,
277 fidl::encoding::DefaultFuchsiaResourceDialect,
278 > {
279 AccessorProxyInterface::r#set_notification_registration(self, payload)
280 }
281}
282
283impl AccessorProxyInterface for AccessorProxy {
284 type GetDetailsResponseFut = fidl::client::QueryResponseFut<
285 MessageControllerGetDetailsResult,
286 fidl::encoding::DefaultFuchsiaResourceDialect,
287 >;
288 fn r#get_details(
289 &self,
290 mut handle: u64,
291 mut include_attachment: bool,
292 ) -> Self::GetDetailsResponseFut {
293 fn _decode(
294 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
295 ) -> Result<MessageControllerGetDetailsResult, fidl::Error> {
296 let _response = fidl::client::decode_transaction_body::<
297 fidl::encoding::FlexibleResultType<Message, Error>,
298 fidl::encoding::DefaultFuchsiaResourceDialect,
299 0x7c3667b69d66691e,
300 >(_buf?)?
301 .into_result::<AccessorMarker>("get_details")?;
302 Ok(_response.map(|x| x))
303 }
304 self.client.send_query_and_decode::<
305 MessageControllerGetDetailsRequest,
306 MessageControllerGetDetailsResult,
307 >(
308 (handle, include_attachment,),
309 0x7c3667b69d66691e,
310 fidl::encoding::DynamicFlags::FLEXIBLE,
311 _decode,
312 )
313 }
314
315 type ListAllMasInstancesResponseFut = fidl::client::QueryResponseFut<
316 AccessorListAllMasInstancesResult,
317 fidl::encoding::DefaultFuchsiaResourceDialect,
318 >;
319 fn r#list_all_mas_instances(&self) -> Self::ListAllMasInstancesResponseFut {
320 fn _decode(
321 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
322 ) -> Result<AccessorListAllMasInstancesResult, fidl::Error> {
323 let _response = fidl::client::decode_transaction_body::<
324 fidl::encoding::FlexibleResultType<AccessorListAllMasInstancesResponse, Error>,
325 fidl::encoding::DefaultFuchsiaResourceDialect,
326 0x6c78ebf9ba9780bd,
327 >(_buf?)?
328 .into_result::<AccessorMarker>("list_all_mas_instances")?;
329 Ok(_response.map(|x| x.instances))
330 }
331 self.client.send_query_and_decode::<
332 fidl::encoding::EmptyPayload,
333 AccessorListAllMasInstancesResult,
334 >(
335 (),
336 0x6c78ebf9ba9780bd,
337 fidl::encoding::DynamicFlags::FLEXIBLE,
338 _decode,
339 )
340 }
341
342 type SetNotificationRegistrationResponseFut = fidl::client::QueryResponseFut<
343 AccessorSetNotificationRegistrationResult,
344 fidl::encoding::DefaultFuchsiaResourceDialect,
345 >;
346 fn r#set_notification_registration(
347 &self,
348 mut payload: AccessorSetNotificationRegistrationRequest,
349 ) -> Self::SetNotificationRegistrationResponseFut {
350 fn _decode(
351 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
352 ) -> Result<AccessorSetNotificationRegistrationResult, fidl::Error> {
353 let _response = fidl::client::decode_transaction_body::<
354 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
355 fidl::encoding::DefaultFuchsiaResourceDialect,
356 0x3d764e196f83bd7c,
357 >(_buf?)?
358 .into_result::<AccessorMarker>("set_notification_registration")?;
359 Ok(_response.map(|x| x))
360 }
361 self.client.send_query_and_decode::<
362 AccessorSetNotificationRegistrationRequest,
363 AccessorSetNotificationRegistrationResult,
364 >(
365 &mut payload,
366 0x3d764e196f83bd7c,
367 fidl::encoding::DynamicFlags::FLEXIBLE,
368 _decode,
369 )
370 }
371}
372
373pub struct AccessorEventStream {
374 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
375}
376
377impl std::marker::Unpin for AccessorEventStream {}
378
379impl futures::stream::FusedStream for AccessorEventStream {
380 fn is_terminated(&self) -> bool {
381 self.event_receiver.is_terminated()
382 }
383}
384
385impl futures::Stream for AccessorEventStream {
386 type Item = Result<AccessorEvent, fidl::Error>;
387
388 fn poll_next(
389 mut self: std::pin::Pin<&mut Self>,
390 cx: &mut std::task::Context<'_>,
391 ) -> std::task::Poll<Option<Self::Item>> {
392 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
393 &mut self.event_receiver,
394 cx
395 )?) {
396 Some(buf) => std::task::Poll::Ready(Some(AccessorEvent::decode(buf))),
397 None => std::task::Poll::Ready(None),
398 }
399 }
400}
401
402#[derive(Debug)]
403pub enum AccessorEvent {
404 #[non_exhaustive]
405 _UnknownEvent {
406 ordinal: u64,
408 },
409}
410
411impl AccessorEvent {
412 fn decode(
414 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
415 ) -> Result<AccessorEvent, fidl::Error> {
416 let (bytes, _handles) = buf.split_mut();
417 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
418 debug_assert_eq!(tx_header.tx_id, 0);
419 match tx_header.ordinal {
420 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
421 Ok(AccessorEvent::_UnknownEvent { ordinal: tx_header.ordinal })
422 }
423 _ => Err(fidl::Error::UnknownOrdinal {
424 ordinal: tx_header.ordinal,
425 protocol_name: <AccessorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
426 }),
427 }
428 }
429}
430
431pub struct AccessorRequestStream {
433 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
434 is_terminated: bool,
435}
436
437impl std::marker::Unpin for AccessorRequestStream {}
438
439impl futures::stream::FusedStream for AccessorRequestStream {
440 fn is_terminated(&self) -> bool {
441 self.is_terminated
442 }
443}
444
445impl fidl::endpoints::RequestStream for AccessorRequestStream {
446 type Protocol = AccessorMarker;
447 type ControlHandle = AccessorControlHandle;
448
449 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
450 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
451 }
452
453 fn control_handle(&self) -> Self::ControlHandle {
454 AccessorControlHandle { inner: self.inner.clone() }
455 }
456
457 fn into_inner(
458 self,
459 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
460 {
461 (self.inner, self.is_terminated)
462 }
463
464 fn from_inner(
465 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
466 is_terminated: bool,
467 ) -> Self {
468 Self { inner, is_terminated }
469 }
470}
471
472impl futures::Stream for AccessorRequestStream {
473 type Item = Result<AccessorRequest, fidl::Error>;
474
475 fn poll_next(
476 mut self: std::pin::Pin<&mut Self>,
477 cx: &mut std::task::Context<'_>,
478 ) -> std::task::Poll<Option<Self::Item>> {
479 let this = &mut *self;
480 if this.inner.check_shutdown(cx) {
481 this.is_terminated = true;
482 return std::task::Poll::Ready(None);
483 }
484 if this.is_terminated {
485 panic!("polled AccessorRequestStream after completion");
486 }
487 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
488 |bytes, handles| {
489 match this.inner.channel().read_etc(cx, bytes, handles) {
490 std::task::Poll::Ready(Ok(())) => {}
491 std::task::Poll::Pending => return std::task::Poll::Pending,
492 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
493 this.is_terminated = true;
494 return std::task::Poll::Ready(None);
495 }
496 std::task::Poll::Ready(Err(e)) => {
497 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
498 e.into(),
499 ))))
500 }
501 }
502
503 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
505
506 std::task::Poll::Ready(Some(match header.ordinal {
507 0x7c3667b69d66691e => {
508 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
509 let mut req = fidl::new_empty!(
510 MessageControllerGetDetailsRequest,
511 fidl::encoding::DefaultFuchsiaResourceDialect
512 );
513 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MessageControllerGetDetailsRequest>(&header, _body_bytes, handles, &mut req)?;
514 let control_handle = AccessorControlHandle { inner: this.inner.clone() };
515 Ok(AccessorRequest::GetDetails {
516 handle: req.handle,
517 include_attachment: req.include_attachment,
518
519 responder: AccessorGetDetailsResponder {
520 control_handle: std::mem::ManuallyDrop::new(control_handle),
521 tx_id: header.tx_id,
522 },
523 })
524 }
525 0x6c78ebf9ba9780bd => {
526 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
527 let mut req = fidl::new_empty!(
528 fidl::encoding::EmptyPayload,
529 fidl::encoding::DefaultFuchsiaResourceDialect
530 );
531 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
532 let control_handle = AccessorControlHandle { inner: this.inner.clone() };
533 Ok(AccessorRequest::ListAllMasInstances {
534 responder: AccessorListAllMasInstancesResponder {
535 control_handle: std::mem::ManuallyDrop::new(control_handle),
536 tx_id: header.tx_id,
537 },
538 })
539 }
540 0x3d764e196f83bd7c => {
541 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
542 let mut req = fidl::new_empty!(
543 AccessorSetNotificationRegistrationRequest,
544 fidl::encoding::DefaultFuchsiaResourceDialect
545 );
546 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AccessorSetNotificationRegistrationRequest>(&header, _body_bytes, handles, &mut req)?;
547 let control_handle = AccessorControlHandle { inner: this.inner.clone() };
548 Ok(AccessorRequest::SetNotificationRegistration {
549 payload: req,
550 responder: AccessorSetNotificationRegistrationResponder {
551 control_handle: std::mem::ManuallyDrop::new(control_handle),
552 tx_id: header.tx_id,
553 },
554 })
555 }
556 _ if header.tx_id == 0
557 && header
558 .dynamic_flags()
559 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
560 {
561 Ok(AccessorRequest::_UnknownMethod {
562 ordinal: header.ordinal,
563 control_handle: AccessorControlHandle { inner: this.inner.clone() },
564 method_type: fidl::MethodType::OneWay,
565 })
566 }
567 _ if header
568 .dynamic_flags()
569 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
570 {
571 this.inner.send_framework_err(
572 fidl::encoding::FrameworkErr::UnknownMethod,
573 header.tx_id,
574 header.ordinal,
575 header.dynamic_flags(),
576 (bytes, handles),
577 )?;
578 Ok(AccessorRequest::_UnknownMethod {
579 ordinal: header.ordinal,
580 control_handle: AccessorControlHandle { inner: this.inner.clone() },
581 method_type: fidl::MethodType::TwoWay,
582 })
583 }
584 _ => Err(fidl::Error::UnknownOrdinal {
585 ordinal: header.ordinal,
586 protocol_name:
587 <AccessorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
588 }),
589 }))
590 },
591 )
592 }
593}
594
595#[derive(Debug)]
597pub enum AccessorRequest {
598 GetDetails {
604 handle: u64,
605 include_attachment: bool,
606 responder: AccessorGetDetailsResponder,
607 },
608 ListAllMasInstances {
609 responder: AccessorListAllMasInstancesResponder,
610 },
611 SetNotificationRegistration {
624 payload: AccessorSetNotificationRegistrationRequest,
625 responder: AccessorSetNotificationRegistrationResponder,
626 },
627 #[non_exhaustive]
629 _UnknownMethod {
630 ordinal: u64,
632 control_handle: AccessorControlHandle,
633 method_type: fidl::MethodType,
634 },
635}
636
637impl AccessorRequest {
638 #[allow(irrefutable_let_patterns)]
639 pub fn into_get_details(self) -> Option<(u64, bool, AccessorGetDetailsResponder)> {
640 if let AccessorRequest::GetDetails { handle, include_attachment, responder } = self {
641 Some((handle, include_attachment, responder))
642 } else {
643 None
644 }
645 }
646
647 #[allow(irrefutable_let_patterns)]
648 pub fn into_list_all_mas_instances(self) -> Option<(AccessorListAllMasInstancesResponder)> {
649 if let AccessorRequest::ListAllMasInstances { responder } = self {
650 Some((responder))
651 } else {
652 None
653 }
654 }
655
656 #[allow(irrefutable_let_patterns)]
657 pub fn into_set_notification_registration(
658 self,
659 ) -> Option<(
660 AccessorSetNotificationRegistrationRequest,
661 AccessorSetNotificationRegistrationResponder,
662 )> {
663 if let AccessorRequest::SetNotificationRegistration { payload, responder } = self {
664 Some((payload, responder))
665 } else {
666 None
667 }
668 }
669
670 pub fn method_name(&self) -> &'static str {
672 match *self {
673 AccessorRequest::GetDetails { .. } => "get_details",
674 AccessorRequest::ListAllMasInstances { .. } => "list_all_mas_instances",
675 AccessorRequest::SetNotificationRegistration { .. } => "set_notification_registration",
676 AccessorRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
677 "unknown one-way method"
678 }
679 AccessorRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
680 "unknown two-way method"
681 }
682 }
683 }
684}
685
686#[derive(Debug, Clone)]
687pub struct AccessorControlHandle {
688 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
689}
690
691impl fidl::endpoints::ControlHandle for AccessorControlHandle {
692 fn shutdown(&self) {
693 self.inner.shutdown()
694 }
695 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
696 self.inner.shutdown_with_epitaph(status)
697 }
698
699 fn is_closed(&self) -> bool {
700 self.inner.channel().is_closed()
701 }
702 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
703 self.inner.channel().on_closed()
704 }
705
706 #[cfg(target_os = "fuchsia")]
707 fn signal_peer(
708 &self,
709 clear_mask: zx::Signals,
710 set_mask: zx::Signals,
711 ) -> Result<(), zx_status::Status> {
712 use fidl::Peered;
713 self.inner.channel().signal_peer(clear_mask, set_mask)
714 }
715}
716
717impl AccessorControlHandle {}
718
719#[must_use = "FIDL methods require a response to be sent"]
720#[derive(Debug)]
721pub struct AccessorGetDetailsResponder {
722 control_handle: std::mem::ManuallyDrop<AccessorControlHandle>,
723 tx_id: u32,
724}
725
726impl std::ops::Drop for AccessorGetDetailsResponder {
730 fn drop(&mut self) {
731 self.control_handle.shutdown();
732 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
734 }
735}
736
737impl fidl::endpoints::Responder for AccessorGetDetailsResponder {
738 type ControlHandle = AccessorControlHandle;
739
740 fn control_handle(&self) -> &AccessorControlHandle {
741 &self.control_handle
742 }
743
744 fn drop_without_shutdown(mut self) {
745 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
747 std::mem::forget(self);
749 }
750}
751
752impl AccessorGetDetailsResponder {
753 pub fn send(self, mut result: Result<&Message, Error>) -> Result<(), fidl::Error> {
757 let _result = self.send_raw(result);
758 if _result.is_err() {
759 self.control_handle.shutdown();
760 }
761 self.drop_without_shutdown();
762 _result
763 }
764
765 pub fn send_no_shutdown_on_err(
767 self,
768 mut result: Result<&Message, Error>,
769 ) -> Result<(), fidl::Error> {
770 let _result = self.send_raw(result);
771 self.drop_without_shutdown();
772 _result
773 }
774
775 fn send_raw(&self, mut result: Result<&Message, Error>) -> Result<(), fidl::Error> {
776 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<Message, Error>>(
777 fidl::encoding::FlexibleResult::new(result),
778 self.tx_id,
779 0x7c3667b69d66691e,
780 fidl::encoding::DynamicFlags::FLEXIBLE,
781 )
782 }
783}
784
785#[must_use = "FIDL methods require a response to be sent"]
786#[derive(Debug)]
787pub struct AccessorListAllMasInstancesResponder {
788 control_handle: std::mem::ManuallyDrop<AccessorControlHandle>,
789 tx_id: u32,
790}
791
792impl std::ops::Drop for AccessorListAllMasInstancesResponder {
796 fn drop(&mut self) {
797 self.control_handle.shutdown();
798 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
800 }
801}
802
803impl fidl::endpoints::Responder for AccessorListAllMasInstancesResponder {
804 type ControlHandle = AccessorControlHandle;
805
806 fn control_handle(&self) -> &AccessorControlHandle {
807 &self.control_handle
808 }
809
810 fn drop_without_shutdown(mut self) {
811 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
813 std::mem::forget(self);
815 }
816}
817
818impl AccessorListAllMasInstancesResponder {
819 pub fn send(self, mut result: Result<&[MasInstance], Error>) -> Result<(), fidl::Error> {
823 let _result = self.send_raw(result);
824 if _result.is_err() {
825 self.control_handle.shutdown();
826 }
827 self.drop_without_shutdown();
828 _result
829 }
830
831 pub fn send_no_shutdown_on_err(
833 self,
834 mut result: Result<&[MasInstance], Error>,
835 ) -> Result<(), fidl::Error> {
836 let _result = self.send_raw(result);
837 self.drop_without_shutdown();
838 _result
839 }
840
841 fn send_raw(&self, mut result: Result<&[MasInstance], Error>) -> Result<(), fidl::Error> {
842 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
843 AccessorListAllMasInstancesResponse,
844 Error,
845 >>(
846 fidl::encoding::FlexibleResult::new(result.map(|instances| (instances,))),
847 self.tx_id,
848 0x6c78ebf9ba9780bd,
849 fidl::encoding::DynamicFlags::FLEXIBLE,
850 )
851 }
852}
853
854#[must_use = "FIDL methods require a response to be sent"]
855#[derive(Debug)]
856pub struct AccessorSetNotificationRegistrationResponder {
857 control_handle: std::mem::ManuallyDrop<AccessorControlHandle>,
858 tx_id: u32,
859}
860
861impl std::ops::Drop for AccessorSetNotificationRegistrationResponder {
865 fn drop(&mut self) {
866 self.control_handle.shutdown();
867 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
869 }
870}
871
872impl fidl::endpoints::Responder for AccessorSetNotificationRegistrationResponder {
873 type ControlHandle = AccessorControlHandle;
874
875 fn control_handle(&self) -> &AccessorControlHandle {
876 &self.control_handle
877 }
878
879 fn drop_without_shutdown(mut self) {
880 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
882 std::mem::forget(self);
884 }
885}
886
887impl AccessorSetNotificationRegistrationResponder {
888 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
892 let _result = self.send_raw(result);
893 if _result.is_err() {
894 self.control_handle.shutdown();
895 }
896 self.drop_without_shutdown();
897 _result
898 }
899
900 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
902 let _result = self.send_raw(result);
903 self.drop_without_shutdown();
904 _result
905 }
906
907 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
908 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
909 fidl::encoding::EmptyStruct,
910 Error,
911 >>(
912 fidl::encoding::FlexibleResult::new(result),
913 self.tx_id,
914 0x3d764e196f83bd7c,
915 fidl::encoding::DynamicFlags::FLEXIBLE,
916 )
917 }
918}
919
920#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
921pub struct MessageControllerMarker;
922
923impl fidl::endpoints::ProtocolMarker for MessageControllerMarker {
924 type Proxy = MessageControllerProxy;
925 type RequestStream = MessageControllerRequestStream;
926 #[cfg(target_os = "fuchsia")]
927 type SynchronousProxy = MessageControllerSynchronousProxy;
928
929 const DEBUG_NAME: &'static str = "(anonymous) MessageController";
930}
931pub type MessageControllerGetDetailsResult = Result<Message, Error>;
932
933pub trait MessageControllerProxyInterface: Send + Sync {
934 type GetDetailsResponseFut: std::future::Future<Output = Result<MessageControllerGetDetailsResult, fidl::Error>>
935 + Send;
936 fn r#get_details(&self, handle: u64, include_attachment: bool) -> Self::GetDetailsResponseFut;
937}
938#[derive(Debug)]
939#[cfg(target_os = "fuchsia")]
940pub struct MessageControllerSynchronousProxy {
941 client: fidl::client::sync::Client,
942}
943
944#[cfg(target_os = "fuchsia")]
945impl fidl::endpoints::SynchronousProxy for MessageControllerSynchronousProxy {
946 type Proxy = MessageControllerProxy;
947 type Protocol = MessageControllerMarker;
948
949 fn from_channel(inner: fidl::Channel) -> Self {
950 Self::new(inner)
951 }
952
953 fn into_channel(self) -> fidl::Channel {
954 self.client.into_channel()
955 }
956
957 fn as_channel(&self) -> &fidl::Channel {
958 self.client.as_channel()
959 }
960}
961
962#[cfg(target_os = "fuchsia")]
963impl MessageControllerSynchronousProxy {
964 pub fn new(channel: fidl::Channel) -> Self {
965 let protocol_name =
966 <MessageControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
967 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
968 }
969
970 pub fn into_channel(self) -> fidl::Channel {
971 self.client.into_channel()
972 }
973
974 pub fn wait_for_event(
977 &self,
978 deadline: zx::MonotonicInstant,
979 ) -> Result<MessageControllerEvent, fidl::Error> {
980 MessageControllerEvent::decode(self.client.wait_for_event(deadline)?)
981 }
982
983 pub fn r#get_details(
989 &self,
990 mut handle: u64,
991 mut include_attachment: bool,
992 ___deadline: zx::MonotonicInstant,
993 ) -> Result<MessageControllerGetDetailsResult, fidl::Error> {
994 let _response = self.client.send_query::<
995 MessageControllerGetDetailsRequest,
996 fidl::encoding::FlexibleResultType<Message, Error>,
997 >(
998 (handle, include_attachment,),
999 0x7c3667b69d66691e,
1000 fidl::encoding::DynamicFlags::FLEXIBLE,
1001 ___deadline,
1002 )?
1003 .into_result::<MessageControllerMarker>("get_details")?;
1004 Ok(_response.map(|x| x))
1005 }
1006}
1007
1008#[cfg(target_os = "fuchsia")]
1009impl From<MessageControllerSynchronousProxy> for zx::Handle {
1010 fn from(value: MessageControllerSynchronousProxy) -> Self {
1011 value.into_channel().into()
1012 }
1013}
1014
1015#[cfg(target_os = "fuchsia")]
1016impl From<fidl::Channel> for MessageControllerSynchronousProxy {
1017 fn from(value: fidl::Channel) -> Self {
1018 Self::new(value)
1019 }
1020}
1021
1022#[derive(Debug, Clone)]
1023pub struct MessageControllerProxy {
1024 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1025}
1026
1027impl fidl::endpoints::Proxy for MessageControllerProxy {
1028 type Protocol = MessageControllerMarker;
1029
1030 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1031 Self::new(inner)
1032 }
1033
1034 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1035 self.client.into_channel().map_err(|client| Self { client })
1036 }
1037
1038 fn as_channel(&self) -> &::fidl::AsyncChannel {
1039 self.client.as_channel()
1040 }
1041}
1042
1043impl MessageControllerProxy {
1044 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1046 let protocol_name =
1047 <MessageControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1048 Self { client: fidl::client::Client::new(channel, protocol_name) }
1049 }
1050
1051 pub fn take_event_stream(&self) -> MessageControllerEventStream {
1057 MessageControllerEventStream { event_receiver: self.client.take_event_receiver() }
1058 }
1059
1060 pub fn r#get_details(
1066 &self,
1067 mut handle: u64,
1068 mut include_attachment: bool,
1069 ) -> fidl::client::QueryResponseFut<
1070 MessageControllerGetDetailsResult,
1071 fidl::encoding::DefaultFuchsiaResourceDialect,
1072 > {
1073 MessageControllerProxyInterface::r#get_details(self, handle, include_attachment)
1074 }
1075}
1076
1077impl MessageControllerProxyInterface for MessageControllerProxy {
1078 type GetDetailsResponseFut = fidl::client::QueryResponseFut<
1079 MessageControllerGetDetailsResult,
1080 fidl::encoding::DefaultFuchsiaResourceDialect,
1081 >;
1082 fn r#get_details(
1083 &self,
1084 mut handle: u64,
1085 mut include_attachment: bool,
1086 ) -> Self::GetDetailsResponseFut {
1087 fn _decode(
1088 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1089 ) -> Result<MessageControllerGetDetailsResult, fidl::Error> {
1090 let _response = fidl::client::decode_transaction_body::<
1091 fidl::encoding::FlexibleResultType<Message, Error>,
1092 fidl::encoding::DefaultFuchsiaResourceDialect,
1093 0x7c3667b69d66691e,
1094 >(_buf?)?
1095 .into_result::<MessageControllerMarker>("get_details")?;
1096 Ok(_response.map(|x| x))
1097 }
1098 self.client.send_query_and_decode::<
1099 MessageControllerGetDetailsRequest,
1100 MessageControllerGetDetailsResult,
1101 >(
1102 (handle, include_attachment,),
1103 0x7c3667b69d66691e,
1104 fidl::encoding::DynamicFlags::FLEXIBLE,
1105 _decode,
1106 )
1107 }
1108}
1109
1110pub struct MessageControllerEventStream {
1111 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1112}
1113
1114impl std::marker::Unpin for MessageControllerEventStream {}
1115
1116impl futures::stream::FusedStream for MessageControllerEventStream {
1117 fn is_terminated(&self) -> bool {
1118 self.event_receiver.is_terminated()
1119 }
1120}
1121
1122impl futures::Stream for MessageControllerEventStream {
1123 type Item = Result<MessageControllerEvent, fidl::Error>;
1124
1125 fn poll_next(
1126 mut self: std::pin::Pin<&mut Self>,
1127 cx: &mut std::task::Context<'_>,
1128 ) -> std::task::Poll<Option<Self::Item>> {
1129 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1130 &mut self.event_receiver,
1131 cx
1132 )?) {
1133 Some(buf) => std::task::Poll::Ready(Some(MessageControllerEvent::decode(buf))),
1134 None => std::task::Poll::Ready(None),
1135 }
1136 }
1137}
1138
1139#[derive(Debug)]
1140pub enum MessageControllerEvent {
1141 #[non_exhaustive]
1142 _UnknownEvent {
1143 ordinal: u64,
1145 },
1146}
1147
1148impl MessageControllerEvent {
1149 fn decode(
1151 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1152 ) -> Result<MessageControllerEvent, fidl::Error> {
1153 let (bytes, _handles) = buf.split_mut();
1154 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1155 debug_assert_eq!(tx_header.tx_id, 0);
1156 match tx_header.ordinal {
1157 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1158 Ok(MessageControllerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1159 }
1160 _ => Err(fidl::Error::UnknownOrdinal {
1161 ordinal: tx_header.ordinal,
1162 protocol_name:
1163 <MessageControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1164 }),
1165 }
1166 }
1167}
1168
1169pub struct MessageControllerRequestStream {
1171 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1172 is_terminated: bool,
1173}
1174
1175impl std::marker::Unpin for MessageControllerRequestStream {}
1176
1177impl futures::stream::FusedStream for MessageControllerRequestStream {
1178 fn is_terminated(&self) -> bool {
1179 self.is_terminated
1180 }
1181}
1182
1183impl fidl::endpoints::RequestStream for MessageControllerRequestStream {
1184 type Protocol = MessageControllerMarker;
1185 type ControlHandle = MessageControllerControlHandle;
1186
1187 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1188 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1189 }
1190
1191 fn control_handle(&self) -> Self::ControlHandle {
1192 MessageControllerControlHandle { inner: self.inner.clone() }
1193 }
1194
1195 fn into_inner(
1196 self,
1197 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1198 {
1199 (self.inner, self.is_terminated)
1200 }
1201
1202 fn from_inner(
1203 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1204 is_terminated: bool,
1205 ) -> Self {
1206 Self { inner, is_terminated }
1207 }
1208}
1209
1210impl futures::Stream for MessageControllerRequestStream {
1211 type Item = Result<MessageControllerRequest, fidl::Error>;
1212
1213 fn poll_next(
1214 mut self: std::pin::Pin<&mut Self>,
1215 cx: &mut std::task::Context<'_>,
1216 ) -> std::task::Poll<Option<Self::Item>> {
1217 let this = &mut *self;
1218 if this.inner.check_shutdown(cx) {
1219 this.is_terminated = true;
1220 return std::task::Poll::Ready(None);
1221 }
1222 if this.is_terminated {
1223 panic!("polled MessageControllerRequestStream after completion");
1224 }
1225 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1226 |bytes, handles| {
1227 match this.inner.channel().read_etc(cx, bytes, handles) {
1228 std::task::Poll::Ready(Ok(())) => {}
1229 std::task::Poll::Pending => return std::task::Poll::Pending,
1230 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1231 this.is_terminated = true;
1232 return std::task::Poll::Ready(None);
1233 }
1234 std::task::Poll::Ready(Err(e)) => {
1235 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1236 e.into(),
1237 ))))
1238 }
1239 }
1240
1241 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1243
1244 std::task::Poll::Ready(Some(match header.ordinal {
1245 0x7c3667b69d66691e => {
1246 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1247 let mut req = fidl::new_empty!(
1248 MessageControllerGetDetailsRequest,
1249 fidl::encoding::DefaultFuchsiaResourceDialect
1250 );
1251 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MessageControllerGetDetailsRequest>(&header, _body_bytes, handles, &mut req)?;
1252 let control_handle =
1253 MessageControllerControlHandle { inner: this.inner.clone() };
1254 Ok(MessageControllerRequest::GetDetails {
1255 handle: req.handle,
1256 include_attachment: req.include_attachment,
1257
1258 responder: MessageControllerGetDetailsResponder {
1259 control_handle: std::mem::ManuallyDrop::new(control_handle),
1260 tx_id: header.tx_id,
1261 },
1262 })
1263 }
1264 _ if header.tx_id == 0
1265 && header
1266 .dynamic_flags()
1267 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1268 {
1269 Ok(MessageControllerRequest::_UnknownMethod {
1270 ordinal: header.ordinal,
1271 control_handle: MessageControllerControlHandle {
1272 inner: this.inner.clone(),
1273 },
1274 method_type: fidl::MethodType::OneWay,
1275 })
1276 }
1277 _ if header
1278 .dynamic_flags()
1279 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1280 {
1281 this.inner.send_framework_err(
1282 fidl::encoding::FrameworkErr::UnknownMethod,
1283 header.tx_id,
1284 header.ordinal,
1285 header.dynamic_flags(),
1286 (bytes, handles),
1287 )?;
1288 Ok(MessageControllerRequest::_UnknownMethod {
1289 ordinal: header.ordinal,
1290 control_handle: MessageControllerControlHandle {
1291 inner: this.inner.clone(),
1292 },
1293 method_type: fidl::MethodType::TwoWay,
1294 })
1295 }
1296 _ => Err(fidl::Error::UnknownOrdinal {
1297 ordinal: header.ordinal,
1298 protocol_name:
1299 <MessageControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1300 }),
1301 }))
1302 },
1303 )
1304 }
1305}
1306
1307#[derive(Debug)]
1308pub enum MessageControllerRequest {
1309 GetDetails {
1315 handle: u64,
1316 include_attachment: bool,
1317 responder: MessageControllerGetDetailsResponder,
1318 },
1319 #[non_exhaustive]
1321 _UnknownMethod {
1322 ordinal: u64,
1324 control_handle: MessageControllerControlHandle,
1325 method_type: fidl::MethodType,
1326 },
1327}
1328
1329impl MessageControllerRequest {
1330 #[allow(irrefutable_let_patterns)]
1331 pub fn into_get_details(self) -> Option<(u64, bool, MessageControllerGetDetailsResponder)> {
1332 if let MessageControllerRequest::GetDetails { handle, include_attachment, responder } = self
1333 {
1334 Some((handle, include_attachment, responder))
1335 } else {
1336 None
1337 }
1338 }
1339
1340 pub fn method_name(&self) -> &'static str {
1342 match *self {
1343 MessageControllerRequest::GetDetails { .. } => "get_details",
1344 MessageControllerRequest::_UnknownMethod {
1345 method_type: fidl::MethodType::OneWay,
1346 ..
1347 } => "unknown one-way method",
1348 MessageControllerRequest::_UnknownMethod {
1349 method_type: fidl::MethodType::TwoWay,
1350 ..
1351 } => "unknown two-way method",
1352 }
1353 }
1354}
1355
1356#[derive(Debug, Clone)]
1357pub struct MessageControllerControlHandle {
1358 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1359}
1360
1361impl fidl::endpoints::ControlHandle for MessageControllerControlHandle {
1362 fn shutdown(&self) {
1363 self.inner.shutdown()
1364 }
1365 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1366 self.inner.shutdown_with_epitaph(status)
1367 }
1368
1369 fn is_closed(&self) -> bool {
1370 self.inner.channel().is_closed()
1371 }
1372 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1373 self.inner.channel().on_closed()
1374 }
1375
1376 #[cfg(target_os = "fuchsia")]
1377 fn signal_peer(
1378 &self,
1379 clear_mask: zx::Signals,
1380 set_mask: zx::Signals,
1381 ) -> Result<(), zx_status::Status> {
1382 use fidl::Peered;
1383 self.inner.channel().signal_peer(clear_mask, set_mask)
1384 }
1385}
1386
1387impl MessageControllerControlHandle {}
1388
1389#[must_use = "FIDL methods require a response to be sent"]
1390#[derive(Debug)]
1391pub struct MessageControllerGetDetailsResponder {
1392 control_handle: std::mem::ManuallyDrop<MessageControllerControlHandle>,
1393 tx_id: u32,
1394}
1395
1396impl std::ops::Drop for MessageControllerGetDetailsResponder {
1400 fn drop(&mut self) {
1401 self.control_handle.shutdown();
1402 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1404 }
1405}
1406
1407impl fidl::endpoints::Responder for MessageControllerGetDetailsResponder {
1408 type ControlHandle = MessageControllerControlHandle;
1409
1410 fn control_handle(&self) -> &MessageControllerControlHandle {
1411 &self.control_handle
1412 }
1413
1414 fn drop_without_shutdown(mut self) {
1415 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1417 std::mem::forget(self);
1419 }
1420}
1421
1422impl MessageControllerGetDetailsResponder {
1423 pub fn send(self, mut result: Result<&Message, Error>) -> Result<(), fidl::Error> {
1427 let _result = self.send_raw(result);
1428 if _result.is_err() {
1429 self.control_handle.shutdown();
1430 }
1431 self.drop_without_shutdown();
1432 _result
1433 }
1434
1435 pub fn send_no_shutdown_on_err(
1437 self,
1438 mut result: Result<&Message, Error>,
1439 ) -> Result<(), fidl::Error> {
1440 let _result = self.send_raw(result);
1441 self.drop_without_shutdown();
1442 _result
1443 }
1444
1445 fn send_raw(&self, mut result: Result<&Message, Error>) -> Result<(), fidl::Error> {
1446 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<Message, Error>>(
1447 fidl::encoding::FlexibleResult::new(result),
1448 self.tx_id,
1449 0x7c3667b69d66691e,
1450 fidl::encoding::DynamicFlags::FLEXIBLE,
1451 )
1452 }
1453}
1454
1455#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1456pub struct MessagingClientMarker;
1457
1458impl fidl::endpoints::ProtocolMarker for MessagingClientMarker {
1459 type Proxy = MessagingClientProxy;
1460 type RequestStream = MessagingClientRequestStream;
1461 #[cfg(target_os = "fuchsia")]
1462 type SynchronousProxy = MessagingClientSynchronousProxy;
1463
1464 const DEBUG_NAME: &'static str = "fuchsia.bluetooth.map.MessagingClient";
1465}
1466impl fidl::endpoints::DiscoverableProtocolMarker for MessagingClientMarker {}
1467pub type MessagingClientWatchAccessorResult = Result<MessagingClientWatchAccessorResponse, Error>;
1468
1469pub trait MessagingClientProxyInterface: Send + Sync {
1470 type WatchAccessorResponseFut: std::future::Future<Output = Result<MessagingClientWatchAccessorResult, fidl::Error>>
1471 + Send;
1472 fn r#watch_accessor(&self) -> Self::WatchAccessorResponseFut;
1473}
1474#[derive(Debug)]
1475#[cfg(target_os = "fuchsia")]
1476pub struct MessagingClientSynchronousProxy {
1477 client: fidl::client::sync::Client,
1478}
1479
1480#[cfg(target_os = "fuchsia")]
1481impl fidl::endpoints::SynchronousProxy for MessagingClientSynchronousProxy {
1482 type Proxy = MessagingClientProxy;
1483 type Protocol = MessagingClientMarker;
1484
1485 fn from_channel(inner: fidl::Channel) -> Self {
1486 Self::new(inner)
1487 }
1488
1489 fn into_channel(self) -> fidl::Channel {
1490 self.client.into_channel()
1491 }
1492
1493 fn as_channel(&self) -> &fidl::Channel {
1494 self.client.as_channel()
1495 }
1496}
1497
1498#[cfg(target_os = "fuchsia")]
1499impl MessagingClientSynchronousProxy {
1500 pub fn new(channel: fidl::Channel) -> Self {
1501 let protocol_name = <MessagingClientMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1502 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1503 }
1504
1505 pub fn into_channel(self) -> fidl::Channel {
1506 self.client.into_channel()
1507 }
1508
1509 pub fn wait_for_event(
1512 &self,
1513 deadline: zx::MonotonicInstant,
1514 ) -> Result<MessagingClientEvent, fidl::Error> {
1515 MessagingClientEvent::decode(self.client.wait_for_event(deadline)?)
1516 }
1517
1518 pub fn r#watch_accessor(
1525 &self,
1526 ___deadline: zx::MonotonicInstant,
1527 ) -> Result<MessagingClientWatchAccessorResult, fidl::Error> {
1528 let _response = self.client.send_query::<
1529 fidl::encoding::EmptyPayload,
1530 fidl::encoding::FlexibleResultType<MessagingClientWatchAccessorResponse, Error>,
1531 >(
1532 (),
1533 0x269e876c67302299,
1534 fidl::encoding::DynamicFlags::FLEXIBLE,
1535 ___deadline,
1536 )?
1537 .into_result::<MessagingClientMarker>("watch_accessor")?;
1538 Ok(_response.map(|x| x))
1539 }
1540}
1541
1542#[cfg(target_os = "fuchsia")]
1543impl From<MessagingClientSynchronousProxy> for zx::Handle {
1544 fn from(value: MessagingClientSynchronousProxy) -> Self {
1545 value.into_channel().into()
1546 }
1547}
1548
1549#[cfg(target_os = "fuchsia")]
1550impl From<fidl::Channel> for MessagingClientSynchronousProxy {
1551 fn from(value: fidl::Channel) -> Self {
1552 Self::new(value)
1553 }
1554}
1555
1556#[derive(Debug, Clone)]
1557pub struct MessagingClientProxy {
1558 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1559}
1560
1561impl fidl::endpoints::Proxy for MessagingClientProxy {
1562 type Protocol = MessagingClientMarker;
1563
1564 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1565 Self::new(inner)
1566 }
1567
1568 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1569 self.client.into_channel().map_err(|client| Self { client })
1570 }
1571
1572 fn as_channel(&self) -> &::fidl::AsyncChannel {
1573 self.client.as_channel()
1574 }
1575}
1576
1577impl MessagingClientProxy {
1578 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1580 let protocol_name = <MessagingClientMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1581 Self { client: fidl::client::Client::new(channel, protocol_name) }
1582 }
1583
1584 pub fn take_event_stream(&self) -> MessagingClientEventStream {
1590 MessagingClientEventStream { event_receiver: self.client.take_event_receiver() }
1591 }
1592
1593 pub fn r#watch_accessor(
1600 &self,
1601 ) -> fidl::client::QueryResponseFut<
1602 MessagingClientWatchAccessorResult,
1603 fidl::encoding::DefaultFuchsiaResourceDialect,
1604 > {
1605 MessagingClientProxyInterface::r#watch_accessor(self)
1606 }
1607}
1608
1609impl MessagingClientProxyInterface for MessagingClientProxy {
1610 type WatchAccessorResponseFut = fidl::client::QueryResponseFut<
1611 MessagingClientWatchAccessorResult,
1612 fidl::encoding::DefaultFuchsiaResourceDialect,
1613 >;
1614 fn r#watch_accessor(&self) -> Self::WatchAccessorResponseFut {
1615 fn _decode(
1616 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1617 ) -> Result<MessagingClientWatchAccessorResult, fidl::Error> {
1618 let _response = fidl::client::decode_transaction_body::<
1619 fidl::encoding::FlexibleResultType<MessagingClientWatchAccessorResponse, Error>,
1620 fidl::encoding::DefaultFuchsiaResourceDialect,
1621 0x269e876c67302299,
1622 >(_buf?)?
1623 .into_result::<MessagingClientMarker>("watch_accessor")?;
1624 Ok(_response.map(|x| x))
1625 }
1626 self.client.send_query_and_decode::<
1627 fidl::encoding::EmptyPayload,
1628 MessagingClientWatchAccessorResult,
1629 >(
1630 (),
1631 0x269e876c67302299,
1632 fidl::encoding::DynamicFlags::FLEXIBLE,
1633 _decode,
1634 )
1635 }
1636}
1637
1638pub struct MessagingClientEventStream {
1639 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1640}
1641
1642impl std::marker::Unpin for MessagingClientEventStream {}
1643
1644impl futures::stream::FusedStream for MessagingClientEventStream {
1645 fn is_terminated(&self) -> bool {
1646 self.event_receiver.is_terminated()
1647 }
1648}
1649
1650impl futures::Stream for MessagingClientEventStream {
1651 type Item = Result<MessagingClientEvent, fidl::Error>;
1652
1653 fn poll_next(
1654 mut self: std::pin::Pin<&mut Self>,
1655 cx: &mut std::task::Context<'_>,
1656 ) -> std::task::Poll<Option<Self::Item>> {
1657 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1658 &mut self.event_receiver,
1659 cx
1660 )?) {
1661 Some(buf) => std::task::Poll::Ready(Some(MessagingClientEvent::decode(buf))),
1662 None => std::task::Poll::Ready(None),
1663 }
1664 }
1665}
1666
1667#[derive(Debug)]
1668pub enum MessagingClientEvent {
1669 #[non_exhaustive]
1670 _UnknownEvent {
1671 ordinal: u64,
1673 },
1674}
1675
1676impl MessagingClientEvent {
1677 fn decode(
1679 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1680 ) -> Result<MessagingClientEvent, fidl::Error> {
1681 let (bytes, _handles) = buf.split_mut();
1682 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1683 debug_assert_eq!(tx_header.tx_id, 0);
1684 match tx_header.ordinal {
1685 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1686 Ok(MessagingClientEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1687 }
1688 _ => Err(fidl::Error::UnknownOrdinal {
1689 ordinal: tx_header.ordinal,
1690 protocol_name:
1691 <MessagingClientMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1692 }),
1693 }
1694 }
1695}
1696
1697pub struct MessagingClientRequestStream {
1699 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1700 is_terminated: bool,
1701}
1702
1703impl std::marker::Unpin for MessagingClientRequestStream {}
1704
1705impl futures::stream::FusedStream for MessagingClientRequestStream {
1706 fn is_terminated(&self) -> bool {
1707 self.is_terminated
1708 }
1709}
1710
1711impl fidl::endpoints::RequestStream for MessagingClientRequestStream {
1712 type Protocol = MessagingClientMarker;
1713 type ControlHandle = MessagingClientControlHandle;
1714
1715 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1716 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1717 }
1718
1719 fn control_handle(&self) -> Self::ControlHandle {
1720 MessagingClientControlHandle { inner: self.inner.clone() }
1721 }
1722
1723 fn into_inner(
1724 self,
1725 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1726 {
1727 (self.inner, self.is_terminated)
1728 }
1729
1730 fn from_inner(
1731 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1732 is_terminated: bool,
1733 ) -> Self {
1734 Self { inner, is_terminated }
1735 }
1736}
1737
1738impl futures::Stream for MessagingClientRequestStream {
1739 type Item = Result<MessagingClientRequest, fidl::Error>;
1740
1741 fn poll_next(
1742 mut self: std::pin::Pin<&mut Self>,
1743 cx: &mut std::task::Context<'_>,
1744 ) -> std::task::Poll<Option<Self::Item>> {
1745 let this = &mut *self;
1746 if this.inner.check_shutdown(cx) {
1747 this.is_terminated = true;
1748 return std::task::Poll::Ready(None);
1749 }
1750 if this.is_terminated {
1751 panic!("polled MessagingClientRequestStream after completion");
1752 }
1753 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1754 |bytes, handles| {
1755 match this.inner.channel().read_etc(cx, bytes, handles) {
1756 std::task::Poll::Ready(Ok(())) => {}
1757 std::task::Poll::Pending => return std::task::Poll::Pending,
1758 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1759 this.is_terminated = true;
1760 return std::task::Poll::Ready(None);
1761 }
1762 std::task::Poll::Ready(Err(e)) => {
1763 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1764 e.into(),
1765 ))))
1766 }
1767 }
1768
1769 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1771
1772 std::task::Poll::Ready(Some(match header.ordinal {
1773 0x269e876c67302299 => {
1774 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1775 let mut req = fidl::new_empty!(
1776 fidl::encoding::EmptyPayload,
1777 fidl::encoding::DefaultFuchsiaResourceDialect
1778 );
1779 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1780 let control_handle =
1781 MessagingClientControlHandle { inner: this.inner.clone() };
1782 Ok(MessagingClientRequest::WatchAccessor {
1783 responder: MessagingClientWatchAccessorResponder {
1784 control_handle: std::mem::ManuallyDrop::new(control_handle),
1785 tx_id: header.tx_id,
1786 },
1787 })
1788 }
1789 _ if header.tx_id == 0
1790 && header
1791 .dynamic_flags()
1792 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1793 {
1794 Ok(MessagingClientRequest::_UnknownMethod {
1795 ordinal: header.ordinal,
1796 control_handle: MessagingClientControlHandle {
1797 inner: this.inner.clone(),
1798 },
1799 method_type: fidl::MethodType::OneWay,
1800 })
1801 }
1802 _ if header
1803 .dynamic_flags()
1804 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1805 {
1806 this.inner.send_framework_err(
1807 fidl::encoding::FrameworkErr::UnknownMethod,
1808 header.tx_id,
1809 header.ordinal,
1810 header.dynamic_flags(),
1811 (bytes, handles),
1812 )?;
1813 Ok(MessagingClientRequest::_UnknownMethod {
1814 ordinal: header.ordinal,
1815 control_handle: MessagingClientControlHandle {
1816 inner: this.inner.clone(),
1817 },
1818 method_type: fidl::MethodType::TwoWay,
1819 })
1820 }
1821 _ => Err(fidl::Error::UnknownOrdinal {
1822 ordinal: header.ordinal,
1823 protocol_name:
1824 <MessagingClientMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1825 }),
1826 }))
1827 },
1828 )
1829 }
1830}
1831
1832#[derive(Debug)]
1835pub enum MessagingClientRequest {
1836 WatchAccessor { responder: MessagingClientWatchAccessorResponder },
1843 #[non_exhaustive]
1845 _UnknownMethod {
1846 ordinal: u64,
1848 control_handle: MessagingClientControlHandle,
1849 method_type: fidl::MethodType,
1850 },
1851}
1852
1853impl MessagingClientRequest {
1854 #[allow(irrefutable_let_patterns)]
1855 pub fn into_watch_accessor(self) -> Option<(MessagingClientWatchAccessorResponder)> {
1856 if let MessagingClientRequest::WatchAccessor { responder } = self {
1857 Some((responder))
1858 } else {
1859 None
1860 }
1861 }
1862
1863 pub fn method_name(&self) -> &'static str {
1865 match *self {
1866 MessagingClientRequest::WatchAccessor { .. } => "watch_accessor",
1867 MessagingClientRequest::_UnknownMethod {
1868 method_type: fidl::MethodType::OneWay,
1869 ..
1870 } => "unknown one-way method",
1871 MessagingClientRequest::_UnknownMethod {
1872 method_type: fidl::MethodType::TwoWay,
1873 ..
1874 } => "unknown two-way method",
1875 }
1876 }
1877}
1878
1879#[derive(Debug, Clone)]
1880pub struct MessagingClientControlHandle {
1881 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1882}
1883
1884impl fidl::endpoints::ControlHandle for MessagingClientControlHandle {
1885 fn shutdown(&self) {
1886 self.inner.shutdown()
1887 }
1888 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1889 self.inner.shutdown_with_epitaph(status)
1890 }
1891
1892 fn is_closed(&self) -> bool {
1893 self.inner.channel().is_closed()
1894 }
1895 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1896 self.inner.channel().on_closed()
1897 }
1898
1899 #[cfg(target_os = "fuchsia")]
1900 fn signal_peer(
1901 &self,
1902 clear_mask: zx::Signals,
1903 set_mask: zx::Signals,
1904 ) -> Result<(), zx_status::Status> {
1905 use fidl::Peered;
1906 self.inner.channel().signal_peer(clear_mask, set_mask)
1907 }
1908}
1909
1910impl MessagingClientControlHandle {}
1911
1912#[must_use = "FIDL methods require a response to be sent"]
1913#[derive(Debug)]
1914pub struct MessagingClientWatchAccessorResponder {
1915 control_handle: std::mem::ManuallyDrop<MessagingClientControlHandle>,
1916 tx_id: u32,
1917}
1918
1919impl std::ops::Drop for MessagingClientWatchAccessorResponder {
1923 fn drop(&mut self) {
1924 self.control_handle.shutdown();
1925 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1927 }
1928}
1929
1930impl fidl::endpoints::Responder for MessagingClientWatchAccessorResponder {
1931 type ControlHandle = MessagingClientControlHandle;
1932
1933 fn control_handle(&self) -> &MessagingClientControlHandle {
1934 &self.control_handle
1935 }
1936
1937 fn drop_without_shutdown(mut self) {
1938 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1940 std::mem::forget(self);
1942 }
1943}
1944
1945impl MessagingClientWatchAccessorResponder {
1946 pub fn send(
1950 self,
1951 mut result: Result<MessagingClientWatchAccessorResponse, Error>,
1952 ) -> Result<(), fidl::Error> {
1953 let _result = self.send_raw(result);
1954 if _result.is_err() {
1955 self.control_handle.shutdown();
1956 }
1957 self.drop_without_shutdown();
1958 _result
1959 }
1960
1961 pub fn send_no_shutdown_on_err(
1963 self,
1964 mut result: Result<MessagingClientWatchAccessorResponse, Error>,
1965 ) -> Result<(), fidl::Error> {
1966 let _result = self.send_raw(result);
1967 self.drop_without_shutdown();
1968 _result
1969 }
1970
1971 fn send_raw(
1972 &self,
1973 mut result: Result<MessagingClientWatchAccessorResponse, Error>,
1974 ) -> Result<(), fidl::Error> {
1975 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1976 MessagingClientWatchAccessorResponse,
1977 Error,
1978 >>(
1979 fidl::encoding::FlexibleResult::new(result.as_mut().map_err(|e| *e)),
1980 self.tx_id,
1981 0x269e876c67302299,
1982 fidl::encoding::DynamicFlags::FLEXIBLE,
1983 )
1984 }
1985}
1986
1987#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1988pub struct NotificationRegistrationMarker;
1989
1990impl fidl::endpoints::ProtocolMarker for NotificationRegistrationMarker {
1991 type Proxy = NotificationRegistrationProxy;
1992 type RequestStream = NotificationRegistrationRequestStream;
1993 #[cfg(target_os = "fuchsia")]
1994 type SynchronousProxy = NotificationRegistrationSynchronousProxy;
1995
1996 const DEBUG_NAME: &'static str = "(anonymous) NotificationRegistration";
1997}
1998
1999pub trait NotificationRegistrationProxyInterface: Send + Sync {
2000 type NewEventReportResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
2001 fn r#new_event_report(
2002 &self,
2003 payload: &NotificationRegistrationNewEventReportRequest,
2004 ) -> Self::NewEventReportResponseFut;
2005}
2006#[derive(Debug)]
2007#[cfg(target_os = "fuchsia")]
2008pub struct NotificationRegistrationSynchronousProxy {
2009 client: fidl::client::sync::Client,
2010}
2011
2012#[cfg(target_os = "fuchsia")]
2013impl fidl::endpoints::SynchronousProxy for NotificationRegistrationSynchronousProxy {
2014 type Proxy = NotificationRegistrationProxy;
2015 type Protocol = NotificationRegistrationMarker;
2016
2017 fn from_channel(inner: fidl::Channel) -> Self {
2018 Self::new(inner)
2019 }
2020
2021 fn into_channel(self) -> fidl::Channel {
2022 self.client.into_channel()
2023 }
2024
2025 fn as_channel(&self) -> &fidl::Channel {
2026 self.client.as_channel()
2027 }
2028}
2029
2030#[cfg(target_os = "fuchsia")]
2031impl NotificationRegistrationSynchronousProxy {
2032 pub fn new(channel: fidl::Channel) -> Self {
2033 let protocol_name =
2034 <NotificationRegistrationMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2035 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2036 }
2037
2038 pub fn into_channel(self) -> fidl::Channel {
2039 self.client.into_channel()
2040 }
2041
2042 pub fn wait_for_event(
2045 &self,
2046 deadline: zx::MonotonicInstant,
2047 ) -> Result<NotificationRegistrationEvent, fidl::Error> {
2048 NotificationRegistrationEvent::decode(self.client.wait_for_event(deadline)?)
2049 }
2050
2051 pub fn r#new_event_report(
2053 &self,
2054 mut payload: &NotificationRegistrationNewEventReportRequest,
2055 ___deadline: zx::MonotonicInstant,
2056 ) -> Result<(), fidl::Error> {
2057 let _response = self.client.send_query::<
2058 NotificationRegistrationNewEventReportRequest,
2059 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
2060 >(
2061 payload,
2062 0x4c7d185363415f14,
2063 fidl::encoding::DynamicFlags::FLEXIBLE,
2064 ___deadline,
2065 )?
2066 .into_result::<NotificationRegistrationMarker>("new_event_report")?;
2067 Ok(_response)
2068 }
2069}
2070
2071#[cfg(target_os = "fuchsia")]
2072impl From<NotificationRegistrationSynchronousProxy> for zx::Handle {
2073 fn from(value: NotificationRegistrationSynchronousProxy) -> Self {
2074 value.into_channel().into()
2075 }
2076}
2077
2078#[cfg(target_os = "fuchsia")]
2079impl From<fidl::Channel> for NotificationRegistrationSynchronousProxy {
2080 fn from(value: fidl::Channel) -> Self {
2081 Self::new(value)
2082 }
2083}
2084
2085#[derive(Debug, Clone)]
2086pub struct NotificationRegistrationProxy {
2087 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2088}
2089
2090impl fidl::endpoints::Proxy for NotificationRegistrationProxy {
2091 type Protocol = NotificationRegistrationMarker;
2092
2093 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2094 Self::new(inner)
2095 }
2096
2097 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2098 self.client.into_channel().map_err(|client| Self { client })
2099 }
2100
2101 fn as_channel(&self) -> &::fidl::AsyncChannel {
2102 self.client.as_channel()
2103 }
2104}
2105
2106impl NotificationRegistrationProxy {
2107 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2109 let protocol_name =
2110 <NotificationRegistrationMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2111 Self { client: fidl::client::Client::new(channel, protocol_name) }
2112 }
2113
2114 pub fn take_event_stream(&self) -> NotificationRegistrationEventStream {
2120 NotificationRegistrationEventStream { event_receiver: self.client.take_event_receiver() }
2121 }
2122
2123 pub fn r#new_event_report(
2125 &self,
2126 mut payload: &NotificationRegistrationNewEventReportRequest,
2127 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
2128 NotificationRegistrationProxyInterface::r#new_event_report(self, payload)
2129 }
2130}
2131
2132impl NotificationRegistrationProxyInterface for NotificationRegistrationProxy {
2133 type NewEventReportResponseFut =
2134 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
2135 fn r#new_event_report(
2136 &self,
2137 mut payload: &NotificationRegistrationNewEventReportRequest,
2138 ) -> Self::NewEventReportResponseFut {
2139 fn _decode(
2140 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2141 ) -> Result<(), fidl::Error> {
2142 let _response = fidl::client::decode_transaction_body::<
2143 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
2144 fidl::encoding::DefaultFuchsiaResourceDialect,
2145 0x4c7d185363415f14,
2146 >(_buf?)?
2147 .into_result::<NotificationRegistrationMarker>("new_event_report")?;
2148 Ok(_response)
2149 }
2150 self.client.send_query_and_decode::<NotificationRegistrationNewEventReportRequest, ()>(
2151 payload,
2152 0x4c7d185363415f14,
2153 fidl::encoding::DynamicFlags::FLEXIBLE,
2154 _decode,
2155 )
2156 }
2157}
2158
2159pub struct NotificationRegistrationEventStream {
2160 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2161}
2162
2163impl std::marker::Unpin for NotificationRegistrationEventStream {}
2164
2165impl futures::stream::FusedStream for NotificationRegistrationEventStream {
2166 fn is_terminated(&self) -> bool {
2167 self.event_receiver.is_terminated()
2168 }
2169}
2170
2171impl futures::Stream for NotificationRegistrationEventStream {
2172 type Item = Result<NotificationRegistrationEvent, fidl::Error>;
2173
2174 fn poll_next(
2175 mut self: std::pin::Pin<&mut Self>,
2176 cx: &mut std::task::Context<'_>,
2177 ) -> std::task::Poll<Option<Self::Item>> {
2178 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2179 &mut self.event_receiver,
2180 cx
2181 )?) {
2182 Some(buf) => std::task::Poll::Ready(Some(NotificationRegistrationEvent::decode(buf))),
2183 None => std::task::Poll::Ready(None),
2184 }
2185 }
2186}
2187
2188#[derive(Debug)]
2189pub enum NotificationRegistrationEvent {
2190 #[non_exhaustive]
2191 _UnknownEvent {
2192 ordinal: u64,
2194 },
2195}
2196
2197impl NotificationRegistrationEvent {
2198 fn decode(
2200 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2201 ) -> Result<NotificationRegistrationEvent, fidl::Error> {
2202 let (bytes, _handles) = buf.split_mut();
2203 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2204 debug_assert_eq!(tx_header.tx_id, 0);
2205 match tx_header.ordinal {
2206 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2207 Ok(NotificationRegistrationEvent::_UnknownEvent { ordinal: tx_header.ordinal })
2208 }
2209 _ => Err(fidl::Error::UnknownOrdinal {
2210 ordinal: tx_header.ordinal,
2211 protocol_name:
2212 <NotificationRegistrationMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2213 }),
2214 }
2215 }
2216}
2217
2218pub struct NotificationRegistrationRequestStream {
2220 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2221 is_terminated: bool,
2222}
2223
2224impl std::marker::Unpin for NotificationRegistrationRequestStream {}
2225
2226impl futures::stream::FusedStream for NotificationRegistrationRequestStream {
2227 fn is_terminated(&self) -> bool {
2228 self.is_terminated
2229 }
2230}
2231
2232impl fidl::endpoints::RequestStream for NotificationRegistrationRequestStream {
2233 type Protocol = NotificationRegistrationMarker;
2234 type ControlHandle = NotificationRegistrationControlHandle;
2235
2236 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2237 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2238 }
2239
2240 fn control_handle(&self) -> Self::ControlHandle {
2241 NotificationRegistrationControlHandle { inner: self.inner.clone() }
2242 }
2243
2244 fn into_inner(
2245 self,
2246 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2247 {
2248 (self.inner, self.is_terminated)
2249 }
2250
2251 fn from_inner(
2252 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2253 is_terminated: bool,
2254 ) -> Self {
2255 Self { inner, is_terminated }
2256 }
2257}
2258
2259impl futures::Stream for NotificationRegistrationRequestStream {
2260 type Item = Result<NotificationRegistrationRequest, fidl::Error>;
2261
2262 fn poll_next(
2263 mut self: std::pin::Pin<&mut Self>,
2264 cx: &mut std::task::Context<'_>,
2265 ) -> std::task::Poll<Option<Self::Item>> {
2266 let this = &mut *self;
2267 if this.inner.check_shutdown(cx) {
2268 this.is_terminated = true;
2269 return std::task::Poll::Ready(None);
2270 }
2271 if this.is_terminated {
2272 panic!("polled NotificationRegistrationRequestStream after completion");
2273 }
2274 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2275 |bytes, handles| {
2276 match this.inner.channel().read_etc(cx, bytes, handles) {
2277 std::task::Poll::Ready(Ok(())) => {}
2278 std::task::Poll::Pending => return std::task::Poll::Pending,
2279 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2280 this.is_terminated = true;
2281 return std::task::Poll::Ready(None);
2282 }
2283 std::task::Poll::Ready(Err(e)) => {
2284 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2285 e.into(),
2286 ))))
2287 }
2288 }
2289
2290 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2292
2293 std::task::Poll::Ready(Some(match header.ordinal {
2294 0x4c7d185363415f14 => {
2295 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2296 let mut req = fidl::new_empty!(NotificationRegistrationNewEventReportRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
2297 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NotificationRegistrationNewEventReportRequest>(&header, _body_bytes, handles, &mut req)?;
2298 let control_handle = NotificationRegistrationControlHandle {
2299 inner: this.inner.clone(),
2300 };
2301 Ok(NotificationRegistrationRequest::NewEventReport {payload: req,
2302 responder: NotificationRegistrationNewEventReportResponder {
2303 control_handle: std::mem::ManuallyDrop::new(control_handle),
2304 tx_id: header.tx_id,
2305 },
2306 })
2307 }
2308 _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2309 Ok(NotificationRegistrationRequest::_UnknownMethod {
2310 ordinal: header.ordinal,
2311 control_handle: NotificationRegistrationControlHandle { inner: this.inner.clone() },
2312 method_type: fidl::MethodType::OneWay,
2313 })
2314 }
2315 _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2316 this.inner.send_framework_err(
2317 fidl::encoding::FrameworkErr::UnknownMethod,
2318 header.tx_id,
2319 header.ordinal,
2320 header.dynamic_flags(),
2321 (bytes, handles),
2322 )?;
2323 Ok(NotificationRegistrationRequest::_UnknownMethod {
2324 ordinal: header.ordinal,
2325 control_handle: NotificationRegistrationControlHandle { inner: this.inner.clone() },
2326 method_type: fidl::MethodType::TwoWay,
2327 })
2328 }
2329 _ => Err(fidl::Error::UnknownOrdinal {
2330 ordinal: header.ordinal,
2331 protocol_name: <NotificationRegistrationMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2332 }),
2333 }))
2334 },
2335 )
2336 }
2337}
2338
2339#[derive(Debug)]
2346pub enum NotificationRegistrationRequest {
2347 NewEventReport {
2349 payload: NotificationRegistrationNewEventReportRequest,
2350 responder: NotificationRegistrationNewEventReportResponder,
2351 },
2352 #[non_exhaustive]
2354 _UnknownMethod {
2355 ordinal: u64,
2357 control_handle: NotificationRegistrationControlHandle,
2358 method_type: fidl::MethodType,
2359 },
2360}
2361
2362impl NotificationRegistrationRequest {
2363 #[allow(irrefutable_let_patterns)]
2364 pub fn into_new_event_report(
2365 self,
2366 ) -> Option<(
2367 NotificationRegistrationNewEventReportRequest,
2368 NotificationRegistrationNewEventReportResponder,
2369 )> {
2370 if let NotificationRegistrationRequest::NewEventReport { payload, responder } = self {
2371 Some((payload, responder))
2372 } else {
2373 None
2374 }
2375 }
2376
2377 pub fn method_name(&self) -> &'static str {
2379 match *self {
2380 NotificationRegistrationRequest::NewEventReport { .. } => "new_event_report",
2381 NotificationRegistrationRequest::_UnknownMethod {
2382 method_type: fidl::MethodType::OneWay,
2383 ..
2384 } => "unknown one-way method",
2385 NotificationRegistrationRequest::_UnknownMethod {
2386 method_type: fidl::MethodType::TwoWay,
2387 ..
2388 } => "unknown two-way method",
2389 }
2390 }
2391}
2392
2393#[derive(Debug, Clone)]
2394pub struct NotificationRegistrationControlHandle {
2395 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2396}
2397
2398impl fidl::endpoints::ControlHandle for NotificationRegistrationControlHandle {
2399 fn shutdown(&self) {
2400 self.inner.shutdown()
2401 }
2402 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2403 self.inner.shutdown_with_epitaph(status)
2404 }
2405
2406 fn is_closed(&self) -> bool {
2407 self.inner.channel().is_closed()
2408 }
2409 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2410 self.inner.channel().on_closed()
2411 }
2412
2413 #[cfg(target_os = "fuchsia")]
2414 fn signal_peer(
2415 &self,
2416 clear_mask: zx::Signals,
2417 set_mask: zx::Signals,
2418 ) -> Result<(), zx_status::Status> {
2419 use fidl::Peered;
2420 self.inner.channel().signal_peer(clear_mask, set_mask)
2421 }
2422}
2423
2424impl NotificationRegistrationControlHandle {}
2425
2426#[must_use = "FIDL methods require a response to be sent"]
2427#[derive(Debug)]
2428pub struct NotificationRegistrationNewEventReportResponder {
2429 control_handle: std::mem::ManuallyDrop<NotificationRegistrationControlHandle>,
2430 tx_id: u32,
2431}
2432
2433impl std::ops::Drop for NotificationRegistrationNewEventReportResponder {
2437 fn drop(&mut self) {
2438 self.control_handle.shutdown();
2439 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2441 }
2442}
2443
2444impl fidl::endpoints::Responder for NotificationRegistrationNewEventReportResponder {
2445 type ControlHandle = NotificationRegistrationControlHandle;
2446
2447 fn control_handle(&self) -> &NotificationRegistrationControlHandle {
2448 &self.control_handle
2449 }
2450
2451 fn drop_without_shutdown(mut self) {
2452 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2454 std::mem::forget(self);
2456 }
2457}
2458
2459impl NotificationRegistrationNewEventReportResponder {
2460 pub fn send(self) -> Result<(), fidl::Error> {
2464 let _result = self.send_raw();
2465 if _result.is_err() {
2466 self.control_handle.shutdown();
2467 }
2468 self.drop_without_shutdown();
2469 _result
2470 }
2471
2472 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2474 let _result = self.send_raw();
2475 self.drop_without_shutdown();
2476 _result
2477 }
2478
2479 fn send_raw(&self) -> Result<(), fidl::Error> {
2480 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
2481 fidl::encoding::Flexible::new(()),
2482 self.tx_id,
2483 0x4c7d185363415f14,
2484 fidl::encoding::DynamicFlags::FLEXIBLE,
2485 )
2486 }
2487}
2488
2489mod internal {
2490 use super::*;
2491
2492 impl AccessorSetNotificationRegistrationRequest {
2493 #[inline(always)]
2494 fn max_ordinal_present(&self) -> u64 {
2495 if let Some(_) = self.server {
2496 return 2;
2497 }
2498 if let Some(_) = self.mas_instance_ids {
2499 return 1;
2500 }
2501 0
2502 }
2503 }
2504
2505 impl fidl::encoding::ResourceTypeMarker for AccessorSetNotificationRegistrationRequest {
2506 type Borrowed<'a> = &'a mut Self;
2507 fn take_or_borrow<'a>(
2508 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2509 ) -> Self::Borrowed<'a> {
2510 value
2511 }
2512 }
2513
2514 unsafe impl fidl::encoding::TypeMarker for AccessorSetNotificationRegistrationRequest {
2515 type Owned = Self;
2516
2517 #[inline(always)]
2518 fn inline_align(_context: fidl::encoding::Context) -> usize {
2519 8
2520 }
2521
2522 #[inline(always)]
2523 fn inline_size(_context: fidl::encoding::Context) -> usize {
2524 16
2525 }
2526 }
2527
2528 unsafe impl
2529 fidl::encoding::Encode<
2530 AccessorSetNotificationRegistrationRequest,
2531 fidl::encoding::DefaultFuchsiaResourceDialect,
2532 > for &mut AccessorSetNotificationRegistrationRequest
2533 {
2534 unsafe fn encode(
2535 self,
2536 encoder: &mut fidl::encoding::Encoder<
2537 '_,
2538 fidl::encoding::DefaultFuchsiaResourceDialect,
2539 >,
2540 offset: usize,
2541 mut depth: fidl::encoding::Depth,
2542 ) -> fidl::Result<()> {
2543 encoder.debug_check_bounds::<AccessorSetNotificationRegistrationRequest>(offset);
2544 let max_ordinal: u64 = self.max_ordinal_present();
2546 encoder.write_num(max_ordinal, offset);
2547 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2548 if max_ordinal == 0 {
2550 return Ok(());
2551 }
2552 depth.increment()?;
2553 let envelope_size = 8;
2554 let bytes_len = max_ordinal as usize * envelope_size;
2555 #[allow(unused_variables)]
2556 let offset = encoder.out_of_line_offset(bytes_len);
2557 let mut _prev_end_offset: usize = 0;
2558 if 1 > max_ordinal {
2559 return Ok(());
2560 }
2561
2562 let cur_offset: usize = (1 - 1) * envelope_size;
2565
2566 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2568
2569 fidl::encoding::encode_in_envelope_optional::<
2574 fidl::encoding::Vector<u8, 256>,
2575 fidl::encoding::DefaultFuchsiaResourceDialect,
2576 >(
2577 self.mas_instance_ids.as_ref().map(
2578 <fidl::encoding::Vector<u8, 256> as fidl::encoding::ValueTypeMarker>::borrow,
2579 ),
2580 encoder,
2581 offset + cur_offset,
2582 depth,
2583 )?;
2584
2585 _prev_end_offset = cur_offset + envelope_size;
2586 if 2 > max_ordinal {
2587 return Ok(());
2588 }
2589
2590 let cur_offset: usize = (2 - 1) * envelope_size;
2593
2594 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2596
2597 fidl::encoding::encode_in_envelope_optional::<
2602 fidl::encoding::Endpoint<
2603 fidl::endpoints::ClientEnd<NotificationRegistrationMarker>,
2604 >,
2605 fidl::encoding::DefaultFuchsiaResourceDialect,
2606 >(
2607 self.server.as_mut().map(
2608 <fidl::encoding::Endpoint<
2609 fidl::endpoints::ClientEnd<NotificationRegistrationMarker>,
2610 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
2611 ),
2612 encoder,
2613 offset + cur_offset,
2614 depth,
2615 )?;
2616
2617 _prev_end_offset = cur_offset + envelope_size;
2618
2619 Ok(())
2620 }
2621 }
2622
2623 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2624 for AccessorSetNotificationRegistrationRequest
2625 {
2626 #[inline(always)]
2627 fn new_empty() -> Self {
2628 Self::default()
2629 }
2630
2631 unsafe fn decode(
2632 &mut self,
2633 decoder: &mut fidl::encoding::Decoder<
2634 '_,
2635 fidl::encoding::DefaultFuchsiaResourceDialect,
2636 >,
2637 offset: usize,
2638 mut depth: fidl::encoding::Depth,
2639 ) -> fidl::Result<()> {
2640 decoder.debug_check_bounds::<Self>(offset);
2641 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2642 None => return Err(fidl::Error::NotNullable),
2643 Some(len) => len,
2644 };
2645 if len == 0 {
2647 return Ok(());
2648 };
2649 depth.increment()?;
2650 let envelope_size = 8;
2651 let bytes_len = len * envelope_size;
2652 let offset = decoder.out_of_line_offset(bytes_len)?;
2653 let mut _next_ordinal_to_read = 0;
2655 let mut next_offset = offset;
2656 let end_offset = offset + bytes_len;
2657 _next_ordinal_to_read += 1;
2658 if next_offset >= end_offset {
2659 return Ok(());
2660 }
2661
2662 while _next_ordinal_to_read < 1 {
2664 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2665 _next_ordinal_to_read += 1;
2666 next_offset += envelope_size;
2667 }
2668
2669 let next_out_of_line = decoder.next_out_of_line();
2670 let handles_before = decoder.remaining_handles();
2671 if let Some((inlined, num_bytes, num_handles)) =
2672 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2673 {
2674 let member_inline_size =
2675 <fidl::encoding::Vector<u8, 256> as fidl::encoding::TypeMarker>::inline_size(
2676 decoder.context,
2677 );
2678 if inlined != (member_inline_size <= 4) {
2679 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2680 }
2681 let inner_offset;
2682 let mut inner_depth = depth.clone();
2683 if inlined {
2684 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2685 inner_offset = next_offset;
2686 } else {
2687 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2688 inner_depth.increment()?;
2689 }
2690 let val_ref =
2691 self.mas_instance_ids.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 256>, fidl::encoding::DefaultFuchsiaResourceDialect));
2692 fidl::decode!(fidl::encoding::Vector<u8, 256>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
2693 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2694 {
2695 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2696 }
2697 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2698 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2699 }
2700 }
2701
2702 next_offset += envelope_size;
2703 _next_ordinal_to_read += 1;
2704 if next_offset >= end_offset {
2705 return Ok(());
2706 }
2707
2708 while _next_ordinal_to_read < 2 {
2710 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2711 _next_ordinal_to_read += 1;
2712 next_offset += envelope_size;
2713 }
2714
2715 let next_out_of_line = decoder.next_out_of_line();
2716 let handles_before = decoder.remaining_handles();
2717 if let Some((inlined, num_bytes, num_handles)) =
2718 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2719 {
2720 let member_inline_size = <fidl::encoding::Endpoint<
2721 fidl::endpoints::ClientEnd<NotificationRegistrationMarker>,
2722 > as fidl::encoding::TypeMarker>::inline_size(
2723 decoder.context
2724 );
2725 if inlined != (member_inline_size <= 4) {
2726 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2727 }
2728 let inner_offset;
2729 let mut inner_depth = depth.clone();
2730 if inlined {
2731 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2732 inner_offset = next_offset;
2733 } else {
2734 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2735 inner_depth.increment()?;
2736 }
2737 let val_ref = self.server.get_or_insert_with(|| {
2738 fidl::new_empty!(
2739 fidl::encoding::Endpoint<
2740 fidl::endpoints::ClientEnd<NotificationRegistrationMarker>,
2741 >,
2742 fidl::encoding::DefaultFuchsiaResourceDialect
2743 )
2744 });
2745 fidl::decode!(
2746 fidl::encoding::Endpoint<
2747 fidl::endpoints::ClientEnd<NotificationRegistrationMarker>,
2748 >,
2749 fidl::encoding::DefaultFuchsiaResourceDialect,
2750 val_ref,
2751 decoder,
2752 inner_offset,
2753 inner_depth
2754 )?;
2755 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2756 {
2757 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2758 }
2759 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2760 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2761 }
2762 }
2763
2764 next_offset += envelope_size;
2765
2766 while next_offset < end_offset {
2768 _next_ordinal_to_read += 1;
2769 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2770 next_offset += envelope_size;
2771 }
2772
2773 Ok(())
2774 }
2775 }
2776
2777 impl MessagingClientWatchAccessorResponse {
2778 #[inline(always)]
2779 fn max_ordinal_present(&self) -> u64 {
2780 if let Some(_) = self.accessor {
2781 return 2;
2782 }
2783 if let Some(_) = self.peer_id {
2784 return 1;
2785 }
2786 0
2787 }
2788 }
2789
2790 impl fidl::encoding::ResourceTypeMarker for MessagingClientWatchAccessorResponse {
2791 type Borrowed<'a> = &'a mut Self;
2792 fn take_or_borrow<'a>(
2793 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2794 ) -> Self::Borrowed<'a> {
2795 value
2796 }
2797 }
2798
2799 unsafe impl fidl::encoding::TypeMarker for MessagingClientWatchAccessorResponse {
2800 type Owned = Self;
2801
2802 #[inline(always)]
2803 fn inline_align(_context: fidl::encoding::Context) -> usize {
2804 8
2805 }
2806
2807 #[inline(always)]
2808 fn inline_size(_context: fidl::encoding::Context) -> usize {
2809 16
2810 }
2811 }
2812
2813 unsafe impl
2814 fidl::encoding::Encode<
2815 MessagingClientWatchAccessorResponse,
2816 fidl::encoding::DefaultFuchsiaResourceDialect,
2817 > for &mut MessagingClientWatchAccessorResponse
2818 {
2819 unsafe fn encode(
2820 self,
2821 encoder: &mut fidl::encoding::Encoder<
2822 '_,
2823 fidl::encoding::DefaultFuchsiaResourceDialect,
2824 >,
2825 offset: usize,
2826 mut depth: fidl::encoding::Depth,
2827 ) -> fidl::Result<()> {
2828 encoder.debug_check_bounds::<MessagingClientWatchAccessorResponse>(offset);
2829 let max_ordinal: u64 = self.max_ordinal_present();
2831 encoder.write_num(max_ordinal, offset);
2832 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2833 if max_ordinal == 0 {
2835 return Ok(());
2836 }
2837 depth.increment()?;
2838 let envelope_size = 8;
2839 let bytes_len = max_ordinal as usize * envelope_size;
2840 #[allow(unused_variables)]
2841 let offset = encoder.out_of_line_offset(bytes_len);
2842 let mut _prev_end_offset: usize = 0;
2843 if 1 > max_ordinal {
2844 return Ok(());
2845 }
2846
2847 let cur_offset: usize = (1 - 1) * envelope_size;
2850
2851 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2853
2854 fidl::encoding::encode_in_envelope_optional::<
2859 fidl_fuchsia_bluetooth::PeerId,
2860 fidl::encoding::DefaultFuchsiaResourceDialect,
2861 >(
2862 self.peer_id.as_ref().map(
2863 <fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow,
2864 ),
2865 encoder,
2866 offset + cur_offset,
2867 depth,
2868 )?;
2869
2870 _prev_end_offset = cur_offset + envelope_size;
2871 if 2 > max_ordinal {
2872 return Ok(());
2873 }
2874
2875 let cur_offset: usize = (2 - 1) * envelope_size;
2878
2879 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2881
2882 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<AccessorMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
2887 self.accessor.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<AccessorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
2888 encoder, offset + cur_offset, depth
2889 )?;
2890
2891 _prev_end_offset = cur_offset + envelope_size;
2892
2893 Ok(())
2894 }
2895 }
2896
2897 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2898 for MessagingClientWatchAccessorResponse
2899 {
2900 #[inline(always)]
2901 fn new_empty() -> Self {
2902 Self::default()
2903 }
2904
2905 unsafe fn decode(
2906 &mut self,
2907 decoder: &mut fidl::encoding::Decoder<
2908 '_,
2909 fidl::encoding::DefaultFuchsiaResourceDialect,
2910 >,
2911 offset: usize,
2912 mut depth: fidl::encoding::Depth,
2913 ) -> fidl::Result<()> {
2914 decoder.debug_check_bounds::<Self>(offset);
2915 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2916 None => return Err(fidl::Error::NotNullable),
2917 Some(len) => len,
2918 };
2919 if len == 0 {
2921 return Ok(());
2922 };
2923 depth.increment()?;
2924 let envelope_size = 8;
2925 let bytes_len = len * envelope_size;
2926 let offset = decoder.out_of_line_offset(bytes_len)?;
2927 let mut _next_ordinal_to_read = 0;
2929 let mut next_offset = offset;
2930 let end_offset = offset + bytes_len;
2931 _next_ordinal_to_read += 1;
2932 if next_offset >= end_offset {
2933 return Ok(());
2934 }
2935
2936 while _next_ordinal_to_read < 1 {
2938 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2939 _next_ordinal_to_read += 1;
2940 next_offset += envelope_size;
2941 }
2942
2943 let next_out_of_line = decoder.next_out_of_line();
2944 let handles_before = decoder.remaining_handles();
2945 if let Some((inlined, num_bytes, num_handles)) =
2946 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2947 {
2948 let member_inline_size =
2949 <fidl_fuchsia_bluetooth::PeerId as fidl::encoding::TypeMarker>::inline_size(
2950 decoder.context,
2951 );
2952 if inlined != (member_inline_size <= 4) {
2953 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2954 }
2955 let inner_offset;
2956 let mut inner_depth = depth.clone();
2957 if inlined {
2958 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2959 inner_offset = next_offset;
2960 } else {
2961 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2962 inner_depth.increment()?;
2963 }
2964 let val_ref = self.peer_id.get_or_insert_with(|| {
2965 fidl::new_empty!(
2966 fidl_fuchsia_bluetooth::PeerId,
2967 fidl::encoding::DefaultFuchsiaResourceDialect
2968 )
2969 });
2970 fidl::decode!(
2971 fidl_fuchsia_bluetooth::PeerId,
2972 fidl::encoding::DefaultFuchsiaResourceDialect,
2973 val_ref,
2974 decoder,
2975 inner_offset,
2976 inner_depth
2977 )?;
2978 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2979 {
2980 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2981 }
2982 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2983 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2984 }
2985 }
2986
2987 next_offset += envelope_size;
2988 _next_ordinal_to_read += 1;
2989 if next_offset >= end_offset {
2990 return Ok(());
2991 }
2992
2993 while _next_ordinal_to_read < 2 {
2995 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2996 _next_ordinal_to_read += 1;
2997 next_offset += envelope_size;
2998 }
2999
3000 let next_out_of_line = decoder.next_out_of_line();
3001 let handles_before = decoder.remaining_handles();
3002 if let Some((inlined, num_bytes, num_handles)) =
3003 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3004 {
3005 let member_inline_size = <fidl::encoding::Endpoint<
3006 fidl::endpoints::ClientEnd<AccessorMarker>,
3007 > as fidl::encoding::TypeMarker>::inline_size(
3008 decoder.context
3009 );
3010 if inlined != (member_inline_size <= 4) {
3011 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3012 }
3013 let inner_offset;
3014 let mut inner_depth = depth.clone();
3015 if inlined {
3016 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3017 inner_offset = next_offset;
3018 } else {
3019 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3020 inner_depth.increment()?;
3021 }
3022 let val_ref = self.accessor.get_or_insert_with(|| {
3023 fidl::new_empty!(
3024 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<AccessorMarker>>,
3025 fidl::encoding::DefaultFuchsiaResourceDialect
3026 )
3027 });
3028 fidl::decode!(
3029 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<AccessorMarker>>,
3030 fidl::encoding::DefaultFuchsiaResourceDialect,
3031 val_ref,
3032 decoder,
3033 inner_offset,
3034 inner_depth
3035 )?;
3036 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3037 {
3038 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3039 }
3040 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3041 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3042 }
3043 }
3044
3045 next_offset += envelope_size;
3046
3047 while next_offset < end_offset {
3049 _next_ordinal_to_read += 1;
3050 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3051 next_offset += envelope_size;
3052 }
3053
3054 Ok(())
3055 }
3056 }
3057}