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)]
46pub enum FormattedContent {
47 Json(fidl_fuchsia_mem::Buffer),
50 Text(fidl_fuchsia_mem::Buffer),
53 Cbor(fidl::Vmo),
57 Fxt(fidl::Vmo),
63 #[doc(hidden)]
64 __SourceBreaking { unknown_ordinal: u64 },
65}
66
67#[macro_export]
69macro_rules! FormattedContentUnknown {
70 () => {
71 _
72 };
73}
74
75impl PartialEq for FormattedContent {
77 fn eq(&self, other: &Self) -> bool {
78 match (self, other) {
79 (Self::Json(x), Self::Json(y)) => *x == *y,
80 (Self::Text(x), Self::Text(y)) => *x == *y,
81 (Self::Cbor(x), Self::Cbor(y)) => *x == *y,
82 (Self::Fxt(x), Self::Fxt(y)) => *x == *y,
83 _ => false,
84 }
85 }
86}
87
88impl FormattedContent {
89 #[inline]
90 pub fn ordinal(&self) -> u64 {
91 match *self {
92 Self::Json(_) => 1,
93 Self::Text(_) => 2,
94 Self::Cbor(_) => 3,
95 Self::Fxt(_) => 4,
96 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
97 }
98 }
99
100 #[inline]
101 pub fn unknown_variant_for_testing() -> Self {
102 Self::__SourceBreaking { unknown_ordinal: 0 }
103 }
104
105 #[inline]
106 pub fn is_unknown(&self) -> bool {
107 match self {
108 Self::__SourceBreaking { .. } => true,
109 _ => false,
110 }
111 }
112}
113
114impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for FormattedContent {}
115
116#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
117pub struct ArchiveAccessorMarker;
118
119impl fidl::endpoints::ProtocolMarker for ArchiveAccessorMarker {
120 type Proxy = ArchiveAccessorProxy;
121 type RequestStream = ArchiveAccessorRequestStream;
122 #[cfg(target_os = "fuchsia")]
123 type SynchronousProxy = ArchiveAccessorSynchronousProxy;
124
125 const DEBUG_NAME: &'static str = "fuchsia.diagnostics.ArchiveAccessor";
126}
127impl fidl::endpoints::DiscoverableProtocolMarker for ArchiveAccessorMarker {}
128
129pub trait ArchiveAccessorProxyInterface: Send + Sync {
130 fn r#stream_diagnostics(
131 &self,
132 stream_parameters: &StreamParameters,
133 result_stream: fidl::endpoints::ServerEnd<BatchIteratorMarker>,
134 ) -> Result<(), fidl::Error>;
135 type WaitForReadyResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
136 fn r#wait_for_ready(&self) -> Self::WaitForReadyResponseFut;
137}
138#[derive(Debug)]
139#[cfg(target_os = "fuchsia")]
140pub struct ArchiveAccessorSynchronousProxy {
141 client: fidl::client::sync::Client,
142}
143
144#[cfg(target_os = "fuchsia")]
145impl fidl::endpoints::SynchronousProxy for ArchiveAccessorSynchronousProxy {
146 type Proxy = ArchiveAccessorProxy;
147 type Protocol = ArchiveAccessorMarker;
148
149 fn from_channel(inner: fidl::Channel) -> Self {
150 Self::new(inner)
151 }
152
153 fn into_channel(self) -> fidl::Channel {
154 self.client.into_channel()
155 }
156
157 fn as_channel(&self) -> &fidl::Channel {
158 self.client.as_channel()
159 }
160}
161
162#[cfg(target_os = "fuchsia")]
163impl ArchiveAccessorSynchronousProxy {
164 pub fn new(channel: fidl::Channel) -> Self {
165 let protocol_name = <ArchiveAccessorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
166 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
167 }
168
169 pub fn into_channel(self) -> fidl::Channel {
170 self.client.into_channel()
171 }
172
173 pub fn wait_for_event(
176 &self,
177 deadline: zx::MonotonicInstant,
178 ) -> Result<ArchiveAccessorEvent, fidl::Error> {
179 ArchiveAccessorEvent::decode(self.client.wait_for_event(deadline)?)
180 }
181
182 pub fn r#stream_diagnostics(
200 &self,
201 mut stream_parameters: &StreamParameters,
202 mut result_stream: fidl::endpoints::ServerEnd<BatchIteratorMarker>,
203 ) -> Result<(), fidl::Error> {
204 self.client.send::<ArchiveAccessorStreamDiagnosticsRequest>(
205 (stream_parameters, result_stream),
206 0x20c73e2ecd653c3e,
207 fidl::encoding::DynamicFlags::FLEXIBLE,
208 )
209 }
210
211 pub fn r#wait_for_ready(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
214 let _response = self.client.send_query::<
215 fidl::encoding::EmptyPayload,
216 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
217 >(
218 (),
219 0x122963198011bd24,
220 fidl::encoding::DynamicFlags::FLEXIBLE,
221 ___deadline,
222 )?
223 .into_result::<ArchiveAccessorMarker>("wait_for_ready")?;
224 Ok(_response)
225 }
226}
227
228#[cfg(target_os = "fuchsia")]
229impl From<ArchiveAccessorSynchronousProxy> for zx::Handle {
230 fn from(value: ArchiveAccessorSynchronousProxy) -> Self {
231 value.into_channel().into()
232 }
233}
234
235#[cfg(target_os = "fuchsia")]
236impl From<fidl::Channel> for ArchiveAccessorSynchronousProxy {
237 fn from(value: fidl::Channel) -> Self {
238 Self::new(value)
239 }
240}
241
242#[cfg(target_os = "fuchsia")]
243impl fidl::endpoints::FromClient for ArchiveAccessorSynchronousProxy {
244 type Protocol = ArchiveAccessorMarker;
245
246 fn from_client(value: fidl::endpoints::ClientEnd<ArchiveAccessorMarker>) -> Self {
247 Self::new(value.into_channel())
248 }
249}
250
251#[derive(Debug, Clone)]
252pub struct ArchiveAccessorProxy {
253 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
254}
255
256impl fidl::endpoints::Proxy for ArchiveAccessorProxy {
257 type Protocol = ArchiveAccessorMarker;
258
259 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
260 Self::new(inner)
261 }
262
263 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
264 self.client.into_channel().map_err(|client| Self { client })
265 }
266
267 fn as_channel(&self) -> &::fidl::AsyncChannel {
268 self.client.as_channel()
269 }
270}
271
272impl ArchiveAccessorProxy {
273 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
275 let protocol_name = <ArchiveAccessorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
276 Self { client: fidl::client::Client::new(channel, protocol_name) }
277 }
278
279 pub fn take_event_stream(&self) -> ArchiveAccessorEventStream {
285 ArchiveAccessorEventStream { event_receiver: self.client.take_event_receiver() }
286 }
287
288 pub fn r#stream_diagnostics(
306 &self,
307 mut stream_parameters: &StreamParameters,
308 mut result_stream: fidl::endpoints::ServerEnd<BatchIteratorMarker>,
309 ) -> Result<(), fidl::Error> {
310 ArchiveAccessorProxyInterface::r#stream_diagnostics(self, stream_parameters, result_stream)
311 }
312
313 pub fn r#wait_for_ready(
316 &self,
317 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
318 ArchiveAccessorProxyInterface::r#wait_for_ready(self)
319 }
320}
321
322impl ArchiveAccessorProxyInterface for ArchiveAccessorProxy {
323 fn r#stream_diagnostics(
324 &self,
325 mut stream_parameters: &StreamParameters,
326 mut result_stream: fidl::endpoints::ServerEnd<BatchIteratorMarker>,
327 ) -> Result<(), fidl::Error> {
328 self.client.send::<ArchiveAccessorStreamDiagnosticsRequest>(
329 (stream_parameters, result_stream),
330 0x20c73e2ecd653c3e,
331 fidl::encoding::DynamicFlags::FLEXIBLE,
332 )
333 }
334
335 type WaitForReadyResponseFut =
336 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
337 fn r#wait_for_ready(&self) -> Self::WaitForReadyResponseFut {
338 fn _decode(
339 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
340 ) -> Result<(), fidl::Error> {
341 let _response = fidl::client::decode_transaction_body::<
342 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
343 fidl::encoding::DefaultFuchsiaResourceDialect,
344 0x122963198011bd24,
345 >(_buf?)?
346 .into_result::<ArchiveAccessorMarker>("wait_for_ready")?;
347 Ok(_response)
348 }
349 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
350 (),
351 0x122963198011bd24,
352 fidl::encoding::DynamicFlags::FLEXIBLE,
353 _decode,
354 )
355 }
356}
357
358pub struct ArchiveAccessorEventStream {
359 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
360}
361
362impl std::marker::Unpin for ArchiveAccessorEventStream {}
363
364impl futures::stream::FusedStream for ArchiveAccessorEventStream {
365 fn is_terminated(&self) -> bool {
366 self.event_receiver.is_terminated()
367 }
368}
369
370impl futures::Stream for ArchiveAccessorEventStream {
371 type Item = Result<ArchiveAccessorEvent, fidl::Error>;
372
373 fn poll_next(
374 mut self: std::pin::Pin<&mut Self>,
375 cx: &mut std::task::Context<'_>,
376 ) -> std::task::Poll<Option<Self::Item>> {
377 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
378 &mut self.event_receiver,
379 cx
380 )?) {
381 Some(buf) => std::task::Poll::Ready(Some(ArchiveAccessorEvent::decode(buf))),
382 None => std::task::Poll::Ready(None),
383 }
384 }
385}
386
387#[derive(Debug)]
388pub enum ArchiveAccessorEvent {
389 #[non_exhaustive]
390 _UnknownEvent {
391 ordinal: u64,
393 },
394}
395
396impl ArchiveAccessorEvent {
397 fn decode(
399 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
400 ) -> Result<ArchiveAccessorEvent, fidl::Error> {
401 let (bytes, _handles) = buf.split_mut();
402 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
403 debug_assert_eq!(tx_header.tx_id, 0);
404 match tx_header.ordinal {
405 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
406 Ok(ArchiveAccessorEvent::_UnknownEvent { ordinal: tx_header.ordinal })
407 }
408 _ => Err(fidl::Error::UnknownOrdinal {
409 ordinal: tx_header.ordinal,
410 protocol_name:
411 <ArchiveAccessorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
412 }),
413 }
414 }
415}
416
417pub struct ArchiveAccessorRequestStream {
419 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
420 is_terminated: bool,
421}
422
423impl std::marker::Unpin for ArchiveAccessorRequestStream {}
424
425impl futures::stream::FusedStream for ArchiveAccessorRequestStream {
426 fn is_terminated(&self) -> bool {
427 self.is_terminated
428 }
429}
430
431impl fidl::endpoints::RequestStream for ArchiveAccessorRequestStream {
432 type Protocol = ArchiveAccessorMarker;
433 type ControlHandle = ArchiveAccessorControlHandle;
434
435 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
436 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
437 }
438
439 fn control_handle(&self) -> Self::ControlHandle {
440 ArchiveAccessorControlHandle { inner: self.inner.clone() }
441 }
442
443 fn into_inner(
444 self,
445 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
446 {
447 (self.inner, self.is_terminated)
448 }
449
450 fn from_inner(
451 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
452 is_terminated: bool,
453 ) -> Self {
454 Self { inner, is_terminated }
455 }
456}
457
458impl futures::Stream for ArchiveAccessorRequestStream {
459 type Item = Result<ArchiveAccessorRequest, fidl::Error>;
460
461 fn poll_next(
462 mut self: std::pin::Pin<&mut Self>,
463 cx: &mut std::task::Context<'_>,
464 ) -> std::task::Poll<Option<Self::Item>> {
465 let this = &mut *self;
466 if this.inner.check_shutdown(cx) {
467 this.is_terminated = true;
468 return std::task::Poll::Ready(None);
469 }
470 if this.is_terminated {
471 panic!("polled ArchiveAccessorRequestStream after completion");
472 }
473 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
474 |bytes, handles| {
475 match this.inner.channel().read_etc(cx, bytes, handles) {
476 std::task::Poll::Ready(Ok(())) => {}
477 std::task::Poll::Pending => return std::task::Poll::Pending,
478 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
479 this.is_terminated = true;
480 return std::task::Poll::Ready(None);
481 }
482 std::task::Poll::Ready(Err(e)) => {
483 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
484 e.into(),
485 ))));
486 }
487 }
488
489 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
491
492 std::task::Poll::Ready(Some(match header.ordinal {
493 0x20c73e2ecd653c3e => {
494 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
495 let mut req = fidl::new_empty!(
496 ArchiveAccessorStreamDiagnosticsRequest,
497 fidl::encoding::DefaultFuchsiaResourceDialect
498 );
499 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ArchiveAccessorStreamDiagnosticsRequest>(&header, _body_bytes, handles, &mut req)?;
500 let control_handle =
501 ArchiveAccessorControlHandle { inner: this.inner.clone() };
502 Ok(ArchiveAccessorRequest::StreamDiagnostics {
503 stream_parameters: req.stream_parameters,
504 result_stream: req.result_stream,
505
506 control_handle,
507 })
508 }
509 0x122963198011bd24 => {
510 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
511 let mut req = fidl::new_empty!(
512 fidl::encoding::EmptyPayload,
513 fidl::encoding::DefaultFuchsiaResourceDialect
514 );
515 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
516 let control_handle =
517 ArchiveAccessorControlHandle { inner: this.inner.clone() };
518 Ok(ArchiveAccessorRequest::WaitForReady {
519 responder: ArchiveAccessorWaitForReadyResponder {
520 control_handle: std::mem::ManuallyDrop::new(control_handle),
521 tx_id: header.tx_id,
522 },
523 })
524 }
525 _ if header.tx_id == 0
526 && header
527 .dynamic_flags()
528 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
529 {
530 Ok(ArchiveAccessorRequest::_UnknownMethod {
531 ordinal: header.ordinal,
532 control_handle: ArchiveAccessorControlHandle {
533 inner: this.inner.clone(),
534 },
535 method_type: fidl::MethodType::OneWay,
536 })
537 }
538 _ if header
539 .dynamic_flags()
540 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
541 {
542 this.inner.send_framework_err(
543 fidl::encoding::FrameworkErr::UnknownMethod,
544 header.tx_id,
545 header.ordinal,
546 header.dynamic_flags(),
547 (bytes, handles),
548 )?;
549 Ok(ArchiveAccessorRequest::_UnknownMethod {
550 ordinal: header.ordinal,
551 control_handle: ArchiveAccessorControlHandle {
552 inner: this.inner.clone(),
553 },
554 method_type: fidl::MethodType::TwoWay,
555 })
556 }
557 _ => Err(fidl::Error::UnknownOrdinal {
558 ordinal: header.ordinal,
559 protocol_name:
560 <ArchiveAccessorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
561 }),
562 }))
563 },
564 )
565 }
566}
567
568#[derive(Debug)]
570pub enum ArchiveAccessorRequest {
571 StreamDiagnostics {
589 stream_parameters: StreamParameters,
590 result_stream: fidl::endpoints::ServerEnd<BatchIteratorMarker>,
591 control_handle: ArchiveAccessorControlHandle,
592 },
593 WaitForReady { responder: ArchiveAccessorWaitForReadyResponder },
596 #[non_exhaustive]
598 _UnknownMethod {
599 ordinal: u64,
601 control_handle: ArchiveAccessorControlHandle,
602 method_type: fidl::MethodType,
603 },
604}
605
606impl ArchiveAccessorRequest {
607 #[allow(irrefutable_let_patterns)]
608 pub fn into_stream_diagnostics(
609 self,
610 ) -> Option<(
611 StreamParameters,
612 fidl::endpoints::ServerEnd<BatchIteratorMarker>,
613 ArchiveAccessorControlHandle,
614 )> {
615 if let ArchiveAccessorRequest::StreamDiagnostics {
616 stream_parameters,
617 result_stream,
618 control_handle,
619 } = self
620 {
621 Some((stream_parameters, result_stream, control_handle))
622 } else {
623 None
624 }
625 }
626
627 #[allow(irrefutable_let_patterns)]
628 pub fn into_wait_for_ready(self) -> Option<(ArchiveAccessorWaitForReadyResponder)> {
629 if let ArchiveAccessorRequest::WaitForReady { responder } = self {
630 Some((responder))
631 } else {
632 None
633 }
634 }
635
636 pub fn method_name(&self) -> &'static str {
638 match *self {
639 ArchiveAccessorRequest::StreamDiagnostics { .. } => "stream_diagnostics",
640 ArchiveAccessorRequest::WaitForReady { .. } => "wait_for_ready",
641 ArchiveAccessorRequest::_UnknownMethod {
642 method_type: fidl::MethodType::OneWay,
643 ..
644 } => "unknown one-way method",
645 ArchiveAccessorRequest::_UnknownMethod {
646 method_type: fidl::MethodType::TwoWay,
647 ..
648 } => "unknown two-way method",
649 }
650 }
651}
652
653#[derive(Debug, Clone)]
654pub struct ArchiveAccessorControlHandle {
655 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
656}
657
658impl fidl::endpoints::ControlHandle for ArchiveAccessorControlHandle {
659 fn shutdown(&self) {
660 self.inner.shutdown()
661 }
662 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
663 self.inner.shutdown_with_epitaph(status)
664 }
665
666 fn is_closed(&self) -> bool {
667 self.inner.channel().is_closed()
668 }
669 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
670 self.inner.channel().on_closed()
671 }
672
673 #[cfg(target_os = "fuchsia")]
674 fn signal_peer(
675 &self,
676 clear_mask: zx::Signals,
677 set_mask: zx::Signals,
678 ) -> Result<(), zx_status::Status> {
679 use fidl::Peered;
680 self.inner.channel().signal_peer(clear_mask, set_mask)
681 }
682}
683
684impl ArchiveAccessorControlHandle {}
685
686#[must_use = "FIDL methods require a response to be sent"]
687#[derive(Debug)]
688pub struct ArchiveAccessorWaitForReadyResponder {
689 control_handle: std::mem::ManuallyDrop<ArchiveAccessorControlHandle>,
690 tx_id: u32,
691}
692
693impl std::ops::Drop for ArchiveAccessorWaitForReadyResponder {
697 fn drop(&mut self) {
698 self.control_handle.shutdown();
699 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
701 }
702}
703
704impl fidl::endpoints::Responder for ArchiveAccessorWaitForReadyResponder {
705 type ControlHandle = ArchiveAccessorControlHandle;
706
707 fn control_handle(&self) -> &ArchiveAccessorControlHandle {
708 &self.control_handle
709 }
710
711 fn drop_without_shutdown(mut self) {
712 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
714 std::mem::forget(self);
716 }
717}
718
719impl ArchiveAccessorWaitForReadyResponder {
720 pub fn send(self) -> Result<(), fidl::Error> {
724 let _result = self.send_raw();
725 if _result.is_err() {
726 self.control_handle.shutdown();
727 }
728 self.drop_without_shutdown();
729 _result
730 }
731
732 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
734 let _result = self.send_raw();
735 self.drop_without_shutdown();
736 _result
737 }
738
739 fn send_raw(&self) -> Result<(), fidl::Error> {
740 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
741 fidl::encoding::Flexible::new(()),
742 self.tx_id,
743 0x122963198011bd24,
744 fidl::encoding::DynamicFlags::FLEXIBLE,
745 )
746 }
747}
748
749#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
750pub struct BatchIteratorMarker;
751
752impl fidl::endpoints::ProtocolMarker for BatchIteratorMarker {
753 type Proxy = BatchIteratorProxy;
754 type RequestStream = BatchIteratorRequestStream;
755 #[cfg(target_os = "fuchsia")]
756 type SynchronousProxy = BatchIteratorSynchronousProxy;
757
758 const DEBUG_NAME: &'static str = "(anonymous) BatchIterator";
759}
760pub type BatchIteratorGetNextResult = Result<Vec<FormattedContent>, ReaderError>;
761
762pub trait BatchIteratorProxyInterface: Send + Sync {
763 type GetNextResponseFut: std::future::Future<Output = Result<BatchIteratorGetNextResult, fidl::Error>>
764 + Send;
765 fn r#get_next(&self) -> Self::GetNextResponseFut;
766 type WaitForReadyResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
767 fn r#wait_for_ready(&self) -> Self::WaitForReadyResponseFut;
768}
769#[derive(Debug)]
770#[cfg(target_os = "fuchsia")]
771pub struct BatchIteratorSynchronousProxy {
772 client: fidl::client::sync::Client,
773}
774
775#[cfg(target_os = "fuchsia")]
776impl fidl::endpoints::SynchronousProxy for BatchIteratorSynchronousProxy {
777 type Proxy = BatchIteratorProxy;
778 type Protocol = BatchIteratorMarker;
779
780 fn from_channel(inner: fidl::Channel) -> Self {
781 Self::new(inner)
782 }
783
784 fn into_channel(self) -> fidl::Channel {
785 self.client.into_channel()
786 }
787
788 fn as_channel(&self) -> &fidl::Channel {
789 self.client.as_channel()
790 }
791}
792
793#[cfg(target_os = "fuchsia")]
794impl BatchIteratorSynchronousProxy {
795 pub fn new(channel: fidl::Channel) -> Self {
796 let protocol_name = <BatchIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
797 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
798 }
799
800 pub fn into_channel(self) -> fidl::Channel {
801 self.client.into_channel()
802 }
803
804 pub fn wait_for_event(
807 &self,
808 deadline: zx::MonotonicInstant,
809 ) -> Result<BatchIteratorEvent, fidl::Error> {
810 BatchIteratorEvent::decode(self.client.wait_for_event(deadline)?)
811 }
812
813 pub fn r#get_next(
837 &self,
838 ___deadline: zx::MonotonicInstant,
839 ) -> Result<BatchIteratorGetNextResult, fidl::Error> {
840 let _response = self.client.send_query::<
841 fidl::encoding::EmptyPayload,
842 fidl::encoding::FlexibleResultType<BatchIteratorGetNextResponse, ReaderError>,
843 >(
844 (),
845 0x781986486c6254a5,
846 fidl::encoding::DynamicFlags::FLEXIBLE,
847 ___deadline,
848 )?
849 .into_result::<BatchIteratorMarker>("get_next")?;
850 Ok(_response.map(|x| x.batch))
851 }
852
853 pub fn r#wait_for_ready(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
856 let _response = self.client.send_query::<
857 fidl::encoding::EmptyPayload,
858 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
859 >(
860 (),
861 0x70598ee271597603,
862 fidl::encoding::DynamicFlags::FLEXIBLE,
863 ___deadline,
864 )?
865 .into_result::<BatchIteratorMarker>("wait_for_ready")?;
866 Ok(_response)
867 }
868}
869
870#[cfg(target_os = "fuchsia")]
871impl From<BatchIteratorSynchronousProxy> for zx::Handle {
872 fn from(value: BatchIteratorSynchronousProxy) -> Self {
873 value.into_channel().into()
874 }
875}
876
877#[cfg(target_os = "fuchsia")]
878impl From<fidl::Channel> for BatchIteratorSynchronousProxy {
879 fn from(value: fidl::Channel) -> Self {
880 Self::new(value)
881 }
882}
883
884#[cfg(target_os = "fuchsia")]
885impl fidl::endpoints::FromClient for BatchIteratorSynchronousProxy {
886 type Protocol = BatchIteratorMarker;
887
888 fn from_client(value: fidl::endpoints::ClientEnd<BatchIteratorMarker>) -> Self {
889 Self::new(value.into_channel())
890 }
891}
892
893#[derive(Debug, Clone)]
894pub struct BatchIteratorProxy {
895 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
896}
897
898impl fidl::endpoints::Proxy for BatchIteratorProxy {
899 type Protocol = BatchIteratorMarker;
900
901 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
902 Self::new(inner)
903 }
904
905 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
906 self.client.into_channel().map_err(|client| Self { client })
907 }
908
909 fn as_channel(&self) -> &::fidl::AsyncChannel {
910 self.client.as_channel()
911 }
912}
913
914impl BatchIteratorProxy {
915 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
917 let protocol_name = <BatchIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
918 Self { client: fidl::client::Client::new(channel, protocol_name) }
919 }
920
921 pub fn take_event_stream(&self) -> BatchIteratorEventStream {
927 BatchIteratorEventStream { event_receiver: self.client.take_event_receiver() }
928 }
929
930 pub fn r#get_next(
954 &self,
955 ) -> fidl::client::QueryResponseFut<
956 BatchIteratorGetNextResult,
957 fidl::encoding::DefaultFuchsiaResourceDialect,
958 > {
959 BatchIteratorProxyInterface::r#get_next(self)
960 }
961
962 pub fn r#wait_for_ready(
965 &self,
966 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
967 BatchIteratorProxyInterface::r#wait_for_ready(self)
968 }
969}
970
971impl BatchIteratorProxyInterface for BatchIteratorProxy {
972 type GetNextResponseFut = fidl::client::QueryResponseFut<
973 BatchIteratorGetNextResult,
974 fidl::encoding::DefaultFuchsiaResourceDialect,
975 >;
976 fn r#get_next(&self) -> Self::GetNextResponseFut {
977 fn _decode(
978 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
979 ) -> Result<BatchIteratorGetNextResult, fidl::Error> {
980 let _response = fidl::client::decode_transaction_body::<
981 fidl::encoding::FlexibleResultType<BatchIteratorGetNextResponse, ReaderError>,
982 fidl::encoding::DefaultFuchsiaResourceDialect,
983 0x781986486c6254a5,
984 >(_buf?)?
985 .into_result::<BatchIteratorMarker>("get_next")?;
986 Ok(_response.map(|x| x.batch))
987 }
988 self.client
989 .send_query_and_decode::<fidl::encoding::EmptyPayload, BatchIteratorGetNextResult>(
990 (),
991 0x781986486c6254a5,
992 fidl::encoding::DynamicFlags::FLEXIBLE,
993 _decode,
994 )
995 }
996
997 type WaitForReadyResponseFut =
998 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
999 fn r#wait_for_ready(&self) -> Self::WaitForReadyResponseFut {
1000 fn _decode(
1001 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1002 ) -> Result<(), fidl::Error> {
1003 let _response = fidl::client::decode_transaction_body::<
1004 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
1005 fidl::encoding::DefaultFuchsiaResourceDialect,
1006 0x70598ee271597603,
1007 >(_buf?)?
1008 .into_result::<BatchIteratorMarker>("wait_for_ready")?;
1009 Ok(_response)
1010 }
1011 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
1012 (),
1013 0x70598ee271597603,
1014 fidl::encoding::DynamicFlags::FLEXIBLE,
1015 _decode,
1016 )
1017 }
1018}
1019
1020pub struct BatchIteratorEventStream {
1021 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1022}
1023
1024impl std::marker::Unpin for BatchIteratorEventStream {}
1025
1026impl futures::stream::FusedStream for BatchIteratorEventStream {
1027 fn is_terminated(&self) -> bool {
1028 self.event_receiver.is_terminated()
1029 }
1030}
1031
1032impl futures::Stream for BatchIteratorEventStream {
1033 type Item = Result<BatchIteratorEvent, fidl::Error>;
1034
1035 fn poll_next(
1036 mut self: std::pin::Pin<&mut Self>,
1037 cx: &mut std::task::Context<'_>,
1038 ) -> std::task::Poll<Option<Self::Item>> {
1039 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1040 &mut self.event_receiver,
1041 cx
1042 )?) {
1043 Some(buf) => std::task::Poll::Ready(Some(BatchIteratorEvent::decode(buf))),
1044 None => std::task::Poll::Ready(None),
1045 }
1046 }
1047}
1048
1049#[derive(Debug)]
1050pub enum BatchIteratorEvent {
1051 #[non_exhaustive]
1052 _UnknownEvent {
1053 ordinal: u64,
1055 },
1056}
1057
1058impl BatchIteratorEvent {
1059 fn decode(
1061 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1062 ) -> Result<BatchIteratorEvent, fidl::Error> {
1063 let (bytes, _handles) = buf.split_mut();
1064 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1065 debug_assert_eq!(tx_header.tx_id, 0);
1066 match tx_header.ordinal {
1067 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1068 Ok(BatchIteratorEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1069 }
1070 _ => Err(fidl::Error::UnknownOrdinal {
1071 ordinal: tx_header.ordinal,
1072 protocol_name: <BatchIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1073 }),
1074 }
1075 }
1076}
1077
1078pub struct BatchIteratorRequestStream {
1080 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1081 is_terminated: bool,
1082}
1083
1084impl std::marker::Unpin for BatchIteratorRequestStream {}
1085
1086impl futures::stream::FusedStream for BatchIteratorRequestStream {
1087 fn is_terminated(&self) -> bool {
1088 self.is_terminated
1089 }
1090}
1091
1092impl fidl::endpoints::RequestStream for BatchIteratorRequestStream {
1093 type Protocol = BatchIteratorMarker;
1094 type ControlHandle = BatchIteratorControlHandle;
1095
1096 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1097 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1098 }
1099
1100 fn control_handle(&self) -> Self::ControlHandle {
1101 BatchIteratorControlHandle { inner: self.inner.clone() }
1102 }
1103
1104 fn into_inner(
1105 self,
1106 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1107 {
1108 (self.inner, self.is_terminated)
1109 }
1110
1111 fn from_inner(
1112 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1113 is_terminated: bool,
1114 ) -> Self {
1115 Self { inner, is_terminated }
1116 }
1117}
1118
1119impl futures::Stream for BatchIteratorRequestStream {
1120 type Item = Result<BatchIteratorRequest, fidl::Error>;
1121
1122 fn poll_next(
1123 mut self: std::pin::Pin<&mut Self>,
1124 cx: &mut std::task::Context<'_>,
1125 ) -> std::task::Poll<Option<Self::Item>> {
1126 let this = &mut *self;
1127 if this.inner.check_shutdown(cx) {
1128 this.is_terminated = true;
1129 return std::task::Poll::Ready(None);
1130 }
1131 if this.is_terminated {
1132 panic!("polled BatchIteratorRequestStream after completion");
1133 }
1134 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1135 |bytes, handles| {
1136 match this.inner.channel().read_etc(cx, bytes, handles) {
1137 std::task::Poll::Ready(Ok(())) => {}
1138 std::task::Poll::Pending => return std::task::Poll::Pending,
1139 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1140 this.is_terminated = true;
1141 return std::task::Poll::Ready(None);
1142 }
1143 std::task::Poll::Ready(Err(e)) => {
1144 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1145 e.into(),
1146 ))));
1147 }
1148 }
1149
1150 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1152
1153 std::task::Poll::Ready(Some(match header.ordinal {
1154 0x781986486c6254a5 => {
1155 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1156 let mut req = fidl::new_empty!(
1157 fidl::encoding::EmptyPayload,
1158 fidl::encoding::DefaultFuchsiaResourceDialect
1159 );
1160 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1161 let control_handle =
1162 BatchIteratorControlHandle { inner: this.inner.clone() };
1163 Ok(BatchIteratorRequest::GetNext {
1164 responder: BatchIteratorGetNextResponder {
1165 control_handle: std::mem::ManuallyDrop::new(control_handle),
1166 tx_id: header.tx_id,
1167 },
1168 })
1169 }
1170 0x70598ee271597603 => {
1171 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1172 let mut req = fidl::new_empty!(
1173 fidl::encoding::EmptyPayload,
1174 fidl::encoding::DefaultFuchsiaResourceDialect
1175 );
1176 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1177 let control_handle =
1178 BatchIteratorControlHandle { inner: this.inner.clone() };
1179 Ok(BatchIteratorRequest::WaitForReady {
1180 responder: BatchIteratorWaitForReadyResponder {
1181 control_handle: std::mem::ManuallyDrop::new(control_handle),
1182 tx_id: header.tx_id,
1183 },
1184 })
1185 }
1186 _ if header.tx_id == 0
1187 && header
1188 .dynamic_flags()
1189 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1190 {
1191 Ok(BatchIteratorRequest::_UnknownMethod {
1192 ordinal: header.ordinal,
1193 control_handle: BatchIteratorControlHandle {
1194 inner: this.inner.clone(),
1195 },
1196 method_type: fidl::MethodType::OneWay,
1197 })
1198 }
1199 _ if header
1200 .dynamic_flags()
1201 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1202 {
1203 this.inner.send_framework_err(
1204 fidl::encoding::FrameworkErr::UnknownMethod,
1205 header.tx_id,
1206 header.ordinal,
1207 header.dynamic_flags(),
1208 (bytes, handles),
1209 )?;
1210 Ok(BatchIteratorRequest::_UnknownMethod {
1211 ordinal: header.ordinal,
1212 control_handle: BatchIteratorControlHandle {
1213 inner: this.inner.clone(),
1214 },
1215 method_type: fidl::MethodType::TwoWay,
1216 })
1217 }
1218 _ => Err(fidl::Error::UnknownOrdinal {
1219 ordinal: header.ordinal,
1220 protocol_name:
1221 <BatchIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1222 }),
1223 }))
1224 },
1225 )
1226 }
1227}
1228
1229#[derive(Debug)]
1232pub enum BatchIteratorRequest {
1233 GetNext { responder: BatchIteratorGetNextResponder },
1257 WaitForReady { responder: BatchIteratorWaitForReadyResponder },
1260 #[non_exhaustive]
1262 _UnknownMethod {
1263 ordinal: u64,
1265 control_handle: BatchIteratorControlHandle,
1266 method_type: fidl::MethodType,
1267 },
1268}
1269
1270impl BatchIteratorRequest {
1271 #[allow(irrefutable_let_patterns)]
1272 pub fn into_get_next(self) -> Option<(BatchIteratorGetNextResponder)> {
1273 if let BatchIteratorRequest::GetNext { responder } = self {
1274 Some((responder))
1275 } else {
1276 None
1277 }
1278 }
1279
1280 #[allow(irrefutable_let_patterns)]
1281 pub fn into_wait_for_ready(self) -> Option<(BatchIteratorWaitForReadyResponder)> {
1282 if let BatchIteratorRequest::WaitForReady { responder } = self {
1283 Some((responder))
1284 } else {
1285 None
1286 }
1287 }
1288
1289 pub fn method_name(&self) -> &'static str {
1291 match *self {
1292 BatchIteratorRequest::GetNext { .. } => "get_next",
1293 BatchIteratorRequest::WaitForReady { .. } => "wait_for_ready",
1294 BatchIteratorRequest::_UnknownMethod {
1295 method_type: fidl::MethodType::OneWay, ..
1296 } => "unknown one-way method",
1297 BatchIteratorRequest::_UnknownMethod {
1298 method_type: fidl::MethodType::TwoWay, ..
1299 } => "unknown two-way method",
1300 }
1301 }
1302}
1303
1304#[derive(Debug, Clone)]
1305pub struct BatchIteratorControlHandle {
1306 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1307}
1308
1309impl fidl::endpoints::ControlHandle for BatchIteratorControlHandle {
1310 fn shutdown(&self) {
1311 self.inner.shutdown()
1312 }
1313 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1314 self.inner.shutdown_with_epitaph(status)
1315 }
1316
1317 fn is_closed(&self) -> bool {
1318 self.inner.channel().is_closed()
1319 }
1320 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1321 self.inner.channel().on_closed()
1322 }
1323
1324 #[cfg(target_os = "fuchsia")]
1325 fn signal_peer(
1326 &self,
1327 clear_mask: zx::Signals,
1328 set_mask: zx::Signals,
1329 ) -> Result<(), zx_status::Status> {
1330 use fidl::Peered;
1331 self.inner.channel().signal_peer(clear_mask, set_mask)
1332 }
1333}
1334
1335impl BatchIteratorControlHandle {}
1336
1337#[must_use = "FIDL methods require a response to be sent"]
1338#[derive(Debug)]
1339pub struct BatchIteratorGetNextResponder {
1340 control_handle: std::mem::ManuallyDrop<BatchIteratorControlHandle>,
1341 tx_id: u32,
1342}
1343
1344impl std::ops::Drop for BatchIteratorGetNextResponder {
1348 fn drop(&mut self) {
1349 self.control_handle.shutdown();
1350 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1352 }
1353}
1354
1355impl fidl::endpoints::Responder for BatchIteratorGetNextResponder {
1356 type ControlHandle = BatchIteratorControlHandle;
1357
1358 fn control_handle(&self) -> &BatchIteratorControlHandle {
1359 &self.control_handle
1360 }
1361
1362 fn drop_without_shutdown(mut self) {
1363 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1365 std::mem::forget(self);
1367 }
1368}
1369
1370impl BatchIteratorGetNextResponder {
1371 pub fn send(
1375 self,
1376 mut result: Result<Vec<FormattedContent>, ReaderError>,
1377 ) -> Result<(), fidl::Error> {
1378 let _result = self.send_raw(result);
1379 if _result.is_err() {
1380 self.control_handle.shutdown();
1381 }
1382 self.drop_without_shutdown();
1383 _result
1384 }
1385
1386 pub fn send_no_shutdown_on_err(
1388 self,
1389 mut result: Result<Vec<FormattedContent>, ReaderError>,
1390 ) -> Result<(), fidl::Error> {
1391 let _result = self.send_raw(result);
1392 self.drop_without_shutdown();
1393 _result
1394 }
1395
1396 fn send_raw(
1397 &self,
1398 mut result: Result<Vec<FormattedContent>, ReaderError>,
1399 ) -> Result<(), fidl::Error> {
1400 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1401 BatchIteratorGetNextResponse,
1402 ReaderError,
1403 >>(
1404 fidl::encoding::FlexibleResult::new(
1405 result.as_mut().map_err(|e| *e).map(|batch| (batch.as_mut_slice(),)),
1406 ),
1407 self.tx_id,
1408 0x781986486c6254a5,
1409 fidl::encoding::DynamicFlags::FLEXIBLE,
1410 )
1411 }
1412}
1413
1414#[must_use = "FIDL methods require a response to be sent"]
1415#[derive(Debug)]
1416pub struct BatchIteratorWaitForReadyResponder {
1417 control_handle: std::mem::ManuallyDrop<BatchIteratorControlHandle>,
1418 tx_id: u32,
1419}
1420
1421impl std::ops::Drop for BatchIteratorWaitForReadyResponder {
1425 fn drop(&mut self) {
1426 self.control_handle.shutdown();
1427 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1429 }
1430}
1431
1432impl fidl::endpoints::Responder for BatchIteratorWaitForReadyResponder {
1433 type ControlHandle = BatchIteratorControlHandle;
1434
1435 fn control_handle(&self) -> &BatchIteratorControlHandle {
1436 &self.control_handle
1437 }
1438
1439 fn drop_without_shutdown(mut self) {
1440 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1442 std::mem::forget(self);
1444 }
1445}
1446
1447impl BatchIteratorWaitForReadyResponder {
1448 pub fn send(self) -> Result<(), fidl::Error> {
1452 let _result = self.send_raw();
1453 if _result.is_err() {
1454 self.control_handle.shutdown();
1455 }
1456 self.drop_without_shutdown();
1457 _result
1458 }
1459
1460 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1462 let _result = self.send_raw();
1463 self.drop_without_shutdown();
1464 _result
1465 }
1466
1467 fn send_raw(&self) -> Result<(), fidl::Error> {
1468 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
1469 fidl::encoding::Flexible::new(()),
1470 self.tx_id,
1471 0x70598ee271597603,
1472 fidl::encoding::DynamicFlags::FLEXIBLE,
1473 )
1474 }
1475}
1476
1477#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1478pub struct LogFlusherMarker;
1479
1480impl fidl::endpoints::ProtocolMarker for LogFlusherMarker {
1481 type Proxy = LogFlusherProxy;
1482 type RequestStream = LogFlusherRequestStream;
1483 #[cfg(target_os = "fuchsia")]
1484 type SynchronousProxy = LogFlusherSynchronousProxy;
1485
1486 const DEBUG_NAME: &'static str = "fuchsia.diagnostics.LogFlusher";
1487}
1488impl fidl::endpoints::DiscoverableProtocolMarker for LogFlusherMarker {}
1489
1490pub trait LogFlusherProxyInterface: Send + Sync {
1491 type WaitUntilFlushedResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1492 fn r#wait_until_flushed(&self) -> Self::WaitUntilFlushedResponseFut;
1493}
1494#[derive(Debug)]
1495#[cfg(target_os = "fuchsia")]
1496pub struct LogFlusherSynchronousProxy {
1497 client: fidl::client::sync::Client,
1498}
1499
1500#[cfg(target_os = "fuchsia")]
1501impl fidl::endpoints::SynchronousProxy for LogFlusherSynchronousProxy {
1502 type Proxy = LogFlusherProxy;
1503 type Protocol = LogFlusherMarker;
1504
1505 fn from_channel(inner: fidl::Channel) -> Self {
1506 Self::new(inner)
1507 }
1508
1509 fn into_channel(self) -> fidl::Channel {
1510 self.client.into_channel()
1511 }
1512
1513 fn as_channel(&self) -> &fidl::Channel {
1514 self.client.as_channel()
1515 }
1516}
1517
1518#[cfg(target_os = "fuchsia")]
1519impl LogFlusherSynchronousProxy {
1520 pub fn new(channel: fidl::Channel) -> Self {
1521 let protocol_name = <LogFlusherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1522 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1523 }
1524
1525 pub fn into_channel(self) -> fidl::Channel {
1526 self.client.into_channel()
1527 }
1528
1529 pub fn wait_for_event(
1532 &self,
1533 deadline: zx::MonotonicInstant,
1534 ) -> Result<LogFlusherEvent, fidl::Error> {
1535 LogFlusherEvent::decode(self.client.wait_for_event(deadline)?)
1536 }
1537
1538 pub fn r#wait_until_flushed(
1554 &self,
1555 ___deadline: zx::MonotonicInstant,
1556 ) -> Result<(), fidl::Error> {
1557 let _response = self.client.send_query::<
1558 fidl::encoding::EmptyPayload,
1559 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
1560 >(
1561 (),
1562 0x7dc4892e46748b5b,
1563 fidl::encoding::DynamicFlags::FLEXIBLE,
1564 ___deadline,
1565 )?
1566 .into_result::<LogFlusherMarker>("wait_until_flushed")?;
1567 Ok(_response)
1568 }
1569}
1570
1571#[cfg(target_os = "fuchsia")]
1572impl From<LogFlusherSynchronousProxy> for zx::Handle {
1573 fn from(value: LogFlusherSynchronousProxy) -> Self {
1574 value.into_channel().into()
1575 }
1576}
1577
1578#[cfg(target_os = "fuchsia")]
1579impl From<fidl::Channel> for LogFlusherSynchronousProxy {
1580 fn from(value: fidl::Channel) -> Self {
1581 Self::new(value)
1582 }
1583}
1584
1585#[cfg(target_os = "fuchsia")]
1586impl fidl::endpoints::FromClient for LogFlusherSynchronousProxy {
1587 type Protocol = LogFlusherMarker;
1588
1589 fn from_client(value: fidl::endpoints::ClientEnd<LogFlusherMarker>) -> Self {
1590 Self::new(value.into_channel())
1591 }
1592}
1593
1594#[derive(Debug, Clone)]
1595pub struct LogFlusherProxy {
1596 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1597}
1598
1599impl fidl::endpoints::Proxy for LogFlusherProxy {
1600 type Protocol = LogFlusherMarker;
1601
1602 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1603 Self::new(inner)
1604 }
1605
1606 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1607 self.client.into_channel().map_err(|client| Self { client })
1608 }
1609
1610 fn as_channel(&self) -> &::fidl::AsyncChannel {
1611 self.client.as_channel()
1612 }
1613}
1614
1615impl LogFlusherProxy {
1616 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1618 let protocol_name = <LogFlusherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1619 Self { client: fidl::client::Client::new(channel, protocol_name) }
1620 }
1621
1622 pub fn take_event_stream(&self) -> LogFlusherEventStream {
1628 LogFlusherEventStream { event_receiver: self.client.take_event_receiver() }
1629 }
1630
1631 pub fn r#wait_until_flushed(
1647 &self,
1648 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1649 LogFlusherProxyInterface::r#wait_until_flushed(self)
1650 }
1651}
1652
1653impl LogFlusherProxyInterface for LogFlusherProxy {
1654 type WaitUntilFlushedResponseFut =
1655 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1656 fn r#wait_until_flushed(&self) -> Self::WaitUntilFlushedResponseFut {
1657 fn _decode(
1658 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1659 ) -> Result<(), fidl::Error> {
1660 let _response = fidl::client::decode_transaction_body::<
1661 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
1662 fidl::encoding::DefaultFuchsiaResourceDialect,
1663 0x7dc4892e46748b5b,
1664 >(_buf?)?
1665 .into_result::<LogFlusherMarker>("wait_until_flushed")?;
1666 Ok(_response)
1667 }
1668 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
1669 (),
1670 0x7dc4892e46748b5b,
1671 fidl::encoding::DynamicFlags::FLEXIBLE,
1672 _decode,
1673 )
1674 }
1675}
1676
1677pub struct LogFlusherEventStream {
1678 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1679}
1680
1681impl std::marker::Unpin for LogFlusherEventStream {}
1682
1683impl futures::stream::FusedStream for LogFlusherEventStream {
1684 fn is_terminated(&self) -> bool {
1685 self.event_receiver.is_terminated()
1686 }
1687}
1688
1689impl futures::Stream for LogFlusherEventStream {
1690 type Item = Result<LogFlusherEvent, fidl::Error>;
1691
1692 fn poll_next(
1693 mut self: std::pin::Pin<&mut Self>,
1694 cx: &mut std::task::Context<'_>,
1695 ) -> std::task::Poll<Option<Self::Item>> {
1696 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1697 &mut self.event_receiver,
1698 cx
1699 )?) {
1700 Some(buf) => std::task::Poll::Ready(Some(LogFlusherEvent::decode(buf))),
1701 None => std::task::Poll::Ready(None),
1702 }
1703 }
1704}
1705
1706#[derive(Debug)]
1707pub enum LogFlusherEvent {
1708 #[non_exhaustive]
1709 _UnknownEvent {
1710 ordinal: u64,
1712 },
1713}
1714
1715impl LogFlusherEvent {
1716 fn decode(
1718 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1719 ) -> Result<LogFlusherEvent, fidl::Error> {
1720 let (bytes, _handles) = buf.split_mut();
1721 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1722 debug_assert_eq!(tx_header.tx_id, 0);
1723 match tx_header.ordinal {
1724 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1725 Ok(LogFlusherEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1726 }
1727 _ => Err(fidl::Error::UnknownOrdinal {
1728 ordinal: tx_header.ordinal,
1729 protocol_name: <LogFlusherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1730 }),
1731 }
1732 }
1733}
1734
1735pub struct LogFlusherRequestStream {
1737 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1738 is_terminated: bool,
1739}
1740
1741impl std::marker::Unpin for LogFlusherRequestStream {}
1742
1743impl futures::stream::FusedStream for LogFlusherRequestStream {
1744 fn is_terminated(&self) -> bool {
1745 self.is_terminated
1746 }
1747}
1748
1749impl fidl::endpoints::RequestStream for LogFlusherRequestStream {
1750 type Protocol = LogFlusherMarker;
1751 type ControlHandle = LogFlusherControlHandle;
1752
1753 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1754 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1755 }
1756
1757 fn control_handle(&self) -> Self::ControlHandle {
1758 LogFlusherControlHandle { inner: self.inner.clone() }
1759 }
1760
1761 fn into_inner(
1762 self,
1763 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1764 {
1765 (self.inner, self.is_terminated)
1766 }
1767
1768 fn from_inner(
1769 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1770 is_terminated: bool,
1771 ) -> Self {
1772 Self { inner, is_terminated }
1773 }
1774}
1775
1776impl futures::Stream for LogFlusherRequestStream {
1777 type Item = Result<LogFlusherRequest, fidl::Error>;
1778
1779 fn poll_next(
1780 mut self: std::pin::Pin<&mut Self>,
1781 cx: &mut std::task::Context<'_>,
1782 ) -> std::task::Poll<Option<Self::Item>> {
1783 let this = &mut *self;
1784 if this.inner.check_shutdown(cx) {
1785 this.is_terminated = true;
1786 return std::task::Poll::Ready(None);
1787 }
1788 if this.is_terminated {
1789 panic!("polled LogFlusherRequestStream after completion");
1790 }
1791 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1792 |bytes, handles| {
1793 match this.inner.channel().read_etc(cx, bytes, handles) {
1794 std::task::Poll::Ready(Ok(())) => {}
1795 std::task::Poll::Pending => return std::task::Poll::Pending,
1796 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1797 this.is_terminated = true;
1798 return std::task::Poll::Ready(None);
1799 }
1800 std::task::Poll::Ready(Err(e)) => {
1801 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1802 e.into(),
1803 ))));
1804 }
1805 }
1806
1807 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1809
1810 std::task::Poll::Ready(Some(match header.ordinal {
1811 0x7dc4892e46748b5b => {
1812 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1813 let mut req = fidl::new_empty!(
1814 fidl::encoding::EmptyPayload,
1815 fidl::encoding::DefaultFuchsiaResourceDialect
1816 );
1817 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1818 let control_handle = LogFlusherControlHandle { inner: this.inner.clone() };
1819 Ok(LogFlusherRequest::WaitUntilFlushed {
1820 responder: LogFlusherWaitUntilFlushedResponder {
1821 control_handle: std::mem::ManuallyDrop::new(control_handle),
1822 tx_id: header.tx_id,
1823 },
1824 })
1825 }
1826 _ if header.tx_id == 0
1827 && header
1828 .dynamic_flags()
1829 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1830 {
1831 Ok(LogFlusherRequest::_UnknownMethod {
1832 ordinal: header.ordinal,
1833 control_handle: LogFlusherControlHandle { inner: this.inner.clone() },
1834 method_type: fidl::MethodType::OneWay,
1835 })
1836 }
1837 _ if header
1838 .dynamic_flags()
1839 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1840 {
1841 this.inner.send_framework_err(
1842 fidl::encoding::FrameworkErr::UnknownMethod,
1843 header.tx_id,
1844 header.ordinal,
1845 header.dynamic_flags(),
1846 (bytes, handles),
1847 )?;
1848 Ok(LogFlusherRequest::_UnknownMethod {
1849 ordinal: header.ordinal,
1850 control_handle: LogFlusherControlHandle { inner: this.inner.clone() },
1851 method_type: fidl::MethodType::TwoWay,
1852 })
1853 }
1854 _ => Err(fidl::Error::UnknownOrdinal {
1855 ordinal: header.ordinal,
1856 protocol_name:
1857 <LogFlusherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1858 }),
1859 }))
1860 },
1861 )
1862 }
1863}
1864
1865#[derive(Debug)]
1866pub enum LogFlusherRequest {
1867 WaitUntilFlushed { responder: LogFlusherWaitUntilFlushedResponder },
1883 #[non_exhaustive]
1885 _UnknownMethod {
1886 ordinal: u64,
1888 control_handle: LogFlusherControlHandle,
1889 method_type: fidl::MethodType,
1890 },
1891}
1892
1893impl LogFlusherRequest {
1894 #[allow(irrefutable_let_patterns)]
1895 pub fn into_wait_until_flushed(self) -> Option<(LogFlusherWaitUntilFlushedResponder)> {
1896 if let LogFlusherRequest::WaitUntilFlushed { responder } = self {
1897 Some((responder))
1898 } else {
1899 None
1900 }
1901 }
1902
1903 pub fn method_name(&self) -> &'static str {
1905 match *self {
1906 LogFlusherRequest::WaitUntilFlushed { .. } => "wait_until_flushed",
1907 LogFlusherRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
1908 "unknown one-way method"
1909 }
1910 LogFlusherRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
1911 "unknown two-way method"
1912 }
1913 }
1914 }
1915}
1916
1917#[derive(Debug, Clone)]
1918pub struct LogFlusherControlHandle {
1919 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1920}
1921
1922impl fidl::endpoints::ControlHandle for LogFlusherControlHandle {
1923 fn shutdown(&self) {
1924 self.inner.shutdown()
1925 }
1926 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1927 self.inner.shutdown_with_epitaph(status)
1928 }
1929
1930 fn is_closed(&self) -> bool {
1931 self.inner.channel().is_closed()
1932 }
1933 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1934 self.inner.channel().on_closed()
1935 }
1936
1937 #[cfg(target_os = "fuchsia")]
1938 fn signal_peer(
1939 &self,
1940 clear_mask: zx::Signals,
1941 set_mask: zx::Signals,
1942 ) -> Result<(), zx_status::Status> {
1943 use fidl::Peered;
1944 self.inner.channel().signal_peer(clear_mask, set_mask)
1945 }
1946}
1947
1948impl LogFlusherControlHandle {}
1949
1950#[must_use = "FIDL methods require a response to be sent"]
1951#[derive(Debug)]
1952pub struct LogFlusherWaitUntilFlushedResponder {
1953 control_handle: std::mem::ManuallyDrop<LogFlusherControlHandle>,
1954 tx_id: u32,
1955}
1956
1957impl std::ops::Drop for LogFlusherWaitUntilFlushedResponder {
1961 fn drop(&mut self) {
1962 self.control_handle.shutdown();
1963 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1965 }
1966}
1967
1968impl fidl::endpoints::Responder for LogFlusherWaitUntilFlushedResponder {
1969 type ControlHandle = LogFlusherControlHandle;
1970
1971 fn control_handle(&self) -> &LogFlusherControlHandle {
1972 &self.control_handle
1973 }
1974
1975 fn drop_without_shutdown(mut self) {
1976 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1978 std::mem::forget(self);
1980 }
1981}
1982
1983impl LogFlusherWaitUntilFlushedResponder {
1984 pub fn send(self) -> Result<(), fidl::Error> {
1988 let _result = self.send_raw();
1989 if _result.is_err() {
1990 self.control_handle.shutdown();
1991 }
1992 self.drop_without_shutdown();
1993 _result
1994 }
1995
1996 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1998 let _result = self.send_raw();
1999 self.drop_without_shutdown();
2000 _result
2001 }
2002
2003 fn send_raw(&self) -> Result<(), fidl::Error> {
2004 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
2005 fidl::encoding::Flexible::new(()),
2006 self.tx_id,
2007 0x7dc4892e46748b5b,
2008 fidl::encoding::DynamicFlags::FLEXIBLE,
2009 )
2010 }
2011}
2012
2013#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2014pub struct LogSettingsMarker;
2015
2016impl fidl::endpoints::ProtocolMarker for LogSettingsMarker {
2017 type Proxy = LogSettingsProxy;
2018 type RequestStream = LogSettingsRequestStream;
2019 #[cfg(target_os = "fuchsia")]
2020 type SynchronousProxy = LogSettingsSynchronousProxy;
2021
2022 const DEBUG_NAME: &'static str = "fuchsia.diagnostics.LogSettings";
2023}
2024impl fidl::endpoints::DiscoverableProtocolMarker for LogSettingsMarker {}
2025
2026pub trait LogSettingsProxyInterface: Send + Sync {
2027 type SetInterestResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
2028 fn r#set_interest(&self, selectors: &[LogInterestSelector]) -> Self::SetInterestResponseFut;
2029 type SetComponentInterestResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
2030 + Send;
2031 fn r#set_component_interest(
2032 &self,
2033 payload: &LogSettingsSetComponentInterestRequest,
2034 ) -> Self::SetComponentInterestResponseFut;
2035}
2036#[derive(Debug)]
2037#[cfg(target_os = "fuchsia")]
2038pub struct LogSettingsSynchronousProxy {
2039 client: fidl::client::sync::Client,
2040}
2041
2042#[cfg(target_os = "fuchsia")]
2043impl fidl::endpoints::SynchronousProxy for LogSettingsSynchronousProxy {
2044 type Proxy = LogSettingsProxy;
2045 type Protocol = LogSettingsMarker;
2046
2047 fn from_channel(inner: fidl::Channel) -> Self {
2048 Self::new(inner)
2049 }
2050
2051 fn into_channel(self) -> fidl::Channel {
2052 self.client.into_channel()
2053 }
2054
2055 fn as_channel(&self) -> &fidl::Channel {
2056 self.client.as_channel()
2057 }
2058}
2059
2060#[cfg(target_os = "fuchsia")]
2061impl LogSettingsSynchronousProxy {
2062 pub fn new(channel: fidl::Channel) -> Self {
2063 let protocol_name = <LogSettingsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2064 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2065 }
2066
2067 pub fn into_channel(self) -> fidl::Channel {
2068 self.client.into_channel()
2069 }
2070
2071 pub fn wait_for_event(
2074 &self,
2075 deadline: zx::MonotonicInstant,
2076 ) -> Result<LogSettingsEvent, fidl::Error> {
2077 LogSettingsEvent::decode(self.client.wait_for_event(deadline)?)
2078 }
2079
2080 pub fn r#set_interest(
2096 &self,
2097 mut selectors: &[LogInterestSelector],
2098 ___deadline: zx::MonotonicInstant,
2099 ) -> Result<(), fidl::Error> {
2100 let _response =
2101 self.client.send_query::<LogSettingsSetInterestRequest, fidl::encoding::EmptyPayload>(
2102 (selectors,),
2103 0x71beced9d2411f90,
2104 fidl::encoding::DynamicFlags::empty(),
2105 ___deadline,
2106 )?;
2107 Ok(_response)
2108 }
2109
2110 pub fn r#set_component_interest(
2126 &self,
2127 mut payload: &LogSettingsSetComponentInterestRequest,
2128 ___deadline: zx::MonotonicInstant,
2129 ) -> Result<(), fidl::Error> {
2130 let _response = self
2131 .client
2132 .send_query::<LogSettingsSetComponentInterestRequest, fidl::encoding::EmptyPayload>(
2133 payload,
2134 0x35f7004d2367f6c1,
2135 fidl::encoding::DynamicFlags::empty(),
2136 ___deadline,
2137 )?;
2138 Ok(_response)
2139 }
2140}
2141
2142#[cfg(target_os = "fuchsia")]
2143impl From<LogSettingsSynchronousProxy> for zx::Handle {
2144 fn from(value: LogSettingsSynchronousProxy) -> Self {
2145 value.into_channel().into()
2146 }
2147}
2148
2149#[cfg(target_os = "fuchsia")]
2150impl From<fidl::Channel> for LogSettingsSynchronousProxy {
2151 fn from(value: fidl::Channel) -> Self {
2152 Self::new(value)
2153 }
2154}
2155
2156#[cfg(target_os = "fuchsia")]
2157impl fidl::endpoints::FromClient for LogSettingsSynchronousProxy {
2158 type Protocol = LogSettingsMarker;
2159
2160 fn from_client(value: fidl::endpoints::ClientEnd<LogSettingsMarker>) -> Self {
2161 Self::new(value.into_channel())
2162 }
2163}
2164
2165#[derive(Debug, Clone)]
2166pub struct LogSettingsProxy {
2167 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2168}
2169
2170impl fidl::endpoints::Proxy for LogSettingsProxy {
2171 type Protocol = LogSettingsMarker;
2172
2173 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2174 Self::new(inner)
2175 }
2176
2177 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2178 self.client.into_channel().map_err(|client| Self { client })
2179 }
2180
2181 fn as_channel(&self) -> &::fidl::AsyncChannel {
2182 self.client.as_channel()
2183 }
2184}
2185
2186impl LogSettingsProxy {
2187 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2189 let protocol_name = <LogSettingsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2190 Self { client: fidl::client::Client::new(channel, protocol_name) }
2191 }
2192
2193 pub fn take_event_stream(&self) -> LogSettingsEventStream {
2199 LogSettingsEventStream { event_receiver: self.client.take_event_receiver() }
2200 }
2201
2202 pub fn r#set_interest(
2218 &self,
2219 mut selectors: &[LogInterestSelector],
2220 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
2221 LogSettingsProxyInterface::r#set_interest(self, selectors)
2222 }
2223
2224 pub fn r#set_component_interest(
2240 &self,
2241 mut payload: &LogSettingsSetComponentInterestRequest,
2242 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
2243 LogSettingsProxyInterface::r#set_component_interest(self, payload)
2244 }
2245}
2246
2247impl LogSettingsProxyInterface for LogSettingsProxy {
2248 type SetInterestResponseFut =
2249 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
2250 fn r#set_interest(
2251 &self,
2252 mut selectors: &[LogInterestSelector],
2253 ) -> Self::SetInterestResponseFut {
2254 fn _decode(
2255 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2256 ) -> Result<(), fidl::Error> {
2257 let _response = fidl::client::decode_transaction_body::<
2258 fidl::encoding::EmptyPayload,
2259 fidl::encoding::DefaultFuchsiaResourceDialect,
2260 0x71beced9d2411f90,
2261 >(_buf?)?;
2262 Ok(_response)
2263 }
2264 self.client.send_query_and_decode::<LogSettingsSetInterestRequest, ()>(
2265 (selectors,),
2266 0x71beced9d2411f90,
2267 fidl::encoding::DynamicFlags::empty(),
2268 _decode,
2269 )
2270 }
2271
2272 type SetComponentInterestResponseFut =
2273 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
2274 fn r#set_component_interest(
2275 &self,
2276 mut payload: &LogSettingsSetComponentInterestRequest,
2277 ) -> Self::SetComponentInterestResponseFut {
2278 fn _decode(
2279 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2280 ) -> Result<(), fidl::Error> {
2281 let _response = fidl::client::decode_transaction_body::<
2282 fidl::encoding::EmptyPayload,
2283 fidl::encoding::DefaultFuchsiaResourceDialect,
2284 0x35f7004d2367f6c1,
2285 >(_buf?)?;
2286 Ok(_response)
2287 }
2288 self.client.send_query_and_decode::<LogSettingsSetComponentInterestRequest, ()>(
2289 payload,
2290 0x35f7004d2367f6c1,
2291 fidl::encoding::DynamicFlags::empty(),
2292 _decode,
2293 )
2294 }
2295}
2296
2297pub struct LogSettingsEventStream {
2298 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2299}
2300
2301impl std::marker::Unpin for LogSettingsEventStream {}
2302
2303impl futures::stream::FusedStream for LogSettingsEventStream {
2304 fn is_terminated(&self) -> bool {
2305 self.event_receiver.is_terminated()
2306 }
2307}
2308
2309impl futures::Stream for LogSettingsEventStream {
2310 type Item = Result<LogSettingsEvent, fidl::Error>;
2311
2312 fn poll_next(
2313 mut self: std::pin::Pin<&mut Self>,
2314 cx: &mut std::task::Context<'_>,
2315 ) -> std::task::Poll<Option<Self::Item>> {
2316 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2317 &mut self.event_receiver,
2318 cx
2319 )?) {
2320 Some(buf) => std::task::Poll::Ready(Some(LogSettingsEvent::decode(buf))),
2321 None => std::task::Poll::Ready(None),
2322 }
2323 }
2324}
2325
2326#[derive(Debug)]
2327pub enum LogSettingsEvent {}
2328
2329impl LogSettingsEvent {
2330 fn decode(
2332 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2333 ) -> Result<LogSettingsEvent, fidl::Error> {
2334 let (bytes, _handles) = buf.split_mut();
2335 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2336 debug_assert_eq!(tx_header.tx_id, 0);
2337 match tx_header.ordinal {
2338 _ => Err(fidl::Error::UnknownOrdinal {
2339 ordinal: tx_header.ordinal,
2340 protocol_name: <LogSettingsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2341 }),
2342 }
2343 }
2344}
2345
2346pub struct LogSettingsRequestStream {
2348 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2349 is_terminated: bool,
2350}
2351
2352impl std::marker::Unpin for LogSettingsRequestStream {}
2353
2354impl futures::stream::FusedStream for LogSettingsRequestStream {
2355 fn is_terminated(&self) -> bool {
2356 self.is_terminated
2357 }
2358}
2359
2360impl fidl::endpoints::RequestStream for LogSettingsRequestStream {
2361 type Protocol = LogSettingsMarker;
2362 type ControlHandle = LogSettingsControlHandle;
2363
2364 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2365 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2366 }
2367
2368 fn control_handle(&self) -> Self::ControlHandle {
2369 LogSettingsControlHandle { inner: self.inner.clone() }
2370 }
2371
2372 fn into_inner(
2373 self,
2374 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2375 {
2376 (self.inner, self.is_terminated)
2377 }
2378
2379 fn from_inner(
2380 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2381 is_terminated: bool,
2382 ) -> Self {
2383 Self { inner, is_terminated }
2384 }
2385}
2386
2387impl futures::Stream for LogSettingsRequestStream {
2388 type Item = Result<LogSettingsRequest, fidl::Error>;
2389
2390 fn poll_next(
2391 mut self: std::pin::Pin<&mut Self>,
2392 cx: &mut std::task::Context<'_>,
2393 ) -> std::task::Poll<Option<Self::Item>> {
2394 let this = &mut *self;
2395 if this.inner.check_shutdown(cx) {
2396 this.is_terminated = true;
2397 return std::task::Poll::Ready(None);
2398 }
2399 if this.is_terminated {
2400 panic!("polled LogSettingsRequestStream after completion");
2401 }
2402 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2403 |bytes, handles| {
2404 match this.inner.channel().read_etc(cx, bytes, handles) {
2405 std::task::Poll::Ready(Ok(())) => {}
2406 std::task::Poll::Pending => return std::task::Poll::Pending,
2407 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2408 this.is_terminated = true;
2409 return std::task::Poll::Ready(None);
2410 }
2411 std::task::Poll::Ready(Err(e)) => {
2412 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2413 e.into(),
2414 ))));
2415 }
2416 }
2417
2418 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2420
2421 std::task::Poll::Ready(Some(match header.ordinal {
2422 0x71beced9d2411f90 => {
2423 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2424 let mut req = fidl::new_empty!(
2425 LogSettingsSetInterestRequest,
2426 fidl::encoding::DefaultFuchsiaResourceDialect
2427 );
2428 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LogSettingsSetInterestRequest>(&header, _body_bytes, handles, &mut req)?;
2429 let control_handle = LogSettingsControlHandle { inner: this.inner.clone() };
2430 Ok(LogSettingsRequest::SetInterest {
2431 selectors: req.selectors,
2432
2433 responder: LogSettingsSetInterestResponder {
2434 control_handle: std::mem::ManuallyDrop::new(control_handle),
2435 tx_id: header.tx_id,
2436 },
2437 })
2438 }
2439 0x35f7004d2367f6c1 => {
2440 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2441 let mut req = fidl::new_empty!(
2442 LogSettingsSetComponentInterestRequest,
2443 fidl::encoding::DefaultFuchsiaResourceDialect
2444 );
2445 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LogSettingsSetComponentInterestRequest>(&header, _body_bytes, handles, &mut req)?;
2446 let control_handle = LogSettingsControlHandle { inner: this.inner.clone() };
2447 Ok(LogSettingsRequest::SetComponentInterest {
2448 payload: req,
2449 responder: LogSettingsSetComponentInterestResponder {
2450 control_handle: std::mem::ManuallyDrop::new(control_handle),
2451 tx_id: header.tx_id,
2452 },
2453 })
2454 }
2455 _ => Err(fidl::Error::UnknownOrdinal {
2456 ordinal: header.ordinal,
2457 protocol_name:
2458 <LogSettingsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2459 }),
2460 }))
2461 },
2462 )
2463 }
2464}
2465
2466#[derive(Debug)]
2469pub enum LogSettingsRequest {
2470 SetInterest { selectors: Vec<LogInterestSelector>, responder: LogSettingsSetInterestResponder },
2486 SetComponentInterest {
2502 payload: LogSettingsSetComponentInterestRequest,
2503 responder: LogSettingsSetComponentInterestResponder,
2504 },
2505}
2506
2507impl LogSettingsRequest {
2508 #[allow(irrefutable_let_patterns)]
2509 pub fn into_set_interest(
2510 self,
2511 ) -> Option<(Vec<LogInterestSelector>, LogSettingsSetInterestResponder)> {
2512 if let LogSettingsRequest::SetInterest { selectors, responder } = self {
2513 Some((selectors, responder))
2514 } else {
2515 None
2516 }
2517 }
2518
2519 #[allow(irrefutable_let_patterns)]
2520 pub fn into_set_component_interest(
2521 self,
2522 ) -> Option<(LogSettingsSetComponentInterestRequest, LogSettingsSetComponentInterestResponder)>
2523 {
2524 if let LogSettingsRequest::SetComponentInterest { payload, responder } = self {
2525 Some((payload, responder))
2526 } else {
2527 None
2528 }
2529 }
2530
2531 pub fn method_name(&self) -> &'static str {
2533 match *self {
2534 LogSettingsRequest::SetInterest { .. } => "set_interest",
2535 LogSettingsRequest::SetComponentInterest { .. } => "set_component_interest",
2536 }
2537 }
2538}
2539
2540#[derive(Debug, Clone)]
2541pub struct LogSettingsControlHandle {
2542 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2543}
2544
2545impl fidl::endpoints::ControlHandle for LogSettingsControlHandle {
2546 fn shutdown(&self) {
2547 self.inner.shutdown()
2548 }
2549 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2550 self.inner.shutdown_with_epitaph(status)
2551 }
2552
2553 fn is_closed(&self) -> bool {
2554 self.inner.channel().is_closed()
2555 }
2556 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2557 self.inner.channel().on_closed()
2558 }
2559
2560 #[cfg(target_os = "fuchsia")]
2561 fn signal_peer(
2562 &self,
2563 clear_mask: zx::Signals,
2564 set_mask: zx::Signals,
2565 ) -> Result<(), zx_status::Status> {
2566 use fidl::Peered;
2567 self.inner.channel().signal_peer(clear_mask, set_mask)
2568 }
2569}
2570
2571impl LogSettingsControlHandle {}
2572
2573#[must_use = "FIDL methods require a response to be sent"]
2574#[derive(Debug)]
2575pub struct LogSettingsSetInterestResponder {
2576 control_handle: std::mem::ManuallyDrop<LogSettingsControlHandle>,
2577 tx_id: u32,
2578}
2579
2580impl std::ops::Drop for LogSettingsSetInterestResponder {
2584 fn drop(&mut self) {
2585 self.control_handle.shutdown();
2586 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2588 }
2589}
2590
2591impl fidl::endpoints::Responder for LogSettingsSetInterestResponder {
2592 type ControlHandle = LogSettingsControlHandle;
2593
2594 fn control_handle(&self) -> &LogSettingsControlHandle {
2595 &self.control_handle
2596 }
2597
2598 fn drop_without_shutdown(mut self) {
2599 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2601 std::mem::forget(self);
2603 }
2604}
2605
2606impl LogSettingsSetInterestResponder {
2607 pub fn send(self) -> Result<(), fidl::Error> {
2611 let _result = self.send_raw();
2612 if _result.is_err() {
2613 self.control_handle.shutdown();
2614 }
2615 self.drop_without_shutdown();
2616 _result
2617 }
2618
2619 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2621 let _result = self.send_raw();
2622 self.drop_without_shutdown();
2623 _result
2624 }
2625
2626 fn send_raw(&self) -> Result<(), fidl::Error> {
2627 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2628 (),
2629 self.tx_id,
2630 0x71beced9d2411f90,
2631 fidl::encoding::DynamicFlags::empty(),
2632 )
2633 }
2634}
2635
2636#[must_use = "FIDL methods require a response to be sent"]
2637#[derive(Debug)]
2638pub struct LogSettingsSetComponentInterestResponder {
2639 control_handle: std::mem::ManuallyDrop<LogSettingsControlHandle>,
2640 tx_id: u32,
2641}
2642
2643impl std::ops::Drop for LogSettingsSetComponentInterestResponder {
2647 fn drop(&mut self) {
2648 self.control_handle.shutdown();
2649 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2651 }
2652}
2653
2654impl fidl::endpoints::Responder for LogSettingsSetComponentInterestResponder {
2655 type ControlHandle = LogSettingsControlHandle;
2656
2657 fn control_handle(&self) -> &LogSettingsControlHandle {
2658 &self.control_handle
2659 }
2660
2661 fn drop_without_shutdown(mut self) {
2662 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2664 std::mem::forget(self);
2666 }
2667}
2668
2669impl LogSettingsSetComponentInterestResponder {
2670 pub fn send(self) -> Result<(), fidl::Error> {
2674 let _result = self.send_raw();
2675 if _result.is_err() {
2676 self.control_handle.shutdown();
2677 }
2678 self.drop_without_shutdown();
2679 _result
2680 }
2681
2682 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2684 let _result = self.send_raw();
2685 self.drop_without_shutdown();
2686 _result
2687 }
2688
2689 fn send_raw(&self) -> Result<(), fidl::Error> {
2690 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2691 (),
2692 self.tx_id,
2693 0x35f7004d2367f6c1,
2694 fidl::encoding::DynamicFlags::empty(),
2695 )
2696 }
2697}
2698
2699#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2700pub struct LogStreamMarker;
2701
2702impl fidl::endpoints::ProtocolMarker for LogStreamMarker {
2703 type Proxy = LogStreamProxy;
2704 type RequestStream = LogStreamRequestStream;
2705 #[cfg(target_os = "fuchsia")]
2706 type SynchronousProxy = LogStreamSynchronousProxy;
2707
2708 const DEBUG_NAME: &'static str = "fuchsia.diagnostics.LogStream";
2709}
2710impl fidl::endpoints::DiscoverableProtocolMarker for LogStreamMarker {}
2711
2712pub trait LogStreamProxyInterface: Send + Sync {
2713 fn r#connect(&self, socket: fidl::Socket, opts: &LogStreamOptions) -> Result<(), fidl::Error>;
2714}
2715#[derive(Debug)]
2716#[cfg(target_os = "fuchsia")]
2717pub struct LogStreamSynchronousProxy {
2718 client: fidl::client::sync::Client,
2719}
2720
2721#[cfg(target_os = "fuchsia")]
2722impl fidl::endpoints::SynchronousProxy for LogStreamSynchronousProxy {
2723 type Proxy = LogStreamProxy;
2724 type Protocol = LogStreamMarker;
2725
2726 fn from_channel(inner: fidl::Channel) -> Self {
2727 Self::new(inner)
2728 }
2729
2730 fn into_channel(self) -> fidl::Channel {
2731 self.client.into_channel()
2732 }
2733
2734 fn as_channel(&self) -> &fidl::Channel {
2735 self.client.as_channel()
2736 }
2737}
2738
2739#[cfg(target_os = "fuchsia")]
2740impl LogStreamSynchronousProxy {
2741 pub fn new(channel: fidl::Channel) -> Self {
2742 let protocol_name = <LogStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2743 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2744 }
2745
2746 pub fn into_channel(self) -> fidl::Channel {
2747 self.client.into_channel()
2748 }
2749
2750 pub fn wait_for_event(
2753 &self,
2754 deadline: zx::MonotonicInstant,
2755 ) -> Result<LogStreamEvent, fidl::Error> {
2756 LogStreamEvent::decode(self.client.wait_for_event(deadline)?)
2757 }
2758
2759 pub fn r#connect(
2771 &self,
2772 mut socket: fidl::Socket,
2773 mut opts: &LogStreamOptions,
2774 ) -> Result<(), fidl::Error> {
2775 self.client.send::<LogStreamConnectRequest>(
2776 (socket, opts),
2777 0x745eb34f10d51a88,
2778 fidl::encoding::DynamicFlags::FLEXIBLE,
2779 )
2780 }
2781}
2782
2783#[cfg(target_os = "fuchsia")]
2784impl From<LogStreamSynchronousProxy> for zx::Handle {
2785 fn from(value: LogStreamSynchronousProxy) -> Self {
2786 value.into_channel().into()
2787 }
2788}
2789
2790#[cfg(target_os = "fuchsia")]
2791impl From<fidl::Channel> for LogStreamSynchronousProxy {
2792 fn from(value: fidl::Channel) -> Self {
2793 Self::new(value)
2794 }
2795}
2796
2797#[cfg(target_os = "fuchsia")]
2798impl fidl::endpoints::FromClient for LogStreamSynchronousProxy {
2799 type Protocol = LogStreamMarker;
2800
2801 fn from_client(value: fidl::endpoints::ClientEnd<LogStreamMarker>) -> Self {
2802 Self::new(value.into_channel())
2803 }
2804}
2805
2806#[derive(Debug, Clone)]
2807pub struct LogStreamProxy {
2808 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2809}
2810
2811impl fidl::endpoints::Proxy for LogStreamProxy {
2812 type Protocol = LogStreamMarker;
2813
2814 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2815 Self::new(inner)
2816 }
2817
2818 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2819 self.client.into_channel().map_err(|client| Self { client })
2820 }
2821
2822 fn as_channel(&self) -> &::fidl::AsyncChannel {
2823 self.client.as_channel()
2824 }
2825}
2826
2827impl LogStreamProxy {
2828 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2830 let protocol_name = <LogStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2831 Self { client: fidl::client::Client::new(channel, protocol_name) }
2832 }
2833
2834 pub fn take_event_stream(&self) -> LogStreamEventStream {
2840 LogStreamEventStream { event_receiver: self.client.take_event_receiver() }
2841 }
2842
2843 pub fn r#connect(
2855 &self,
2856 mut socket: fidl::Socket,
2857 mut opts: &LogStreamOptions,
2858 ) -> Result<(), fidl::Error> {
2859 LogStreamProxyInterface::r#connect(self, socket, opts)
2860 }
2861}
2862
2863impl LogStreamProxyInterface for LogStreamProxy {
2864 fn r#connect(
2865 &self,
2866 mut socket: fidl::Socket,
2867 mut opts: &LogStreamOptions,
2868 ) -> Result<(), fidl::Error> {
2869 self.client.send::<LogStreamConnectRequest>(
2870 (socket, opts),
2871 0x745eb34f10d51a88,
2872 fidl::encoding::DynamicFlags::FLEXIBLE,
2873 )
2874 }
2875}
2876
2877pub struct LogStreamEventStream {
2878 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2879}
2880
2881impl std::marker::Unpin for LogStreamEventStream {}
2882
2883impl futures::stream::FusedStream for LogStreamEventStream {
2884 fn is_terminated(&self) -> bool {
2885 self.event_receiver.is_terminated()
2886 }
2887}
2888
2889impl futures::Stream for LogStreamEventStream {
2890 type Item = Result<LogStreamEvent, fidl::Error>;
2891
2892 fn poll_next(
2893 mut self: std::pin::Pin<&mut Self>,
2894 cx: &mut std::task::Context<'_>,
2895 ) -> std::task::Poll<Option<Self::Item>> {
2896 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2897 &mut self.event_receiver,
2898 cx
2899 )?) {
2900 Some(buf) => std::task::Poll::Ready(Some(LogStreamEvent::decode(buf))),
2901 None => std::task::Poll::Ready(None),
2902 }
2903 }
2904}
2905
2906#[derive(Debug)]
2907pub enum LogStreamEvent {
2908 #[non_exhaustive]
2909 _UnknownEvent {
2910 ordinal: u64,
2912 },
2913}
2914
2915impl LogStreamEvent {
2916 fn decode(
2918 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2919 ) -> Result<LogStreamEvent, fidl::Error> {
2920 let (bytes, _handles) = buf.split_mut();
2921 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2922 debug_assert_eq!(tx_header.tx_id, 0);
2923 match tx_header.ordinal {
2924 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2925 Ok(LogStreamEvent::_UnknownEvent { ordinal: tx_header.ordinal })
2926 }
2927 _ => Err(fidl::Error::UnknownOrdinal {
2928 ordinal: tx_header.ordinal,
2929 protocol_name: <LogStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2930 }),
2931 }
2932 }
2933}
2934
2935pub struct LogStreamRequestStream {
2937 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2938 is_terminated: bool,
2939}
2940
2941impl std::marker::Unpin for LogStreamRequestStream {}
2942
2943impl futures::stream::FusedStream for LogStreamRequestStream {
2944 fn is_terminated(&self) -> bool {
2945 self.is_terminated
2946 }
2947}
2948
2949impl fidl::endpoints::RequestStream for LogStreamRequestStream {
2950 type Protocol = LogStreamMarker;
2951 type ControlHandle = LogStreamControlHandle;
2952
2953 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2954 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2955 }
2956
2957 fn control_handle(&self) -> Self::ControlHandle {
2958 LogStreamControlHandle { inner: self.inner.clone() }
2959 }
2960
2961 fn into_inner(
2962 self,
2963 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2964 {
2965 (self.inner, self.is_terminated)
2966 }
2967
2968 fn from_inner(
2969 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2970 is_terminated: bool,
2971 ) -> Self {
2972 Self { inner, is_terminated }
2973 }
2974}
2975
2976impl futures::Stream for LogStreamRequestStream {
2977 type Item = Result<LogStreamRequest, fidl::Error>;
2978
2979 fn poll_next(
2980 mut self: std::pin::Pin<&mut Self>,
2981 cx: &mut std::task::Context<'_>,
2982 ) -> std::task::Poll<Option<Self::Item>> {
2983 let this = &mut *self;
2984 if this.inner.check_shutdown(cx) {
2985 this.is_terminated = true;
2986 return std::task::Poll::Ready(None);
2987 }
2988 if this.is_terminated {
2989 panic!("polled LogStreamRequestStream after completion");
2990 }
2991 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2992 |bytes, handles| {
2993 match this.inner.channel().read_etc(cx, bytes, handles) {
2994 std::task::Poll::Ready(Ok(())) => {}
2995 std::task::Poll::Pending => return std::task::Poll::Pending,
2996 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2997 this.is_terminated = true;
2998 return std::task::Poll::Ready(None);
2999 }
3000 std::task::Poll::Ready(Err(e)) => {
3001 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3002 e.into(),
3003 ))));
3004 }
3005 }
3006
3007 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3009
3010 std::task::Poll::Ready(Some(match header.ordinal {
3011 0x745eb34f10d51a88 => {
3012 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3013 let mut req = fidl::new_empty!(
3014 LogStreamConnectRequest,
3015 fidl::encoding::DefaultFuchsiaResourceDialect
3016 );
3017 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LogStreamConnectRequest>(&header, _body_bytes, handles, &mut req)?;
3018 let control_handle = LogStreamControlHandle { inner: this.inner.clone() };
3019 Ok(LogStreamRequest::Connect {
3020 socket: req.socket,
3021 opts: req.opts,
3022
3023 control_handle,
3024 })
3025 }
3026 _ if header.tx_id == 0
3027 && header
3028 .dynamic_flags()
3029 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3030 {
3031 Ok(LogStreamRequest::_UnknownMethod {
3032 ordinal: header.ordinal,
3033 control_handle: LogStreamControlHandle { inner: this.inner.clone() },
3034 method_type: fidl::MethodType::OneWay,
3035 })
3036 }
3037 _ if header
3038 .dynamic_flags()
3039 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3040 {
3041 this.inner.send_framework_err(
3042 fidl::encoding::FrameworkErr::UnknownMethod,
3043 header.tx_id,
3044 header.ordinal,
3045 header.dynamic_flags(),
3046 (bytes, handles),
3047 )?;
3048 Ok(LogStreamRequest::_UnknownMethod {
3049 ordinal: header.ordinal,
3050 control_handle: LogStreamControlHandle { inner: this.inner.clone() },
3051 method_type: fidl::MethodType::TwoWay,
3052 })
3053 }
3054 _ => Err(fidl::Error::UnknownOrdinal {
3055 ordinal: header.ordinal,
3056 protocol_name:
3057 <LogStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3058 }),
3059 }))
3060 },
3061 )
3062 }
3063}
3064
3065#[derive(Debug)]
3066pub enum LogStreamRequest {
3067 Connect { socket: fidl::Socket, opts: LogStreamOptions, control_handle: LogStreamControlHandle },
3079 #[non_exhaustive]
3081 _UnknownMethod {
3082 ordinal: u64,
3084 control_handle: LogStreamControlHandle,
3085 method_type: fidl::MethodType,
3086 },
3087}
3088
3089impl LogStreamRequest {
3090 #[allow(irrefutable_let_patterns)]
3091 pub fn into_connect(self) -> Option<(fidl::Socket, LogStreamOptions, LogStreamControlHandle)> {
3092 if let LogStreamRequest::Connect { socket, opts, control_handle } = self {
3093 Some((socket, opts, control_handle))
3094 } else {
3095 None
3096 }
3097 }
3098
3099 pub fn method_name(&self) -> &'static str {
3101 match *self {
3102 LogStreamRequest::Connect { .. } => "connect",
3103 LogStreamRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
3104 "unknown one-way method"
3105 }
3106 LogStreamRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
3107 "unknown two-way method"
3108 }
3109 }
3110 }
3111}
3112
3113#[derive(Debug, Clone)]
3114pub struct LogStreamControlHandle {
3115 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3116}
3117
3118impl fidl::endpoints::ControlHandle for LogStreamControlHandle {
3119 fn shutdown(&self) {
3120 self.inner.shutdown()
3121 }
3122 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3123 self.inner.shutdown_with_epitaph(status)
3124 }
3125
3126 fn is_closed(&self) -> bool {
3127 self.inner.channel().is_closed()
3128 }
3129 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3130 self.inner.channel().on_closed()
3131 }
3132
3133 #[cfg(target_os = "fuchsia")]
3134 fn signal_peer(
3135 &self,
3136 clear_mask: zx::Signals,
3137 set_mask: zx::Signals,
3138 ) -> Result<(), zx_status::Status> {
3139 use fidl::Peered;
3140 self.inner.channel().signal_peer(clear_mask, set_mask)
3141 }
3142}
3143
3144impl LogStreamControlHandle {}
3145
3146mod internal {
3147 use super::*;
3148
3149 impl fidl::encoding::ResourceTypeMarker for ArchiveAccessorStreamDiagnosticsRequest {
3150 type Borrowed<'a> = &'a mut Self;
3151 fn take_or_borrow<'a>(
3152 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3153 ) -> Self::Borrowed<'a> {
3154 value
3155 }
3156 }
3157
3158 unsafe impl fidl::encoding::TypeMarker for ArchiveAccessorStreamDiagnosticsRequest {
3159 type Owned = Self;
3160
3161 #[inline(always)]
3162 fn inline_align(_context: fidl::encoding::Context) -> usize {
3163 8
3164 }
3165
3166 #[inline(always)]
3167 fn inline_size(_context: fidl::encoding::Context) -> usize {
3168 24
3169 }
3170 }
3171
3172 unsafe impl
3173 fidl::encoding::Encode<
3174 ArchiveAccessorStreamDiagnosticsRequest,
3175 fidl::encoding::DefaultFuchsiaResourceDialect,
3176 > for &mut ArchiveAccessorStreamDiagnosticsRequest
3177 {
3178 #[inline]
3179 unsafe fn encode(
3180 self,
3181 encoder: &mut fidl::encoding::Encoder<
3182 '_,
3183 fidl::encoding::DefaultFuchsiaResourceDialect,
3184 >,
3185 offset: usize,
3186 _depth: fidl::encoding::Depth,
3187 ) -> fidl::Result<()> {
3188 encoder.debug_check_bounds::<ArchiveAccessorStreamDiagnosticsRequest>(offset);
3189 fidl::encoding::Encode::<ArchiveAccessorStreamDiagnosticsRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
3191 (
3192 <StreamParameters as fidl::encoding::ValueTypeMarker>::borrow(&self.stream_parameters),
3193 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BatchIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.result_stream),
3194 ),
3195 encoder, offset, _depth
3196 )
3197 }
3198 }
3199 unsafe impl<
3200 T0: fidl::encoding::Encode<StreamParameters, fidl::encoding::DefaultFuchsiaResourceDialect>,
3201 T1: fidl::encoding::Encode<
3202 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BatchIteratorMarker>>,
3203 fidl::encoding::DefaultFuchsiaResourceDialect,
3204 >,
3205 >
3206 fidl::encoding::Encode<
3207 ArchiveAccessorStreamDiagnosticsRequest,
3208 fidl::encoding::DefaultFuchsiaResourceDialect,
3209 > for (T0, T1)
3210 {
3211 #[inline]
3212 unsafe fn encode(
3213 self,
3214 encoder: &mut fidl::encoding::Encoder<
3215 '_,
3216 fidl::encoding::DefaultFuchsiaResourceDialect,
3217 >,
3218 offset: usize,
3219 depth: fidl::encoding::Depth,
3220 ) -> fidl::Result<()> {
3221 encoder.debug_check_bounds::<ArchiveAccessorStreamDiagnosticsRequest>(offset);
3222 unsafe {
3225 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
3226 (ptr as *mut u64).write_unaligned(0);
3227 }
3228 self.0.encode(encoder, offset + 0, depth)?;
3230 self.1.encode(encoder, offset + 16, depth)?;
3231 Ok(())
3232 }
3233 }
3234
3235 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3236 for ArchiveAccessorStreamDiagnosticsRequest
3237 {
3238 #[inline(always)]
3239 fn new_empty() -> Self {
3240 Self {
3241 stream_parameters: fidl::new_empty!(
3242 StreamParameters,
3243 fidl::encoding::DefaultFuchsiaResourceDialect
3244 ),
3245 result_stream: fidl::new_empty!(
3246 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BatchIteratorMarker>>,
3247 fidl::encoding::DefaultFuchsiaResourceDialect
3248 ),
3249 }
3250 }
3251
3252 #[inline]
3253 unsafe fn decode(
3254 &mut self,
3255 decoder: &mut fidl::encoding::Decoder<
3256 '_,
3257 fidl::encoding::DefaultFuchsiaResourceDialect,
3258 >,
3259 offset: usize,
3260 _depth: fidl::encoding::Depth,
3261 ) -> fidl::Result<()> {
3262 decoder.debug_check_bounds::<Self>(offset);
3263 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
3265 let padval = unsafe { (ptr as *const u64).read_unaligned() };
3266 let mask = 0xffffffff00000000u64;
3267 let maskedval = padval & mask;
3268 if maskedval != 0 {
3269 return Err(fidl::Error::NonZeroPadding {
3270 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
3271 });
3272 }
3273 fidl::decode!(
3274 StreamParameters,
3275 fidl::encoding::DefaultFuchsiaResourceDialect,
3276 &mut self.stream_parameters,
3277 decoder,
3278 offset + 0,
3279 _depth
3280 )?;
3281 fidl::decode!(
3282 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BatchIteratorMarker>>,
3283 fidl::encoding::DefaultFuchsiaResourceDialect,
3284 &mut self.result_stream,
3285 decoder,
3286 offset + 16,
3287 _depth
3288 )?;
3289 Ok(())
3290 }
3291 }
3292
3293 impl fidl::encoding::ResourceTypeMarker for BatchIteratorGetNextResponse {
3294 type Borrowed<'a> = &'a mut Self;
3295 fn take_or_borrow<'a>(
3296 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3297 ) -> Self::Borrowed<'a> {
3298 value
3299 }
3300 }
3301
3302 unsafe impl fidl::encoding::TypeMarker for BatchIteratorGetNextResponse {
3303 type Owned = Self;
3304
3305 #[inline(always)]
3306 fn inline_align(_context: fidl::encoding::Context) -> usize {
3307 8
3308 }
3309
3310 #[inline(always)]
3311 fn inline_size(_context: fidl::encoding::Context) -> usize {
3312 16
3313 }
3314 }
3315
3316 unsafe impl
3317 fidl::encoding::Encode<
3318 BatchIteratorGetNextResponse,
3319 fidl::encoding::DefaultFuchsiaResourceDialect,
3320 > for &mut BatchIteratorGetNextResponse
3321 {
3322 #[inline]
3323 unsafe fn encode(
3324 self,
3325 encoder: &mut fidl::encoding::Encoder<
3326 '_,
3327 fidl::encoding::DefaultFuchsiaResourceDialect,
3328 >,
3329 offset: usize,
3330 _depth: fidl::encoding::Depth,
3331 ) -> fidl::Result<()> {
3332 encoder.debug_check_bounds::<BatchIteratorGetNextResponse>(offset);
3333 fidl::encoding::Encode::<BatchIteratorGetNextResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
3335 (
3336 <fidl::encoding::Vector<FormattedContent, 64> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.batch),
3337 ),
3338 encoder, offset, _depth
3339 )
3340 }
3341 }
3342 unsafe impl<
3343 T0: fidl::encoding::Encode<
3344 fidl::encoding::Vector<FormattedContent, 64>,
3345 fidl::encoding::DefaultFuchsiaResourceDialect,
3346 >,
3347 >
3348 fidl::encoding::Encode<
3349 BatchIteratorGetNextResponse,
3350 fidl::encoding::DefaultFuchsiaResourceDialect,
3351 > for (T0,)
3352 {
3353 #[inline]
3354 unsafe fn encode(
3355 self,
3356 encoder: &mut fidl::encoding::Encoder<
3357 '_,
3358 fidl::encoding::DefaultFuchsiaResourceDialect,
3359 >,
3360 offset: usize,
3361 depth: fidl::encoding::Depth,
3362 ) -> fidl::Result<()> {
3363 encoder.debug_check_bounds::<BatchIteratorGetNextResponse>(offset);
3364 self.0.encode(encoder, offset + 0, depth)?;
3368 Ok(())
3369 }
3370 }
3371
3372 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3373 for BatchIteratorGetNextResponse
3374 {
3375 #[inline(always)]
3376 fn new_empty() -> Self {
3377 Self {
3378 batch: fidl::new_empty!(fidl::encoding::Vector<FormattedContent, 64>, fidl::encoding::DefaultFuchsiaResourceDialect),
3379 }
3380 }
3381
3382 #[inline]
3383 unsafe fn decode(
3384 &mut self,
3385 decoder: &mut fidl::encoding::Decoder<
3386 '_,
3387 fidl::encoding::DefaultFuchsiaResourceDialect,
3388 >,
3389 offset: usize,
3390 _depth: fidl::encoding::Depth,
3391 ) -> fidl::Result<()> {
3392 decoder.debug_check_bounds::<Self>(offset);
3393 fidl::decode!(fidl::encoding::Vector<FormattedContent, 64>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.batch, decoder, offset + 0, _depth)?;
3395 Ok(())
3396 }
3397 }
3398
3399 impl fidl::encoding::ResourceTypeMarker for LogStreamConnectRequest {
3400 type Borrowed<'a> = &'a mut Self;
3401 fn take_or_borrow<'a>(
3402 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3403 ) -> Self::Borrowed<'a> {
3404 value
3405 }
3406 }
3407
3408 unsafe impl fidl::encoding::TypeMarker for LogStreamConnectRequest {
3409 type Owned = Self;
3410
3411 #[inline(always)]
3412 fn inline_align(_context: fidl::encoding::Context) -> usize {
3413 8
3414 }
3415
3416 #[inline(always)]
3417 fn inline_size(_context: fidl::encoding::Context) -> usize {
3418 24
3419 }
3420 }
3421
3422 unsafe impl
3423 fidl::encoding::Encode<
3424 LogStreamConnectRequest,
3425 fidl::encoding::DefaultFuchsiaResourceDialect,
3426 > for &mut LogStreamConnectRequest
3427 {
3428 #[inline]
3429 unsafe fn encode(
3430 self,
3431 encoder: &mut fidl::encoding::Encoder<
3432 '_,
3433 fidl::encoding::DefaultFuchsiaResourceDialect,
3434 >,
3435 offset: usize,
3436 _depth: fidl::encoding::Depth,
3437 ) -> fidl::Result<()> {
3438 encoder.debug_check_bounds::<LogStreamConnectRequest>(offset);
3439 fidl::encoding::Encode::<
3441 LogStreamConnectRequest,
3442 fidl::encoding::DefaultFuchsiaResourceDialect,
3443 >::encode(
3444 (
3445 <fidl::encoding::HandleType<
3446 fidl::Socket,
3447 { fidl::ObjectType::SOCKET.into_raw() },
3448 16392,
3449 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3450 &mut self.socket
3451 ),
3452 <LogStreamOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.opts),
3453 ),
3454 encoder,
3455 offset,
3456 _depth,
3457 )
3458 }
3459 }
3460 unsafe impl<
3461 T0: fidl::encoding::Encode<
3462 fidl::encoding::HandleType<
3463 fidl::Socket,
3464 { fidl::ObjectType::SOCKET.into_raw() },
3465 16392,
3466 >,
3467 fidl::encoding::DefaultFuchsiaResourceDialect,
3468 >,
3469 T1: fidl::encoding::Encode<LogStreamOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
3470 >
3471 fidl::encoding::Encode<
3472 LogStreamConnectRequest,
3473 fidl::encoding::DefaultFuchsiaResourceDialect,
3474 > for (T0, T1)
3475 {
3476 #[inline]
3477 unsafe fn encode(
3478 self,
3479 encoder: &mut fidl::encoding::Encoder<
3480 '_,
3481 fidl::encoding::DefaultFuchsiaResourceDialect,
3482 >,
3483 offset: usize,
3484 depth: fidl::encoding::Depth,
3485 ) -> fidl::Result<()> {
3486 encoder.debug_check_bounds::<LogStreamConnectRequest>(offset);
3487 unsafe {
3490 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
3491 (ptr as *mut u64).write_unaligned(0);
3492 }
3493 self.0.encode(encoder, offset + 0, depth)?;
3495 self.1.encode(encoder, offset + 8, depth)?;
3496 Ok(())
3497 }
3498 }
3499
3500 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3501 for LogStreamConnectRequest
3502 {
3503 #[inline(always)]
3504 fn new_empty() -> Self {
3505 Self {
3506 socket: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 16392>, fidl::encoding::DefaultFuchsiaResourceDialect),
3507 opts: fidl::new_empty!(
3508 LogStreamOptions,
3509 fidl::encoding::DefaultFuchsiaResourceDialect
3510 ),
3511 }
3512 }
3513
3514 #[inline]
3515 unsafe fn decode(
3516 &mut self,
3517 decoder: &mut fidl::encoding::Decoder<
3518 '_,
3519 fidl::encoding::DefaultFuchsiaResourceDialect,
3520 >,
3521 offset: usize,
3522 _depth: fidl::encoding::Depth,
3523 ) -> fidl::Result<()> {
3524 decoder.debug_check_bounds::<Self>(offset);
3525 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
3527 let padval = unsafe { (ptr as *const u64).read_unaligned() };
3528 let mask = 0xffffffff00000000u64;
3529 let maskedval = padval & mask;
3530 if maskedval != 0 {
3531 return Err(fidl::Error::NonZeroPadding {
3532 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
3533 });
3534 }
3535 fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 16392>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.socket, decoder, offset + 0, _depth)?;
3536 fidl::decode!(
3537 LogStreamOptions,
3538 fidl::encoding::DefaultFuchsiaResourceDialect,
3539 &mut self.opts,
3540 decoder,
3541 offset + 8,
3542 _depth
3543 )?;
3544 Ok(())
3545 }
3546 }
3547
3548 impl fidl::encoding::ResourceTypeMarker for FormattedContent {
3549 type Borrowed<'a> = &'a mut Self;
3550 fn take_or_borrow<'a>(
3551 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3552 ) -> Self::Borrowed<'a> {
3553 value
3554 }
3555 }
3556
3557 unsafe impl fidl::encoding::TypeMarker for FormattedContent {
3558 type Owned = Self;
3559
3560 #[inline(always)]
3561 fn inline_align(_context: fidl::encoding::Context) -> usize {
3562 8
3563 }
3564
3565 #[inline(always)]
3566 fn inline_size(_context: fidl::encoding::Context) -> usize {
3567 16
3568 }
3569 }
3570
3571 unsafe impl
3572 fidl::encoding::Encode<FormattedContent, fidl::encoding::DefaultFuchsiaResourceDialect>
3573 for &mut FormattedContent
3574 {
3575 #[inline]
3576 unsafe fn encode(
3577 self,
3578 encoder: &mut fidl::encoding::Encoder<
3579 '_,
3580 fidl::encoding::DefaultFuchsiaResourceDialect,
3581 >,
3582 offset: usize,
3583 _depth: fidl::encoding::Depth,
3584 ) -> fidl::Result<()> {
3585 encoder.debug_check_bounds::<FormattedContent>(offset);
3586 encoder.write_num::<u64>(self.ordinal(), offset);
3587 match self {
3588 FormattedContent::Json(ref mut val) => {
3589 fidl::encoding::encode_in_envelope::<fidl_fuchsia_mem::Buffer, fidl::encoding::DefaultFuchsiaResourceDialect>(
3590 <fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
3591 encoder, offset + 8, _depth
3592 )
3593 }
3594 FormattedContent::Text(ref mut val) => {
3595 fidl::encoding::encode_in_envelope::<fidl_fuchsia_mem::Buffer, fidl::encoding::DefaultFuchsiaResourceDialect>(
3596 <fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
3597 encoder, offset + 8, _depth
3598 )
3599 }
3600 FormattedContent::Cbor(ref mut val) => {
3601 fidl::encoding::encode_in_envelope::<fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect>(
3602 <fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
3603 encoder, offset + 8, _depth
3604 )
3605 }
3606 FormattedContent::Fxt(ref mut val) => {
3607 fidl::encoding::encode_in_envelope::<fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect>(
3608 <fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
3609 encoder, offset + 8, _depth
3610 )
3611 }
3612 FormattedContent::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
3613 }
3614 }
3615 }
3616
3617 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3618 for FormattedContent
3619 {
3620 #[inline(always)]
3621 fn new_empty() -> Self {
3622 Self::__SourceBreaking { unknown_ordinal: 0 }
3623 }
3624
3625 #[inline]
3626 unsafe fn decode(
3627 &mut self,
3628 decoder: &mut fidl::encoding::Decoder<
3629 '_,
3630 fidl::encoding::DefaultFuchsiaResourceDialect,
3631 >,
3632 offset: usize,
3633 mut depth: fidl::encoding::Depth,
3634 ) -> fidl::Result<()> {
3635 decoder.debug_check_bounds::<Self>(offset);
3636 #[allow(unused_variables)]
3637 let next_out_of_line = decoder.next_out_of_line();
3638 let handles_before = decoder.remaining_handles();
3639 let (ordinal, inlined, num_bytes, num_handles) =
3640 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
3641
3642 let member_inline_size = match ordinal {
3643 1 => <fidl_fuchsia_mem::Buffer as fidl::encoding::TypeMarker>::inline_size(
3644 decoder.context,
3645 ),
3646 2 => <fidl_fuchsia_mem::Buffer as fidl::encoding::TypeMarker>::inline_size(
3647 decoder.context,
3648 ),
3649 3 => <fidl::encoding::HandleType<
3650 fidl::Vmo,
3651 { fidl::ObjectType::VMO.into_raw() },
3652 2147483648,
3653 > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3654 4 => <fidl::encoding::HandleType<
3655 fidl::Vmo,
3656 { fidl::ObjectType::VMO.into_raw() },
3657 2147483648,
3658 > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3659 0 => return Err(fidl::Error::UnknownUnionTag),
3660 _ => num_bytes as usize,
3661 };
3662
3663 if inlined != (member_inline_size <= 4) {
3664 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3665 }
3666 let _inner_offset;
3667 if inlined {
3668 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
3669 _inner_offset = offset + 8;
3670 } else {
3671 depth.increment()?;
3672 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3673 }
3674 match ordinal {
3675 1 => {
3676 #[allow(irrefutable_let_patterns)]
3677 if let FormattedContent::Json(_) = self {
3678 } else {
3680 *self = FormattedContent::Json(fidl::new_empty!(
3682 fidl_fuchsia_mem::Buffer,
3683 fidl::encoding::DefaultFuchsiaResourceDialect
3684 ));
3685 }
3686 #[allow(irrefutable_let_patterns)]
3687 if let FormattedContent::Json(ref mut val) = self {
3688 fidl::decode!(
3689 fidl_fuchsia_mem::Buffer,
3690 fidl::encoding::DefaultFuchsiaResourceDialect,
3691 val,
3692 decoder,
3693 _inner_offset,
3694 depth
3695 )?;
3696 } else {
3697 unreachable!()
3698 }
3699 }
3700 2 => {
3701 #[allow(irrefutable_let_patterns)]
3702 if let FormattedContent::Text(_) = self {
3703 } else {
3705 *self = FormattedContent::Text(fidl::new_empty!(
3707 fidl_fuchsia_mem::Buffer,
3708 fidl::encoding::DefaultFuchsiaResourceDialect
3709 ));
3710 }
3711 #[allow(irrefutable_let_patterns)]
3712 if let FormattedContent::Text(ref mut val) = self {
3713 fidl::decode!(
3714 fidl_fuchsia_mem::Buffer,
3715 fidl::encoding::DefaultFuchsiaResourceDialect,
3716 val,
3717 decoder,
3718 _inner_offset,
3719 depth
3720 )?;
3721 } else {
3722 unreachable!()
3723 }
3724 }
3725 3 => {
3726 #[allow(irrefutable_let_patterns)]
3727 if let FormattedContent::Cbor(_) = self {
3728 } else {
3730 *self = FormattedContent::Cbor(
3732 fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
3733 );
3734 }
3735 #[allow(irrefutable_let_patterns)]
3736 if let FormattedContent::Cbor(ref mut val) = self {
3737 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
3738 } else {
3739 unreachable!()
3740 }
3741 }
3742 4 => {
3743 #[allow(irrefutable_let_patterns)]
3744 if let FormattedContent::Fxt(_) = self {
3745 } else {
3747 *self = FormattedContent::Fxt(
3749 fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
3750 );
3751 }
3752 #[allow(irrefutable_let_patterns)]
3753 if let FormattedContent::Fxt(ref mut val) = self {
3754 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
3755 } else {
3756 unreachable!()
3757 }
3758 }
3759 #[allow(deprecated)]
3760 ordinal => {
3761 for _ in 0..num_handles {
3762 decoder.drop_next_handle()?;
3763 }
3764 *self = FormattedContent::__SourceBreaking { unknown_ordinal: ordinal };
3765 }
3766 }
3767 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
3768 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3769 }
3770 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3771 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3772 }
3773 Ok(())
3774 }
3775 }
3776}