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