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