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_diagnostics__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct ArchiveAccessorStreamDiagnosticsRequest {
16 pub stream_parameters: StreamParameters,
17 pub result_stream: fidl::endpoints::ServerEnd<BatchIteratorMarker>,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
21 for ArchiveAccessorStreamDiagnosticsRequest
22{
23}
24
25#[derive(Debug, PartialEq)]
26pub struct BatchIteratorGetNextResponse {
27 pub batch: Vec<FormattedContent>,
28}
29
30impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
31 for BatchIteratorGetNextResponse
32{
33}
34
35#[derive(Debug, PartialEq)]
36pub struct LogStreamConnectRequest {
37 pub socket: fidl::Socket,
38 pub opts: LogStreamOptions,
39}
40
41impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for LogStreamConnectRequest {}
42
43#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
44pub struct SampleCommitRequest {
45 pub sink: fidl::endpoints::ClientEnd<SampleSinkMarker>,
47}
48
49impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for SampleCommitRequest {}
50
51#[derive(Debug, PartialEq)]
52pub struct SampleSetRequest {
53 pub sample_parameters: SampleParameters,
55}
56
57impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for SampleSetRequest {}
58
59#[derive(Debug, PartialEq)]
60pub struct SampleSinkOnSampleReadiedRequest {
61 pub event: SampleSinkResult,
62}
63
64impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
65 for SampleSinkOnSampleReadiedRequest
66{
67}
68
69#[derive(Debug, Default, PartialEq)]
71pub struct SampleReady {
72 pub batch_iter: Option<fidl::endpoints::ClientEnd<BatchIteratorMarker>>,
74 pub seconds_since_start: Option<i64>,
90 #[doc(hidden)]
91 pub __source_breaking: fidl::marker::SourceBreaking,
92}
93
94impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for SampleReady {}
95
96#[derive(Debug)]
99pub enum FormattedContent {
100 Json(fidl_fuchsia_mem::Buffer),
103 Text(fidl_fuchsia_mem::Buffer),
106 Cbor(fidl::Vmo),
110 Fxt(fidl::Vmo),
116 #[doc(hidden)]
117 __SourceBreaking { unknown_ordinal: u64 },
118}
119
120#[macro_export]
122macro_rules! FormattedContentUnknown {
123 () => {
124 _
125 };
126}
127
128impl PartialEq for FormattedContent {
130 fn eq(&self, other: &Self) -> bool {
131 match (self, other) {
132 (Self::Json(x), Self::Json(y)) => *x == *y,
133 (Self::Text(x), Self::Text(y)) => *x == *y,
134 (Self::Cbor(x), Self::Cbor(y)) => *x == *y,
135 (Self::Fxt(x), Self::Fxt(y)) => *x == *y,
136 _ => false,
137 }
138 }
139}
140
141impl FormattedContent {
142 #[inline]
143 pub fn ordinal(&self) -> u64 {
144 match *self {
145 Self::Json(_) => 1,
146 Self::Text(_) => 2,
147 Self::Cbor(_) => 3,
148 Self::Fxt(_) => 4,
149 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
150 }
151 }
152
153 #[inline]
154 pub fn unknown_variant_for_testing() -> Self {
155 Self::__SourceBreaking { unknown_ordinal: 0 }
156 }
157
158 #[inline]
159 pub fn is_unknown(&self) -> bool {
160 match self {
161 Self::__SourceBreaking { .. } => true,
162 _ => false,
163 }
164 }
165}
166
167impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for FormattedContent {}
168
169#[derive(Debug)]
170pub enum SampleSinkResult {
171 Ready(SampleReady),
177 Error(RuntimeError),
180 #[doc(hidden)]
181 __SourceBreaking { unknown_ordinal: u64 },
182}
183
184#[macro_export]
186macro_rules! SampleSinkResultUnknown {
187 () => {
188 _
189 };
190}
191
192impl PartialEq for SampleSinkResult {
194 fn eq(&self, other: &Self) -> bool {
195 match (self, other) {
196 (Self::Ready(x), Self::Ready(y)) => *x == *y,
197 (Self::Error(x), Self::Error(y)) => *x == *y,
198 _ => false,
199 }
200 }
201}
202
203impl SampleSinkResult {
204 #[inline]
205 pub fn ordinal(&self) -> u64 {
206 match *self {
207 Self::Ready(_) => 1,
208 Self::Error(_) => 2,
209 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
210 }
211 }
212
213 #[inline]
214 pub fn unknown_variant_for_testing() -> Self {
215 Self::__SourceBreaking { unknown_ordinal: 0 }
216 }
217
218 #[inline]
219 pub fn is_unknown(&self) -> bool {
220 match self {
221 Self::__SourceBreaking { .. } => true,
222 _ => false,
223 }
224 }
225}
226
227impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for SampleSinkResult {}
228
229#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
230pub struct ArchiveAccessorMarker;
231
232impl fidl::endpoints::ProtocolMarker for ArchiveAccessorMarker {
233 type Proxy = ArchiveAccessorProxy;
234 type RequestStream = ArchiveAccessorRequestStream;
235 #[cfg(target_os = "fuchsia")]
236 type SynchronousProxy = ArchiveAccessorSynchronousProxy;
237
238 const DEBUG_NAME: &'static str = "fuchsia.diagnostics.ArchiveAccessor";
239}
240impl fidl::endpoints::DiscoverableProtocolMarker for ArchiveAccessorMarker {}
241
242pub trait ArchiveAccessorProxyInterface: Send + Sync {
243 fn r#stream_diagnostics(
244 &self,
245 stream_parameters: &StreamParameters,
246 result_stream: fidl::endpoints::ServerEnd<BatchIteratorMarker>,
247 ) -> Result<(), fidl::Error>;
248 type WaitForReadyResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
249 fn r#wait_for_ready(&self) -> Self::WaitForReadyResponseFut;
250}
251#[derive(Debug)]
252#[cfg(target_os = "fuchsia")]
253pub struct ArchiveAccessorSynchronousProxy {
254 client: fidl::client::sync::Client,
255}
256
257#[cfg(target_os = "fuchsia")]
258impl fidl::endpoints::SynchronousProxy for ArchiveAccessorSynchronousProxy {
259 type Proxy = ArchiveAccessorProxy;
260 type Protocol = ArchiveAccessorMarker;
261
262 fn from_channel(inner: fidl::Channel) -> Self {
263 Self::new(inner)
264 }
265
266 fn into_channel(self) -> fidl::Channel {
267 self.client.into_channel()
268 }
269
270 fn as_channel(&self) -> &fidl::Channel {
271 self.client.as_channel()
272 }
273}
274
275#[cfg(target_os = "fuchsia")]
276impl ArchiveAccessorSynchronousProxy {
277 pub fn new(channel: fidl::Channel) -> Self {
278 let protocol_name = <ArchiveAccessorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
279 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
280 }
281
282 pub fn into_channel(self) -> fidl::Channel {
283 self.client.into_channel()
284 }
285
286 pub fn wait_for_event(
289 &self,
290 deadline: zx::MonotonicInstant,
291 ) -> Result<ArchiveAccessorEvent, fidl::Error> {
292 ArchiveAccessorEvent::decode(self.client.wait_for_event(deadline)?)
293 }
294
295 pub fn r#stream_diagnostics(
313 &self,
314 mut stream_parameters: &StreamParameters,
315 mut result_stream: fidl::endpoints::ServerEnd<BatchIteratorMarker>,
316 ) -> Result<(), fidl::Error> {
317 self.client.send::<ArchiveAccessorStreamDiagnosticsRequest>(
318 (stream_parameters, result_stream),
319 0x20c73e2ecd653c3e,
320 fidl::encoding::DynamicFlags::FLEXIBLE,
321 )
322 }
323
324 pub fn r#wait_for_ready(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
327 let _response = self.client.send_query::<
328 fidl::encoding::EmptyPayload,
329 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
330 >(
331 (),
332 0x122963198011bd24,
333 fidl::encoding::DynamicFlags::FLEXIBLE,
334 ___deadline,
335 )?
336 .into_result::<ArchiveAccessorMarker>("wait_for_ready")?;
337 Ok(_response)
338 }
339}
340
341#[cfg(target_os = "fuchsia")]
342impl From<ArchiveAccessorSynchronousProxy> for zx::Handle {
343 fn from(value: ArchiveAccessorSynchronousProxy) -> Self {
344 value.into_channel().into()
345 }
346}
347
348#[cfg(target_os = "fuchsia")]
349impl From<fidl::Channel> for ArchiveAccessorSynchronousProxy {
350 fn from(value: fidl::Channel) -> Self {
351 Self::new(value)
352 }
353}
354
355#[cfg(target_os = "fuchsia")]
356impl fidl::endpoints::FromClient for ArchiveAccessorSynchronousProxy {
357 type Protocol = ArchiveAccessorMarker;
358
359 fn from_client(value: fidl::endpoints::ClientEnd<ArchiveAccessorMarker>) -> Self {
360 Self::new(value.into_channel())
361 }
362}
363
364#[derive(Debug, Clone)]
365pub struct ArchiveAccessorProxy {
366 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
367}
368
369impl fidl::endpoints::Proxy for ArchiveAccessorProxy {
370 type Protocol = ArchiveAccessorMarker;
371
372 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
373 Self::new(inner)
374 }
375
376 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
377 self.client.into_channel().map_err(|client| Self { client })
378 }
379
380 fn as_channel(&self) -> &::fidl::AsyncChannel {
381 self.client.as_channel()
382 }
383}
384
385impl ArchiveAccessorProxy {
386 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
388 let protocol_name = <ArchiveAccessorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
389 Self { client: fidl::client::Client::new(channel, protocol_name) }
390 }
391
392 pub fn take_event_stream(&self) -> ArchiveAccessorEventStream {
398 ArchiveAccessorEventStream { event_receiver: self.client.take_event_receiver() }
399 }
400
401 pub fn r#stream_diagnostics(
419 &self,
420 mut stream_parameters: &StreamParameters,
421 mut result_stream: fidl::endpoints::ServerEnd<BatchIteratorMarker>,
422 ) -> Result<(), fidl::Error> {
423 ArchiveAccessorProxyInterface::r#stream_diagnostics(self, stream_parameters, result_stream)
424 }
425
426 pub fn r#wait_for_ready(
429 &self,
430 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
431 ArchiveAccessorProxyInterface::r#wait_for_ready(self)
432 }
433}
434
435impl ArchiveAccessorProxyInterface for ArchiveAccessorProxy {
436 fn r#stream_diagnostics(
437 &self,
438 mut stream_parameters: &StreamParameters,
439 mut result_stream: fidl::endpoints::ServerEnd<BatchIteratorMarker>,
440 ) -> Result<(), fidl::Error> {
441 self.client.send::<ArchiveAccessorStreamDiagnosticsRequest>(
442 (stream_parameters, result_stream),
443 0x20c73e2ecd653c3e,
444 fidl::encoding::DynamicFlags::FLEXIBLE,
445 )
446 }
447
448 type WaitForReadyResponseFut =
449 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
450 fn r#wait_for_ready(&self) -> Self::WaitForReadyResponseFut {
451 fn _decode(
452 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
453 ) -> Result<(), fidl::Error> {
454 let _response = fidl::client::decode_transaction_body::<
455 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
456 fidl::encoding::DefaultFuchsiaResourceDialect,
457 0x122963198011bd24,
458 >(_buf?)?
459 .into_result::<ArchiveAccessorMarker>("wait_for_ready")?;
460 Ok(_response)
461 }
462 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
463 (),
464 0x122963198011bd24,
465 fidl::encoding::DynamicFlags::FLEXIBLE,
466 _decode,
467 )
468 }
469}
470
471pub struct ArchiveAccessorEventStream {
472 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
473}
474
475impl std::marker::Unpin for ArchiveAccessorEventStream {}
476
477impl futures::stream::FusedStream for ArchiveAccessorEventStream {
478 fn is_terminated(&self) -> bool {
479 self.event_receiver.is_terminated()
480 }
481}
482
483impl futures::Stream for ArchiveAccessorEventStream {
484 type Item = Result<ArchiveAccessorEvent, fidl::Error>;
485
486 fn poll_next(
487 mut self: std::pin::Pin<&mut Self>,
488 cx: &mut std::task::Context<'_>,
489 ) -> std::task::Poll<Option<Self::Item>> {
490 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
491 &mut self.event_receiver,
492 cx
493 )?) {
494 Some(buf) => std::task::Poll::Ready(Some(ArchiveAccessorEvent::decode(buf))),
495 None => std::task::Poll::Ready(None),
496 }
497 }
498}
499
500#[derive(Debug)]
501pub enum ArchiveAccessorEvent {
502 #[non_exhaustive]
503 _UnknownEvent {
504 ordinal: u64,
506 },
507}
508
509impl ArchiveAccessorEvent {
510 fn decode(
512 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
513 ) -> Result<ArchiveAccessorEvent, fidl::Error> {
514 let (bytes, _handles) = buf.split_mut();
515 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
516 debug_assert_eq!(tx_header.tx_id, 0);
517 match tx_header.ordinal {
518 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
519 Ok(ArchiveAccessorEvent::_UnknownEvent { ordinal: tx_header.ordinal })
520 }
521 _ => Err(fidl::Error::UnknownOrdinal {
522 ordinal: tx_header.ordinal,
523 protocol_name:
524 <ArchiveAccessorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
525 }),
526 }
527 }
528}
529
530pub struct ArchiveAccessorRequestStream {
532 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
533 is_terminated: bool,
534}
535
536impl std::marker::Unpin for ArchiveAccessorRequestStream {}
537
538impl futures::stream::FusedStream for ArchiveAccessorRequestStream {
539 fn is_terminated(&self) -> bool {
540 self.is_terminated
541 }
542}
543
544impl fidl::endpoints::RequestStream for ArchiveAccessorRequestStream {
545 type Protocol = ArchiveAccessorMarker;
546 type ControlHandle = ArchiveAccessorControlHandle;
547
548 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
549 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
550 }
551
552 fn control_handle(&self) -> Self::ControlHandle {
553 ArchiveAccessorControlHandle { inner: self.inner.clone() }
554 }
555
556 fn into_inner(
557 self,
558 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
559 {
560 (self.inner, self.is_terminated)
561 }
562
563 fn from_inner(
564 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
565 is_terminated: bool,
566 ) -> Self {
567 Self { inner, is_terminated }
568 }
569}
570
571impl futures::Stream for ArchiveAccessorRequestStream {
572 type Item = Result<ArchiveAccessorRequest, fidl::Error>;
573
574 fn poll_next(
575 mut self: std::pin::Pin<&mut Self>,
576 cx: &mut std::task::Context<'_>,
577 ) -> std::task::Poll<Option<Self::Item>> {
578 let this = &mut *self;
579 if this.inner.check_shutdown(cx) {
580 this.is_terminated = true;
581 return std::task::Poll::Ready(None);
582 }
583 if this.is_terminated {
584 panic!("polled ArchiveAccessorRequestStream after completion");
585 }
586 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
587 |bytes, handles| {
588 match this.inner.channel().read_etc(cx, bytes, handles) {
589 std::task::Poll::Ready(Ok(())) => {}
590 std::task::Poll::Pending => return std::task::Poll::Pending,
591 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
592 this.is_terminated = true;
593 return std::task::Poll::Ready(None);
594 }
595 std::task::Poll::Ready(Err(e)) => {
596 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
597 e.into(),
598 ))));
599 }
600 }
601
602 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
604
605 std::task::Poll::Ready(Some(match header.ordinal {
606 0x20c73e2ecd653c3e => {
607 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
608 let mut req = fidl::new_empty!(
609 ArchiveAccessorStreamDiagnosticsRequest,
610 fidl::encoding::DefaultFuchsiaResourceDialect
611 );
612 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ArchiveAccessorStreamDiagnosticsRequest>(&header, _body_bytes, handles, &mut req)?;
613 let control_handle =
614 ArchiveAccessorControlHandle { inner: this.inner.clone() };
615 Ok(ArchiveAccessorRequest::StreamDiagnostics {
616 stream_parameters: req.stream_parameters,
617 result_stream: req.result_stream,
618
619 control_handle,
620 })
621 }
622 0x122963198011bd24 => {
623 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
624 let mut req = fidl::new_empty!(
625 fidl::encoding::EmptyPayload,
626 fidl::encoding::DefaultFuchsiaResourceDialect
627 );
628 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
629 let control_handle =
630 ArchiveAccessorControlHandle { inner: this.inner.clone() };
631 Ok(ArchiveAccessorRequest::WaitForReady {
632 responder: ArchiveAccessorWaitForReadyResponder {
633 control_handle: std::mem::ManuallyDrop::new(control_handle),
634 tx_id: header.tx_id,
635 },
636 })
637 }
638 _ if header.tx_id == 0
639 && header
640 .dynamic_flags()
641 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
642 {
643 Ok(ArchiveAccessorRequest::_UnknownMethod {
644 ordinal: header.ordinal,
645 control_handle: ArchiveAccessorControlHandle {
646 inner: this.inner.clone(),
647 },
648 method_type: fidl::MethodType::OneWay,
649 })
650 }
651 _ if header
652 .dynamic_flags()
653 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
654 {
655 this.inner.send_framework_err(
656 fidl::encoding::FrameworkErr::UnknownMethod,
657 header.tx_id,
658 header.ordinal,
659 header.dynamic_flags(),
660 (bytes, handles),
661 )?;
662 Ok(ArchiveAccessorRequest::_UnknownMethod {
663 ordinal: header.ordinal,
664 control_handle: ArchiveAccessorControlHandle {
665 inner: this.inner.clone(),
666 },
667 method_type: fidl::MethodType::TwoWay,
668 })
669 }
670 _ => Err(fidl::Error::UnknownOrdinal {
671 ordinal: header.ordinal,
672 protocol_name:
673 <ArchiveAccessorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
674 }),
675 }))
676 },
677 )
678 }
679}
680
681#[derive(Debug)]
683pub enum ArchiveAccessorRequest {
684 StreamDiagnostics {
702 stream_parameters: StreamParameters,
703 result_stream: fidl::endpoints::ServerEnd<BatchIteratorMarker>,
704 control_handle: ArchiveAccessorControlHandle,
705 },
706 WaitForReady { responder: ArchiveAccessorWaitForReadyResponder },
709 #[non_exhaustive]
711 _UnknownMethod {
712 ordinal: u64,
714 control_handle: ArchiveAccessorControlHandle,
715 method_type: fidl::MethodType,
716 },
717}
718
719impl ArchiveAccessorRequest {
720 #[allow(irrefutable_let_patterns)]
721 pub fn into_stream_diagnostics(
722 self,
723 ) -> Option<(
724 StreamParameters,
725 fidl::endpoints::ServerEnd<BatchIteratorMarker>,
726 ArchiveAccessorControlHandle,
727 )> {
728 if let ArchiveAccessorRequest::StreamDiagnostics {
729 stream_parameters,
730 result_stream,
731 control_handle,
732 } = self
733 {
734 Some((stream_parameters, result_stream, control_handle))
735 } else {
736 None
737 }
738 }
739
740 #[allow(irrefutable_let_patterns)]
741 pub fn into_wait_for_ready(self) -> Option<(ArchiveAccessorWaitForReadyResponder)> {
742 if let ArchiveAccessorRequest::WaitForReady { responder } = self {
743 Some((responder))
744 } else {
745 None
746 }
747 }
748
749 pub fn method_name(&self) -> &'static str {
751 match *self {
752 ArchiveAccessorRequest::StreamDiagnostics { .. } => "stream_diagnostics",
753 ArchiveAccessorRequest::WaitForReady { .. } => "wait_for_ready",
754 ArchiveAccessorRequest::_UnknownMethod {
755 method_type: fidl::MethodType::OneWay,
756 ..
757 } => "unknown one-way method",
758 ArchiveAccessorRequest::_UnknownMethod {
759 method_type: fidl::MethodType::TwoWay,
760 ..
761 } => "unknown two-way method",
762 }
763 }
764}
765
766#[derive(Debug, Clone)]
767pub struct ArchiveAccessorControlHandle {
768 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
769}
770
771impl fidl::endpoints::ControlHandle for ArchiveAccessorControlHandle {
772 fn shutdown(&self) {
773 self.inner.shutdown()
774 }
775 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
776 self.inner.shutdown_with_epitaph(status)
777 }
778
779 fn is_closed(&self) -> bool {
780 self.inner.channel().is_closed()
781 }
782 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
783 self.inner.channel().on_closed()
784 }
785
786 #[cfg(target_os = "fuchsia")]
787 fn signal_peer(
788 &self,
789 clear_mask: zx::Signals,
790 set_mask: zx::Signals,
791 ) -> Result<(), zx_status::Status> {
792 use fidl::Peered;
793 self.inner.channel().signal_peer(clear_mask, set_mask)
794 }
795}
796
797impl ArchiveAccessorControlHandle {}
798
799#[must_use = "FIDL methods require a response to be sent"]
800#[derive(Debug)]
801pub struct ArchiveAccessorWaitForReadyResponder {
802 control_handle: std::mem::ManuallyDrop<ArchiveAccessorControlHandle>,
803 tx_id: u32,
804}
805
806impl std::ops::Drop for ArchiveAccessorWaitForReadyResponder {
810 fn drop(&mut self) {
811 self.control_handle.shutdown();
812 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
814 }
815}
816
817impl fidl::endpoints::Responder for ArchiveAccessorWaitForReadyResponder {
818 type ControlHandle = ArchiveAccessorControlHandle;
819
820 fn control_handle(&self) -> &ArchiveAccessorControlHandle {
821 &self.control_handle
822 }
823
824 fn drop_without_shutdown(mut self) {
825 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
827 std::mem::forget(self);
829 }
830}
831
832impl ArchiveAccessorWaitForReadyResponder {
833 pub fn send(self) -> Result<(), fidl::Error> {
837 let _result = self.send_raw();
838 if _result.is_err() {
839 self.control_handle.shutdown();
840 }
841 self.drop_without_shutdown();
842 _result
843 }
844
845 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
847 let _result = self.send_raw();
848 self.drop_without_shutdown();
849 _result
850 }
851
852 fn send_raw(&self) -> Result<(), fidl::Error> {
853 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
854 fidl::encoding::Flexible::new(()),
855 self.tx_id,
856 0x122963198011bd24,
857 fidl::encoding::DynamicFlags::FLEXIBLE,
858 )
859 }
860}
861
862#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
863pub struct BatchIteratorMarker;
864
865impl fidl::endpoints::ProtocolMarker for BatchIteratorMarker {
866 type Proxy = BatchIteratorProxy;
867 type RequestStream = BatchIteratorRequestStream;
868 #[cfg(target_os = "fuchsia")]
869 type SynchronousProxy = BatchIteratorSynchronousProxy;
870
871 const DEBUG_NAME: &'static str = "(anonymous) BatchIterator";
872}
873pub type BatchIteratorGetNextResult = Result<Vec<FormattedContent>, ReaderError>;
874
875pub trait BatchIteratorProxyInterface: Send + Sync {
876 type GetNextResponseFut: std::future::Future<Output = Result<BatchIteratorGetNextResult, fidl::Error>>
877 + Send;
878 fn r#get_next(&self) -> Self::GetNextResponseFut;
879 type WaitForReadyResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
880 fn r#wait_for_ready(&self) -> Self::WaitForReadyResponseFut;
881}
882#[derive(Debug)]
883#[cfg(target_os = "fuchsia")]
884pub struct BatchIteratorSynchronousProxy {
885 client: fidl::client::sync::Client,
886}
887
888#[cfg(target_os = "fuchsia")]
889impl fidl::endpoints::SynchronousProxy for BatchIteratorSynchronousProxy {
890 type Proxy = BatchIteratorProxy;
891 type Protocol = BatchIteratorMarker;
892
893 fn from_channel(inner: fidl::Channel) -> Self {
894 Self::new(inner)
895 }
896
897 fn into_channel(self) -> fidl::Channel {
898 self.client.into_channel()
899 }
900
901 fn as_channel(&self) -> &fidl::Channel {
902 self.client.as_channel()
903 }
904}
905
906#[cfg(target_os = "fuchsia")]
907impl BatchIteratorSynchronousProxy {
908 pub fn new(channel: fidl::Channel) -> Self {
909 let protocol_name = <BatchIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
910 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
911 }
912
913 pub fn into_channel(self) -> fidl::Channel {
914 self.client.into_channel()
915 }
916
917 pub fn wait_for_event(
920 &self,
921 deadline: zx::MonotonicInstant,
922 ) -> Result<BatchIteratorEvent, fidl::Error> {
923 BatchIteratorEvent::decode(self.client.wait_for_event(deadline)?)
924 }
925
926 pub fn r#get_next(
950 &self,
951 ___deadline: zx::MonotonicInstant,
952 ) -> Result<BatchIteratorGetNextResult, fidl::Error> {
953 let _response = self.client.send_query::<
954 fidl::encoding::EmptyPayload,
955 fidl::encoding::FlexibleResultType<BatchIteratorGetNextResponse, ReaderError>,
956 >(
957 (),
958 0x781986486c6254a5,
959 fidl::encoding::DynamicFlags::FLEXIBLE,
960 ___deadline,
961 )?
962 .into_result::<BatchIteratorMarker>("get_next")?;
963 Ok(_response.map(|x| x.batch))
964 }
965
966 pub fn r#wait_for_ready(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
969 let _response = self.client.send_query::<
970 fidl::encoding::EmptyPayload,
971 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
972 >(
973 (),
974 0x70598ee271597603,
975 fidl::encoding::DynamicFlags::FLEXIBLE,
976 ___deadline,
977 )?
978 .into_result::<BatchIteratorMarker>("wait_for_ready")?;
979 Ok(_response)
980 }
981}
982
983#[cfg(target_os = "fuchsia")]
984impl From<BatchIteratorSynchronousProxy> for zx::Handle {
985 fn from(value: BatchIteratorSynchronousProxy) -> Self {
986 value.into_channel().into()
987 }
988}
989
990#[cfg(target_os = "fuchsia")]
991impl From<fidl::Channel> for BatchIteratorSynchronousProxy {
992 fn from(value: fidl::Channel) -> Self {
993 Self::new(value)
994 }
995}
996
997#[cfg(target_os = "fuchsia")]
998impl fidl::endpoints::FromClient for BatchIteratorSynchronousProxy {
999 type Protocol = BatchIteratorMarker;
1000
1001 fn from_client(value: fidl::endpoints::ClientEnd<BatchIteratorMarker>) -> Self {
1002 Self::new(value.into_channel())
1003 }
1004}
1005
1006#[derive(Debug, Clone)]
1007pub struct BatchIteratorProxy {
1008 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1009}
1010
1011impl fidl::endpoints::Proxy for BatchIteratorProxy {
1012 type Protocol = BatchIteratorMarker;
1013
1014 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1015 Self::new(inner)
1016 }
1017
1018 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1019 self.client.into_channel().map_err(|client| Self { client })
1020 }
1021
1022 fn as_channel(&self) -> &::fidl::AsyncChannel {
1023 self.client.as_channel()
1024 }
1025}
1026
1027impl BatchIteratorProxy {
1028 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1030 let protocol_name = <BatchIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1031 Self { client: fidl::client::Client::new(channel, protocol_name) }
1032 }
1033
1034 pub fn take_event_stream(&self) -> BatchIteratorEventStream {
1040 BatchIteratorEventStream { event_receiver: self.client.take_event_receiver() }
1041 }
1042
1043 pub fn r#get_next(
1067 &self,
1068 ) -> fidl::client::QueryResponseFut<
1069 BatchIteratorGetNextResult,
1070 fidl::encoding::DefaultFuchsiaResourceDialect,
1071 > {
1072 BatchIteratorProxyInterface::r#get_next(self)
1073 }
1074
1075 pub fn r#wait_for_ready(
1078 &self,
1079 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1080 BatchIteratorProxyInterface::r#wait_for_ready(self)
1081 }
1082}
1083
1084impl BatchIteratorProxyInterface for BatchIteratorProxy {
1085 type GetNextResponseFut = fidl::client::QueryResponseFut<
1086 BatchIteratorGetNextResult,
1087 fidl::encoding::DefaultFuchsiaResourceDialect,
1088 >;
1089 fn r#get_next(&self) -> Self::GetNextResponseFut {
1090 fn _decode(
1091 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1092 ) -> Result<BatchIteratorGetNextResult, fidl::Error> {
1093 let _response = fidl::client::decode_transaction_body::<
1094 fidl::encoding::FlexibleResultType<BatchIteratorGetNextResponse, ReaderError>,
1095 fidl::encoding::DefaultFuchsiaResourceDialect,
1096 0x781986486c6254a5,
1097 >(_buf?)?
1098 .into_result::<BatchIteratorMarker>("get_next")?;
1099 Ok(_response.map(|x| x.batch))
1100 }
1101 self.client
1102 .send_query_and_decode::<fidl::encoding::EmptyPayload, BatchIteratorGetNextResult>(
1103 (),
1104 0x781986486c6254a5,
1105 fidl::encoding::DynamicFlags::FLEXIBLE,
1106 _decode,
1107 )
1108 }
1109
1110 type WaitForReadyResponseFut =
1111 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1112 fn r#wait_for_ready(&self) -> Self::WaitForReadyResponseFut {
1113 fn _decode(
1114 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1115 ) -> Result<(), fidl::Error> {
1116 let _response = fidl::client::decode_transaction_body::<
1117 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
1118 fidl::encoding::DefaultFuchsiaResourceDialect,
1119 0x70598ee271597603,
1120 >(_buf?)?
1121 .into_result::<BatchIteratorMarker>("wait_for_ready")?;
1122 Ok(_response)
1123 }
1124 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
1125 (),
1126 0x70598ee271597603,
1127 fidl::encoding::DynamicFlags::FLEXIBLE,
1128 _decode,
1129 )
1130 }
1131}
1132
1133pub struct BatchIteratorEventStream {
1134 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1135}
1136
1137impl std::marker::Unpin for BatchIteratorEventStream {}
1138
1139impl futures::stream::FusedStream for BatchIteratorEventStream {
1140 fn is_terminated(&self) -> bool {
1141 self.event_receiver.is_terminated()
1142 }
1143}
1144
1145impl futures::Stream for BatchIteratorEventStream {
1146 type Item = Result<BatchIteratorEvent, fidl::Error>;
1147
1148 fn poll_next(
1149 mut self: std::pin::Pin<&mut Self>,
1150 cx: &mut std::task::Context<'_>,
1151 ) -> std::task::Poll<Option<Self::Item>> {
1152 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1153 &mut self.event_receiver,
1154 cx
1155 )?) {
1156 Some(buf) => std::task::Poll::Ready(Some(BatchIteratorEvent::decode(buf))),
1157 None => std::task::Poll::Ready(None),
1158 }
1159 }
1160}
1161
1162#[derive(Debug)]
1163pub enum BatchIteratorEvent {
1164 #[non_exhaustive]
1165 _UnknownEvent {
1166 ordinal: u64,
1168 },
1169}
1170
1171impl BatchIteratorEvent {
1172 fn decode(
1174 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1175 ) -> Result<BatchIteratorEvent, fidl::Error> {
1176 let (bytes, _handles) = buf.split_mut();
1177 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1178 debug_assert_eq!(tx_header.tx_id, 0);
1179 match tx_header.ordinal {
1180 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1181 Ok(BatchIteratorEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1182 }
1183 _ => Err(fidl::Error::UnknownOrdinal {
1184 ordinal: tx_header.ordinal,
1185 protocol_name: <BatchIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1186 }),
1187 }
1188 }
1189}
1190
1191pub struct BatchIteratorRequestStream {
1193 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1194 is_terminated: bool,
1195}
1196
1197impl std::marker::Unpin for BatchIteratorRequestStream {}
1198
1199impl futures::stream::FusedStream for BatchIteratorRequestStream {
1200 fn is_terminated(&self) -> bool {
1201 self.is_terminated
1202 }
1203}
1204
1205impl fidl::endpoints::RequestStream for BatchIteratorRequestStream {
1206 type Protocol = BatchIteratorMarker;
1207 type ControlHandle = BatchIteratorControlHandle;
1208
1209 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1210 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1211 }
1212
1213 fn control_handle(&self) -> Self::ControlHandle {
1214 BatchIteratorControlHandle { inner: self.inner.clone() }
1215 }
1216
1217 fn into_inner(
1218 self,
1219 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1220 {
1221 (self.inner, self.is_terminated)
1222 }
1223
1224 fn from_inner(
1225 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1226 is_terminated: bool,
1227 ) -> Self {
1228 Self { inner, is_terminated }
1229 }
1230}
1231
1232impl futures::Stream for BatchIteratorRequestStream {
1233 type Item = Result<BatchIteratorRequest, fidl::Error>;
1234
1235 fn poll_next(
1236 mut self: std::pin::Pin<&mut Self>,
1237 cx: &mut std::task::Context<'_>,
1238 ) -> std::task::Poll<Option<Self::Item>> {
1239 let this = &mut *self;
1240 if this.inner.check_shutdown(cx) {
1241 this.is_terminated = true;
1242 return std::task::Poll::Ready(None);
1243 }
1244 if this.is_terminated {
1245 panic!("polled BatchIteratorRequestStream after completion");
1246 }
1247 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1248 |bytes, handles| {
1249 match this.inner.channel().read_etc(cx, bytes, handles) {
1250 std::task::Poll::Ready(Ok(())) => {}
1251 std::task::Poll::Pending => return std::task::Poll::Pending,
1252 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1253 this.is_terminated = true;
1254 return std::task::Poll::Ready(None);
1255 }
1256 std::task::Poll::Ready(Err(e)) => {
1257 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1258 e.into(),
1259 ))));
1260 }
1261 }
1262
1263 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1265
1266 std::task::Poll::Ready(Some(match header.ordinal {
1267 0x781986486c6254a5 => {
1268 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1269 let mut req = fidl::new_empty!(
1270 fidl::encoding::EmptyPayload,
1271 fidl::encoding::DefaultFuchsiaResourceDialect
1272 );
1273 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1274 let control_handle =
1275 BatchIteratorControlHandle { inner: this.inner.clone() };
1276 Ok(BatchIteratorRequest::GetNext {
1277 responder: BatchIteratorGetNextResponder {
1278 control_handle: std::mem::ManuallyDrop::new(control_handle),
1279 tx_id: header.tx_id,
1280 },
1281 })
1282 }
1283 0x70598ee271597603 => {
1284 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1285 let mut req = fidl::new_empty!(
1286 fidl::encoding::EmptyPayload,
1287 fidl::encoding::DefaultFuchsiaResourceDialect
1288 );
1289 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1290 let control_handle =
1291 BatchIteratorControlHandle { inner: this.inner.clone() };
1292 Ok(BatchIteratorRequest::WaitForReady {
1293 responder: BatchIteratorWaitForReadyResponder {
1294 control_handle: std::mem::ManuallyDrop::new(control_handle),
1295 tx_id: header.tx_id,
1296 },
1297 })
1298 }
1299 _ if header.tx_id == 0
1300 && header
1301 .dynamic_flags()
1302 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1303 {
1304 Ok(BatchIteratorRequest::_UnknownMethod {
1305 ordinal: header.ordinal,
1306 control_handle: BatchIteratorControlHandle {
1307 inner: this.inner.clone(),
1308 },
1309 method_type: fidl::MethodType::OneWay,
1310 })
1311 }
1312 _ if header
1313 .dynamic_flags()
1314 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1315 {
1316 this.inner.send_framework_err(
1317 fidl::encoding::FrameworkErr::UnknownMethod,
1318 header.tx_id,
1319 header.ordinal,
1320 header.dynamic_flags(),
1321 (bytes, handles),
1322 )?;
1323 Ok(BatchIteratorRequest::_UnknownMethod {
1324 ordinal: header.ordinal,
1325 control_handle: BatchIteratorControlHandle {
1326 inner: this.inner.clone(),
1327 },
1328 method_type: fidl::MethodType::TwoWay,
1329 })
1330 }
1331 _ => Err(fidl::Error::UnknownOrdinal {
1332 ordinal: header.ordinal,
1333 protocol_name:
1334 <BatchIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1335 }),
1336 }))
1337 },
1338 )
1339 }
1340}
1341
1342#[derive(Debug)]
1345pub enum BatchIteratorRequest {
1346 GetNext { responder: BatchIteratorGetNextResponder },
1370 WaitForReady { responder: BatchIteratorWaitForReadyResponder },
1373 #[non_exhaustive]
1375 _UnknownMethod {
1376 ordinal: u64,
1378 control_handle: BatchIteratorControlHandle,
1379 method_type: fidl::MethodType,
1380 },
1381}
1382
1383impl BatchIteratorRequest {
1384 #[allow(irrefutable_let_patterns)]
1385 pub fn into_get_next(self) -> Option<(BatchIteratorGetNextResponder)> {
1386 if let BatchIteratorRequest::GetNext { responder } = self {
1387 Some((responder))
1388 } else {
1389 None
1390 }
1391 }
1392
1393 #[allow(irrefutable_let_patterns)]
1394 pub fn into_wait_for_ready(self) -> Option<(BatchIteratorWaitForReadyResponder)> {
1395 if let BatchIteratorRequest::WaitForReady { responder } = self {
1396 Some((responder))
1397 } else {
1398 None
1399 }
1400 }
1401
1402 pub fn method_name(&self) -> &'static str {
1404 match *self {
1405 BatchIteratorRequest::GetNext { .. } => "get_next",
1406 BatchIteratorRequest::WaitForReady { .. } => "wait_for_ready",
1407 BatchIteratorRequest::_UnknownMethod {
1408 method_type: fidl::MethodType::OneWay, ..
1409 } => "unknown one-way method",
1410 BatchIteratorRequest::_UnknownMethod {
1411 method_type: fidl::MethodType::TwoWay, ..
1412 } => "unknown two-way method",
1413 }
1414 }
1415}
1416
1417#[derive(Debug, Clone)]
1418pub struct BatchIteratorControlHandle {
1419 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1420}
1421
1422impl fidl::endpoints::ControlHandle for BatchIteratorControlHandle {
1423 fn shutdown(&self) {
1424 self.inner.shutdown()
1425 }
1426 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1427 self.inner.shutdown_with_epitaph(status)
1428 }
1429
1430 fn is_closed(&self) -> bool {
1431 self.inner.channel().is_closed()
1432 }
1433 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1434 self.inner.channel().on_closed()
1435 }
1436
1437 #[cfg(target_os = "fuchsia")]
1438 fn signal_peer(
1439 &self,
1440 clear_mask: zx::Signals,
1441 set_mask: zx::Signals,
1442 ) -> Result<(), zx_status::Status> {
1443 use fidl::Peered;
1444 self.inner.channel().signal_peer(clear_mask, set_mask)
1445 }
1446}
1447
1448impl BatchIteratorControlHandle {}
1449
1450#[must_use = "FIDL methods require a response to be sent"]
1451#[derive(Debug)]
1452pub struct BatchIteratorGetNextResponder {
1453 control_handle: std::mem::ManuallyDrop<BatchIteratorControlHandle>,
1454 tx_id: u32,
1455}
1456
1457impl std::ops::Drop for BatchIteratorGetNextResponder {
1461 fn drop(&mut self) {
1462 self.control_handle.shutdown();
1463 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1465 }
1466}
1467
1468impl fidl::endpoints::Responder for BatchIteratorGetNextResponder {
1469 type ControlHandle = BatchIteratorControlHandle;
1470
1471 fn control_handle(&self) -> &BatchIteratorControlHandle {
1472 &self.control_handle
1473 }
1474
1475 fn drop_without_shutdown(mut self) {
1476 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1478 std::mem::forget(self);
1480 }
1481}
1482
1483impl BatchIteratorGetNextResponder {
1484 pub fn send(
1488 self,
1489 mut result: Result<Vec<FormattedContent>, ReaderError>,
1490 ) -> Result<(), fidl::Error> {
1491 let _result = self.send_raw(result);
1492 if _result.is_err() {
1493 self.control_handle.shutdown();
1494 }
1495 self.drop_without_shutdown();
1496 _result
1497 }
1498
1499 pub fn send_no_shutdown_on_err(
1501 self,
1502 mut result: Result<Vec<FormattedContent>, ReaderError>,
1503 ) -> Result<(), fidl::Error> {
1504 let _result = self.send_raw(result);
1505 self.drop_without_shutdown();
1506 _result
1507 }
1508
1509 fn send_raw(
1510 &self,
1511 mut result: Result<Vec<FormattedContent>, ReaderError>,
1512 ) -> Result<(), fidl::Error> {
1513 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1514 BatchIteratorGetNextResponse,
1515 ReaderError,
1516 >>(
1517 fidl::encoding::FlexibleResult::new(
1518 result.as_mut().map_err(|e| *e).map(|batch| (batch.as_mut_slice(),)),
1519 ),
1520 self.tx_id,
1521 0x781986486c6254a5,
1522 fidl::encoding::DynamicFlags::FLEXIBLE,
1523 )
1524 }
1525}
1526
1527#[must_use = "FIDL methods require a response to be sent"]
1528#[derive(Debug)]
1529pub struct BatchIteratorWaitForReadyResponder {
1530 control_handle: std::mem::ManuallyDrop<BatchIteratorControlHandle>,
1531 tx_id: u32,
1532}
1533
1534impl std::ops::Drop for BatchIteratorWaitForReadyResponder {
1538 fn drop(&mut self) {
1539 self.control_handle.shutdown();
1540 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1542 }
1543}
1544
1545impl fidl::endpoints::Responder for BatchIteratorWaitForReadyResponder {
1546 type ControlHandle = BatchIteratorControlHandle;
1547
1548 fn control_handle(&self) -> &BatchIteratorControlHandle {
1549 &self.control_handle
1550 }
1551
1552 fn drop_without_shutdown(mut self) {
1553 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1555 std::mem::forget(self);
1557 }
1558}
1559
1560impl BatchIteratorWaitForReadyResponder {
1561 pub fn send(self) -> Result<(), fidl::Error> {
1565 let _result = self.send_raw();
1566 if _result.is_err() {
1567 self.control_handle.shutdown();
1568 }
1569 self.drop_without_shutdown();
1570 _result
1571 }
1572
1573 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1575 let _result = self.send_raw();
1576 self.drop_without_shutdown();
1577 _result
1578 }
1579
1580 fn send_raw(&self) -> Result<(), fidl::Error> {
1581 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
1582 fidl::encoding::Flexible::new(()),
1583 self.tx_id,
1584 0x70598ee271597603,
1585 fidl::encoding::DynamicFlags::FLEXIBLE,
1586 )
1587 }
1588}
1589
1590#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1591pub struct LogFlusherMarker;
1592
1593impl fidl::endpoints::ProtocolMarker for LogFlusherMarker {
1594 type Proxy = LogFlusherProxy;
1595 type RequestStream = LogFlusherRequestStream;
1596 #[cfg(target_os = "fuchsia")]
1597 type SynchronousProxy = LogFlusherSynchronousProxy;
1598
1599 const DEBUG_NAME: &'static str = "fuchsia.diagnostics.LogFlusher";
1600}
1601impl fidl::endpoints::DiscoverableProtocolMarker for LogFlusherMarker {}
1602
1603pub trait LogFlusherProxyInterface: Send + Sync {
1604 type WaitUntilFlushedResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1605 fn r#wait_until_flushed(&self) -> Self::WaitUntilFlushedResponseFut;
1606}
1607#[derive(Debug)]
1608#[cfg(target_os = "fuchsia")]
1609pub struct LogFlusherSynchronousProxy {
1610 client: fidl::client::sync::Client,
1611}
1612
1613#[cfg(target_os = "fuchsia")]
1614impl fidl::endpoints::SynchronousProxy for LogFlusherSynchronousProxy {
1615 type Proxy = LogFlusherProxy;
1616 type Protocol = LogFlusherMarker;
1617
1618 fn from_channel(inner: fidl::Channel) -> Self {
1619 Self::new(inner)
1620 }
1621
1622 fn into_channel(self) -> fidl::Channel {
1623 self.client.into_channel()
1624 }
1625
1626 fn as_channel(&self) -> &fidl::Channel {
1627 self.client.as_channel()
1628 }
1629}
1630
1631#[cfg(target_os = "fuchsia")]
1632impl LogFlusherSynchronousProxy {
1633 pub fn new(channel: fidl::Channel) -> Self {
1634 let protocol_name = <LogFlusherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1635 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1636 }
1637
1638 pub fn into_channel(self) -> fidl::Channel {
1639 self.client.into_channel()
1640 }
1641
1642 pub fn wait_for_event(
1645 &self,
1646 deadline: zx::MonotonicInstant,
1647 ) -> Result<LogFlusherEvent, fidl::Error> {
1648 LogFlusherEvent::decode(self.client.wait_for_event(deadline)?)
1649 }
1650
1651 pub fn r#wait_until_flushed(
1667 &self,
1668 ___deadline: zx::MonotonicInstant,
1669 ) -> Result<(), fidl::Error> {
1670 let _response = self.client.send_query::<
1671 fidl::encoding::EmptyPayload,
1672 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
1673 >(
1674 (),
1675 0x7dc4892e46748b5b,
1676 fidl::encoding::DynamicFlags::FLEXIBLE,
1677 ___deadline,
1678 )?
1679 .into_result::<LogFlusherMarker>("wait_until_flushed")?;
1680 Ok(_response)
1681 }
1682}
1683
1684#[cfg(target_os = "fuchsia")]
1685impl From<LogFlusherSynchronousProxy> for zx::Handle {
1686 fn from(value: LogFlusherSynchronousProxy) -> Self {
1687 value.into_channel().into()
1688 }
1689}
1690
1691#[cfg(target_os = "fuchsia")]
1692impl From<fidl::Channel> for LogFlusherSynchronousProxy {
1693 fn from(value: fidl::Channel) -> Self {
1694 Self::new(value)
1695 }
1696}
1697
1698#[cfg(target_os = "fuchsia")]
1699impl fidl::endpoints::FromClient for LogFlusherSynchronousProxy {
1700 type Protocol = LogFlusherMarker;
1701
1702 fn from_client(value: fidl::endpoints::ClientEnd<LogFlusherMarker>) -> Self {
1703 Self::new(value.into_channel())
1704 }
1705}
1706
1707#[derive(Debug, Clone)]
1708pub struct LogFlusherProxy {
1709 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1710}
1711
1712impl fidl::endpoints::Proxy for LogFlusherProxy {
1713 type Protocol = LogFlusherMarker;
1714
1715 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1716 Self::new(inner)
1717 }
1718
1719 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1720 self.client.into_channel().map_err(|client| Self { client })
1721 }
1722
1723 fn as_channel(&self) -> &::fidl::AsyncChannel {
1724 self.client.as_channel()
1725 }
1726}
1727
1728impl LogFlusherProxy {
1729 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1731 let protocol_name = <LogFlusherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1732 Self { client: fidl::client::Client::new(channel, protocol_name) }
1733 }
1734
1735 pub fn take_event_stream(&self) -> LogFlusherEventStream {
1741 LogFlusherEventStream { event_receiver: self.client.take_event_receiver() }
1742 }
1743
1744 pub fn r#wait_until_flushed(
1760 &self,
1761 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1762 LogFlusherProxyInterface::r#wait_until_flushed(self)
1763 }
1764}
1765
1766impl LogFlusherProxyInterface for LogFlusherProxy {
1767 type WaitUntilFlushedResponseFut =
1768 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1769 fn r#wait_until_flushed(&self) -> Self::WaitUntilFlushedResponseFut {
1770 fn _decode(
1771 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1772 ) -> Result<(), fidl::Error> {
1773 let _response = fidl::client::decode_transaction_body::<
1774 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
1775 fidl::encoding::DefaultFuchsiaResourceDialect,
1776 0x7dc4892e46748b5b,
1777 >(_buf?)?
1778 .into_result::<LogFlusherMarker>("wait_until_flushed")?;
1779 Ok(_response)
1780 }
1781 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
1782 (),
1783 0x7dc4892e46748b5b,
1784 fidl::encoding::DynamicFlags::FLEXIBLE,
1785 _decode,
1786 )
1787 }
1788}
1789
1790pub struct LogFlusherEventStream {
1791 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1792}
1793
1794impl std::marker::Unpin for LogFlusherEventStream {}
1795
1796impl futures::stream::FusedStream for LogFlusherEventStream {
1797 fn is_terminated(&self) -> bool {
1798 self.event_receiver.is_terminated()
1799 }
1800}
1801
1802impl futures::Stream for LogFlusherEventStream {
1803 type Item = Result<LogFlusherEvent, fidl::Error>;
1804
1805 fn poll_next(
1806 mut self: std::pin::Pin<&mut Self>,
1807 cx: &mut std::task::Context<'_>,
1808 ) -> std::task::Poll<Option<Self::Item>> {
1809 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1810 &mut self.event_receiver,
1811 cx
1812 )?) {
1813 Some(buf) => std::task::Poll::Ready(Some(LogFlusherEvent::decode(buf))),
1814 None => std::task::Poll::Ready(None),
1815 }
1816 }
1817}
1818
1819#[derive(Debug)]
1820pub enum LogFlusherEvent {
1821 #[non_exhaustive]
1822 _UnknownEvent {
1823 ordinal: u64,
1825 },
1826}
1827
1828impl LogFlusherEvent {
1829 fn decode(
1831 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1832 ) -> Result<LogFlusherEvent, fidl::Error> {
1833 let (bytes, _handles) = buf.split_mut();
1834 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1835 debug_assert_eq!(tx_header.tx_id, 0);
1836 match tx_header.ordinal {
1837 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1838 Ok(LogFlusherEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1839 }
1840 _ => Err(fidl::Error::UnknownOrdinal {
1841 ordinal: tx_header.ordinal,
1842 protocol_name: <LogFlusherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1843 }),
1844 }
1845 }
1846}
1847
1848pub struct LogFlusherRequestStream {
1850 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1851 is_terminated: bool,
1852}
1853
1854impl std::marker::Unpin for LogFlusherRequestStream {}
1855
1856impl futures::stream::FusedStream for LogFlusherRequestStream {
1857 fn is_terminated(&self) -> bool {
1858 self.is_terminated
1859 }
1860}
1861
1862impl fidl::endpoints::RequestStream for LogFlusherRequestStream {
1863 type Protocol = LogFlusherMarker;
1864 type ControlHandle = LogFlusherControlHandle;
1865
1866 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1867 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1868 }
1869
1870 fn control_handle(&self) -> Self::ControlHandle {
1871 LogFlusherControlHandle { inner: self.inner.clone() }
1872 }
1873
1874 fn into_inner(
1875 self,
1876 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1877 {
1878 (self.inner, self.is_terminated)
1879 }
1880
1881 fn from_inner(
1882 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1883 is_terminated: bool,
1884 ) -> Self {
1885 Self { inner, is_terminated }
1886 }
1887}
1888
1889impl futures::Stream for LogFlusherRequestStream {
1890 type Item = Result<LogFlusherRequest, fidl::Error>;
1891
1892 fn poll_next(
1893 mut self: std::pin::Pin<&mut Self>,
1894 cx: &mut std::task::Context<'_>,
1895 ) -> std::task::Poll<Option<Self::Item>> {
1896 let this = &mut *self;
1897 if this.inner.check_shutdown(cx) {
1898 this.is_terminated = true;
1899 return std::task::Poll::Ready(None);
1900 }
1901 if this.is_terminated {
1902 panic!("polled LogFlusherRequestStream after completion");
1903 }
1904 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1905 |bytes, handles| {
1906 match this.inner.channel().read_etc(cx, bytes, handles) {
1907 std::task::Poll::Ready(Ok(())) => {}
1908 std::task::Poll::Pending => return std::task::Poll::Pending,
1909 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1910 this.is_terminated = true;
1911 return std::task::Poll::Ready(None);
1912 }
1913 std::task::Poll::Ready(Err(e)) => {
1914 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1915 e.into(),
1916 ))));
1917 }
1918 }
1919
1920 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1922
1923 std::task::Poll::Ready(Some(match header.ordinal {
1924 0x7dc4892e46748b5b => {
1925 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1926 let mut req = fidl::new_empty!(
1927 fidl::encoding::EmptyPayload,
1928 fidl::encoding::DefaultFuchsiaResourceDialect
1929 );
1930 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1931 let control_handle = LogFlusherControlHandle { inner: this.inner.clone() };
1932 Ok(LogFlusherRequest::WaitUntilFlushed {
1933 responder: LogFlusherWaitUntilFlushedResponder {
1934 control_handle: std::mem::ManuallyDrop::new(control_handle),
1935 tx_id: header.tx_id,
1936 },
1937 })
1938 }
1939 _ if header.tx_id == 0
1940 && header
1941 .dynamic_flags()
1942 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1943 {
1944 Ok(LogFlusherRequest::_UnknownMethod {
1945 ordinal: header.ordinal,
1946 control_handle: LogFlusherControlHandle { inner: this.inner.clone() },
1947 method_type: fidl::MethodType::OneWay,
1948 })
1949 }
1950 _ if header
1951 .dynamic_flags()
1952 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1953 {
1954 this.inner.send_framework_err(
1955 fidl::encoding::FrameworkErr::UnknownMethod,
1956 header.tx_id,
1957 header.ordinal,
1958 header.dynamic_flags(),
1959 (bytes, handles),
1960 )?;
1961 Ok(LogFlusherRequest::_UnknownMethod {
1962 ordinal: header.ordinal,
1963 control_handle: LogFlusherControlHandle { inner: this.inner.clone() },
1964 method_type: fidl::MethodType::TwoWay,
1965 })
1966 }
1967 _ => Err(fidl::Error::UnknownOrdinal {
1968 ordinal: header.ordinal,
1969 protocol_name:
1970 <LogFlusherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1971 }),
1972 }))
1973 },
1974 )
1975 }
1976}
1977
1978#[derive(Debug)]
1979pub enum LogFlusherRequest {
1980 WaitUntilFlushed { responder: LogFlusherWaitUntilFlushedResponder },
1996 #[non_exhaustive]
1998 _UnknownMethod {
1999 ordinal: u64,
2001 control_handle: LogFlusherControlHandle,
2002 method_type: fidl::MethodType,
2003 },
2004}
2005
2006impl LogFlusherRequest {
2007 #[allow(irrefutable_let_patterns)]
2008 pub fn into_wait_until_flushed(self) -> Option<(LogFlusherWaitUntilFlushedResponder)> {
2009 if let LogFlusherRequest::WaitUntilFlushed { responder } = self {
2010 Some((responder))
2011 } else {
2012 None
2013 }
2014 }
2015
2016 pub fn method_name(&self) -> &'static str {
2018 match *self {
2019 LogFlusherRequest::WaitUntilFlushed { .. } => "wait_until_flushed",
2020 LogFlusherRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
2021 "unknown one-way method"
2022 }
2023 LogFlusherRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
2024 "unknown two-way method"
2025 }
2026 }
2027 }
2028}
2029
2030#[derive(Debug, Clone)]
2031pub struct LogFlusherControlHandle {
2032 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2033}
2034
2035impl fidl::endpoints::ControlHandle for LogFlusherControlHandle {
2036 fn shutdown(&self) {
2037 self.inner.shutdown()
2038 }
2039 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2040 self.inner.shutdown_with_epitaph(status)
2041 }
2042
2043 fn is_closed(&self) -> bool {
2044 self.inner.channel().is_closed()
2045 }
2046 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2047 self.inner.channel().on_closed()
2048 }
2049
2050 #[cfg(target_os = "fuchsia")]
2051 fn signal_peer(
2052 &self,
2053 clear_mask: zx::Signals,
2054 set_mask: zx::Signals,
2055 ) -> Result<(), zx_status::Status> {
2056 use fidl::Peered;
2057 self.inner.channel().signal_peer(clear_mask, set_mask)
2058 }
2059}
2060
2061impl LogFlusherControlHandle {}
2062
2063#[must_use = "FIDL methods require a response to be sent"]
2064#[derive(Debug)]
2065pub struct LogFlusherWaitUntilFlushedResponder {
2066 control_handle: std::mem::ManuallyDrop<LogFlusherControlHandle>,
2067 tx_id: u32,
2068}
2069
2070impl std::ops::Drop for LogFlusherWaitUntilFlushedResponder {
2074 fn drop(&mut self) {
2075 self.control_handle.shutdown();
2076 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2078 }
2079}
2080
2081impl fidl::endpoints::Responder for LogFlusherWaitUntilFlushedResponder {
2082 type ControlHandle = LogFlusherControlHandle;
2083
2084 fn control_handle(&self) -> &LogFlusherControlHandle {
2085 &self.control_handle
2086 }
2087
2088 fn drop_without_shutdown(mut self) {
2089 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2091 std::mem::forget(self);
2093 }
2094}
2095
2096impl LogFlusherWaitUntilFlushedResponder {
2097 pub fn send(self) -> Result<(), fidl::Error> {
2101 let _result = self.send_raw();
2102 if _result.is_err() {
2103 self.control_handle.shutdown();
2104 }
2105 self.drop_without_shutdown();
2106 _result
2107 }
2108
2109 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2111 let _result = self.send_raw();
2112 self.drop_without_shutdown();
2113 _result
2114 }
2115
2116 fn send_raw(&self) -> Result<(), fidl::Error> {
2117 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
2118 fidl::encoding::Flexible::new(()),
2119 self.tx_id,
2120 0x7dc4892e46748b5b,
2121 fidl::encoding::DynamicFlags::FLEXIBLE,
2122 )
2123 }
2124}
2125
2126#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2127pub struct LogSettingsMarker;
2128
2129impl fidl::endpoints::ProtocolMarker for LogSettingsMarker {
2130 type Proxy = LogSettingsProxy;
2131 type RequestStream = LogSettingsRequestStream;
2132 #[cfg(target_os = "fuchsia")]
2133 type SynchronousProxy = LogSettingsSynchronousProxy;
2134
2135 const DEBUG_NAME: &'static str = "fuchsia.diagnostics.LogSettings";
2136}
2137impl fidl::endpoints::DiscoverableProtocolMarker for LogSettingsMarker {}
2138
2139pub trait LogSettingsProxyInterface: Send + Sync {
2140 type SetInterestResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
2141 fn r#set_interest(&self, selectors: &[LogInterestSelector]) -> Self::SetInterestResponseFut;
2142 type SetComponentInterestResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
2143 + Send;
2144 fn r#set_component_interest(
2145 &self,
2146 payload: &LogSettingsSetComponentInterestRequest,
2147 ) -> Self::SetComponentInterestResponseFut;
2148}
2149#[derive(Debug)]
2150#[cfg(target_os = "fuchsia")]
2151pub struct LogSettingsSynchronousProxy {
2152 client: fidl::client::sync::Client,
2153}
2154
2155#[cfg(target_os = "fuchsia")]
2156impl fidl::endpoints::SynchronousProxy for LogSettingsSynchronousProxy {
2157 type Proxy = LogSettingsProxy;
2158 type Protocol = LogSettingsMarker;
2159
2160 fn from_channel(inner: fidl::Channel) -> Self {
2161 Self::new(inner)
2162 }
2163
2164 fn into_channel(self) -> fidl::Channel {
2165 self.client.into_channel()
2166 }
2167
2168 fn as_channel(&self) -> &fidl::Channel {
2169 self.client.as_channel()
2170 }
2171}
2172
2173#[cfg(target_os = "fuchsia")]
2174impl LogSettingsSynchronousProxy {
2175 pub fn new(channel: fidl::Channel) -> Self {
2176 let protocol_name = <LogSettingsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2177 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2178 }
2179
2180 pub fn into_channel(self) -> fidl::Channel {
2181 self.client.into_channel()
2182 }
2183
2184 pub fn wait_for_event(
2187 &self,
2188 deadline: zx::MonotonicInstant,
2189 ) -> Result<LogSettingsEvent, fidl::Error> {
2190 LogSettingsEvent::decode(self.client.wait_for_event(deadline)?)
2191 }
2192
2193 pub fn r#set_interest(
2209 &self,
2210 mut selectors: &[LogInterestSelector],
2211 ___deadline: zx::MonotonicInstant,
2212 ) -> Result<(), fidl::Error> {
2213 let _response =
2214 self.client.send_query::<LogSettingsSetInterestRequest, fidl::encoding::EmptyPayload>(
2215 (selectors,),
2216 0x71beced9d2411f90,
2217 fidl::encoding::DynamicFlags::empty(),
2218 ___deadline,
2219 )?;
2220 Ok(_response)
2221 }
2222
2223 pub fn r#set_component_interest(
2239 &self,
2240 mut payload: &LogSettingsSetComponentInterestRequest,
2241 ___deadline: zx::MonotonicInstant,
2242 ) -> Result<(), fidl::Error> {
2243 let _response = self
2244 .client
2245 .send_query::<LogSettingsSetComponentInterestRequest, fidl::encoding::EmptyPayload>(
2246 payload,
2247 0x35f7004d2367f6c1,
2248 fidl::encoding::DynamicFlags::empty(),
2249 ___deadline,
2250 )?;
2251 Ok(_response)
2252 }
2253}
2254
2255#[cfg(target_os = "fuchsia")]
2256impl From<LogSettingsSynchronousProxy> for zx::Handle {
2257 fn from(value: LogSettingsSynchronousProxy) -> Self {
2258 value.into_channel().into()
2259 }
2260}
2261
2262#[cfg(target_os = "fuchsia")]
2263impl From<fidl::Channel> for LogSettingsSynchronousProxy {
2264 fn from(value: fidl::Channel) -> Self {
2265 Self::new(value)
2266 }
2267}
2268
2269#[cfg(target_os = "fuchsia")]
2270impl fidl::endpoints::FromClient for LogSettingsSynchronousProxy {
2271 type Protocol = LogSettingsMarker;
2272
2273 fn from_client(value: fidl::endpoints::ClientEnd<LogSettingsMarker>) -> Self {
2274 Self::new(value.into_channel())
2275 }
2276}
2277
2278#[derive(Debug, Clone)]
2279pub struct LogSettingsProxy {
2280 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2281}
2282
2283impl fidl::endpoints::Proxy for LogSettingsProxy {
2284 type Protocol = LogSettingsMarker;
2285
2286 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2287 Self::new(inner)
2288 }
2289
2290 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2291 self.client.into_channel().map_err(|client| Self { client })
2292 }
2293
2294 fn as_channel(&self) -> &::fidl::AsyncChannel {
2295 self.client.as_channel()
2296 }
2297}
2298
2299impl LogSettingsProxy {
2300 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2302 let protocol_name = <LogSettingsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2303 Self { client: fidl::client::Client::new(channel, protocol_name) }
2304 }
2305
2306 pub fn take_event_stream(&self) -> LogSettingsEventStream {
2312 LogSettingsEventStream { event_receiver: self.client.take_event_receiver() }
2313 }
2314
2315 pub fn r#set_interest(
2331 &self,
2332 mut selectors: &[LogInterestSelector],
2333 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
2334 LogSettingsProxyInterface::r#set_interest(self, selectors)
2335 }
2336
2337 pub fn r#set_component_interest(
2353 &self,
2354 mut payload: &LogSettingsSetComponentInterestRequest,
2355 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
2356 LogSettingsProxyInterface::r#set_component_interest(self, payload)
2357 }
2358}
2359
2360impl LogSettingsProxyInterface for LogSettingsProxy {
2361 type SetInterestResponseFut =
2362 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
2363 fn r#set_interest(
2364 &self,
2365 mut selectors: &[LogInterestSelector],
2366 ) -> Self::SetInterestResponseFut {
2367 fn _decode(
2368 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2369 ) -> Result<(), fidl::Error> {
2370 let _response = fidl::client::decode_transaction_body::<
2371 fidl::encoding::EmptyPayload,
2372 fidl::encoding::DefaultFuchsiaResourceDialect,
2373 0x71beced9d2411f90,
2374 >(_buf?)?;
2375 Ok(_response)
2376 }
2377 self.client.send_query_and_decode::<LogSettingsSetInterestRequest, ()>(
2378 (selectors,),
2379 0x71beced9d2411f90,
2380 fidl::encoding::DynamicFlags::empty(),
2381 _decode,
2382 )
2383 }
2384
2385 type SetComponentInterestResponseFut =
2386 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
2387 fn r#set_component_interest(
2388 &self,
2389 mut payload: &LogSettingsSetComponentInterestRequest,
2390 ) -> Self::SetComponentInterestResponseFut {
2391 fn _decode(
2392 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2393 ) -> Result<(), fidl::Error> {
2394 let _response = fidl::client::decode_transaction_body::<
2395 fidl::encoding::EmptyPayload,
2396 fidl::encoding::DefaultFuchsiaResourceDialect,
2397 0x35f7004d2367f6c1,
2398 >(_buf?)?;
2399 Ok(_response)
2400 }
2401 self.client.send_query_and_decode::<LogSettingsSetComponentInterestRequest, ()>(
2402 payload,
2403 0x35f7004d2367f6c1,
2404 fidl::encoding::DynamicFlags::empty(),
2405 _decode,
2406 )
2407 }
2408}
2409
2410pub struct LogSettingsEventStream {
2411 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2412}
2413
2414impl std::marker::Unpin for LogSettingsEventStream {}
2415
2416impl futures::stream::FusedStream for LogSettingsEventStream {
2417 fn is_terminated(&self) -> bool {
2418 self.event_receiver.is_terminated()
2419 }
2420}
2421
2422impl futures::Stream for LogSettingsEventStream {
2423 type Item = Result<LogSettingsEvent, fidl::Error>;
2424
2425 fn poll_next(
2426 mut self: std::pin::Pin<&mut Self>,
2427 cx: &mut std::task::Context<'_>,
2428 ) -> std::task::Poll<Option<Self::Item>> {
2429 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2430 &mut self.event_receiver,
2431 cx
2432 )?) {
2433 Some(buf) => std::task::Poll::Ready(Some(LogSettingsEvent::decode(buf))),
2434 None => std::task::Poll::Ready(None),
2435 }
2436 }
2437}
2438
2439#[derive(Debug)]
2440pub enum LogSettingsEvent {}
2441
2442impl LogSettingsEvent {
2443 fn decode(
2445 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2446 ) -> Result<LogSettingsEvent, fidl::Error> {
2447 let (bytes, _handles) = buf.split_mut();
2448 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2449 debug_assert_eq!(tx_header.tx_id, 0);
2450 match tx_header.ordinal {
2451 _ => Err(fidl::Error::UnknownOrdinal {
2452 ordinal: tx_header.ordinal,
2453 protocol_name: <LogSettingsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2454 }),
2455 }
2456 }
2457}
2458
2459pub struct LogSettingsRequestStream {
2461 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2462 is_terminated: bool,
2463}
2464
2465impl std::marker::Unpin for LogSettingsRequestStream {}
2466
2467impl futures::stream::FusedStream for LogSettingsRequestStream {
2468 fn is_terminated(&self) -> bool {
2469 self.is_terminated
2470 }
2471}
2472
2473impl fidl::endpoints::RequestStream for LogSettingsRequestStream {
2474 type Protocol = LogSettingsMarker;
2475 type ControlHandle = LogSettingsControlHandle;
2476
2477 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2478 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2479 }
2480
2481 fn control_handle(&self) -> Self::ControlHandle {
2482 LogSettingsControlHandle { inner: self.inner.clone() }
2483 }
2484
2485 fn into_inner(
2486 self,
2487 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2488 {
2489 (self.inner, self.is_terminated)
2490 }
2491
2492 fn from_inner(
2493 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2494 is_terminated: bool,
2495 ) -> Self {
2496 Self { inner, is_terminated }
2497 }
2498}
2499
2500impl futures::Stream for LogSettingsRequestStream {
2501 type Item = Result<LogSettingsRequest, fidl::Error>;
2502
2503 fn poll_next(
2504 mut self: std::pin::Pin<&mut Self>,
2505 cx: &mut std::task::Context<'_>,
2506 ) -> std::task::Poll<Option<Self::Item>> {
2507 let this = &mut *self;
2508 if this.inner.check_shutdown(cx) {
2509 this.is_terminated = true;
2510 return std::task::Poll::Ready(None);
2511 }
2512 if this.is_terminated {
2513 panic!("polled LogSettingsRequestStream after completion");
2514 }
2515 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2516 |bytes, handles| {
2517 match this.inner.channel().read_etc(cx, bytes, handles) {
2518 std::task::Poll::Ready(Ok(())) => {}
2519 std::task::Poll::Pending => return std::task::Poll::Pending,
2520 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2521 this.is_terminated = true;
2522 return std::task::Poll::Ready(None);
2523 }
2524 std::task::Poll::Ready(Err(e)) => {
2525 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2526 e.into(),
2527 ))));
2528 }
2529 }
2530
2531 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2533
2534 std::task::Poll::Ready(Some(match header.ordinal {
2535 0x71beced9d2411f90 => {
2536 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2537 let mut req = fidl::new_empty!(
2538 LogSettingsSetInterestRequest,
2539 fidl::encoding::DefaultFuchsiaResourceDialect
2540 );
2541 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LogSettingsSetInterestRequest>(&header, _body_bytes, handles, &mut req)?;
2542 let control_handle = LogSettingsControlHandle { inner: this.inner.clone() };
2543 Ok(LogSettingsRequest::SetInterest {
2544 selectors: req.selectors,
2545
2546 responder: LogSettingsSetInterestResponder {
2547 control_handle: std::mem::ManuallyDrop::new(control_handle),
2548 tx_id: header.tx_id,
2549 },
2550 })
2551 }
2552 0x35f7004d2367f6c1 => {
2553 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2554 let mut req = fidl::new_empty!(
2555 LogSettingsSetComponentInterestRequest,
2556 fidl::encoding::DefaultFuchsiaResourceDialect
2557 );
2558 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LogSettingsSetComponentInterestRequest>(&header, _body_bytes, handles, &mut req)?;
2559 let control_handle = LogSettingsControlHandle { inner: this.inner.clone() };
2560 Ok(LogSettingsRequest::SetComponentInterest {
2561 payload: req,
2562 responder: LogSettingsSetComponentInterestResponder {
2563 control_handle: std::mem::ManuallyDrop::new(control_handle),
2564 tx_id: header.tx_id,
2565 },
2566 })
2567 }
2568 _ => Err(fidl::Error::UnknownOrdinal {
2569 ordinal: header.ordinal,
2570 protocol_name:
2571 <LogSettingsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2572 }),
2573 }))
2574 },
2575 )
2576 }
2577}
2578
2579#[derive(Debug)]
2582pub enum LogSettingsRequest {
2583 SetInterest { selectors: Vec<LogInterestSelector>, responder: LogSettingsSetInterestResponder },
2599 SetComponentInterest {
2615 payload: LogSettingsSetComponentInterestRequest,
2616 responder: LogSettingsSetComponentInterestResponder,
2617 },
2618}
2619
2620impl LogSettingsRequest {
2621 #[allow(irrefutable_let_patterns)]
2622 pub fn into_set_interest(
2623 self,
2624 ) -> Option<(Vec<LogInterestSelector>, LogSettingsSetInterestResponder)> {
2625 if let LogSettingsRequest::SetInterest { selectors, responder } = self {
2626 Some((selectors, responder))
2627 } else {
2628 None
2629 }
2630 }
2631
2632 #[allow(irrefutable_let_patterns)]
2633 pub fn into_set_component_interest(
2634 self,
2635 ) -> Option<(LogSettingsSetComponentInterestRequest, LogSettingsSetComponentInterestResponder)>
2636 {
2637 if let LogSettingsRequest::SetComponentInterest { payload, responder } = self {
2638 Some((payload, responder))
2639 } else {
2640 None
2641 }
2642 }
2643
2644 pub fn method_name(&self) -> &'static str {
2646 match *self {
2647 LogSettingsRequest::SetInterest { .. } => "set_interest",
2648 LogSettingsRequest::SetComponentInterest { .. } => "set_component_interest",
2649 }
2650 }
2651}
2652
2653#[derive(Debug, Clone)]
2654pub struct LogSettingsControlHandle {
2655 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2656}
2657
2658impl fidl::endpoints::ControlHandle for LogSettingsControlHandle {
2659 fn shutdown(&self) {
2660 self.inner.shutdown()
2661 }
2662 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2663 self.inner.shutdown_with_epitaph(status)
2664 }
2665
2666 fn is_closed(&self) -> bool {
2667 self.inner.channel().is_closed()
2668 }
2669 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2670 self.inner.channel().on_closed()
2671 }
2672
2673 #[cfg(target_os = "fuchsia")]
2674 fn signal_peer(
2675 &self,
2676 clear_mask: zx::Signals,
2677 set_mask: zx::Signals,
2678 ) -> Result<(), zx_status::Status> {
2679 use fidl::Peered;
2680 self.inner.channel().signal_peer(clear_mask, set_mask)
2681 }
2682}
2683
2684impl LogSettingsControlHandle {}
2685
2686#[must_use = "FIDL methods require a response to be sent"]
2687#[derive(Debug)]
2688pub struct LogSettingsSetInterestResponder {
2689 control_handle: std::mem::ManuallyDrop<LogSettingsControlHandle>,
2690 tx_id: u32,
2691}
2692
2693impl std::ops::Drop for LogSettingsSetInterestResponder {
2697 fn drop(&mut self) {
2698 self.control_handle.shutdown();
2699 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2701 }
2702}
2703
2704impl fidl::endpoints::Responder for LogSettingsSetInterestResponder {
2705 type ControlHandle = LogSettingsControlHandle;
2706
2707 fn control_handle(&self) -> &LogSettingsControlHandle {
2708 &self.control_handle
2709 }
2710
2711 fn drop_without_shutdown(mut self) {
2712 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2714 std::mem::forget(self);
2716 }
2717}
2718
2719impl LogSettingsSetInterestResponder {
2720 pub fn send(self) -> Result<(), fidl::Error> {
2724 let _result = self.send_raw();
2725 if _result.is_err() {
2726 self.control_handle.shutdown();
2727 }
2728 self.drop_without_shutdown();
2729 _result
2730 }
2731
2732 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2734 let _result = self.send_raw();
2735 self.drop_without_shutdown();
2736 _result
2737 }
2738
2739 fn send_raw(&self) -> Result<(), fidl::Error> {
2740 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2741 (),
2742 self.tx_id,
2743 0x71beced9d2411f90,
2744 fidl::encoding::DynamicFlags::empty(),
2745 )
2746 }
2747}
2748
2749#[must_use = "FIDL methods require a response to be sent"]
2750#[derive(Debug)]
2751pub struct LogSettingsSetComponentInterestResponder {
2752 control_handle: std::mem::ManuallyDrop<LogSettingsControlHandle>,
2753 tx_id: u32,
2754}
2755
2756impl std::ops::Drop for LogSettingsSetComponentInterestResponder {
2760 fn drop(&mut self) {
2761 self.control_handle.shutdown();
2762 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2764 }
2765}
2766
2767impl fidl::endpoints::Responder for LogSettingsSetComponentInterestResponder {
2768 type ControlHandle = LogSettingsControlHandle;
2769
2770 fn control_handle(&self) -> &LogSettingsControlHandle {
2771 &self.control_handle
2772 }
2773
2774 fn drop_without_shutdown(mut self) {
2775 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2777 std::mem::forget(self);
2779 }
2780}
2781
2782impl LogSettingsSetComponentInterestResponder {
2783 pub fn send(self) -> Result<(), fidl::Error> {
2787 let _result = self.send_raw();
2788 if _result.is_err() {
2789 self.control_handle.shutdown();
2790 }
2791 self.drop_without_shutdown();
2792 _result
2793 }
2794
2795 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2797 let _result = self.send_raw();
2798 self.drop_without_shutdown();
2799 _result
2800 }
2801
2802 fn send_raw(&self) -> Result<(), fidl::Error> {
2803 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2804 (),
2805 self.tx_id,
2806 0x35f7004d2367f6c1,
2807 fidl::encoding::DynamicFlags::empty(),
2808 )
2809 }
2810}
2811
2812#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2813pub struct LogStreamMarker;
2814
2815impl fidl::endpoints::ProtocolMarker for LogStreamMarker {
2816 type Proxy = LogStreamProxy;
2817 type RequestStream = LogStreamRequestStream;
2818 #[cfg(target_os = "fuchsia")]
2819 type SynchronousProxy = LogStreamSynchronousProxy;
2820
2821 const DEBUG_NAME: &'static str = "fuchsia.diagnostics.LogStream";
2822}
2823impl fidl::endpoints::DiscoverableProtocolMarker for LogStreamMarker {}
2824
2825pub trait LogStreamProxyInterface: Send + Sync {
2826 fn r#connect(&self, socket: fidl::Socket, opts: &LogStreamOptions) -> Result<(), fidl::Error>;
2827}
2828#[derive(Debug)]
2829#[cfg(target_os = "fuchsia")]
2830pub struct LogStreamSynchronousProxy {
2831 client: fidl::client::sync::Client,
2832}
2833
2834#[cfg(target_os = "fuchsia")]
2835impl fidl::endpoints::SynchronousProxy for LogStreamSynchronousProxy {
2836 type Proxy = LogStreamProxy;
2837 type Protocol = LogStreamMarker;
2838
2839 fn from_channel(inner: fidl::Channel) -> Self {
2840 Self::new(inner)
2841 }
2842
2843 fn into_channel(self) -> fidl::Channel {
2844 self.client.into_channel()
2845 }
2846
2847 fn as_channel(&self) -> &fidl::Channel {
2848 self.client.as_channel()
2849 }
2850}
2851
2852#[cfg(target_os = "fuchsia")]
2853impl LogStreamSynchronousProxy {
2854 pub fn new(channel: fidl::Channel) -> Self {
2855 let protocol_name = <LogStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2856 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2857 }
2858
2859 pub fn into_channel(self) -> fidl::Channel {
2860 self.client.into_channel()
2861 }
2862
2863 pub fn wait_for_event(
2866 &self,
2867 deadline: zx::MonotonicInstant,
2868 ) -> Result<LogStreamEvent, fidl::Error> {
2869 LogStreamEvent::decode(self.client.wait_for_event(deadline)?)
2870 }
2871
2872 pub fn r#connect(
2884 &self,
2885 mut socket: fidl::Socket,
2886 mut opts: &LogStreamOptions,
2887 ) -> Result<(), fidl::Error> {
2888 self.client.send::<LogStreamConnectRequest>(
2889 (socket, opts),
2890 0x745eb34f10d51a88,
2891 fidl::encoding::DynamicFlags::FLEXIBLE,
2892 )
2893 }
2894}
2895
2896#[cfg(target_os = "fuchsia")]
2897impl From<LogStreamSynchronousProxy> for zx::Handle {
2898 fn from(value: LogStreamSynchronousProxy) -> Self {
2899 value.into_channel().into()
2900 }
2901}
2902
2903#[cfg(target_os = "fuchsia")]
2904impl From<fidl::Channel> for LogStreamSynchronousProxy {
2905 fn from(value: fidl::Channel) -> Self {
2906 Self::new(value)
2907 }
2908}
2909
2910#[cfg(target_os = "fuchsia")]
2911impl fidl::endpoints::FromClient for LogStreamSynchronousProxy {
2912 type Protocol = LogStreamMarker;
2913
2914 fn from_client(value: fidl::endpoints::ClientEnd<LogStreamMarker>) -> Self {
2915 Self::new(value.into_channel())
2916 }
2917}
2918
2919#[derive(Debug, Clone)]
2920pub struct LogStreamProxy {
2921 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2922}
2923
2924impl fidl::endpoints::Proxy for LogStreamProxy {
2925 type Protocol = LogStreamMarker;
2926
2927 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2928 Self::new(inner)
2929 }
2930
2931 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2932 self.client.into_channel().map_err(|client| Self { client })
2933 }
2934
2935 fn as_channel(&self) -> &::fidl::AsyncChannel {
2936 self.client.as_channel()
2937 }
2938}
2939
2940impl LogStreamProxy {
2941 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2943 let protocol_name = <LogStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2944 Self { client: fidl::client::Client::new(channel, protocol_name) }
2945 }
2946
2947 pub fn take_event_stream(&self) -> LogStreamEventStream {
2953 LogStreamEventStream { event_receiver: self.client.take_event_receiver() }
2954 }
2955
2956 pub fn r#connect(
2968 &self,
2969 mut socket: fidl::Socket,
2970 mut opts: &LogStreamOptions,
2971 ) -> Result<(), fidl::Error> {
2972 LogStreamProxyInterface::r#connect(self, socket, opts)
2973 }
2974}
2975
2976impl LogStreamProxyInterface for LogStreamProxy {
2977 fn r#connect(
2978 &self,
2979 mut socket: fidl::Socket,
2980 mut opts: &LogStreamOptions,
2981 ) -> Result<(), fidl::Error> {
2982 self.client.send::<LogStreamConnectRequest>(
2983 (socket, opts),
2984 0x745eb34f10d51a88,
2985 fidl::encoding::DynamicFlags::FLEXIBLE,
2986 )
2987 }
2988}
2989
2990pub struct LogStreamEventStream {
2991 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2992}
2993
2994impl std::marker::Unpin for LogStreamEventStream {}
2995
2996impl futures::stream::FusedStream for LogStreamEventStream {
2997 fn is_terminated(&self) -> bool {
2998 self.event_receiver.is_terminated()
2999 }
3000}
3001
3002impl futures::Stream for LogStreamEventStream {
3003 type Item = Result<LogStreamEvent, fidl::Error>;
3004
3005 fn poll_next(
3006 mut self: std::pin::Pin<&mut Self>,
3007 cx: &mut std::task::Context<'_>,
3008 ) -> std::task::Poll<Option<Self::Item>> {
3009 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3010 &mut self.event_receiver,
3011 cx
3012 )?) {
3013 Some(buf) => std::task::Poll::Ready(Some(LogStreamEvent::decode(buf))),
3014 None => std::task::Poll::Ready(None),
3015 }
3016 }
3017}
3018
3019#[derive(Debug)]
3020pub enum LogStreamEvent {
3021 #[non_exhaustive]
3022 _UnknownEvent {
3023 ordinal: u64,
3025 },
3026}
3027
3028impl LogStreamEvent {
3029 fn decode(
3031 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3032 ) -> Result<LogStreamEvent, fidl::Error> {
3033 let (bytes, _handles) = buf.split_mut();
3034 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3035 debug_assert_eq!(tx_header.tx_id, 0);
3036 match tx_header.ordinal {
3037 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3038 Ok(LogStreamEvent::_UnknownEvent { ordinal: tx_header.ordinal })
3039 }
3040 _ => Err(fidl::Error::UnknownOrdinal {
3041 ordinal: tx_header.ordinal,
3042 protocol_name: <LogStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3043 }),
3044 }
3045 }
3046}
3047
3048pub struct LogStreamRequestStream {
3050 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3051 is_terminated: bool,
3052}
3053
3054impl std::marker::Unpin for LogStreamRequestStream {}
3055
3056impl futures::stream::FusedStream for LogStreamRequestStream {
3057 fn is_terminated(&self) -> bool {
3058 self.is_terminated
3059 }
3060}
3061
3062impl fidl::endpoints::RequestStream for LogStreamRequestStream {
3063 type Protocol = LogStreamMarker;
3064 type ControlHandle = LogStreamControlHandle;
3065
3066 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3067 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3068 }
3069
3070 fn control_handle(&self) -> Self::ControlHandle {
3071 LogStreamControlHandle { inner: self.inner.clone() }
3072 }
3073
3074 fn into_inner(
3075 self,
3076 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3077 {
3078 (self.inner, self.is_terminated)
3079 }
3080
3081 fn from_inner(
3082 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3083 is_terminated: bool,
3084 ) -> Self {
3085 Self { inner, is_terminated }
3086 }
3087}
3088
3089impl futures::Stream for LogStreamRequestStream {
3090 type Item = Result<LogStreamRequest, fidl::Error>;
3091
3092 fn poll_next(
3093 mut self: std::pin::Pin<&mut Self>,
3094 cx: &mut std::task::Context<'_>,
3095 ) -> std::task::Poll<Option<Self::Item>> {
3096 let this = &mut *self;
3097 if this.inner.check_shutdown(cx) {
3098 this.is_terminated = true;
3099 return std::task::Poll::Ready(None);
3100 }
3101 if this.is_terminated {
3102 panic!("polled LogStreamRequestStream after completion");
3103 }
3104 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3105 |bytes, handles| {
3106 match this.inner.channel().read_etc(cx, bytes, handles) {
3107 std::task::Poll::Ready(Ok(())) => {}
3108 std::task::Poll::Pending => return std::task::Poll::Pending,
3109 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3110 this.is_terminated = true;
3111 return std::task::Poll::Ready(None);
3112 }
3113 std::task::Poll::Ready(Err(e)) => {
3114 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3115 e.into(),
3116 ))));
3117 }
3118 }
3119
3120 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3122
3123 std::task::Poll::Ready(Some(match header.ordinal {
3124 0x745eb34f10d51a88 => {
3125 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3126 let mut req = fidl::new_empty!(
3127 LogStreamConnectRequest,
3128 fidl::encoding::DefaultFuchsiaResourceDialect
3129 );
3130 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LogStreamConnectRequest>(&header, _body_bytes, handles, &mut req)?;
3131 let control_handle = LogStreamControlHandle { inner: this.inner.clone() };
3132 Ok(LogStreamRequest::Connect {
3133 socket: req.socket,
3134 opts: req.opts,
3135
3136 control_handle,
3137 })
3138 }
3139 _ if header.tx_id == 0
3140 && header
3141 .dynamic_flags()
3142 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3143 {
3144 Ok(LogStreamRequest::_UnknownMethod {
3145 ordinal: header.ordinal,
3146 control_handle: LogStreamControlHandle { inner: this.inner.clone() },
3147 method_type: fidl::MethodType::OneWay,
3148 })
3149 }
3150 _ if header
3151 .dynamic_flags()
3152 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3153 {
3154 this.inner.send_framework_err(
3155 fidl::encoding::FrameworkErr::UnknownMethod,
3156 header.tx_id,
3157 header.ordinal,
3158 header.dynamic_flags(),
3159 (bytes, handles),
3160 )?;
3161 Ok(LogStreamRequest::_UnknownMethod {
3162 ordinal: header.ordinal,
3163 control_handle: LogStreamControlHandle { inner: this.inner.clone() },
3164 method_type: fidl::MethodType::TwoWay,
3165 })
3166 }
3167 _ => Err(fidl::Error::UnknownOrdinal {
3168 ordinal: header.ordinal,
3169 protocol_name:
3170 <LogStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3171 }),
3172 }))
3173 },
3174 )
3175 }
3176}
3177
3178#[derive(Debug)]
3179pub enum LogStreamRequest {
3180 Connect { socket: fidl::Socket, opts: LogStreamOptions, control_handle: LogStreamControlHandle },
3192 #[non_exhaustive]
3194 _UnknownMethod {
3195 ordinal: u64,
3197 control_handle: LogStreamControlHandle,
3198 method_type: fidl::MethodType,
3199 },
3200}
3201
3202impl LogStreamRequest {
3203 #[allow(irrefutable_let_patterns)]
3204 pub fn into_connect(self) -> Option<(fidl::Socket, LogStreamOptions, LogStreamControlHandle)> {
3205 if let LogStreamRequest::Connect { socket, opts, control_handle } = self {
3206 Some((socket, opts, control_handle))
3207 } else {
3208 None
3209 }
3210 }
3211
3212 pub fn method_name(&self) -> &'static str {
3214 match *self {
3215 LogStreamRequest::Connect { .. } => "connect",
3216 LogStreamRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
3217 "unknown one-way method"
3218 }
3219 LogStreamRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
3220 "unknown two-way method"
3221 }
3222 }
3223 }
3224}
3225
3226#[derive(Debug, Clone)]
3227pub struct LogStreamControlHandle {
3228 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3229}
3230
3231impl fidl::endpoints::ControlHandle for LogStreamControlHandle {
3232 fn shutdown(&self) {
3233 self.inner.shutdown()
3234 }
3235 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3236 self.inner.shutdown_with_epitaph(status)
3237 }
3238
3239 fn is_closed(&self) -> bool {
3240 self.inner.channel().is_closed()
3241 }
3242 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3243 self.inner.channel().on_closed()
3244 }
3245
3246 #[cfg(target_os = "fuchsia")]
3247 fn signal_peer(
3248 &self,
3249 clear_mask: zx::Signals,
3250 set_mask: zx::Signals,
3251 ) -> Result<(), zx_status::Status> {
3252 use fidl::Peered;
3253 self.inner.channel().signal_peer(clear_mask, set_mask)
3254 }
3255}
3256
3257impl LogStreamControlHandle {}
3258
3259#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3260pub struct SampleMarker;
3261
3262impl fidl::endpoints::ProtocolMarker for SampleMarker {
3263 type Proxy = SampleProxy;
3264 type RequestStream = SampleRequestStream;
3265 #[cfg(target_os = "fuchsia")]
3266 type SynchronousProxy = SampleSynchronousProxy;
3267
3268 const DEBUG_NAME: &'static str = "fuchsia.diagnostics.Sample";
3269}
3270impl fidl::endpoints::DiscoverableProtocolMarker for SampleMarker {}
3271pub type SampleCommitResult = Result<(), ConfigurationError>;
3272
3273pub trait SampleProxyInterface: Send + Sync {
3274 fn r#set(&self, sample_parameters: &SampleParameters) -> Result<(), fidl::Error>;
3275 type CommitResponseFut: std::future::Future<Output = Result<SampleCommitResult, fidl::Error>>
3276 + Send;
3277 fn r#commit(
3278 &self,
3279 sink: fidl::endpoints::ClientEnd<SampleSinkMarker>,
3280 ) -> Self::CommitResponseFut;
3281}
3282#[derive(Debug)]
3283#[cfg(target_os = "fuchsia")]
3284pub struct SampleSynchronousProxy {
3285 client: fidl::client::sync::Client,
3286}
3287
3288#[cfg(target_os = "fuchsia")]
3289impl fidl::endpoints::SynchronousProxy for SampleSynchronousProxy {
3290 type Proxy = SampleProxy;
3291 type Protocol = SampleMarker;
3292
3293 fn from_channel(inner: fidl::Channel) -> Self {
3294 Self::new(inner)
3295 }
3296
3297 fn into_channel(self) -> fidl::Channel {
3298 self.client.into_channel()
3299 }
3300
3301 fn as_channel(&self) -> &fidl::Channel {
3302 self.client.as_channel()
3303 }
3304}
3305
3306#[cfg(target_os = "fuchsia")]
3307impl SampleSynchronousProxy {
3308 pub fn new(channel: fidl::Channel) -> Self {
3309 let protocol_name = <SampleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3310 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3311 }
3312
3313 pub fn into_channel(self) -> fidl::Channel {
3314 self.client.into_channel()
3315 }
3316
3317 pub fn wait_for_event(
3320 &self,
3321 deadline: zx::MonotonicInstant,
3322 ) -> Result<SampleEvent, fidl::Error> {
3323 SampleEvent::decode(self.client.wait_for_event(deadline)?)
3324 }
3325
3326 pub fn r#set(&self, mut sample_parameters: &SampleParameters) -> Result<(), fidl::Error> {
3334 self.client.send::<SampleSetRequest>(
3335 (sample_parameters,),
3336 0x421a79bdbf45418e,
3337 fidl::encoding::DynamicFlags::FLEXIBLE,
3338 )
3339 }
3340
3341 pub fn r#commit(
3344 &self,
3345 mut sink: fidl::endpoints::ClientEnd<SampleSinkMarker>,
3346 ___deadline: zx::MonotonicInstant,
3347 ) -> Result<SampleCommitResult, fidl::Error> {
3348 let _response = self.client.send_query::<
3349 SampleCommitRequest,
3350 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, ConfigurationError>,
3351 >(
3352 (sink,),
3353 0x25a3bc5f26787e9b,
3354 fidl::encoding::DynamicFlags::FLEXIBLE,
3355 ___deadline,
3356 )?
3357 .into_result::<SampleMarker>("commit")?;
3358 Ok(_response.map(|x| x))
3359 }
3360}
3361
3362#[cfg(target_os = "fuchsia")]
3363impl From<SampleSynchronousProxy> for zx::Handle {
3364 fn from(value: SampleSynchronousProxy) -> Self {
3365 value.into_channel().into()
3366 }
3367}
3368
3369#[cfg(target_os = "fuchsia")]
3370impl From<fidl::Channel> for SampleSynchronousProxy {
3371 fn from(value: fidl::Channel) -> Self {
3372 Self::new(value)
3373 }
3374}
3375
3376#[cfg(target_os = "fuchsia")]
3377impl fidl::endpoints::FromClient for SampleSynchronousProxy {
3378 type Protocol = SampleMarker;
3379
3380 fn from_client(value: fidl::endpoints::ClientEnd<SampleMarker>) -> Self {
3381 Self::new(value.into_channel())
3382 }
3383}
3384
3385#[derive(Debug, Clone)]
3386pub struct SampleProxy {
3387 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3388}
3389
3390impl fidl::endpoints::Proxy for SampleProxy {
3391 type Protocol = SampleMarker;
3392
3393 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3394 Self::new(inner)
3395 }
3396
3397 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3398 self.client.into_channel().map_err(|client| Self { client })
3399 }
3400
3401 fn as_channel(&self) -> &::fidl::AsyncChannel {
3402 self.client.as_channel()
3403 }
3404}
3405
3406impl SampleProxy {
3407 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3409 let protocol_name = <SampleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3410 Self { client: fidl::client::Client::new(channel, protocol_name) }
3411 }
3412
3413 pub fn take_event_stream(&self) -> SampleEventStream {
3419 SampleEventStream { event_receiver: self.client.take_event_receiver() }
3420 }
3421
3422 pub fn r#set(&self, mut sample_parameters: &SampleParameters) -> Result<(), fidl::Error> {
3430 SampleProxyInterface::r#set(self, sample_parameters)
3431 }
3432
3433 pub fn r#commit(
3436 &self,
3437 mut sink: fidl::endpoints::ClientEnd<SampleSinkMarker>,
3438 ) -> fidl::client::QueryResponseFut<
3439 SampleCommitResult,
3440 fidl::encoding::DefaultFuchsiaResourceDialect,
3441 > {
3442 SampleProxyInterface::r#commit(self, sink)
3443 }
3444}
3445
3446impl SampleProxyInterface for SampleProxy {
3447 fn r#set(&self, mut sample_parameters: &SampleParameters) -> Result<(), fidl::Error> {
3448 self.client.send::<SampleSetRequest>(
3449 (sample_parameters,),
3450 0x421a79bdbf45418e,
3451 fidl::encoding::DynamicFlags::FLEXIBLE,
3452 )
3453 }
3454
3455 type CommitResponseFut = fidl::client::QueryResponseFut<
3456 SampleCommitResult,
3457 fidl::encoding::DefaultFuchsiaResourceDialect,
3458 >;
3459 fn r#commit(
3460 &self,
3461 mut sink: fidl::endpoints::ClientEnd<SampleSinkMarker>,
3462 ) -> Self::CommitResponseFut {
3463 fn _decode(
3464 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3465 ) -> Result<SampleCommitResult, fidl::Error> {
3466 let _response = fidl::client::decode_transaction_body::<
3467 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, ConfigurationError>,
3468 fidl::encoding::DefaultFuchsiaResourceDialect,
3469 0x25a3bc5f26787e9b,
3470 >(_buf?)?
3471 .into_result::<SampleMarker>("commit")?;
3472 Ok(_response.map(|x| x))
3473 }
3474 self.client.send_query_and_decode::<SampleCommitRequest, SampleCommitResult>(
3475 (sink,),
3476 0x25a3bc5f26787e9b,
3477 fidl::encoding::DynamicFlags::FLEXIBLE,
3478 _decode,
3479 )
3480 }
3481}
3482
3483pub struct SampleEventStream {
3484 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3485}
3486
3487impl std::marker::Unpin for SampleEventStream {}
3488
3489impl futures::stream::FusedStream for SampleEventStream {
3490 fn is_terminated(&self) -> bool {
3491 self.event_receiver.is_terminated()
3492 }
3493}
3494
3495impl futures::Stream for SampleEventStream {
3496 type Item = Result<SampleEvent, fidl::Error>;
3497
3498 fn poll_next(
3499 mut self: std::pin::Pin<&mut Self>,
3500 cx: &mut std::task::Context<'_>,
3501 ) -> std::task::Poll<Option<Self::Item>> {
3502 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3503 &mut self.event_receiver,
3504 cx
3505 )?) {
3506 Some(buf) => std::task::Poll::Ready(Some(SampleEvent::decode(buf))),
3507 None => std::task::Poll::Ready(None),
3508 }
3509 }
3510}
3511
3512#[derive(Debug)]
3513pub enum SampleEvent {
3514 #[non_exhaustive]
3515 _UnknownEvent {
3516 ordinal: u64,
3518 },
3519}
3520
3521impl SampleEvent {
3522 fn decode(
3524 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3525 ) -> Result<SampleEvent, fidl::Error> {
3526 let (bytes, _handles) = buf.split_mut();
3527 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3528 debug_assert_eq!(tx_header.tx_id, 0);
3529 match tx_header.ordinal {
3530 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3531 Ok(SampleEvent::_UnknownEvent { ordinal: tx_header.ordinal })
3532 }
3533 _ => Err(fidl::Error::UnknownOrdinal {
3534 ordinal: tx_header.ordinal,
3535 protocol_name: <SampleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3536 }),
3537 }
3538 }
3539}
3540
3541pub struct SampleRequestStream {
3543 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3544 is_terminated: bool,
3545}
3546
3547impl std::marker::Unpin for SampleRequestStream {}
3548
3549impl futures::stream::FusedStream for SampleRequestStream {
3550 fn is_terminated(&self) -> bool {
3551 self.is_terminated
3552 }
3553}
3554
3555impl fidl::endpoints::RequestStream for SampleRequestStream {
3556 type Protocol = SampleMarker;
3557 type ControlHandle = SampleControlHandle;
3558
3559 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3560 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3561 }
3562
3563 fn control_handle(&self) -> Self::ControlHandle {
3564 SampleControlHandle { inner: self.inner.clone() }
3565 }
3566
3567 fn into_inner(
3568 self,
3569 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3570 {
3571 (self.inner, self.is_terminated)
3572 }
3573
3574 fn from_inner(
3575 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3576 is_terminated: bool,
3577 ) -> Self {
3578 Self { inner, is_terminated }
3579 }
3580}
3581
3582impl futures::Stream for SampleRequestStream {
3583 type Item = Result<SampleRequest, fidl::Error>;
3584
3585 fn poll_next(
3586 mut self: std::pin::Pin<&mut Self>,
3587 cx: &mut std::task::Context<'_>,
3588 ) -> std::task::Poll<Option<Self::Item>> {
3589 let this = &mut *self;
3590 if this.inner.check_shutdown(cx) {
3591 this.is_terminated = true;
3592 return std::task::Poll::Ready(None);
3593 }
3594 if this.is_terminated {
3595 panic!("polled SampleRequestStream after completion");
3596 }
3597 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3598 |bytes, handles| {
3599 match this.inner.channel().read_etc(cx, bytes, handles) {
3600 std::task::Poll::Ready(Ok(())) => {}
3601 std::task::Poll::Pending => return std::task::Poll::Pending,
3602 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3603 this.is_terminated = true;
3604 return std::task::Poll::Ready(None);
3605 }
3606 std::task::Poll::Ready(Err(e)) => {
3607 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3608 e.into(),
3609 ))));
3610 }
3611 }
3612
3613 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3615
3616 std::task::Poll::Ready(Some(match header.ordinal {
3617 0x421a79bdbf45418e => {
3618 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3619 let mut req = fidl::new_empty!(
3620 SampleSetRequest,
3621 fidl::encoding::DefaultFuchsiaResourceDialect
3622 );
3623 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SampleSetRequest>(&header, _body_bytes, handles, &mut req)?;
3624 let control_handle = SampleControlHandle { inner: this.inner.clone() };
3625 Ok(SampleRequest::Set {
3626 sample_parameters: req.sample_parameters,
3627
3628 control_handle,
3629 })
3630 }
3631 0x25a3bc5f26787e9b => {
3632 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3633 let mut req = fidl::new_empty!(
3634 SampleCommitRequest,
3635 fidl::encoding::DefaultFuchsiaResourceDialect
3636 );
3637 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SampleCommitRequest>(&header, _body_bytes, handles, &mut req)?;
3638 let control_handle = SampleControlHandle { inner: this.inner.clone() };
3639 Ok(SampleRequest::Commit {
3640 sink: req.sink,
3641
3642 responder: SampleCommitResponder {
3643 control_handle: std::mem::ManuallyDrop::new(control_handle),
3644 tx_id: header.tx_id,
3645 },
3646 })
3647 }
3648 _ if header.tx_id == 0
3649 && header
3650 .dynamic_flags()
3651 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3652 {
3653 Ok(SampleRequest::_UnknownMethod {
3654 ordinal: header.ordinal,
3655 control_handle: SampleControlHandle { inner: this.inner.clone() },
3656 method_type: fidl::MethodType::OneWay,
3657 })
3658 }
3659 _ if header
3660 .dynamic_flags()
3661 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3662 {
3663 this.inner.send_framework_err(
3664 fidl::encoding::FrameworkErr::UnknownMethod,
3665 header.tx_id,
3666 header.ordinal,
3667 header.dynamic_flags(),
3668 (bytes, handles),
3669 )?;
3670 Ok(SampleRequest::_UnknownMethod {
3671 ordinal: header.ordinal,
3672 control_handle: SampleControlHandle { inner: this.inner.clone() },
3673 method_type: fidl::MethodType::TwoWay,
3674 })
3675 }
3676 _ => Err(fidl::Error::UnknownOrdinal {
3677 ordinal: header.ordinal,
3678 protocol_name:
3679 <SampleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3680 }),
3681 }))
3682 },
3683 )
3684 }
3685}
3686
3687#[derive(Debug)]
3699pub enum SampleRequest {
3700 Set { sample_parameters: SampleParameters, control_handle: SampleControlHandle },
3708 Commit { sink: fidl::endpoints::ClientEnd<SampleSinkMarker>, responder: SampleCommitResponder },
3711 #[non_exhaustive]
3713 _UnknownMethod {
3714 ordinal: u64,
3716 control_handle: SampleControlHandle,
3717 method_type: fidl::MethodType,
3718 },
3719}
3720
3721impl SampleRequest {
3722 #[allow(irrefutable_let_patterns)]
3723 pub fn into_set(self) -> Option<(SampleParameters, SampleControlHandle)> {
3724 if let SampleRequest::Set { sample_parameters, control_handle } = self {
3725 Some((sample_parameters, control_handle))
3726 } else {
3727 None
3728 }
3729 }
3730
3731 #[allow(irrefutable_let_patterns)]
3732 pub fn into_commit(
3733 self,
3734 ) -> Option<(fidl::endpoints::ClientEnd<SampleSinkMarker>, SampleCommitResponder)> {
3735 if let SampleRequest::Commit { sink, responder } = self {
3736 Some((sink, responder))
3737 } else {
3738 None
3739 }
3740 }
3741
3742 pub fn method_name(&self) -> &'static str {
3744 match *self {
3745 SampleRequest::Set { .. } => "set",
3746 SampleRequest::Commit { .. } => "commit",
3747 SampleRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
3748 "unknown one-way method"
3749 }
3750 SampleRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
3751 "unknown two-way method"
3752 }
3753 }
3754 }
3755}
3756
3757#[derive(Debug, Clone)]
3758pub struct SampleControlHandle {
3759 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3760}
3761
3762impl fidl::endpoints::ControlHandle for SampleControlHandle {
3763 fn shutdown(&self) {
3764 self.inner.shutdown()
3765 }
3766 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3767 self.inner.shutdown_with_epitaph(status)
3768 }
3769
3770 fn is_closed(&self) -> bool {
3771 self.inner.channel().is_closed()
3772 }
3773 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3774 self.inner.channel().on_closed()
3775 }
3776
3777 #[cfg(target_os = "fuchsia")]
3778 fn signal_peer(
3779 &self,
3780 clear_mask: zx::Signals,
3781 set_mask: zx::Signals,
3782 ) -> Result<(), zx_status::Status> {
3783 use fidl::Peered;
3784 self.inner.channel().signal_peer(clear_mask, set_mask)
3785 }
3786}
3787
3788impl SampleControlHandle {}
3789
3790#[must_use = "FIDL methods require a response to be sent"]
3791#[derive(Debug)]
3792pub struct SampleCommitResponder {
3793 control_handle: std::mem::ManuallyDrop<SampleControlHandle>,
3794 tx_id: u32,
3795}
3796
3797impl std::ops::Drop for SampleCommitResponder {
3801 fn drop(&mut self) {
3802 self.control_handle.shutdown();
3803 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3805 }
3806}
3807
3808impl fidl::endpoints::Responder for SampleCommitResponder {
3809 type ControlHandle = SampleControlHandle;
3810
3811 fn control_handle(&self) -> &SampleControlHandle {
3812 &self.control_handle
3813 }
3814
3815 fn drop_without_shutdown(mut self) {
3816 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3818 std::mem::forget(self);
3820 }
3821}
3822
3823impl SampleCommitResponder {
3824 pub fn send(self, mut result: Result<(), ConfigurationError>) -> Result<(), fidl::Error> {
3828 let _result = self.send_raw(result);
3829 if _result.is_err() {
3830 self.control_handle.shutdown();
3831 }
3832 self.drop_without_shutdown();
3833 _result
3834 }
3835
3836 pub fn send_no_shutdown_on_err(
3838 self,
3839 mut result: Result<(), ConfigurationError>,
3840 ) -> Result<(), fidl::Error> {
3841 let _result = self.send_raw(result);
3842 self.drop_without_shutdown();
3843 _result
3844 }
3845
3846 fn send_raw(&self, mut result: Result<(), ConfigurationError>) -> Result<(), fidl::Error> {
3847 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3848 fidl::encoding::EmptyStruct,
3849 ConfigurationError,
3850 >>(
3851 fidl::encoding::FlexibleResult::new(result),
3852 self.tx_id,
3853 0x25a3bc5f26787e9b,
3854 fidl::encoding::DynamicFlags::FLEXIBLE,
3855 )
3856 }
3857}
3858
3859#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3860pub struct SampleSinkMarker;
3861
3862impl fidl::endpoints::ProtocolMarker for SampleSinkMarker {
3863 type Proxy = SampleSinkProxy;
3864 type RequestStream = SampleSinkRequestStream;
3865 #[cfg(target_os = "fuchsia")]
3866 type SynchronousProxy = SampleSinkSynchronousProxy;
3867
3868 const DEBUG_NAME: &'static str = "(anonymous) SampleSink";
3869}
3870
3871pub trait SampleSinkProxyInterface: Send + Sync {
3872 fn r#on_sample_readied(&self, event: SampleSinkResult) -> Result<(), fidl::Error>;
3873}
3874#[derive(Debug)]
3875#[cfg(target_os = "fuchsia")]
3876pub struct SampleSinkSynchronousProxy {
3877 client: fidl::client::sync::Client,
3878}
3879
3880#[cfg(target_os = "fuchsia")]
3881impl fidl::endpoints::SynchronousProxy for SampleSinkSynchronousProxy {
3882 type Proxy = SampleSinkProxy;
3883 type Protocol = SampleSinkMarker;
3884
3885 fn from_channel(inner: fidl::Channel) -> Self {
3886 Self::new(inner)
3887 }
3888
3889 fn into_channel(self) -> fidl::Channel {
3890 self.client.into_channel()
3891 }
3892
3893 fn as_channel(&self) -> &fidl::Channel {
3894 self.client.as_channel()
3895 }
3896}
3897
3898#[cfg(target_os = "fuchsia")]
3899impl SampleSinkSynchronousProxy {
3900 pub fn new(channel: fidl::Channel) -> Self {
3901 let protocol_name = <SampleSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3902 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3903 }
3904
3905 pub fn into_channel(self) -> fidl::Channel {
3906 self.client.into_channel()
3907 }
3908
3909 pub fn wait_for_event(
3912 &self,
3913 deadline: zx::MonotonicInstant,
3914 ) -> Result<SampleSinkEvent, fidl::Error> {
3915 SampleSinkEvent::decode(self.client.wait_for_event(deadline)?)
3916 }
3917
3918 pub fn r#on_sample_readied(&self, mut event: SampleSinkResult) -> Result<(), fidl::Error> {
3919 self.client.send::<SampleSinkOnSampleReadiedRequest>(
3920 (&mut event,),
3921 0x39096d97ed03335f,
3922 fidl::encoding::DynamicFlags::FLEXIBLE,
3923 )
3924 }
3925}
3926
3927#[cfg(target_os = "fuchsia")]
3928impl From<SampleSinkSynchronousProxy> for zx::Handle {
3929 fn from(value: SampleSinkSynchronousProxy) -> Self {
3930 value.into_channel().into()
3931 }
3932}
3933
3934#[cfg(target_os = "fuchsia")]
3935impl From<fidl::Channel> for SampleSinkSynchronousProxy {
3936 fn from(value: fidl::Channel) -> Self {
3937 Self::new(value)
3938 }
3939}
3940
3941#[cfg(target_os = "fuchsia")]
3942impl fidl::endpoints::FromClient for SampleSinkSynchronousProxy {
3943 type Protocol = SampleSinkMarker;
3944
3945 fn from_client(value: fidl::endpoints::ClientEnd<SampleSinkMarker>) -> Self {
3946 Self::new(value.into_channel())
3947 }
3948}
3949
3950#[derive(Debug, Clone)]
3951pub struct SampleSinkProxy {
3952 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3953}
3954
3955impl fidl::endpoints::Proxy for SampleSinkProxy {
3956 type Protocol = SampleSinkMarker;
3957
3958 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3959 Self::new(inner)
3960 }
3961
3962 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3963 self.client.into_channel().map_err(|client| Self { client })
3964 }
3965
3966 fn as_channel(&self) -> &::fidl::AsyncChannel {
3967 self.client.as_channel()
3968 }
3969}
3970
3971impl SampleSinkProxy {
3972 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3974 let protocol_name = <SampleSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3975 Self { client: fidl::client::Client::new(channel, protocol_name) }
3976 }
3977
3978 pub fn take_event_stream(&self) -> SampleSinkEventStream {
3984 SampleSinkEventStream { event_receiver: self.client.take_event_receiver() }
3985 }
3986
3987 pub fn r#on_sample_readied(&self, mut event: SampleSinkResult) -> Result<(), fidl::Error> {
3988 SampleSinkProxyInterface::r#on_sample_readied(self, event)
3989 }
3990}
3991
3992impl SampleSinkProxyInterface for SampleSinkProxy {
3993 fn r#on_sample_readied(&self, mut event: SampleSinkResult) -> Result<(), fidl::Error> {
3994 self.client.send::<SampleSinkOnSampleReadiedRequest>(
3995 (&mut event,),
3996 0x39096d97ed03335f,
3997 fidl::encoding::DynamicFlags::FLEXIBLE,
3998 )
3999 }
4000}
4001
4002pub struct SampleSinkEventStream {
4003 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4004}
4005
4006impl std::marker::Unpin for SampleSinkEventStream {}
4007
4008impl futures::stream::FusedStream for SampleSinkEventStream {
4009 fn is_terminated(&self) -> bool {
4010 self.event_receiver.is_terminated()
4011 }
4012}
4013
4014impl futures::Stream for SampleSinkEventStream {
4015 type Item = Result<SampleSinkEvent, fidl::Error>;
4016
4017 fn poll_next(
4018 mut self: std::pin::Pin<&mut Self>,
4019 cx: &mut std::task::Context<'_>,
4020 ) -> std::task::Poll<Option<Self::Item>> {
4021 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4022 &mut self.event_receiver,
4023 cx
4024 )?) {
4025 Some(buf) => std::task::Poll::Ready(Some(SampleSinkEvent::decode(buf))),
4026 None => std::task::Poll::Ready(None),
4027 }
4028 }
4029}
4030
4031#[derive(Debug)]
4032pub enum SampleSinkEvent {
4033 OnNowOrNever {},
4034 #[non_exhaustive]
4035 _UnknownEvent {
4036 ordinal: u64,
4038 },
4039}
4040
4041impl SampleSinkEvent {
4042 #[allow(irrefutable_let_patterns)]
4043 pub fn into_on_now_or_never(self) -> Option<()> {
4044 if let SampleSinkEvent::OnNowOrNever {} = self { Some(()) } else { None }
4045 }
4046
4047 fn decode(
4049 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4050 ) -> Result<SampleSinkEvent, fidl::Error> {
4051 let (bytes, _handles) = buf.split_mut();
4052 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4053 debug_assert_eq!(tx_header.tx_id, 0);
4054 match tx_header.ordinal {
4055 0x3dc94ca1e1290894 => {
4056 let mut out = fidl::new_empty!(
4057 fidl::encoding::EmptyPayload,
4058 fidl::encoding::DefaultFuchsiaResourceDialect
4059 );
4060 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&tx_header, _body_bytes, _handles, &mut out)?;
4061 Ok((SampleSinkEvent::OnNowOrNever {}))
4062 }
4063 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
4064 Ok(SampleSinkEvent::_UnknownEvent { ordinal: tx_header.ordinal })
4065 }
4066 _ => Err(fidl::Error::UnknownOrdinal {
4067 ordinal: tx_header.ordinal,
4068 protocol_name: <SampleSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4069 }),
4070 }
4071 }
4072}
4073
4074pub struct SampleSinkRequestStream {
4076 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4077 is_terminated: bool,
4078}
4079
4080impl std::marker::Unpin for SampleSinkRequestStream {}
4081
4082impl futures::stream::FusedStream for SampleSinkRequestStream {
4083 fn is_terminated(&self) -> bool {
4084 self.is_terminated
4085 }
4086}
4087
4088impl fidl::endpoints::RequestStream for SampleSinkRequestStream {
4089 type Protocol = SampleSinkMarker;
4090 type ControlHandle = SampleSinkControlHandle;
4091
4092 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4093 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4094 }
4095
4096 fn control_handle(&self) -> Self::ControlHandle {
4097 SampleSinkControlHandle { inner: self.inner.clone() }
4098 }
4099
4100 fn into_inner(
4101 self,
4102 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4103 {
4104 (self.inner, self.is_terminated)
4105 }
4106
4107 fn from_inner(
4108 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4109 is_terminated: bool,
4110 ) -> Self {
4111 Self { inner, is_terminated }
4112 }
4113}
4114
4115impl futures::Stream for SampleSinkRequestStream {
4116 type Item = Result<SampleSinkRequest, fidl::Error>;
4117
4118 fn poll_next(
4119 mut self: std::pin::Pin<&mut Self>,
4120 cx: &mut std::task::Context<'_>,
4121 ) -> std::task::Poll<Option<Self::Item>> {
4122 let this = &mut *self;
4123 if this.inner.check_shutdown(cx) {
4124 this.is_terminated = true;
4125 return std::task::Poll::Ready(None);
4126 }
4127 if this.is_terminated {
4128 panic!("polled SampleSinkRequestStream after completion");
4129 }
4130 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4131 |bytes, handles| {
4132 match this.inner.channel().read_etc(cx, bytes, handles) {
4133 std::task::Poll::Ready(Ok(())) => {}
4134 std::task::Poll::Pending => return std::task::Poll::Pending,
4135 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4136 this.is_terminated = true;
4137 return std::task::Poll::Ready(None);
4138 }
4139 std::task::Poll::Ready(Err(e)) => {
4140 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4141 e.into(),
4142 ))));
4143 }
4144 }
4145
4146 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4148
4149 std::task::Poll::Ready(Some(match header.ordinal {
4150 0x39096d97ed03335f => {
4151 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4152 let mut req = fidl::new_empty!(
4153 SampleSinkOnSampleReadiedRequest,
4154 fidl::encoding::DefaultFuchsiaResourceDialect
4155 );
4156 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SampleSinkOnSampleReadiedRequest>(&header, _body_bytes, handles, &mut req)?;
4157 let control_handle = SampleSinkControlHandle { inner: this.inner.clone() };
4158 Ok(SampleSinkRequest::OnSampleReadied { event: req.event, control_handle })
4159 }
4160 _ if header.tx_id == 0
4161 && header
4162 .dynamic_flags()
4163 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
4164 {
4165 Ok(SampleSinkRequest::_UnknownMethod {
4166 ordinal: header.ordinal,
4167 control_handle: SampleSinkControlHandle { inner: this.inner.clone() },
4168 method_type: fidl::MethodType::OneWay,
4169 })
4170 }
4171 _ if header
4172 .dynamic_flags()
4173 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
4174 {
4175 this.inner.send_framework_err(
4176 fidl::encoding::FrameworkErr::UnknownMethod,
4177 header.tx_id,
4178 header.ordinal,
4179 header.dynamic_flags(),
4180 (bytes, handles),
4181 )?;
4182 Ok(SampleSinkRequest::_UnknownMethod {
4183 ordinal: header.ordinal,
4184 control_handle: SampleSinkControlHandle { inner: this.inner.clone() },
4185 method_type: fidl::MethodType::TwoWay,
4186 })
4187 }
4188 _ => Err(fidl::Error::UnknownOrdinal {
4189 ordinal: header.ordinal,
4190 protocol_name:
4191 <SampleSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4192 }),
4193 }))
4194 },
4195 )
4196 }
4197}
4198
4199#[derive(Debug)]
4202pub enum SampleSinkRequest {
4203 OnSampleReadied {
4204 event: SampleSinkResult,
4205 control_handle: SampleSinkControlHandle,
4206 },
4207 #[non_exhaustive]
4209 _UnknownMethod {
4210 ordinal: u64,
4212 control_handle: SampleSinkControlHandle,
4213 method_type: fidl::MethodType,
4214 },
4215}
4216
4217impl SampleSinkRequest {
4218 #[allow(irrefutable_let_patterns)]
4219 pub fn into_on_sample_readied(self) -> Option<(SampleSinkResult, SampleSinkControlHandle)> {
4220 if let SampleSinkRequest::OnSampleReadied { event, control_handle } = self {
4221 Some((event, control_handle))
4222 } else {
4223 None
4224 }
4225 }
4226
4227 pub fn method_name(&self) -> &'static str {
4229 match *self {
4230 SampleSinkRequest::OnSampleReadied { .. } => "on_sample_readied",
4231 SampleSinkRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
4232 "unknown one-way method"
4233 }
4234 SampleSinkRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
4235 "unknown two-way method"
4236 }
4237 }
4238 }
4239}
4240
4241#[derive(Debug, Clone)]
4242pub struct SampleSinkControlHandle {
4243 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4244}
4245
4246impl fidl::endpoints::ControlHandle for SampleSinkControlHandle {
4247 fn shutdown(&self) {
4248 self.inner.shutdown()
4249 }
4250 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4251 self.inner.shutdown_with_epitaph(status)
4252 }
4253
4254 fn is_closed(&self) -> bool {
4255 self.inner.channel().is_closed()
4256 }
4257 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4258 self.inner.channel().on_closed()
4259 }
4260
4261 #[cfg(target_os = "fuchsia")]
4262 fn signal_peer(
4263 &self,
4264 clear_mask: zx::Signals,
4265 set_mask: zx::Signals,
4266 ) -> Result<(), zx_status::Status> {
4267 use fidl::Peered;
4268 self.inner.channel().signal_peer(clear_mask, set_mask)
4269 }
4270}
4271
4272impl SampleSinkControlHandle {
4273 pub fn send_on_now_or_never(&self) -> Result<(), fidl::Error> {
4274 self.inner.send::<fidl::encoding::EmptyPayload>(
4275 (),
4276 0,
4277 0x3dc94ca1e1290894,
4278 fidl::encoding::DynamicFlags::FLEXIBLE,
4279 )
4280 }
4281}
4282
4283mod internal {
4284 use super::*;
4285
4286 impl fidl::encoding::ResourceTypeMarker for ArchiveAccessorStreamDiagnosticsRequest {
4287 type Borrowed<'a> = &'a mut Self;
4288 fn take_or_borrow<'a>(
4289 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4290 ) -> Self::Borrowed<'a> {
4291 value
4292 }
4293 }
4294
4295 unsafe impl fidl::encoding::TypeMarker for ArchiveAccessorStreamDiagnosticsRequest {
4296 type Owned = Self;
4297
4298 #[inline(always)]
4299 fn inline_align(_context: fidl::encoding::Context) -> usize {
4300 8
4301 }
4302
4303 #[inline(always)]
4304 fn inline_size(_context: fidl::encoding::Context) -> usize {
4305 24
4306 }
4307 }
4308
4309 unsafe impl
4310 fidl::encoding::Encode<
4311 ArchiveAccessorStreamDiagnosticsRequest,
4312 fidl::encoding::DefaultFuchsiaResourceDialect,
4313 > for &mut ArchiveAccessorStreamDiagnosticsRequest
4314 {
4315 #[inline]
4316 unsafe fn encode(
4317 self,
4318 encoder: &mut fidl::encoding::Encoder<
4319 '_,
4320 fidl::encoding::DefaultFuchsiaResourceDialect,
4321 >,
4322 offset: usize,
4323 _depth: fidl::encoding::Depth,
4324 ) -> fidl::Result<()> {
4325 encoder.debug_check_bounds::<ArchiveAccessorStreamDiagnosticsRequest>(offset);
4326 fidl::encoding::Encode::<ArchiveAccessorStreamDiagnosticsRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4328 (
4329 <StreamParameters as fidl::encoding::ValueTypeMarker>::borrow(&self.stream_parameters),
4330 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BatchIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.result_stream),
4331 ),
4332 encoder, offset, _depth
4333 )
4334 }
4335 }
4336 unsafe impl<
4337 T0: fidl::encoding::Encode<StreamParameters, fidl::encoding::DefaultFuchsiaResourceDialect>,
4338 T1: fidl::encoding::Encode<
4339 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BatchIteratorMarker>>,
4340 fidl::encoding::DefaultFuchsiaResourceDialect,
4341 >,
4342 >
4343 fidl::encoding::Encode<
4344 ArchiveAccessorStreamDiagnosticsRequest,
4345 fidl::encoding::DefaultFuchsiaResourceDialect,
4346 > for (T0, T1)
4347 {
4348 #[inline]
4349 unsafe fn encode(
4350 self,
4351 encoder: &mut fidl::encoding::Encoder<
4352 '_,
4353 fidl::encoding::DefaultFuchsiaResourceDialect,
4354 >,
4355 offset: usize,
4356 depth: fidl::encoding::Depth,
4357 ) -> fidl::Result<()> {
4358 encoder.debug_check_bounds::<ArchiveAccessorStreamDiagnosticsRequest>(offset);
4359 unsafe {
4362 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
4363 (ptr as *mut u64).write_unaligned(0);
4364 }
4365 self.0.encode(encoder, offset + 0, depth)?;
4367 self.1.encode(encoder, offset + 16, depth)?;
4368 Ok(())
4369 }
4370 }
4371
4372 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4373 for ArchiveAccessorStreamDiagnosticsRequest
4374 {
4375 #[inline(always)]
4376 fn new_empty() -> Self {
4377 Self {
4378 stream_parameters: fidl::new_empty!(
4379 StreamParameters,
4380 fidl::encoding::DefaultFuchsiaResourceDialect
4381 ),
4382 result_stream: fidl::new_empty!(
4383 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BatchIteratorMarker>>,
4384 fidl::encoding::DefaultFuchsiaResourceDialect
4385 ),
4386 }
4387 }
4388
4389 #[inline]
4390 unsafe fn decode(
4391 &mut self,
4392 decoder: &mut fidl::encoding::Decoder<
4393 '_,
4394 fidl::encoding::DefaultFuchsiaResourceDialect,
4395 >,
4396 offset: usize,
4397 _depth: fidl::encoding::Depth,
4398 ) -> fidl::Result<()> {
4399 decoder.debug_check_bounds::<Self>(offset);
4400 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
4402 let padval = unsafe { (ptr as *const u64).read_unaligned() };
4403 let mask = 0xffffffff00000000u64;
4404 let maskedval = padval & mask;
4405 if maskedval != 0 {
4406 return Err(fidl::Error::NonZeroPadding {
4407 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
4408 });
4409 }
4410 fidl::decode!(
4411 StreamParameters,
4412 fidl::encoding::DefaultFuchsiaResourceDialect,
4413 &mut self.stream_parameters,
4414 decoder,
4415 offset + 0,
4416 _depth
4417 )?;
4418 fidl::decode!(
4419 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BatchIteratorMarker>>,
4420 fidl::encoding::DefaultFuchsiaResourceDialect,
4421 &mut self.result_stream,
4422 decoder,
4423 offset + 16,
4424 _depth
4425 )?;
4426 Ok(())
4427 }
4428 }
4429
4430 impl fidl::encoding::ResourceTypeMarker for BatchIteratorGetNextResponse {
4431 type Borrowed<'a> = &'a mut Self;
4432 fn take_or_borrow<'a>(
4433 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4434 ) -> Self::Borrowed<'a> {
4435 value
4436 }
4437 }
4438
4439 unsafe impl fidl::encoding::TypeMarker for BatchIteratorGetNextResponse {
4440 type Owned = Self;
4441
4442 #[inline(always)]
4443 fn inline_align(_context: fidl::encoding::Context) -> usize {
4444 8
4445 }
4446
4447 #[inline(always)]
4448 fn inline_size(_context: fidl::encoding::Context) -> usize {
4449 16
4450 }
4451 }
4452
4453 unsafe impl
4454 fidl::encoding::Encode<
4455 BatchIteratorGetNextResponse,
4456 fidl::encoding::DefaultFuchsiaResourceDialect,
4457 > for &mut BatchIteratorGetNextResponse
4458 {
4459 #[inline]
4460 unsafe fn encode(
4461 self,
4462 encoder: &mut fidl::encoding::Encoder<
4463 '_,
4464 fidl::encoding::DefaultFuchsiaResourceDialect,
4465 >,
4466 offset: usize,
4467 _depth: fidl::encoding::Depth,
4468 ) -> fidl::Result<()> {
4469 encoder.debug_check_bounds::<BatchIteratorGetNextResponse>(offset);
4470 fidl::encoding::Encode::<BatchIteratorGetNextResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4472 (
4473 <fidl::encoding::Vector<FormattedContent, 64> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.batch),
4474 ),
4475 encoder, offset, _depth
4476 )
4477 }
4478 }
4479 unsafe impl<
4480 T0: fidl::encoding::Encode<
4481 fidl::encoding::Vector<FormattedContent, 64>,
4482 fidl::encoding::DefaultFuchsiaResourceDialect,
4483 >,
4484 >
4485 fidl::encoding::Encode<
4486 BatchIteratorGetNextResponse,
4487 fidl::encoding::DefaultFuchsiaResourceDialect,
4488 > for (T0,)
4489 {
4490 #[inline]
4491 unsafe fn encode(
4492 self,
4493 encoder: &mut fidl::encoding::Encoder<
4494 '_,
4495 fidl::encoding::DefaultFuchsiaResourceDialect,
4496 >,
4497 offset: usize,
4498 depth: fidl::encoding::Depth,
4499 ) -> fidl::Result<()> {
4500 encoder.debug_check_bounds::<BatchIteratorGetNextResponse>(offset);
4501 self.0.encode(encoder, offset + 0, depth)?;
4505 Ok(())
4506 }
4507 }
4508
4509 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4510 for BatchIteratorGetNextResponse
4511 {
4512 #[inline(always)]
4513 fn new_empty() -> Self {
4514 Self {
4515 batch: fidl::new_empty!(fidl::encoding::Vector<FormattedContent, 64>, fidl::encoding::DefaultFuchsiaResourceDialect),
4516 }
4517 }
4518
4519 #[inline]
4520 unsafe fn decode(
4521 &mut self,
4522 decoder: &mut fidl::encoding::Decoder<
4523 '_,
4524 fidl::encoding::DefaultFuchsiaResourceDialect,
4525 >,
4526 offset: usize,
4527 _depth: fidl::encoding::Depth,
4528 ) -> fidl::Result<()> {
4529 decoder.debug_check_bounds::<Self>(offset);
4530 fidl::decode!(fidl::encoding::Vector<FormattedContent, 64>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.batch, decoder, offset + 0, _depth)?;
4532 Ok(())
4533 }
4534 }
4535
4536 impl fidl::encoding::ResourceTypeMarker for LogStreamConnectRequest {
4537 type Borrowed<'a> = &'a mut Self;
4538 fn take_or_borrow<'a>(
4539 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4540 ) -> Self::Borrowed<'a> {
4541 value
4542 }
4543 }
4544
4545 unsafe impl fidl::encoding::TypeMarker for LogStreamConnectRequest {
4546 type Owned = Self;
4547
4548 #[inline(always)]
4549 fn inline_align(_context: fidl::encoding::Context) -> usize {
4550 8
4551 }
4552
4553 #[inline(always)]
4554 fn inline_size(_context: fidl::encoding::Context) -> usize {
4555 24
4556 }
4557 }
4558
4559 unsafe impl
4560 fidl::encoding::Encode<
4561 LogStreamConnectRequest,
4562 fidl::encoding::DefaultFuchsiaResourceDialect,
4563 > for &mut LogStreamConnectRequest
4564 {
4565 #[inline]
4566 unsafe fn encode(
4567 self,
4568 encoder: &mut fidl::encoding::Encoder<
4569 '_,
4570 fidl::encoding::DefaultFuchsiaResourceDialect,
4571 >,
4572 offset: usize,
4573 _depth: fidl::encoding::Depth,
4574 ) -> fidl::Result<()> {
4575 encoder.debug_check_bounds::<LogStreamConnectRequest>(offset);
4576 fidl::encoding::Encode::<
4578 LogStreamConnectRequest,
4579 fidl::encoding::DefaultFuchsiaResourceDialect,
4580 >::encode(
4581 (
4582 <fidl::encoding::HandleType<
4583 fidl::Socket,
4584 { fidl::ObjectType::SOCKET.into_raw() },
4585 16392,
4586 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4587 &mut self.socket
4588 ),
4589 <LogStreamOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.opts),
4590 ),
4591 encoder,
4592 offset,
4593 _depth,
4594 )
4595 }
4596 }
4597 unsafe impl<
4598 T0: fidl::encoding::Encode<
4599 fidl::encoding::HandleType<
4600 fidl::Socket,
4601 { fidl::ObjectType::SOCKET.into_raw() },
4602 16392,
4603 >,
4604 fidl::encoding::DefaultFuchsiaResourceDialect,
4605 >,
4606 T1: fidl::encoding::Encode<LogStreamOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
4607 >
4608 fidl::encoding::Encode<
4609 LogStreamConnectRequest,
4610 fidl::encoding::DefaultFuchsiaResourceDialect,
4611 > for (T0, T1)
4612 {
4613 #[inline]
4614 unsafe fn encode(
4615 self,
4616 encoder: &mut fidl::encoding::Encoder<
4617 '_,
4618 fidl::encoding::DefaultFuchsiaResourceDialect,
4619 >,
4620 offset: usize,
4621 depth: fidl::encoding::Depth,
4622 ) -> fidl::Result<()> {
4623 encoder.debug_check_bounds::<LogStreamConnectRequest>(offset);
4624 unsafe {
4627 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
4628 (ptr as *mut u64).write_unaligned(0);
4629 }
4630 self.0.encode(encoder, offset + 0, depth)?;
4632 self.1.encode(encoder, offset + 8, depth)?;
4633 Ok(())
4634 }
4635 }
4636
4637 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4638 for LogStreamConnectRequest
4639 {
4640 #[inline(always)]
4641 fn new_empty() -> Self {
4642 Self {
4643 socket: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 16392>, fidl::encoding::DefaultFuchsiaResourceDialect),
4644 opts: fidl::new_empty!(
4645 LogStreamOptions,
4646 fidl::encoding::DefaultFuchsiaResourceDialect
4647 ),
4648 }
4649 }
4650
4651 #[inline]
4652 unsafe fn decode(
4653 &mut self,
4654 decoder: &mut fidl::encoding::Decoder<
4655 '_,
4656 fidl::encoding::DefaultFuchsiaResourceDialect,
4657 >,
4658 offset: usize,
4659 _depth: fidl::encoding::Depth,
4660 ) -> fidl::Result<()> {
4661 decoder.debug_check_bounds::<Self>(offset);
4662 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
4664 let padval = unsafe { (ptr as *const u64).read_unaligned() };
4665 let mask = 0xffffffff00000000u64;
4666 let maskedval = padval & mask;
4667 if maskedval != 0 {
4668 return Err(fidl::Error::NonZeroPadding {
4669 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
4670 });
4671 }
4672 fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 16392>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.socket, decoder, offset + 0, _depth)?;
4673 fidl::decode!(
4674 LogStreamOptions,
4675 fidl::encoding::DefaultFuchsiaResourceDialect,
4676 &mut self.opts,
4677 decoder,
4678 offset + 8,
4679 _depth
4680 )?;
4681 Ok(())
4682 }
4683 }
4684
4685 impl fidl::encoding::ResourceTypeMarker for SampleCommitRequest {
4686 type Borrowed<'a> = &'a mut Self;
4687 fn take_or_borrow<'a>(
4688 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4689 ) -> Self::Borrowed<'a> {
4690 value
4691 }
4692 }
4693
4694 unsafe impl fidl::encoding::TypeMarker for SampleCommitRequest {
4695 type Owned = Self;
4696
4697 #[inline(always)]
4698 fn inline_align(_context: fidl::encoding::Context) -> usize {
4699 4
4700 }
4701
4702 #[inline(always)]
4703 fn inline_size(_context: fidl::encoding::Context) -> usize {
4704 4
4705 }
4706 }
4707
4708 unsafe impl
4709 fidl::encoding::Encode<SampleCommitRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
4710 for &mut SampleCommitRequest
4711 {
4712 #[inline]
4713 unsafe fn encode(
4714 self,
4715 encoder: &mut fidl::encoding::Encoder<
4716 '_,
4717 fidl::encoding::DefaultFuchsiaResourceDialect,
4718 >,
4719 offset: usize,
4720 _depth: fidl::encoding::Depth,
4721 ) -> fidl::Result<()> {
4722 encoder.debug_check_bounds::<SampleCommitRequest>(offset);
4723 fidl::encoding::Encode::<SampleCommitRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4725 (
4726 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SampleSinkMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.sink),
4727 ),
4728 encoder, offset, _depth
4729 )
4730 }
4731 }
4732 unsafe impl<
4733 T0: fidl::encoding::Encode<
4734 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SampleSinkMarker>>,
4735 fidl::encoding::DefaultFuchsiaResourceDialect,
4736 >,
4737 > fidl::encoding::Encode<SampleCommitRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
4738 for (T0,)
4739 {
4740 #[inline]
4741 unsafe fn encode(
4742 self,
4743 encoder: &mut fidl::encoding::Encoder<
4744 '_,
4745 fidl::encoding::DefaultFuchsiaResourceDialect,
4746 >,
4747 offset: usize,
4748 depth: fidl::encoding::Depth,
4749 ) -> fidl::Result<()> {
4750 encoder.debug_check_bounds::<SampleCommitRequest>(offset);
4751 self.0.encode(encoder, offset + 0, depth)?;
4755 Ok(())
4756 }
4757 }
4758
4759 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4760 for SampleCommitRequest
4761 {
4762 #[inline(always)]
4763 fn new_empty() -> Self {
4764 Self {
4765 sink: fidl::new_empty!(
4766 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SampleSinkMarker>>,
4767 fidl::encoding::DefaultFuchsiaResourceDialect
4768 ),
4769 }
4770 }
4771
4772 #[inline]
4773 unsafe fn decode(
4774 &mut self,
4775 decoder: &mut fidl::encoding::Decoder<
4776 '_,
4777 fidl::encoding::DefaultFuchsiaResourceDialect,
4778 >,
4779 offset: usize,
4780 _depth: fidl::encoding::Depth,
4781 ) -> fidl::Result<()> {
4782 decoder.debug_check_bounds::<Self>(offset);
4783 fidl::decode!(
4785 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SampleSinkMarker>>,
4786 fidl::encoding::DefaultFuchsiaResourceDialect,
4787 &mut self.sink,
4788 decoder,
4789 offset + 0,
4790 _depth
4791 )?;
4792 Ok(())
4793 }
4794 }
4795
4796 impl fidl::encoding::ResourceTypeMarker for SampleSetRequest {
4797 type Borrowed<'a> = &'a mut Self;
4798 fn take_or_borrow<'a>(
4799 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4800 ) -> Self::Borrowed<'a> {
4801 value
4802 }
4803 }
4804
4805 unsafe impl fidl::encoding::TypeMarker for SampleSetRequest {
4806 type Owned = Self;
4807
4808 #[inline(always)]
4809 fn inline_align(_context: fidl::encoding::Context) -> usize {
4810 8
4811 }
4812
4813 #[inline(always)]
4814 fn inline_size(_context: fidl::encoding::Context) -> usize {
4815 16
4816 }
4817 }
4818
4819 unsafe impl
4820 fidl::encoding::Encode<SampleSetRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
4821 for &mut SampleSetRequest
4822 {
4823 #[inline]
4824 unsafe fn encode(
4825 self,
4826 encoder: &mut fidl::encoding::Encoder<
4827 '_,
4828 fidl::encoding::DefaultFuchsiaResourceDialect,
4829 >,
4830 offset: usize,
4831 _depth: fidl::encoding::Depth,
4832 ) -> fidl::Result<()> {
4833 encoder.debug_check_bounds::<SampleSetRequest>(offset);
4834 fidl::encoding::Encode::<SampleSetRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4836 (
4837 <SampleParameters as fidl::encoding::ValueTypeMarker>::borrow(&self.sample_parameters),
4838 ),
4839 encoder, offset, _depth
4840 )
4841 }
4842 }
4843 unsafe impl<
4844 T0: fidl::encoding::Encode<SampleParameters, fidl::encoding::DefaultFuchsiaResourceDialect>,
4845 > fidl::encoding::Encode<SampleSetRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
4846 for (T0,)
4847 {
4848 #[inline]
4849 unsafe fn encode(
4850 self,
4851 encoder: &mut fidl::encoding::Encoder<
4852 '_,
4853 fidl::encoding::DefaultFuchsiaResourceDialect,
4854 >,
4855 offset: usize,
4856 depth: fidl::encoding::Depth,
4857 ) -> fidl::Result<()> {
4858 encoder.debug_check_bounds::<SampleSetRequest>(offset);
4859 self.0.encode(encoder, offset + 0, depth)?;
4863 Ok(())
4864 }
4865 }
4866
4867 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4868 for SampleSetRequest
4869 {
4870 #[inline(always)]
4871 fn new_empty() -> Self {
4872 Self {
4873 sample_parameters: fidl::new_empty!(
4874 SampleParameters,
4875 fidl::encoding::DefaultFuchsiaResourceDialect
4876 ),
4877 }
4878 }
4879
4880 #[inline]
4881 unsafe fn decode(
4882 &mut self,
4883 decoder: &mut fidl::encoding::Decoder<
4884 '_,
4885 fidl::encoding::DefaultFuchsiaResourceDialect,
4886 >,
4887 offset: usize,
4888 _depth: fidl::encoding::Depth,
4889 ) -> fidl::Result<()> {
4890 decoder.debug_check_bounds::<Self>(offset);
4891 fidl::decode!(
4893 SampleParameters,
4894 fidl::encoding::DefaultFuchsiaResourceDialect,
4895 &mut self.sample_parameters,
4896 decoder,
4897 offset + 0,
4898 _depth
4899 )?;
4900 Ok(())
4901 }
4902 }
4903
4904 impl fidl::encoding::ResourceTypeMarker for SampleSinkOnSampleReadiedRequest {
4905 type Borrowed<'a> = &'a mut Self;
4906 fn take_or_borrow<'a>(
4907 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4908 ) -> Self::Borrowed<'a> {
4909 value
4910 }
4911 }
4912
4913 unsafe impl fidl::encoding::TypeMarker for SampleSinkOnSampleReadiedRequest {
4914 type Owned = Self;
4915
4916 #[inline(always)]
4917 fn inline_align(_context: fidl::encoding::Context) -> usize {
4918 8
4919 }
4920
4921 #[inline(always)]
4922 fn inline_size(_context: fidl::encoding::Context) -> usize {
4923 16
4924 }
4925 }
4926
4927 unsafe impl
4928 fidl::encoding::Encode<
4929 SampleSinkOnSampleReadiedRequest,
4930 fidl::encoding::DefaultFuchsiaResourceDialect,
4931 > for &mut SampleSinkOnSampleReadiedRequest
4932 {
4933 #[inline]
4934 unsafe fn encode(
4935 self,
4936 encoder: &mut fidl::encoding::Encoder<
4937 '_,
4938 fidl::encoding::DefaultFuchsiaResourceDialect,
4939 >,
4940 offset: usize,
4941 _depth: fidl::encoding::Depth,
4942 ) -> fidl::Result<()> {
4943 encoder.debug_check_bounds::<SampleSinkOnSampleReadiedRequest>(offset);
4944 fidl::encoding::Encode::<
4946 SampleSinkOnSampleReadiedRequest,
4947 fidl::encoding::DefaultFuchsiaResourceDialect,
4948 >::encode(
4949 (<SampleSinkResult as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4950 &mut self.event,
4951 ),),
4952 encoder,
4953 offset,
4954 _depth,
4955 )
4956 }
4957 }
4958 unsafe impl<
4959 T0: fidl::encoding::Encode<SampleSinkResult, fidl::encoding::DefaultFuchsiaResourceDialect>,
4960 >
4961 fidl::encoding::Encode<
4962 SampleSinkOnSampleReadiedRequest,
4963 fidl::encoding::DefaultFuchsiaResourceDialect,
4964 > for (T0,)
4965 {
4966 #[inline]
4967 unsafe fn encode(
4968 self,
4969 encoder: &mut fidl::encoding::Encoder<
4970 '_,
4971 fidl::encoding::DefaultFuchsiaResourceDialect,
4972 >,
4973 offset: usize,
4974 depth: fidl::encoding::Depth,
4975 ) -> fidl::Result<()> {
4976 encoder.debug_check_bounds::<SampleSinkOnSampleReadiedRequest>(offset);
4977 self.0.encode(encoder, offset + 0, depth)?;
4981 Ok(())
4982 }
4983 }
4984
4985 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4986 for SampleSinkOnSampleReadiedRequest
4987 {
4988 #[inline(always)]
4989 fn new_empty() -> Self {
4990 Self {
4991 event: fidl::new_empty!(
4992 SampleSinkResult,
4993 fidl::encoding::DefaultFuchsiaResourceDialect
4994 ),
4995 }
4996 }
4997
4998 #[inline]
4999 unsafe fn decode(
5000 &mut self,
5001 decoder: &mut fidl::encoding::Decoder<
5002 '_,
5003 fidl::encoding::DefaultFuchsiaResourceDialect,
5004 >,
5005 offset: usize,
5006 _depth: fidl::encoding::Depth,
5007 ) -> fidl::Result<()> {
5008 decoder.debug_check_bounds::<Self>(offset);
5009 fidl::decode!(
5011 SampleSinkResult,
5012 fidl::encoding::DefaultFuchsiaResourceDialect,
5013 &mut self.event,
5014 decoder,
5015 offset + 0,
5016 _depth
5017 )?;
5018 Ok(())
5019 }
5020 }
5021
5022 impl SampleReady {
5023 #[inline(always)]
5024 fn max_ordinal_present(&self) -> u64 {
5025 if let Some(_) = self.seconds_since_start {
5026 return 2;
5027 }
5028 if let Some(_) = self.batch_iter {
5029 return 1;
5030 }
5031 0
5032 }
5033 }
5034
5035 impl fidl::encoding::ResourceTypeMarker for SampleReady {
5036 type Borrowed<'a> = &'a mut Self;
5037 fn take_or_borrow<'a>(
5038 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5039 ) -> Self::Borrowed<'a> {
5040 value
5041 }
5042 }
5043
5044 unsafe impl fidl::encoding::TypeMarker for SampleReady {
5045 type Owned = Self;
5046
5047 #[inline(always)]
5048 fn inline_align(_context: fidl::encoding::Context) -> usize {
5049 8
5050 }
5051
5052 #[inline(always)]
5053 fn inline_size(_context: fidl::encoding::Context) -> usize {
5054 16
5055 }
5056 }
5057
5058 unsafe impl fidl::encoding::Encode<SampleReady, fidl::encoding::DefaultFuchsiaResourceDialect>
5059 for &mut SampleReady
5060 {
5061 unsafe fn encode(
5062 self,
5063 encoder: &mut fidl::encoding::Encoder<
5064 '_,
5065 fidl::encoding::DefaultFuchsiaResourceDialect,
5066 >,
5067 offset: usize,
5068 mut depth: fidl::encoding::Depth,
5069 ) -> fidl::Result<()> {
5070 encoder.debug_check_bounds::<SampleReady>(offset);
5071 let max_ordinal: u64 = self.max_ordinal_present();
5073 encoder.write_num(max_ordinal, offset);
5074 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5075 if max_ordinal == 0 {
5077 return Ok(());
5078 }
5079 depth.increment()?;
5080 let envelope_size = 8;
5081 let bytes_len = max_ordinal as usize * envelope_size;
5082 #[allow(unused_variables)]
5083 let offset = encoder.out_of_line_offset(bytes_len);
5084 let mut _prev_end_offset: usize = 0;
5085 if 1 > max_ordinal {
5086 return Ok(());
5087 }
5088
5089 let cur_offset: usize = (1 - 1) * envelope_size;
5092
5093 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5095
5096 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<BatchIteratorMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
5101 self.batch_iter.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<BatchIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
5102 encoder, offset + cur_offset, depth
5103 )?;
5104
5105 _prev_end_offset = cur_offset + envelope_size;
5106 if 2 > max_ordinal {
5107 return Ok(());
5108 }
5109
5110 let cur_offset: usize = (2 - 1) * envelope_size;
5113
5114 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5116
5117 fidl::encoding::encode_in_envelope_optional::<
5122 i64,
5123 fidl::encoding::DefaultFuchsiaResourceDialect,
5124 >(
5125 self.seconds_since_start
5126 .as_ref()
5127 .map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
5128 encoder,
5129 offset + cur_offset,
5130 depth,
5131 )?;
5132
5133 _prev_end_offset = cur_offset + envelope_size;
5134
5135 Ok(())
5136 }
5137 }
5138
5139 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for SampleReady {
5140 #[inline(always)]
5141 fn new_empty() -> Self {
5142 Self::default()
5143 }
5144
5145 unsafe fn decode(
5146 &mut self,
5147 decoder: &mut fidl::encoding::Decoder<
5148 '_,
5149 fidl::encoding::DefaultFuchsiaResourceDialect,
5150 >,
5151 offset: usize,
5152 mut depth: fidl::encoding::Depth,
5153 ) -> fidl::Result<()> {
5154 decoder.debug_check_bounds::<Self>(offset);
5155 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5156 None => return Err(fidl::Error::NotNullable),
5157 Some(len) => len,
5158 };
5159 if len == 0 {
5161 return Ok(());
5162 };
5163 depth.increment()?;
5164 let envelope_size = 8;
5165 let bytes_len = len * envelope_size;
5166 let offset = decoder.out_of_line_offset(bytes_len)?;
5167 let mut _next_ordinal_to_read = 0;
5169 let mut next_offset = offset;
5170 let end_offset = offset + bytes_len;
5171 _next_ordinal_to_read += 1;
5172 if next_offset >= end_offset {
5173 return Ok(());
5174 }
5175
5176 while _next_ordinal_to_read < 1 {
5178 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5179 _next_ordinal_to_read += 1;
5180 next_offset += envelope_size;
5181 }
5182
5183 let next_out_of_line = decoder.next_out_of_line();
5184 let handles_before = decoder.remaining_handles();
5185 if let Some((inlined, num_bytes, num_handles)) =
5186 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5187 {
5188 let member_inline_size = <fidl::encoding::Endpoint<
5189 fidl::endpoints::ClientEnd<BatchIteratorMarker>,
5190 > as fidl::encoding::TypeMarker>::inline_size(
5191 decoder.context
5192 );
5193 if inlined != (member_inline_size <= 4) {
5194 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5195 }
5196 let inner_offset;
5197 let mut inner_depth = depth.clone();
5198 if inlined {
5199 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5200 inner_offset = next_offset;
5201 } else {
5202 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5203 inner_depth.increment()?;
5204 }
5205 let val_ref = self.batch_iter.get_or_insert_with(|| {
5206 fidl::new_empty!(
5207 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<BatchIteratorMarker>>,
5208 fidl::encoding::DefaultFuchsiaResourceDialect
5209 )
5210 });
5211 fidl::decode!(
5212 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<BatchIteratorMarker>>,
5213 fidl::encoding::DefaultFuchsiaResourceDialect,
5214 val_ref,
5215 decoder,
5216 inner_offset,
5217 inner_depth
5218 )?;
5219 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5220 {
5221 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5222 }
5223 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5224 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5225 }
5226 }
5227
5228 next_offset += envelope_size;
5229 _next_ordinal_to_read += 1;
5230 if next_offset >= end_offset {
5231 return Ok(());
5232 }
5233
5234 while _next_ordinal_to_read < 2 {
5236 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5237 _next_ordinal_to_read += 1;
5238 next_offset += envelope_size;
5239 }
5240
5241 let next_out_of_line = decoder.next_out_of_line();
5242 let handles_before = decoder.remaining_handles();
5243 if let Some((inlined, num_bytes, num_handles)) =
5244 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5245 {
5246 let member_inline_size =
5247 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5248 if inlined != (member_inline_size <= 4) {
5249 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5250 }
5251 let inner_offset;
5252 let mut inner_depth = depth.clone();
5253 if inlined {
5254 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5255 inner_offset = next_offset;
5256 } else {
5257 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5258 inner_depth.increment()?;
5259 }
5260 let val_ref = self.seconds_since_start.get_or_insert_with(|| {
5261 fidl::new_empty!(i64, fidl::encoding::DefaultFuchsiaResourceDialect)
5262 });
5263 fidl::decode!(
5264 i64,
5265 fidl::encoding::DefaultFuchsiaResourceDialect,
5266 val_ref,
5267 decoder,
5268 inner_offset,
5269 inner_depth
5270 )?;
5271 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5272 {
5273 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5274 }
5275 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5276 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5277 }
5278 }
5279
5280 next_offset += envelope_size;
5281
5282 while next_offset < end_offset {
5284 _next_ordinal_to_read += 1;
5285 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5286 next_offset += envelope_size;
5287 }
5288
5289 Ok(())
5290 }
5291 }
5292
5293 impl fidl::encoding::ResourceTypeMarker for FormattedContent {
5294 type Borrowed<'a> = &'a mut Self;
5295 fn take_or_borrow<'a>(
5296 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5297 ) -> Self::Borrowed<'a> {
5298 value
5299 }
5300 }
5301
5302 unsafe impl fidl::encoding::TypeMarker for FormattedContent {
5303 type Owned = Self;
5304
5305 #[inline(always)]
5306 fn inline_align(_context: fidl::encoding::Context) -> usize {
5307 8
5308 }
5309
5310 #[inline(always)]
5311 fn inline_size(_context: fidl::encoding::Context) -> usize {
5312 16
5313 }
5314 }
5315
5316 unsafe impl
5317 fidl::encoding::Encode<FormattedContent, fidl::encoding::DefaultFuchsiaResourceDialect>
5318 for &mut FormattedContent
5319 {
5320 #[inline]
5321 unsafe fn encode(
5322 self,
5323 encoder: &mut fidl::encoding::Encoder<
5324 '_,
5325 fidl::encoding::DefaultFuchsiaResourceDialect,
5326 >,
5327 offset: usize,
5328 _depth: fidl::encoding::Depth,
5329 ) -> fidl::Result<()> {
5330 encoder.debug_check_bounds::<FormattedContent>(offset);
5331 encoder.write_num::<u64>(self.ordinal(), offset);
5332 match self {
5333 FormattedContent::Json(ref mut val) => {
5334 fidl::encoding::encode_in_envelope::<fidl_fuchsia_mem::Buffer, fidl::encoding::DefaultFuchsiaResourceDialect>(
5335 <fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
5336 encoder, offset + 8, _depth
5337 )
5338 }
5339 FormattedContent::Text(ref mut val) => {
5340 fidl::encoding::encode_in_envelope::<fidl_fuchsia_mem::Buffer, fidl::encoding::DefaultFuchsiaResourceDialect>(
5341 <fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
5342 encoder, offset + 8, _depth
5343 )
5344 }
5345 FormattedContent::Cbor(ref mut val) => {
5346 fidl::encoding::encode_in_envelope::<fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect>(
5347 <fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
5348 encoder, offset + 8, _depth
5349 )
5350 }
5351 FormattedContent::Fxt(ref mut val) => {
5352 fidl::encoding::encode_in_envelope::<fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect>(
5353 <fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
5354 encoder, offset + 8, _depth
5355 )
5356 }
5357 FormattedContent::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
5358 }
5359 }
5360 }
5361
5362 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5363 for FormattedContent
5364 {
5365 #[inline(always)]
5366 fn new_empty() -> Self {
5367 Self::__SourceBreaking { unknown_ordinal: 0 }
5368 }
5369
5370 #[inline]
5371 unsafe fn decode(
5372 &mut self,
5373 decoder: &mut fidl::encoding::Decoder<
5374 '_,
5375 fidl::encoding::DefaultFuchsiaResourceDialect,
5376 >,
5377 offset: usize,
5378 mut depth: fidl::encoding::Depth,
5379 ) -> fidl::Result<()> {
5380 decoder.debug_check_bounds::<Self>(offset);
5381 #[allow(unused_variables)]
5382 let next_out_of_line = decoder.next_out_of_line();
5383 let handles_before = decoder.remaining_handles();
5384 let (ordinal, inlined, num_bytes, num_handles) =
5385 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
5386
5387 let member_inline_size = match ordinal {
5388 1 => <fidl_fuchsia_mem::Buffer as fidl::encoding::TypeMarker>::inline_size(
5389 decoder.context,
5390 ),
5391 2 => <fidl_fuchsia_mem::Buffer as fidl::encoding::TypeMarker>::inline_size(
5392 decoder.context,
5393 ),
5394 3 => <fidl::encoding::HandleType<
5395 fidl::Vmo,
5396 { fidl::ObjectType::VMO.into_raw() },
5397 2147483648,
5398 > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5399 4 => <fidl::encoding::HandleType<
5400 fidl::Vmo,
5401 { fidl::ObjectType::VMO.into_raw() },
5402 2147483648,
5403 > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5404 0 => return Err(fidl::Error::UnknownUnionTag),
5405 _ => num_bytes as usize,
5406 };
5407
5408 if inlined != (member_inline_size <= 4) {
5409 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5410 }
5411 let _inner_offset;
5412 if inlined {
5413 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
5414 _inner_offset = offset + 8;
5415 } else {
5416 depth.increment()?;
5417 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5418 }
5419 match ordinal {
5420 1 => {
5421 #[allow(irrefutable_let_patterns)]
5422 if let FormattedContent::Json(_) = self {
5423 } else {
5425 *self = FormattedContent::Json(fidl::new_empty!(
5427 fidl_fuchsia_mem::Buffer,
5428 fidl::encoding::DefaultFuchsiaResourceDialect
5429 ));
5430 }
5431 #[allow(irrefutable_let_patterns)]
5432 if let FormattedContent::Json(ref mut val) = self {
5433 fidl::decode!(
5434 fidl_fuchsia_mem::Buffer,
5435 fidl::encoding::DefaultFuchsiaResourceDialect,
5436 val,
5437 decoder,
5438 _inner_offset,
5439 depth
5440 )?;
5441 } else {
5442 unreachable!()
5443 }
5444 }
5445 2 => {
5446 #[allow(irrefutable_let_patterns)]
5447 if let FormattedContent::Text(_) = self {
5448 } else {
5450 *self = FormattedContent::Text(fidl::new_empty!(
5452 fidl_fuchsia_mem::Buffer,
5453 fidl::encoding::DefaultFuchsiaResourceDialect
5454 ));
5455 }
5456 #[allow(irrefutable_let_patterns)]
5457 if let FormattedContent::Text(ref mut val) = self {
5458 fidl::decode!(
5459 fidl_fuchsia_mem::Buffer,
5460 fidl::encoding::DefaultFuchsiaResourceDialect,
5461 val,
5462 decoder,
5463 _inner_offset,
5464 depth
5465 )?;
5466 } else {
5467 unreachable!()
5468 }
5469 }
5470 3 => {
5471 #[allow(irrefutable_let_patterns)]
5472 if let FormattedContent::Cbor(_) = self {
5473 } else {
5475 *self = FormattedContent::Cbor(
5477 fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
5478 );
5479 }
5480 #[allow(irrefutable_let_patterns)]
5481 if let FormattedContent::Cbor(ref mut val) = self {
5482 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
5483 } else {
5484 unreachable!()
5485 }
5486 }
5487 4 => {
5488 #[allow(irrefutable_let_patterns)]
5489 if let FormattedContent::Fxt(_) = self {
5490 } else {
5492 *self = FormattedContent::Fxt(
5494 fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
5495 );
5496 }
5497 #[allow(irrefutable_let_patterns)]
5498 if let FormattedContent::Fxt(ref mut val) = self {
5499 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
5500 } else {
5501 unreachable!()
5502 }
5503 }
5504 #[allow(deprecated)]
5505 ordinal => {
5506 for _ in 0..num_handles {
5507 decoder.drop_next_handle()?;
5508 }
5509 *self = FormattedContent::__SourceBreaking { unknown_ordinal: ordinal };
5510 }
5511 }
5512 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
5513 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5514 }
5515 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5516 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5517 }
5518 Ok(())
5519 }
5520 }
5521
5522 impl fidl::encoding::ResourceTypeMarker for SampleSinkResult {
5523 type Borrowed<'a> = &'a mut Self;
5524 fn take_or_borrow<'a>(
5525 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5526 ) -> Self::Borrowed<'a> {
5527 value
5528 }
5529 }
5530
5531 unsafe impl fidl::encoding::TypeMarker for SampleSinkResult {
5532 type Owned = Self;
5533
5534 #[inline(always)]
5535 fn inline_align(_context: fidl::encoding::Context) -> usize {
5536 8
5537 }
5538
5539 #[inline(always)]
5540 fn inline_size(_context: fidl::encoding::Context) -> usize {
5541 16
5542 }
5543 }
5544
5545 unsafe impl
5546 fidl::encoding::Encode<SampleSinkResult, fidl::encoding::DefaultFuchsiaResourceDialect>
5547 for &mut SampleSinkResult
5548 {
5549 #[inline]
5550 unsafe fn encode(
5551 self,
5552 encoder: &mut fidl::encoding::Encoder<
5553 '_,
5554 fidl::encoding::DefaultFuchsiaResourceDialect,
5555 >,
5556 offset: usize,
5557 _depth: fidl::encoding::Depth,
5558 ) -> fidl::Result<()> {
5559 encoder.debug_check_bounds::<SampleSinkResult>(offset);
5560 encoder.write_num::<u64>(self.ordinal(), offset);
5561 match self {
5562 SampleSinkResult::Ready(ref mut val) => fidl::encoding::encode_in_envelope::<
5563 SampleReady,
5564 fidl::encoding::DefaultFuchsiaResourceDialect,
5565 >(
5566 <SampleReady as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
5567 encoder,
5568 offset + 8,
5569 _depth,
5570 ),
5571 SampleSinkResult::Error(ref val) => fidl::encoding::encode_in_envelope::<
5572 RuntimeError,
5573 fidl::encoding::DefaultFuchsiaResourceDialect,
5574 >(
5575 <RuntimeError as fidl::encoding::ValueTypeMarker>::borrow(val),
5576 encoder,
5577 offset + 8,
5578 _depth,
5579 ),
5580 SampleSinkResult::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
5581 }
5582 }
5583 }
5584
5585 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5586 for SampleSinkResult
5587 {
5588 #[inline(always)]
5589 fn new_empty() -> Self {
5590 Self::__SourceBreaking { unknown_ordinal: 0 }
5591 }
5592
5593 #[inline]
5594 unsafe fn decode(
5595 &mut self,
5596 decoder: &mut fidl::encoding::Decoder<
5597 '_,
5598 fidl::encoding::DefaultFuchsiaResourceDialect,
5599 >,
5600 offset: usize,
5601 mut depth: fidl::encoding::Depth,
5602 ) -> fidl::Result<()> {
5603 decoder.debug_check_bounds::<Self>(offset);
5604 #[allow(unused_variables)]
5605 let next_out_of_line = decoder.next_out_of_line();
5606 let handles_before = decoder.remaining_handles();
5607 let (ordinal, inlined, num_bytes, num_handles) =
5608 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
5609
5610 let member_inline_size = match ordinal {
5611 1 => <SampleReady as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5612 2 => <RuntimeError as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5613 0 => return Err(fidl::Error::UnknownUnionTag),
5614 _ => num_bytes as usize,
5615 };
5616
5617 if inlined != (member_inline_size <= 4) {
5618 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5619 }
5620 let _inner_offset;
5621 if inlined {
5622 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
5623 _inner_offset = offset + 8;
5624 } else {
5625 depth.increment()?;
5626 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5627 }
5628 match ordinal {
5629 1 => {
5630 #[allow(irrefutable_let_patterns)]
5631 if let SampleSinkResult::Ready(_) = self {
5632 } else {
5634 *self = SampleSinkResult::Ready(fidl::new_empty!(
5636 SampleReady,
5637 fidl::encoding::DefaultFuchsiaResourceDialect
5638 ));
5639 }
5640 #[allow(irrefutable_let_patterns)]
5641 if let SampleSinkResult::Ready(ref mut val) = self {
5642 fidl::decode!(
5643 SampleReady,
5644 fidl::encoding::DefaultFuchsiaResourceDialect,
5645 val,
5646 decoder,
5647 _inner_offset,
5648 depth
5649 )?;
5650 } else {
5651 unreachable!()
5652 }
5653 }
5654 2 => {
5655 #[allow(irrefutable_let_patterns)]
5656 if let SampleSinkResult::Error(_) = self {
5657 } else {
5659 *self = SampleSinkResult::Error(fidl::new_empty!(
5661 RuntimeError,
5662 fidl::encoding::DefaultFuchsiaResourceDialect
5663 ));
5664 }
5665 #[allow(irrefutable_let_patterns)]
5666 if let SampleSinkResult::Error(ref mut val) = self {
5667 fidl::decode!(
5668 RuntimeError,
5669 fidl::encoding::DefaultFuchsiaResourceDialect,
5670 val,
5671 decoder,
5672 _inner_offset,
5673 depth
5674 )?;
5675 } else {
5676 unreachable!()
5677 }
5678 }
5679 #[allow(deprecated)]
5680 ordinal => {
5681 for _ in 0..num_handles {
5682 decoder.drop_next_handle()?;
5683 }
5684 *self = SampleSinkResult::__SourceBreaking { unknown_ordinal: ordinal };
5685 }
5686 }
5687 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
5688 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5689 }
5690 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5691 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5692 }
5693 Ok(())
5694 }
5695 }
5696}