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 LogSettingsMarker;
1479
1480impl fidl::endpoints::ProtocolMarker for LogSettingsMarker {
1481 type Proxy = LogSettingsProxy;
1482 type RequestStream = LogSettingsRequestStream;
1483 #[cfg(target_os = "fuchsia")]
1484 type SynchronousProxy = LogSettingsSynchronousProxy;
1485
1486 const DEBUG_NAME: &'static str = "fuchsia.diagnostics.LogSettings";
1487}
1488impl fidl::endpoints::DiscoverableProtocolMarker for LogSettingsMarker {}
1489
1490pub trait LogSettingsProxyInterface: Send + Sync {
1491 fn r#register_interest(&self, selectors: &[LogInterestSelector]) -> Result<(), fidl::Error>;
1492 type SetInterestResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1493 fn r#set_interest(&self, selectors: &[LogInterestSelector]) -> Self::SetInterestResponseFut;
1494 type SetComponentInterestResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
1495 + Send;
1496 fn r#set_component_interest(
1497 &self,
1498 payload: &LogSettingsSetComponentInterestRequest,
1499 ) -> Self::SetComponentInterestResponseFut;
1500}
1501#[derive(Debug)]
1502#[cfg(target_os = "fuchsia")]
1503pub struct LogSettingsSynchronousProxy {
1504 client: fidl::client::sync::Client,
1505}
1506
1507#[cfg(target_os = "fuchsia")]
1508impl fidl::endpoints::SynchronousProxy for LogSettingsSynchronousProxy {
1509 type Proxy = LogSettingsProxy;
1510 type Protocol = LogSettingsMarker;
1511
1512 fn from_channel(inner: fidl::Channel) -> Self {
1513 Self::new(inner)
1514 }
1515
1516 fn into_channel(self) -> fidl::Channel {
1517 self.client.into_channel()
1518 }
1519
1520 fn as_channel(&self) -> &fidl::Channel {
1521 self.client.as_channel()
1522 }
1523}
1524
1525#[cfg(target_os = "fuchsia")]
1526impl LogSettingsSynchronousProxy {
1527 pub fn new(channel: fidl::Channel) -> Self {
1528 let protocol_name = <LogSettingsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1529 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1530 }
1531
1532 pub fn into_channel(self) -> fidl::Channel {
1533 self.client.into_channel()
1534 }
1535
1536 pub fn wait_for_event(
1539 &self,
1540 deadline: zx::MonotonicInstant,
1541 ) -> Result<LogSettingsEvent, fidl::Error> {
1542 LogSettingsEvent::decode(self.client.wait_for_event(deadline)?)
1543 }
1544
1545 pub fn r#register_interest(
1546 &self,
1547 mut selectors: &[LogInterestSelector],
1548 ) -> Result<(), fidl::Error> {
1549 self.client.send::<LogSettingsRegisterInterestRequest>(
1550 (selectors,),
1551 0x49d7c14eec975fb,
1552 fidl::encoding::DynamicFlags::empty(),
1553 )
1554 }
1555
1556 pub fn r#set_interest(
1572 &self,
1573 mut selectors: &[LogInterestSelector],
1574 ___deadline: zx::MonotonicInstant,
1575 ) -> Result<(), fidl::Error> {
1576 let _response =
1577 self.client.send_query::<LogSettingsSetInterestRequest, fidl::encoding::EmptyPayload>(
1578 (selectors,),
1579 0x71beced9d2411f90,
1580 fidl::encoding::DynamicFlags::empty(),
1581 ___deadline,
1582 )?;
1583 Ok(_response)
1584 }
1585
1586 pub fn r#set_component_interest(
1602 &self,
1603 mut payload: &LogSettingsSetComponentInterestRequest,
1604 ___deadline: zx::MonotonicInstant,
1605 ) -> Result<(), fidl::Error> {
1606 let _response = self
1607 .client
1608 .send_query::<LogSettingsSetComponentInterestRequest, fidl::encoding::EmptyPayload>(
1609 payload,
1610 0x35f7004d2367f6c1,
1611 fidl::encoding::DynamicFlags::empty(),
1612 ___deadline,
1613 )?;
1614 Ok(_response)
1615 }
1616}
1617
1618#[cfg(target_os = "fuchsia")]
1619impl From<LogSettingsSynchronousProxy> for zx::Handle {
1620 fn from(value: LogSettingsSynchronousProxy) -> Self {
1621 value.into_channel().into()
1622 }
1623}
1624
1625#[cfg(target_os = "fuchsia")]
1626impl From<fidl::Channel> for LogSettingsSynchronousProxy {
1627 fn from(value: fidl::Channel) -> Self {
1628 Self::new(value)
1629 }
1630}
1631
1632#[cfg(target_os = "fuchsia")]
1633impl fidl::endpoints::FromClient for LogSettingsSynchronousProxy {
1634 type Protocol = LogSettingsMarker;
1635
1636 fn from_client(value: fidl::endpoints::ClientEnd<LogSettingsMarker>) -> Self {
1637 Self::new(value.into_channel())
1638 }
1639}
1640
1641#[derive(Debug, Clone)]
1642pub struct LogSettingsProxy {
1643 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1644}
1645
1646impl fidl::endpoints::Proxy for LogSettingsProxy {
1647 type Protocol = LogSettingsMarker;
1648
1649 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1650 Self::new(inner)
1651 }
1652
1653 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1654 self.client.into_channel().map_err(|client| Self { client })
1655 }
1656
1657 fn as_channel(&self) -> &::fidl::AsyncChannel {
1658 self.client.as_channel()
1659 }
1660}
1661
1662impl LogSettingsProxy {
1663 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1665 let protocol_name = <LogSettingsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1666 Self { client: fidl::client::Client::new(channel, protocol_name) }
1667 }
1668
1669 pub fn take_event_stream(&self) -> LogSettingsEventStream {
1675 LogSettingsEventStream { event_receiver: self.client.take_event_receiver() }
1676 }
1677
1678 pub fn r#register_interest(
1679 &self,
1680 mut selectors: &[LogInterestSelector],
1681 ) -> Result<(), fidl::Error> {
1682 LogSettingsProxyInterface::r#register_interest(self, selectors)
1683 }
1684
1685 pub fn r#set_interest(
1701 &self,
1702 mut selectors: &[LogInterestSelector],
1703 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1704 LogSettingsProxyInterface::r#set_interest(self, selectors)
1705 }
1706
1707 pub fn r#set_component_interest(
1723 &self,
1724 mut payload: &LogSettingsSetComponentInterestRequest,
1725 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1726 LogSettingsProxyInterface::r#set_component_interest(self, payload)
1727 }
1728}
1729
1730impl LogSettingsProxyInterface for LogSettingsProxy {
1731 fn r#register_interest(
1732 &self,
1733 mut selectors: &[LogInterestSelector],
1734 ) -> Result<(), fidl::Error> {
1735 self.client.send::<LogSettingsRegisterInterestRequest>(
1736 (selectors,),
1737 0x49d7c14eec975fb,
1738 fidl::encoding::DynamicFlags::empty(),
1739 )
1740 }
1741
1742 type SetInterestResponseFut =
1743 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1744 fn r#set_interest(
1745 &self,
1746 mut selectors: &[LogInterestSelector],
1747 ) -> Self::SetInterestResponseFut {
1748 fn _decode(
1749 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1750 ) -> Result<(), fidl::Error> {
1751 let _response = fidl::client::decode_transaction_body::<
1752 fidl::encoding::EmptyPayload,
1753 fidl::encoding::DefaultFuchsiaResourceDialect,
1754 0x71beced9d2411f90,
1755 >(_buf?)?;
1756 Ok(_response)
1757 }
1758 self.client.send_query_and_decode::<LogSettingsSetInterestRequest, ()>(
1759 (selectors,),
1760 0x71beced9d2411f90,
1761 fidl::encoding::DynamicFlags::empty(),
1762 _decode,
1763 )
1764 }
1765
1766 type SetComponentInterestResponseFut =
1767 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1768 fn r#set_component_interest(
1769 &self,
1770 mut payload: &LogSettingsSetComponentInterestRequest,
1771 ) -> Self::SetComponentInterestResponseFut {
1772 fn _decode(
1773 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1774 ) -> Result<(), fidl::Error> {
1775 let _response = fidl::client::decode_transaction_body::<
1776 fidl::encoding::EmptyPayload,
1777 fidl::encoding::DefaultFuchsiaResourceDialect,
1778 0x35f7004d2367f6c1,
1779 >(_buf?)?;
1780 Ok(_response)
1781 }
1782 self.client.send_query_and_decode::<LogSettingsSetComponentInterestRequest, ()>(
1783 payload,
1784 0x35f7004d2367f6c1,
1785 fidl::encoding::DynamicFlags::empty(),
1786 _decode,
1787 )
1788 }
1789}
1790
1791pub struct LogSettingsEventStream {
1792 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1793}
1794
1795impl std::marker::Unpin for LogSettingsEventStream {}
1796
1797impl futures::stream::FusedStream for LogSettingsEventStream {
1798 fn is_terminated(&self) -> bool {
1799 self.event_receiver.is_terminated()
1800 }
1801}
1802
1803impl futures::Stream for LogSettingsEventStream {
1804 type Item = Result<LogSettingsEvent, fidl::Error>;
1805
1806 fn poll_next(
1807 mut self: std::pin::Pin<&mut Self>,
1808 cx: &mut std::task::Context<'_>,
1809 ) -> std::task::Poll<Option<Self::Item>> {
1810 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1811 &mut self.event_receiver,
1812 cx
1813 )?) {
1814 Some(buf) => std::task::Poll::Ready(Some(LogSettingsEvent::decode(buf))),
1815 None => std::task::Poll::Ready(None),
1816 }
1817 }
1818}
1819
1820#[derive(Debug)]
1821pub enum LogSettingsEvent {}
1822
1823impl LogSettingsEvent {
1824 fn decode(
1826 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1827 ) -> Result<LogSettingsEvent, fidl::Error> {
1828 let (bytes, _handles) = buf.split_mut();
1829 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1830 debug_assert_eq!(tx_header.tx_id, 0);
1831 match tx_header.ordinal {
1832 _ => Err(fidl::Error::UnknownOrdinal {
1833 ordinal: tx_header.ordinal,
1834 protocol_name: <LogSettingsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1835 }),
1836 }
1837 }
1838}
1839
1840pub struct LogSettingsRequestStream {
1842 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1843 is_terminated: bool,
1844}
1845
1846impl std::marker::Unpin for LogSettingsRequestStream {}
1847
1848impl futures::stream::FusedStream for LogSettingsRequestStream {
1849 fn is_terminated(&self) -> bool {
1850 self.is_terminated
1851 }
1852}
1853
1854impl fidl::endpoints::RequestStream for LogSettingsRequestStream {
1855 type Protocol = LogSettingsMarker;
1856 type ControlHandle = LogSettingsControlHandle;
1857
1858 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1859 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1860 }
1861
1862 fn control_handle(&self) -> Self::ControlHandle {
1863 LogSettingsControlHandle { inner: self.inner.clone() }
1864 }
1865
1866 fn into_inner(
1867 self,
1868 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1869 {
1870 (self.inner, self.is_terminated)
1871 }
1872
1873 fn from_inner(
1874 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1875 is_terminated: bool,
1876 ) -> Self {
1877 Self { inner, is_terminated }
1878 }
1879}
1880
1881impl futures::Stream for LogSettingsRequestStream {
1882 type Item = Result<LogSettingsRequest, fidl::Error>;
1883
1884 fn poll_next(
1885 mut self: std::pin::Pin<&mut Self>,
1886 cx: &mut std::task::Context<'_>,
1887 ) -> std::task::Poll<Option<Self::Item>> {
1888 let this = &mut *self;
1889 if this.inner.check_shutdown(cx) {
1890 this.is_terminated = true;
1891 return std::task::Poll::Ready(None);
1892 }
1893 if this.is_terminated {
1894 panic!("polled LogSettingsRequestStream after completion");
1895 }
1896 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1897 |bytes, handles| {
1898 match this.inner.channel().read_etc(cx, bytes, handles) {
1899 std::task::Poll::Ready(Ok(())) => {}
1900 std::task::Poll::Pending => return std::task::Poll::Pending,
1901 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1902 this.is_terminated = true;
1903 return std::task::Poll::Ready(None);
1904 }
1905 std::task::Poll::Ready(Err(e)) => {
1906 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1907 e.into(),
1908 ))))
1909 }
1910 }
1911
1912 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1914
1915 std::task::Poll::Ready(Some(match header.ordinal {
1916 0x49d7c14eec975fb => {
1917 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1918 let mut req = fidl::new_empty!(
1919 LogSettingsRegisterInterestRequest,
1920 fidl::encoding::DefaultFuchsiaResourceDialect
1921 );
1922 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LogSettingsRegisterInterestRequest>(&header, _body_bytes, handles, &mut req)?;
1923 let control_handle = LogSettingsControlHandle { inner: this.inner.clone() };
1924 Ok(LogSettingsRequest::RegisterInterest {
1925 selectors: req.selectors,
1926
1927 control_handle,
1928 })
1929 }
1930 0x71beced9d2411f90 => {
1931 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1932 let mut req = fidl::new_empty!(
1933 LogSettingsSetInterestRequest,
1934 fidl::encoding::DefaultFuchsiaResourceDialect
1935 );
1936 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LogSettingsSetInterestRequest>(&header, _body_bytes, handles, &mut req)?;
1937 let control_handle = LogSettingsControlHandle { inner: this.inner.clone() };
1938 Ok(LogSettingsRequest::SetInterest {
1939 selectors: req.selectors,
1940
1941 responder: LogSettingsSetInterestResponder {
1942 control_handle: std::mem::ManuallyDrop::new(control_handle),
1943 tx_id: header.tx_id,
1944 },
1945 })
1946 }
1947 0x35f7004d2367f6c1 => {
1948 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1949 let mut req = fidl::new_empty!(
1950 LogSettingsSetComponentInterestRequest,
1951 fidl::encoding::DefaultFuchsiaResourceDialect
1952 );
1953 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LogSettingsSetComponentInterestRequest>(&header, _body_bytes, handles, &mut req)?;
1954 let control_handle = LogSettingsControlHandle { inner: this.inner.clone() };
1955 Ok(LogSettingsRequest::SetComponentInterest {
1956 payload: req,
1957 responder: LogSettingsSetComponentInterestResponder {
1958 control_handle: std::mem::ManuallyDrop::new(control_handle),
1959 tx_id: header.tx_id,
1960 },
1961 })
1962 }
1963 _ => Err(fidl::Error::UnknownOrdinal {
1964 ordinal: header.ordinal,
1965 protocol_name:
1966 <LogSettingsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1967 }),
1968 }))
1969 },
1970 )
1971 }
1972}
1973
1974#[derive(Debug)]
1977pub enum LogSettingsRequest {
1978 RegisterInterest {
1979 selectors: Vec<LogInterestSelector>,
1980 control_handle: LogSettingsControlHandle,
1981 },
1982 SetInterest { selectors: Vec<LogInterestSelector>, responder: LogSettingsSetInterestResponder },
1998 SetComponentInterest {
2014 payload: LogSettingsSetComponentInterestRequest,
2015 responder: LogSettingsSetComponentInterestResponder,
2016 },
2017}
2018
2019impl LogSettingsRequest {
2020 #[allow(irrefutable_let_patterns)]
2021 pub fn into_register_interest(
2022 self,
2023 ) -> Option<(Vec<LogInterestSelector>, LogSettingsControlHandle)> {
2024 if let LogSettingsRequest::RegisterInterest { selectors, control_handle } = self {
2025 Some((selectors, control_handle))
2026 } else {
2027 None
2028 }
2029 }
2030
2031 #[allow(irrefutable_let_patterns)]
2032 pub fn into_set_interest(
2033 self,
2034 ) -> Option<(Vec<LogInterestSelector>, LogSettingsSetInterestResponder)> {
2035 if let LogSettingsRequest::SetInterest { selectors, responder } = self {
2036 Some((selectors, responder))
2037 } else {
2038 None
2039 }
2040 }
2041
2042 #[allow(irrefutable_let_patterns)]
2043 pub fn into_set_component_interest(
2044 self,
2045 ) -> Option<(LogSettingsSetComponentInterestRequest, LogSettingsSetComponentInterestResponder)>
2046 {
2047 if let LogSettingsRequest::SetComponentInterest { payload, responder } = self {
2048 Some((payload, responder))
2049 } else {
2050 None
2051 }
2052 }
2053
2054 pub fn method_name(&self) -> &'static str {
2056 match *self {
2057 LogSettingsRequest::RegisterInterest { .. } => "register_interest",
2058 LogSettingsRequest::SetInterest { .. } => "set_interest",
2059 LogSettingsRequest::SetComponentInterest { .. } => "set_component_interest",
2060 }
2061 }
2062}
2063
2064#[derive(Debug, Clone)]
2065pub struct LogSettingsControlHandle {
2066 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2067}
2068
2069impl fidl::endpoints::ControlHandle for LogSettingsControlHandle {
2070 fn shutdown(&self) {
2071 self.inner.shutdown()
2072 }
2073 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2074 self.inner.shutdown_with_epitaph(status)
2075 }
2076
2077 fn is_closed(&self) -> bool {
2078 self.inner.channel().is_closed()
2079 }
2080 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2081 self.inner.channel().on_closed()
2082 }
2083
2084 #[cfg(target_os = "fuchsia")]
2085 fn signal_peer(
2086 &self,
2087 clear_mask: zx::Signals,
2088 set_mask: zx::Signals,
2089 ) -> Result<(), zx_status::Status> {
2090 use fidl::Peered;
2091 self.inner.channel().signal_peer(clear_mask, set_mask)
2092 }
2093}
2094
2095impl LogSettingsControlHandle {}
2096
2097#[must_use = "FIDL methods require a response to be sent"]
2098#[derive(Debug)]
2099pub struct LogSettingsSetInterestResponder {
2100 control_handle: std::mem::ManuallyDrop<LogSettingsControlHandle>,
2101 tx_id: u32,
2102}
2103
2104impl std::ops::Drop for LogSettingsSetInterestResponder {
2108 fn drop(&mut self) {
2109 self.control_handle.shutdown();
2110 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2112 }
2113}
2114
2115impl fidl::endpoints::Responder for LogSettingsSetInterestResponder {
2116 type ControlHandle = LogSettingsControlHandle;
2117
2118 fn control_handle(&self) -> &LogSettingsControlHandle {
2119 &self.control_handle
2120 }
2121
2122 fn drop_without_shutdown(mut self) {
2123 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2125 std::mem::forget(self);
2127 }
2128}
2129
2130impl LogSettingsSetInterestResponder {
2131 pub fn send(self) -> Result<(), fidl::Error> {
2135 let _result = self.send_raw();
2136 if _result.is_err() {
2137 self.control_handle.shutdown();
2138 }
2139 self.drop_without_shutdown();
2140 _result
2141 }
2142
2143 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2145 let _result = self.send_raw();
2146 self.drop_without_shutdown();
2147 _result
2148 }
2149
2150 fn send_raw(&self) -> Result<(), fidl::Error> {
2151 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2152 (),
2153 self.tx_id,
2154 0x71beced9d2411f90,
2155 fidl::encoding::DynamicFlags::empty(),
2156 )
2157 }
2158}
2159
2160#[must_use = "FIDL methods require a response to be sent"]
2161#[derive(Debug)]
2162pub struct LogSettingsSetComponentInterestResponder {
2163 control_handle: std::mem::ManuallyDrop<LogSettingsControlHandle>,
2164 tx_id: u32,
2165}
2166
2167impl std::ops::Drop for LogSettingsSetComponentInterestResponder {
2171 fn drop(&mut self) {
2172 self.control_handle.shutdown();
2173 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2175 }
2176}
2177
2178impl fidl::endpoints::Responder for LogSettingsSetComponentInterestResponder {
2179 type ControlHandle = LogSettingsControlHandle;
2180
2181 fn control_handle(&self) -> &LogSettingsControlHandle {
2182 &self.control_handle
2183 }
2184
2185 fn drop_without_shutdown(mut self) {
2186 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2188 std::mem::forget(self);
2190 }
2191}
2192
2193impl LogSettingsSetComponentInterestResponder {
2194 pub fn send(self) -> Result<(), fidl::Error> {
2198 let _result = self.send_raw();
2199 if _result.is_err() {
2200 self.control_handle.shutdown();
2201 }
2202 self.drop_without_shutdown();
2203 _result
2204 }
2205
2206 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2208 let _result = self.send_raw();
2209 self.drop_without_shutdown();
2210 _result
2211 }
2212
2213 fn send_raw(&self) -> Result<(), fidl::Error> {
2214 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2215 (),
2216 self.tx_id,
2217 0x35f7004d2367f6c1,
2218 fidl::encoding::DynamicFlags::empty(),
2219 )
2220 }
2221}
2222
2223#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2224pub struct LogStreamMarker;
2225
2226impl fidl::endpoints::ProtocolMarker for LogStreamMarker {
2227 type Proxy = LogStreamProxy;
2228 type RequestStream = LogStreamRequestStream;
2229 #[cfg(target_os = "fuchsia")]
2230 type SynchronousProxy = LogStreamSynchronousProxy;
2231
2232 const DEBUG_NAME: &'static str = "fuchsia.diagnostics.LogStream";
2233}
2234impl fidl::endpoints::DiscoverableProtocolMarker for LogStreamMarker {}
2235
2236pub trait LogStreamProxyInterface: Send + Sync {
2237 fn r#connect(&self, socket: fidl::Socket, opts: &LogStreamOptions) -> Result<(), fidl::Error>;
2238}
2239#[derive(Debug)]
2240#[cfg(target_os = "fuchsia")]
2241pub struct LogStreamSynchronousProxy {
2242 client: fidl::client::sync::Client,
2243}
2244
2245#[cfg(target_os = "fuchsia")]
2246impl fidl::endpoints::SynchronousProxy for LogStreamSynchronousProxy {
2247 type Proxy = LogStreamProxy;
2248 type Protocol = LogStreamMarker;
2249
2250 fn from_channel(inner: fidl::Channel) -> Self {
2251 Self::new(inner)
2252 }
2253
2254 fn into_channel(self) -> fidl::Channel {
2255 self.client.into_channel()
2256 }
2257
2258 fn as_channel(&self) -> &fidl::Channel {
2259 self.client.as_channel()
2260 }
2261}
2262
2263#[cfg(target_os = "fuchsia")]
2264impl LogStreamSynchronousProxy {
2265 pub fn new(channel: fidl::Channel) -> Self {
2266 let protocol_name = <LogStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2267 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2268 }
2269
2270 pub fn into_channel(self) -> fidl::Channel {
2271 self.client.into_channel()
2272 }
2273
2274 pub fn wait_for_event(
2277 &self,
2278 deadline: zx::MonotonicInstant,
2279 ) -> Result<LogStreamEvent, fidl::Error> {
2280 LogStreamEvent::decode(self.client.wait_for_event(deadline)?)
2281 }
2282
2283 pub fn r#connect(
2295 &self,
2296 mut socket: fidl::Socket,
2297 mut opts: &LogStreamOptions,
2298 ) -> Result<(), fidl::Error> {
2299 self.client.send::<LogStreamConnectRequest>(
2300 (socket, opts),
2301 0x745eb34f10d51a88,
2302 fidl::encoding::DynamicFlags::FLEXIBLE,
2303 )
2304 }
2305}
2306
2307#[cfg(target_os = "fuchsia")]
2308impl From<LogStreamSynchronousProxy> for zx::Handle {
2309 fn from(value: LogStreamSynchronousProxy) -> Self {
2310 value.into_channel().into()
2311 }
2312}
2313
2314#[cfg(target_os = "fuchsia")]
2315impl From<fidl::Channel> for LogStreamSynchronousProxy {
2316 fn from(value: fidl::Channel) -> Self {
2317 Self::new(value)
2318 }
2319}
2320
2321#[cfg(target_os = "fuchsia")]
2322impl fidl::endpoints::FromClient for LogStreamSynchronousProxy {
2323 type Protocol = LogStreamMarker;
2324
2325 fn from_client(value: fidl::endpoints::ClientEnd<LogStreamMarker>) -> Self {
2326 Self::new(value.into_channel())
2327 }
2328}
2329
2330#[derive(Debug, Clone)]
2331pub struct LogStreamProxy {
2332 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2333}
2334
2335impl fidl::endpoints::Proxy for LogStreamProxy {
2336 type Protocol = LogStreamMarker;
2337
2338 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2339 Self::new(inner)
2340 }
2341
2342 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2343 self.client.into_channel().map_err(|client| Self { client })
2344 }
2345
2346 fn as_channel(&self) -> &::fidl::AsyncChannel {
2347 self.client.as_channel()
2348 }
2349}
2350
2351impl LogStreamProxy {
2352 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2354 let protocol_name = <LogStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2355 Self { client: fidl::client::Client::new(channel, protocol_name) }
2356 }
2357
2358 pub fn take_event_stream(&self) -> LogStreamEventStream {
2364 LogStreamEventStream { event_receiver: self.client.take_event_receiver() }
2365 }
2366
2367 pub fn r#connect(
2379 &self,
2380 mut socket: fidl::Socket,
2381 mut opts: &LogStreamOptions,
2382 ) -> Result<(), fidl::Error> {
2383 LogStreamProxyInterface::r#connect(self, socket, opts)
2384 }
2385}
2386
2387impl LogStreamProxyInterface for LogStreamProxy {
2388 fn r#connect(
2389 &self,
2390 mut socket: fidl::Socket,
2391 mut opts: &LogStreamOptions,
2392 ) -> Result<(), fidl::Error> {
2393 self.client.send::<LogStreamConnectRequest>(
2394 (socket, opts),
2395 0x745eb34f10d51a88,
2396 fidl::encoding::DynamicFlags::FLEXIBLE,
2397 )
2398 }
2399}
2400
2401pub struct LogStreamEventStream {
2402 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2403}
2404
2405impl std::marker::Unpin for LogStreamEventStream {}
2406
2407impl futures::stream::FusedStream for LogStreamEventStream {
2408 fn is_terminated(&self) -> bool {
2409 self.event_receiver.is_terminated()
2410 }
2411}
2412
2413impl futures::Stream for LogStreamEventStream {
2414 type Item = Result<LogStreamEvent, fidl::Error>;
2415
2416 fn poll_next(
2417 mut self: std::pin::Pin<&mut Self>,
2418 cx: &mut std::task::Context<'_>,
2419 ) -> std::task::Poll<Option<Self::Item>> {
2420 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2421 &mut self.event_receiver,
2422 cx
2423 )?) {
2424 Some(buf) => std::task::Poll::Ready(Some(LogStreamEvent::decode(buf))),
2425 None => std::task::Poll::Ready(None),
2426 }
2427 }
2428}
2429
2430#[derive(Debug)]
2431pub enum LogStreamEvent {
2432 #[non_exhaustive]
2433 _UnknownEvent {
2434 ordinal: u64,
2436 },
2437}
2438
2439impl LogStreamEvent {
2440 fn decode(
2442 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2443 ) -> Result<LogStreamEvent, fidl::Error> {
2444 let (bytes, _handles) = buf.split_mut();
2445 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2446 debug_assert_eq!(tx_header.tx_id, 0);
2447 match tx_header.ordinal {
2448 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2449 Ok(LogStreamEvent::_UnknownEvent { ordinal: tx_header.ordinal })
2450 }
2451 _ => Err(fidl::Error::UnknownOrdinal {
2452 ordinal: tx_header.ordinal,
2453 protocol_name: <LogStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2454 }),
2455 }
2456 }
2457}
2458
2459pub struct LogStreamRequestStream {
2461 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2462 is_terminated: bool,
2463}
2464
2465impl std::marker::Unpin for LogStreamRequestStream {}
2466
2467impl futures::stream::FusedStream for LogStreamRequestStream {
2468 fn is_terminated(&self) -> bool {
2469 self.is_terminated
2470 }
2471}
2472
2473impl fidl::endpoints::RequestStream for LogStreamRequestStream {
2474 type Protocol = LogStreamMarker;
2475 type ControlHandle = LogStreamControlHandle;
2476
2477 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2478 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2479 }
2480
2481 fn control_handle(&self) -> Self::ControlHandle {
2482 LogStreamControlHandle { inner: self.inner.clone() }
2483 }
2484
2485 fn into_inner(
2486 self,
2487 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2488 {
2489 (self.inner, self.is_terminated)
2490 }
2491
2492 fn from_inner(
2493 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2494 is_terminated: bool,
2495 ) -> Self {
2496 Self { inner, is_terminated }
2497 }
2498}
2499
2500impl futures::Stream for LogStreamRequestStream {
2501 type Item = Result<LogStreamRequest, fidl::Error>;
2502
2503 fn poll_next(
2504 mut self: std::pin::Pin<&mut Self>,
2505 cx: &mut std::task::Context<'_>,
2506 ) -> std::task::Poll<Option<Self::Item>> {
2507 let this = &mut *self;
2508 if this.inner.check_shutdown(cx) {
2509 this.is_terminated = true;
2510 return std::task::Poll::Ready(None);
2511 }
2512 if this.is_terminated {
2513 panic!("polled LogStreamRequestStream after completion");
2514 }
2515 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2516 |bytes, handles| {
2517 match this.inner.channel().read_etc(cx, bytes, handles) {
2518 std::task::Poll::Ready(Ok(())) => {}
2519 std::task::Poll::Pending => return std::task::Poll::Pending,
2520 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2521 this.is_terminated = true;
2522 return std::task::Poll::Ready(None);
2523 }
2524 std::task::Poll::Ready(Err(e)) => {
2525 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2526 e.into(),
2527 ))))
2528 }
2529 }
2530
2531 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2533
2534 std::task::Poll::Ready(Some(match header.ordinal {
2535 0x745eb34f10d51a88 => {
2536 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2537 let mut req = fidl::new_empty!(
2538 LogStreamConnectRequest,
2539 fidl::encoding::DefaultFuchsiaResourceDialect
2540 );
2541 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LogStreamConnectRequest>(&header, _body_bytes, handles, &mut req)?;
2542 let control_handle = LogStreamControlHandle { inner: this.inner.clone() };
2543 Ok(LogStreamRequest::Connect {
2544 socket: req.socket,
2545 opts: req.opts,
2546
2547 control_handle,
2548 })
2549 }
2550 _ if header.tx_id == 0
2551 && header
2552 .dynamic_flags()
2553 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2554 {
2555 Ok(LogStreamRequest::_UnknownMethod {
2556 ordinal: header.ordinal,
2557 control_handle: LogStreamControlHandle { inner: this.inner.clone() },
2558 method_type: fidl::MethodType::OneWay,
2559 })
2560 }
2561 _ if header
2562 .dynamic_flags()
2563 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2564 {
2565 this.inner.send_framework_err(
2566 fidl::encoding::FrameworkErr::UnknownMethod,
2567 header.tx_id,
2568 header.ordinal,
2569 header.dynamic_flags(),
2570 (bytes, handles),
2571 )?;
2572 Ok(LogStreamRequest::_UnknownMethod {
2573 ordinal: header.ordinal,
2574 control_handle: LogStreamControlHandle { inner: this.inner.clone() },
2575 method_type: fidl::MethodType::TwoWay,
2576 })
2577 }
2578 _ => Err(fidl::Error::UnknownOrdinal {
2579 ordinal: header.ordinal,
2580 protocol_name:
2581 <LogStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2582 }),
2583 }))
2584 },
2585 )
2586 }
2587}
2588
2589#[derive(Debug)]
2590pub enum LogStreamRequest {
2591 Connect { socket: fidl::Socket, opts: LogStreamOptions, control_handle: LogStreamControlHandle },
2603 #[non_exhaustive]
2605 _UnknownMethod {
2606 ordinal: u64,
2608 control_handle: LogStreamControlHandle,
2609 method_type: fidl::MethodType,
2610 },
2611}
2612
2613impl LogStreamRequest {
2614 #[allow(irrefutable_let_patterns)]
2615 pub fn into_connect(self) -> Option<(fidl::Socket, LogStreamOptions, LogStreamControlHandle)> {
2616 if let LogStreamRequest::Connect { socket, opts, control_handle } = self {
2617 Some((socket, opts, control_handle))
2618 } else {
2619 None
2620 }
2621 }
2622
2623 pub fn method_name(&self) -> &'static str {
2625 match *self {
2626 LogStreamRequest::Connect { .. } => "connect",
2627 LogStreamRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
2628 "unknown one-way method"
2629 }
2630 LogStreamRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
2631 "unknown two-way method"
2632 }
2633 }
2634 }
2635}
2636
2637#[derive(Debug, Clone)]
2638pub struct LogStreamControlHandle {
2639 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2640}
2641
2642impl fidl::endpoints::ControlHandle for LogStreamControlHandle {
2643 fn shutdown(&self) {
2644 self.inner.shutdown()
2645 }
2646 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2647 self.inner.shutdown_with_epitaph(status)
2648 }
2649
2650 fn is_closed(&self) -> bool {
2651 self.inner.channel().is_closed()
2652 }
2653 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2654 self.inner.channel().on_closed()
2655 }
2656
2657 #[cfg(target_os = "fuchsia")]
2658 fn signal_peer(
2659 &self,
2660 clear_mask: zx::Signals,
2661 set_mask: zx::Signals,
2662 ) -> Result<(), zx_status::Status> {
2663 use fidl::Peered;
2664 self.inner.channel().signal_peer(clear_mask, set_mask)
2665 }
2666}
2667
2668impl LogStreamControlHandle {}
2669
2670mod internal {
2671 use super::*;
2672
2673 impl fidl::encoding::ResourceTypeMarker for ArchiveAccessorStreamDiagnosticsRequest {
2674 type Borrowed<'a> = &'a mut Self;
2675 fn take_or_borrow<'a>(
2676 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2677 ) -> Self::Borrowed<'a> {
2678 value
2679 }
2680 }
2681
2682 unsafe impl fidl::encoding::TypeMarker for ArchiveAccessorStreamDiagnosticsRequest {
2683 type Owned = Self;
2684
2685 #[inline(always)]
2686 fn inline_align(_context: fidl::encoding::Context) -> usize {
2687 8
2688 }
2689
2690 #[inline(always)]
2691 fn inline_size(_context: fidl::encoding::Context) -> usize {
2692 24
2693 }
2694 }
2695
2696 unsafe impl
2697 fidl::encoding::Encode<
2698 ArchiveAccessorStreamDiagnosticsRequest,
2699 fidl::encoding::DefaultFuchsiaResourceDialect,
2700 > for &mut ArchiveAccessorStreamDiagnosticsRequest
2701 {
2702 #[inline]
2703 unsafe fn encode(
2704 self,
2705 encoder: &mut fidl::encoding::Encoder<
2706 '_,
2707 fidl::encoding::DefaultFuchsiaResourceDialect,
2708 >,
2709 offset: usize,
2710 _depth: fidl::encoding::Depth,
2711 ) -> fidl::Result<()> {
2712 encoder.debug_check_bounds::<ArchiveAccessorStreamDiagnosticsRequest>(offset);
2713 fidl::encoding::Encode::<ArchiveAccessorStreamDiagnosticsRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2715 (
2716 <StreamParameters as fidl::encoding::ValueTypeMarker>::borrow(&self.stream_parameters),
2717 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BatchIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.result_stream),
2718 ),
2719 encoder, offset, _depth
2720 )
2721 }
2722 }
2723 unsafe impl<
2724 T0: fidl::encoding::Encode<StreamParameters, fidl::encoding::DefaultFuchsiaResourceDialect>,
2725 T1: fidl::encoding::Encode<
2726 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BatchIteratorMarker>>,
2727 fidl::encoding::DefaultFuchsiaResourceDialect,
2728 >,
2729 >
2730 fidl::encoding::Encode<
2731 ArchiveAccessorStreamDiagnosticsRequest,
2732 fidl::encoding::DefaultFuchsiaResourceDialect,
2733 > for (T0, T1)
2734 {
2735 #[inline]
2736 unsafe fn encode(
2737 self,
2738 encoder: &mut fidl::encoding::Encoder<
2739 '_,
2740 fidl::encoding::DefaultFuchsiaResourceDialect,
2741 >,
2742 offset: usize,
2743 depth: fidl::encoding::Depth,
2744 ) -> fidl::Result<()> {
2745 encoder.debug_check_bounds::<ArchiveAccessorStreamDiagnosticsRequest>(offset);
2746 unsafe {
2749 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
2750 (ptr as *mut u64).write_unaligned(0);
2751 }
2752 self.0.encode(encoder, offset + 0, depth)?;
2754 self.1.encode(encoder, offset + 16, depth)?;
2755 Ok(())
2756 }
2757 }
2758
2759 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2760 for ArchiveAccessorStreamDiagnosticsRequest
2761 {
2762 #[inline(always)]
2763 fn new_empty() -> Self {
2764 Self {
2765 stream_parameters: fidl::new_empty!(
2766 StreamParameters,
2767 fidl::encoding::DefaultFuchsiaResourceDialect
2768 ),
2769 result_stream: fidl::new_empty!(
2770 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BatchIteratorMarker>>,
2771 fidl::encoding::DefaultFuchsiaResourceDialect
2772 ),
2773 }
2774 }
2775
2776 #[inline]
2777 unsafe fn decode(
2778 &mut self,
2779 decoder: &mut fidl::encoding::Decoder<
2780 '_,
2781 fidl::encoding::DefaultFuchsiaResourceDialect,
2782 >,
2783 offset: usize,
2784 _depth: fidl::encoding::Depth,
2785 ) -> fidl::Result<()> {
2786 decoder.debug_check_bounds::<Self>(offset);
2787 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
2789 let padval = unsafe { (ptr as *const u64).read_unaligned() };
2790 let mask = 0xffffffff00000000u64;
2791 let maskedval = padval & mask;
2792 if maskedval != 0 {
2793 return Err(fidl::Error::NonZeroPadding {
2794 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
2795 });
2796 }
2797 fidl::decode!(
2798 StreamParameters,
2799 fidl::encoding::DefaultFuchsiaResourceDialect,
2800 &mut self.stream_parameters,
2801 decoder,
2802 offset + 0,
2803 _depth
2804 )?;
2805 fidl::decode!(
2806 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BatchIteratorMarker>>,
2807 fidl::encoding::DefaultFuchsiaResourceDialect,
2808 &mut self.result_stream,
2809 decoder,
2810 offset + 16,
2811 _depth
2812 )?;
2813 Ok(())
2814 }
2815 }
2816
2817 impl fidl::encoding::ResourceTypeMarker for BatchIteratorGetNextResponse {
2818 type Borrowed<'a> = &'a mut Self;
2819 fn take_or_borrow<'a>(
2820 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2821 ) -> Self::Borrowed<'a> {
2822 value
2823 }
2824 }
2825
2826 unsafe impl fidl::encoding::TypeMarker for BatchIteratorGetNextResponse {
2827 type Owned = Self;
2828
2829 #[inline(always)]
2830 fn inline_align(_context: fidl::encoding::Context) -> usize {
2831 8
2832 }
2833
2834 #[inline(always)]
2835 fn inline_size(_context: fidl::encoding::Context) -> usize {
2836 16
2837 }
2838 }
2839
2840 unsafe impl
2841 fidl::encoding::Encode<
2842 BatchIteratorGetNextResponse,
2843 fidl::encoding::DefaultFuchsiaResourceDialect,
2844 > for &mut BatchIteratorGetNextResponse
2845 {
2846 #[inline]
2847 unsafe fn encode(
2848 self,
2849 encoder: &mut fidl::encoding::Encoder<
2850 '_,
2851 fidl::encoding::DefaultFuchsiaResourceDialect,
2852 >,
2853 offset: usize,
2854 _depth: fidl::encoding::Depth,
2855 ) -> fidl::Result<()> {
2856 encoder.debug_check_bounds::<BatchIteratorGetNextResponse>(offset);
2857 fidl::encoding::Encode::<BatchIteratorGetNextResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2859 (
2860 <fidl::encoding::Vector<FormattedContent, 64> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.batch),
2861 ),
2862 encoder, offset, _depth
2863 )
2864 }
2865 }
2866 unsafe impl<
2867 T0: fidl::encoding::Encode<
2868 fidl::encoding::Vector<FormattedContent, 64>,
2869 fidl::encoding::DefaultFuchsiaResourceDialect,
2870 >,
2871 >
2872 fidl::encoding::Encode<
2873 BatchIteratorGetNextResponse,
2874 fidl::encoding::DefaultFuchsiaResourceDialect,
2875 > for (T0,)
2876 {
2877 #[inline]
2878 unsafe fn encode(
2879 self,
2880 encoder: &mut fidl::encoding::Encoder<
2881 '_,
2882 fidl::encoding::DefaultFuchsiaResourceDialect,
2883 >,
2884 offset: usize,
2885 depth: fidl::encoding::Depth,
2886 ) -> fidl::Result<()> {
2887 encoder.debug_check_bounds::<BatchIteratorGetNextResponse>(offset);
2888 self.0.encode(encoder, offset + 0, depth)?;
2892 Ok(())
2893 }
2894 }
2895
2896 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2897 for BatchIteratorGetNextResponse
2898 {
2899 #[inline(always)]
2900 fn new_empty() -> Self {
2901 Self {
2902 batch: fidl::new_empty!(fidl::encoding::Vector<FormattedContent, 64>, fidl::encoding::DefaultFuchsiaResourceDialect),
2903 }
2904 }
2905
2906 #[inline]
2907 unsafe fn decode(
2908 &mut self,
2909 decoder: &mut fidl::encoding::Decoder<
2910 '_,
2911 fidl::encoding::DefaultFuchsiaResourceDialect,
2912 >,
2913 offset: usize,
2914 _depth: fidl::encoding::Depth,
2915 ) -> fidl::Result<()> {
2916 decoder.debug_check_bounds::<Self>(offset);
2917 fidl::decode!(fidl::encoding::Vector<FormattedContent, 64>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.batch, decoder, offset + 0, _depth)?;
2919 Ok(())
2920 }
2921 }
2922
2923 impl fidl::encoding::ResourceTypeMarker for LogStreamConnectRequest {
2924 type Borrowed<'a> = &'a mut Self;
2925 fn take_or_borrow<'a>(
2926 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2927 ) -> Self::Borrowed<'a> {
2928 value
2929 }
2930 }
2931
2932 unsafe impl fidl::encoding::TypeMarker for LogStreamConnectRequest {
2933 type Owned = Self;
2934
2935 #[inline(always)]
2936 fn inline_align(_context: fidl::encoding::Context) -> usize {
2937 8
2938 }
2939
2940 #[inline(always)]
2941 fn inline_size(_context: fidl::encoding::Context) -> usize {
2942 24
2943 }
2944 }
2945
2946 unsafe impl
2947 fidl::encoding::Encode<
2948 LogStreamConnectRequest,
2949 fidl::encoding::DefaultFuchsiaResourceDialect,
2950 > for &mut LogStreamConnectRequest
2951 {
2952 #[inline]
2953 unsafe fn encode(
2954 self,
2955 encoder: &mut fidl::encoding::Encoder<
2956 '_,
2957 fidl::encoding::DefaultFuchsiaResourceDialect,
2958 >,
2959 offset: usize,
2960 _depth: fidl::encoding::Depth,
2961 ) -> fidl::Result<()> {
2962 encoder.debug_check_bounds::<LogStreamConnectRequest>(offset);
2963 fidl::encoding::Encode::<
2965 LogStreamConnectRequest,
2966 fidl::encoding::DefaultFuchsiaResourceDialect,
2967 >::encode(
2968 (
2969 <fidl::encoding::HandleType<
2970 fidl::Socket,
2971 { fidl::ObjectType::SOCKET.into_raw() },
2972 16392,
2973 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2974 &mut self.socket
2975 ),
2976 <LogStreamOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.opts),
2977 ),
2978 encoder,
2979 offset,
2980 _depth,
2981 )
2982 }
2983 }
2984 unsafe impl<
2985 T0: fidl::encoding::Encode<
2986 fidl::encoding::HandleType<
2987 fidl::Socket,
2988 { fidl::ObjectType::SOCKET.into_raw() },
2989 16392,
2990 >,
2991 fidl::encoding::DefaultFuchsiaResourceDialect,
2992 >,
2993 T1: fidl::encoding::Encode<LogStreamOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
2994 >
2995 fidl::encoding::Encode<
2996 LogStreamConnectRequest,
2997 fidl::encoding::DefaultFuchsiaResourceDialect,
2998 > for (T0, T1)
2999 {
3000 #[inline]
3001 unsafe fn encode(
3002 self,
3003 encoder: &mut fidl::encoding::Encoder<
3004 '_,
3005 fidl::encoding::DefaultFuchsiaResourceDialect,
3006 >,
3007 offset: usize,
3008 depth: fidl::encoding::Depth,
3009 ) -> fidl::Result<()> {
3010 encoder.debug_check_bounds::<LogStreamConnectRequest>(offset);
3011 unsafe {
3014 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
3015 (ptr as *mut u64).write_unaligned(0);
3016 }
3017 self.0.encode(encoder, offset + 0, depth)?;
3019 self.1.encode(encoder, offset + 8, depth)?;
3020 Ok(())
3021 }
3022 }
3023
3024 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3025 for LogStreamConnectRequest
3026 {
3027 #[inline(always)]
3028 fn new_empty() -> Self {
3029 Self {
3030 socket: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 16392>, fidl::encoding::DefaultFuchsiaResourceDialect),
3031 opts: fidl::new_empty!(
3032 LogStreamOptions,
3033 fidl::encoding::DefaultFuchsiaResourceDialect
3034 ),
3035 }
3036 }
3037
3038 #[inline]
3039 unsafe fn decode(
3040 &mut self,
3041 decoder: &mut fidl::encoding::Decoder<
3042 '_,
3043 fidl::encoding::DefaultFuchsiaResourceDialect,
3044 >,
3045 offset: usize,
3046 _depth: fidl::encoding::Depth,
3047 ) -> fidl::Result<()> {
3048 decoder.debug_check_bounds::<Self>(offset);
3049 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
3051 let padval = unsafe { (ptr as *const u64).read_unaligned() };
3052 let mask = 0xffffffff00000000u64;
3053 let maskedval = padval & mask;
3054 if maskedval != 0 {
3055 return Err(fidl::Error::NonZeroPadding {
3056 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
3057 });
3058 }
3059 fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 16392>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.socket, decoder, offset + 0, _depth)?;
3060 fidl::decode!(
3061 LogStreamOptions,
3062 fidl::encoding::DefaultFuchsiaResourceDialect,
3063 &mut self.opts,
3064 decoder,
3065 offset + 8,
3066 _depth
3067 )?;
3068 Ok(())
3069 }
3070 }
3071
3072 impl fidl::encoding::ResourceTypeMarker for FormattedContent {
3073 type Borrowed<'a> = &'a mut Self;
3074 fn take_or_borrow<'a>(
3075 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3076 ) -> Self::Borrowed<'a> {
3077 value
3078 }
3079 }
3080
3081 unsafe impl fidl::encoding::TypeMarker for FormattedContent {
3082 type Owned = Self;
3083
3084 #[inline(always)]
3085 fn inline_align(_context: fidl::encoding::Context) -> usize {
3086 8
3087 }
3088
3089 #[inline(always)]
3090 fn inline_size(_context: fidl::encoding::Context) -> usize {
3091 16
3092 }
3093 }
3094
3095 unsafe impl
3096 fidl::encoding::Encode<FormattedContent, fidl::encoding::DefaultFuchsiaResourceDialect>
3097 for &mut FormattedContent
3098 {
3099 #[inline]
3100 unsafe fn encode(
3101 self,
3102 encoder: &mut fidl::encoding::Encoder<
3103 '_,
3104 fidl::encoding::DefaultFuchsiaResourceDialect,
3105 >,
3106 offset: usize,
3107 _depth: fidl::encoding::Depth,
3108 ) -> fidl::Result<()> {
3109 encoder.debug_check_bounds::<FormattedContent>(offset);
3110 encoder.write_num::<u64>(self.ordinal(), offset);
3111 match self {
3112 FormattedContent::Json(ref mut val) => {
3113 fidl::encoding::encode_in_envelope::<fidl_fuchsia_mem::Buffer, fidl::encoding::DefaultFuchsiaResourceDialect>(
3114 <fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
3115 encoder, offset + 8, _depth
3116 )
3117 }
3118 FormattedContent::Text(ref mut val) => {
3119 fidl::encoding::encode_in_envelope::<fidl_fuchsia_mem::Buffer, fidl::encoding::DefaultFuchsiaResourceDialect>(
3120 <fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
3121 encoder, offset + 8, _depth
3122 )
3123 }
3124 FormattedContent::Cbor(ref mut val) => {
3125 fidl::encoding::encode_in_envelope::<fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect>(
3126 <fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
3127 encoder, offset + 8, _depth
3128 )
3129 }
3130 FormattedContent::Fxt(ref mut val) => {
3131 fidl::encoding::encode_in_envelope::<fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect>(
3132 <fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
3133 encoder, offset + 8, _depth
3134 )
3135 }
3136 FormattedContent::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
3137 }
3138 }
3139 }
3140
3141 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3142 for FormattedContent
3143 {
3144 #[inline(always)]
3145 fn new_empty() -> Self {
3146 Self::__SourceBreaking { unknown_ordinal: 0 }
3147 }
3148
3149 #[inline]
3150 unsafe fn decode(
3151 &mut self,
3152 decoder: &mut fidl::encoding::Decoder<
3153 '_,
3154 fidl::encoding::DefaultFuchsiaResourceDialect,
3155 >,
3156 offset: usize,
3157 mut depth: fidl::encoding::Depth,
3158 ) -> fidl::Result<()> {
3159 decoder.debug_check_bounds::<Self>(offset);
3160 #[allow(unused_variables)]
3161 let next_out_of_line = decoder.next_out_of_line();
3162 let handles_before = decoder.remaining_handles();
3163 let (ordinal, inlined, num_bytes, num_handles) =
3164 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
3165
3166 let member_inline_size = match ordinal {
3167 1 => <fidl_fuchsia_mem::Buffer as fidl::encoding::TypeMarker>::inline_size(
3168 decoder.context,
3169 ),
3170 2 => <fidl_fuchsia_mem::Buffer as fidl::encoding::TypeMarker>::inline_size(
3171 decoder.context,
3172 ),
3173 3 => <fidl::encoding::HandleType<
3174 fidl::Vmo,
3175 { fidl::ObjectType::VMO.into_raw() },
3176 2147483648,
3177 > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3178 4 => <fidl::encoding::HandleType<
3179 fidl::Vmo,
3180 { fidl::ObjectType::VMO.into_raw() },
3181 2147483648,
3182 > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3183 0 => return Err(fidl::Error::UnknownUnionTag),
3184 _ => num_bytes as usize,
3185 };
3186
3187 if inlined != (member_inline_size <= 4) {
3188 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3189 }
3190 let _inner_offset;
3191 if inlined {
3192 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
3193 _inner_offset = offset + 8;
3194 } else {
3195 depth.increment()?;
3196 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3197 }
3198 match ordinal {
3199 1 => {
3200 #[allow(irrefutable_let_patterns)]
3201 if let FormattedContent::Json(_) = self {
3202 } else {
3204 *self = FormattedContent::Json(fidl::new_empty!(
3206 fidl_fuchsia_mem::Buffer,
3207 fidl::encoding::DefaultFuchsiaResourceDialect
3208 ));
3209 }
3210 #[allow(irrefutable_let_patterns)]
3211 if let FormattedContent::Json(ref mut val) = self {
3212 fidl::decode!(
3213 fidl_fuchsia_mem::Buffer,
3214 fidl::encoding::DefaultFuchsiaResourceDialect,
3215 val,
3216 decoder,
3217 _inner_offset,
3218 depth
3219 )?;
3220 } else {
3221 unreachable!()
3222 }
3223 }
3224 2 => {
3225 #[allow(irrefutable_let_patterns)]
3226 if let FormattedContent::Text(_) = self {
3227 } else {
3229 *self = FormattedContent::Text(fidl::new_empty!(
3231 fidl_fuchsia_mem::Buffer,
3232 fidl::encoding::DefaultFuchsiaResourceDialect
3233 ));
3234 }
3235 #[allow(irrefutable_let_patterns)]
3236 if let FormattedContent::Text(ref mut val) = self {
3237 fidl::decode!(
3238 fidl_fuchsia_mem::Buffer,
3239 fidl::encoding::DefaultFuchsiaResourceDialect,
3240 val,
3241 decoder,
3242 _inner_offset,
3243 depth
3244 )?;
3245 } else {
3246 unreachable!()
3247 }
3248 }
3249 3 => {
3250 #[allow(irrefutable_let_patterns)]
3251 if let FormattedContent::Cbor(_) = self {
3252 } else {
3254 *self = FormattedContent::Cbor(
3256 fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
3257 );
3258 }
3259 #[allow(irrefutable_let_patterns)]
3260 if let FormattedContent::Cbor(ref mut val) = self {
3261 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
3262 } else {
3263 unreachable!()
3264 }
3265 }
3266 4 => {
3267 #[allow(irrefutable_let_patterns)]
3268 if let FormattedContent::Fxt(_) = self {
3269 } else {
3271 *self = FormattedContent::Fxt(
3273 fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
3274 );
3275 }
3276 #[allow(irrefutable_let_patterns)]
3277 if let FormattedContent::Fxt(ref mut val) = self {
3278 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
3279 } else {
3280 unreachable!()
3281 }
3282 }
3283 #[allow(deprecated)]
3284 ordinal => {
3285 for _ in 0..num_handles {
3286 decoder.drop_next_handle()?;
3287 }
3288 *self = FormattedContent::__SourceBreaking { unknown_ordinal: ordinal };
3289 }
3290 }
3291 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
3292 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3293 }
3294 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3295 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3296 }
3297 Ok(())
3298 }
3299 }
3300}