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 fn r#register_interest(&self, selectors: &[LogInterestSelector]) -> Result<(), fidl::Error>;
2028 type SetInterestResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
2029 fn r#set_interest(&self, selectors: &[LogInterestSelector]) -> Self::SetInterestResponseFut;
2030 type SetComponentInterestResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
2031 + Send;
2032 fn r#set_component_interest(
2033 &self,
2034 payload: &LogSettingsSetComponentInterestRequest,
2035 ) -> Self::SetComponentInterestResponseFut;
2036}
2037#[derive(Debug)]
2038#[cfg(target_os = "fuchsia")]
2039pub struct LogSettingsSynchronousProxy {
2040 client: fidl::client::sync::Client,
2041}
2042
2043#[cfg(target_os = "fuchsia")]
2044impl fidl::endpoints::SynchronousProxy for LogSettingsSynchronousProxy {
2045 type Proxy = LogSettingsProxy;
2046 type Protocol = LogSettingsMarker;
2047
2048 fn from_channel(inner: fidl::Channel) -> Self {
2049 Self::new(inner)
2050 }
2051
2052 fn into_channel(self) -> fidl::Channel {
2053 self.client.into_channel()
2054 }
2055
2056 fn as_channel(&self) -> &fidl::Channel {
2057 self.client.as_channel()
2058 }
2059}
2060
2061#[cfg(target_os = "fuchsia")]
2062impl LogSettingsSynchronousProxy {
2063 pub fn new(channel: fidl::Channel) -> Self {
2064 let protocol_name = <LogSettingsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2065 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2066 }
2067
2068 pub fn into_channel(self) -> fidl::Channel {
2069 self.client.into_channel()
2070 }
2071
2072 pub fn wait_for_event(
2075 &self,
2076 deadline: zx::MonotonicInstant,
2077 ) -> Result<LogSettingsEvent, fidl::Error> {
2078 LogSettingsEvent::decode(self.client.wait_for_event(deadline)?)
2079 }
2080
2081 pub fn r#register_interest(
2082 &self,
2083 mut selectors: &[LogInterestSelector],
2084 ) -> Result<(), fidl::Error> {
2085 self.client.send::<LogSettingsRegisterInterestRequest>(
2086 (selectors,),
2087 0x49d7c14eec975fb,
2088 fidl::encoding::DynamicFlags::empty(),
2089 )
2090 }
2091
2092 pub fn r#set_interest(
2108 &self,
2109 mut selectors: &[LogInterestSelector],
2110 ___deadline: zx::MonotonicInstant,
2111 ) -> Result<(), fidl::Error> {
2112 let _response =
2113 self.client.send_query::<LogSettingsSetInterestRequest, fidl::encoding::EmptyPayload>(
2114 (selectors,),
2115 0x71beced9d2411f90,
2116 fidl::encoding::DynamicFlags::empty(),
2117 ___deadline,
2118 )?;
2119 Ok(_response)
2120 }
2121
2122 pub fn r#set_component_interest(
2138 &self,
2139 mut payload: &LogSettingsSetComponentInterestRequest,
2140 ___deadline: zx::MonotonicInstant,
2141 ) -> Result<(), fidl::Error> {
2142 let _response = self
2143 .client
2144 .send_query::<LogSettingsSetComponentInterestRequest, fidl::encoding::EmptyPayload>(
2145 payload,
2146 0x35f7004d2367f6c1,
2147 fidl::encoding::DynamicFlags::empty(),
2148 ___deadline,
2149 )?;
2150 Ok(_response)
2151 }
2152}
2153
2154#[cfg(target_os = "fuchsia")]
2155impl From<LogSettingsSynchronousProxy> for zx::Handle {
2156 fn from(value: LogSettingsSynchronousProxy) -> Self {
2157 value.into_channel().into()
2158 }
2159}
2160
2161#[cfg(target_os = "fuchsia")]
2162impl From<fidl::Channel> for LogSettingsSynchronousProxy {
2163 fn from(value: fidl::Channel) -> Self {
2164 Self::new(value)
2165 }
2166}
2167
2168#[cfg(target_os = "fuchsia")]
2169impl fidl::endpoints::FromClient for LogSettingsSynchronousProxy {
2170 type Protocol = LogSettingsMarker;
2171
2172 fn from_client(value: fidl::endpoints::ClientEnd<LogSettingsMarker>) -> Self {
2173 Self::new(value.into_channel())
2174 }
2175}
2176
2177#[derive(Debug, Clone)]
2178pub struct LogSettingsProxy {
2179 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2180}
2181
2182impl fidl::endpoints::Proxy for LogSettingsProxy {
2183 type Protocol = LogSettingsMarker;
2184
2185 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2186 Self::new(inner)
2187 }
2188
2189 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2190 self.client.into_channel().map_err(|client| Self { client })
2191 }
2192
2193 fn as_channel(&self) -> &::fidl::AsyncChannel {
2194 self.client.as_channel()
2195 }
2196}
2197
2198impl LogSettingsProxy {
2199 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2201 let protocol_name = <LogSettingsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2202 Self { client: fidl::client::Client::new(channel, protocol_name) }
2203 }
2204
2205 pub fn take_event_stream(&self) -> LogSettingsEventStream {
2211 LogSettingsEventStream { event_receiver: self.client.take_event_receiver() }
2212 }
2213
2214 pub fn r#register_interest(
2215 &self,
2216 mut selectors: &[LogInterestSelector],
2217 ) -> Result<(), fidl::Error> {
2218 LogSettingsProxyInterface::r#register_interest(self, selectors)
2219 }
2220
2221 pub fn r#set_interest(
2237 &self,
2238 mut selectors: &[LogInterestSelector],
2239 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
2240 LogSettingsProxyInterface::r#set_interest(self, selectors)
2241 }
2242
2243 pub fn r#set_component_interest(
2259 &self,
2260 mut payload: &LogSettingsSetComponentInterestRequest,
2261 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
2262 LogSettingsProxyInterface::r#set_component_interest(self, payload)
2263 }
2264}
2265
2266impl LogSettingsProxyInterface for LogSettingsProxy {
2267 fn r#register_interest(
2268 &self,
2269 mut selectors: &[LogInterestSelector],
2270 ) -> Result<(), fidl::Error> {
2271 self.client.send::<LogSettingsRegisterInterestRequest>(
2272 (selectors,),
2273 0x49d7c14eec975fb,
2274 fidl::encoding::DynamicFlags::empty(),
2275 )
2276 }
2277
2278 type SetInterestResponseFut =
2279 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
2280 fn r#set_interest(
2281 &self,
2282 mut selectors: &[LogInterestSelector],
2283 ) -> Self::SetInterestResponseFut {
2284 fn _decode(
2285 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2286 ) -> Result<(), fidl::Error> {
2287 let _response = fidl::client::decode_transaction_body::<
2288 fidl::encoding::EmptyPayload,
2289 fidl::encoding::DefaultFuchsiaResourceDialect,
2290 0x71beced9d2411f90,
2291 >(_buf?)?;
2292 Ok(_response)
2293 }
2294 self.client.send_query_and_decode::<LogSettingsSetInterestRequest, ()>(
2295 (selectors,),
2296 0x71beced9d2411f90,
2297 fidl::encoding::DynamicFlags::empty(),
2298 _decode,
2299 )
2300 }
2301
2302 type SetComponentInterestResponseFut =
2303 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
2304 fn r#set_component_interest(
2305 &self,
2306 mut payload: &LogSettingsSetComponentInterestRequest,
2307 ) -> Self::SetComponentInterestResponseFut {
2308 fn _decode(
2309 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2310 ) -> Result<(), fidl::Error> {
2311 let _response = fidl::client::decode_transaction_body::<
2312 fidl::encoding::EmptyPayload,
2313 fidl::encoding::DefaultFuchsiaResourceDialect,
2314 0x35f7004d2367f6c1,
2315 >(_buf?)?;
2316 Ok(_response)
2317 }
2318 self.client.send_query_and_decode::<LogSettingsSetComponentInterestRequest, ()>(
2319 payload,
2320 0x35f7004d2367f6c1,
2321 fidl::encoding::DynamicFlags::empty(),
2322 _decode,
2323 )
2324 }
2325}
2326
2327pub struct LogSettingsEventStream {
2328 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2329}
2330
2331impl std::marker::Unpin for LogSettingsEventStream {}
2332
2333impl futures::stream::FusedStream for LogSettingsEventStream {
2334 fn is_terminated(&self) -> bool {
2335 self.event_receiver.is_terminated()
2336 }
2337}
2338
2339impl futures::Stream for LogSettingsEventStream {
2340 type Item = Result<LogSettingsEvent, fidl::Error>;
2341
2342 fn poll_next(
2343 mut self: std::pin::Pin<&mut Self>,
2344 cx: &mut std::task::Context<'_>,
2345 ) -> std::task::Poll<Option<Self::Item>> {
2346 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2347 &mut self.event_receiver,
2348 cx
2349 )?) {
2350 Some(buf) => std::task::Poll::Ready(Some(LogSettingsEvent::decode(buf))),
2351 None => std::task::Poll::Ready(None),
2352 }
2353 }
2354}
2355
2356#[derive(Debug)]
2357pub enum LogSettingsEvent {}
2358
2359impl LogSettingsEvent {
2360 fn decode(
2362 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2363 ) -> Result<LogSettingsEvent, fidl::Error> {
2364 let (bytes, _handles) = buf.split_mut();
2365 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2366 debug_assert_eq!(tx_header.tx_id, 0);
2367 match tx_header.ordinal {
2368 _ => Err(fidl::Error::UnknownOrdinal {
2369 ordinal: tx_header.ordinal,
2370 protocol_name: <LogSettingsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2371 }),
2372 }
2373 }
2374}
2375
2376pub struct LogSettingsRequestStream {
2378 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2379 is_terminated: bool,
2380}
2381
2382impl std::marker::Unpin for LogSettingsRequestStream {}
2383
2384impl futures::stream::FusedStream for LogSettingsRequestStream {
2385 fn is_terminated(&self) -> bool {
2386 self.is_terminated
2387 }
2388}
2389
2390impl fidl::endpoints::RequestStream for LogSettingsRequestStream {
2391 type Protocol = LogSettingsMarker;
2392 type ControlHandle = LogSettingsControlHandle;
2393
2394 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2395 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2396 }
2397
2398 fn control_handle(&self) -> Self::ControlHandle {
2399 LogSettingsControlHandle { inner: self.inner.clone() }
2400 }
2401
2402 fn into_inner(
2403 self,
2404 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2405 {
2406 (self.inner, self.is_terminated)
2407 }
2408
2409 fn from_inner(
2410 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2411 is_terminated: bool,
2412 ) -> Self {
2413 Self { inner, is_terminated }
2414 }
2415}
2416
2417impl futures::Stream for LogSettingsRequestStream {
2418 type Item = Result<LogSettingsRequest, fidl::Error>;
2419
2420 fn poll_next(
2421 mut self: std::pin::Pin<&mut Self>,
2422 cx: &mut std::task::Context<'_>,
2423 ) -> std::task::Poll<Option<Self::Item>> {
2424 let this = &mut *self;
2425 if this.inner.check_shutdown(cx) {
2426 this.is_terminated = true;
2427 return std::task::Poll::Ready(None);
2428 }
2429 if this.is_terminated {
2430 panic!("polled LogSettingsRequestStream after completion");
2431 }
2432 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2433 |bytes, handles| {
2434 match this.inner.channel().read_etc(cx, bytes, handles) {
2435 std::task::Poll::Ready(Ok(())) => {}
2436 std::task::Poll::Pending => return std::task::Poll::Pending,
2437 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2438 this.is_terminated = true;
2439 return std::task::Poll::Ready(None);
2440 }
2441 std::task::Poll::Ready(Err(e)) => {
2442 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2443 e.into(),
2444 ))))
2445 }
2446 }
2447
2448 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2450
2451 std::task::Poll::Ready(Some(match header.ordinal {
2452 0x49d7c14eec975fb => {
2453 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2454 let mut req = fidl::new_empty!(
2455 LogSettingsRegisterInterestRequest,
2456 fidl::encoding::DefaultFuchsiaResourceDialect
2457 );
2458 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LogSettingsRegisterInterestRequest>(&header, _body_bytes, handles, &mut req)?;
2459 let control_handle = LogSettingsControlHandle { inner: this.inner.clone() };
2460 Ok(LogSettingsRequest::RegisterInterest {
2461 selectors: req.selectors,
2462
2463 control_handle,
2464 })
2465 }
2466 0x71beced9d2411f90 => {
2467 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2468 let mut req = fidl::new_empty!(
2469 LogSettingsSetInterestRequest,
2470 fidl::encoding::DefaultFuchsiaResourceDialect
2471 );
2472 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LogSettingsSetInterestRequest>(&header, _body_bytes, handles, &mut req)?;
2473 let control_handle = LogSettingsControlHandle { inner: this.inner.clone() };
2474 Ok(LogSettingsRequest::SetInterest {
2475 selectors: req.selectors,
2476
2477 responder: LogSettingsSetInterestResponder {
2478 control_handle: std::mem::ManuallyDrop::new(control_handle),
2479 tx_id: header.tx_id,
2480 },
2481 })
2482 }
2483 0x35f7004d2367f6c1 => {
2484 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2485 let mut req = fidl::new_empty!(
2486 LogSettingsSetComponentInterestRequest,
2487 fidl::encoding::DefaultFuchsiaResourceDialect
2488 );
2489 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LogSettingsSetComponentInterestRequest>(&header, _body_bytes, handles, &mut req)?;
2490 let control_handle = LogSettingsControlHandle { inner: this.inner.clone() };
2491 Ok(LogSettingsRequest::SetComponentInterest {
2492 payload: req,
2493 responder: LogSettingsSetComponentInterestResponder {
2494 control_handle: std::mem::ManuallyDrop::new(control_handle),
2495 tx_id: header.tx_id,
2496 },
2497 })
2498 }
2499 _ => Err(fidl::Error::UnknownOrdinal {
2500 ordinal: header.ordinal,
2501 protocol_name:
2502 <LogSettingsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2503 }),
2504 }))
2505 },
2506 )
2507 }
2508}
2509
2510#[derive(Debug)]
2513pub enum LogSettingsRequest {
2514 RegisterInterest {
2515 selectors: Vec<LogInterestSelector>,
2516 control_handle: LogSettingsControlHandle,
2517 },
2518 SetInterest { selectors: Vec<LogInterestSelector>, responder: LogSettingsSetInterestResponder },
2534 SetComponentInterest {
2550 payload: LogSettingsSetComponentInterestRequest,
2551 responder: LogSettingsSetComponentInterestResponder,
2552 },
2553}
2554
2555impl LogSettingsRequest {
2556 #[allow(irrefutable_let_patterns)]
2557 pub fn into_register_interest(
2558 self,
2559 ) -> Option<(Vec<LogInterestSelector>, LogSettingsControlHandle)> {
2560 if let LogSettingsRequest::RegisterInterest { selectors, control_handle } = self {
2561 Some((selectors, control_handle))
2562 } else {
2563 None
2564 }
2565 }
2566
2567 #[allow(irrefutable_let_patterns)]
2568 pub fn into_set_interest(
2569 self,
2570 ) -> Option<(Vec<LogInterestSelector>, LogSettingsSetInterestResponder)> {
2571 if let LogSettingsRequest::SetInterest { selectors, responder } = self {
2572 Some((selectors, responder))
2573 } else {
2574 None
2575 }
2576 }
2577
2578 #[allow(irrefutable_let_patterns)]
2579 pub fn into_set_component_interest(
2580 self,
2581 ) -> Option<(LogSettingsSetComponentInterestRequest, LogSettingsSetComponentInterestResponder)>
2582 {
2583 if let LogSettingsRequest::SetComponentInterest { payload, responder } = self {
2584 Some((payload, responder))
2585 } else {
2586 None
2587 }
2588 }
2589
2590 pub fn method_name(&self) -> &'static str {
2592 match *self {
2593 LogSettingsRequest::RegisterInterest { .. } => "register_interest",
2594 LogSettingsRequest::SetInterest { .. } => "set_interest",
2595 LogSettingsRequest::SetComponentInterest { .. } => "set_component_interest",
2596 }
2597 }
2598}
2599
2600#[derive(Debug, Clone)]
2601pub struct LogSettingsControlHandle {
2602 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2603}
2604
2605impl fidl::endpoints::ControlHandle for LogSettingsControlHandle {
2606 fn shutdown(&self) {
2607 self.inner.shutdown()
2608 }
2609 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2610 self.inner.shutdown_with_epitaph(status)
2611 }
2612
2613 fn is_closed(&self) -> bool {
2614 self.inner.channel().is_closed()
2615 }
2616 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2617 self.inner.channel().on_closed()
2618 }
2619
2620 #[cfg(target_os = "fuchsia")]
2621 fn signal_peer(
2622 &self,
2623 clear_mask: zx::Signals,
2624 set_mask: zx::Signals,
2625 ) -> Result<(), zx_status::Status> {
2626 use fidl::Peered;
2627 self.inner.channel().signal_peer(clear_mask, set_mask)
2628 }
2629}
2630
2631impl LogSettingsControlHandle {}
2632
2633#[must_use = "FIDL methods require a response to be sent"]
2634#[derive(Debug)]
2635pub struct LogSettingsSetInterestResponder {
2636 control_handle: std::mem::ManuallyDrop<LogSettingsControlHandle>,
2637 tx_id: u32,
2638}
2639
2640impl std::ops::Drop for LogSettingsSetInterestResponder {
2644 fn drop(&mut self) {
2645 self.control_handle.shutdown();
2646 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2648 }
2649}
2650
2651impl fidl::endpoints::Responder for LogSettingsSetInterestResponder {
2652 type ControlHandle = LogSettingsControlHandle;
2653
2654 fn control_handle(&self) -> &LogSettingsControlHandle {
2655 &self.control_handle
2656 }
2657
2658 fn drop_without_shutdown(mut self) {
2659 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2661 std::mem::forget(self);
2663 }
2664}
2665
2666impl LogSettingsSetInterestResponder {
2667 pub fn send(self) -> Result<(), fidl::Error> {
2671 let _result = self.send_raw();
2672 if _result.is_err() {
2673 self.control_handle.shutdown();
2674 }
2675 self.drop_without_shutdown();
2676 _result
2677 }
2678
2679 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2681 let _result = self.send_raw();
2682 self.drop_without_shutdown();
2683 _result
2684 }
2685
2686 fn send_raw(&self) -> Result<(), fidl::Error> {
2687 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2688 (),
2689 self.tx_id,
2690 0x71beced9d2411f90,
2691 fidl::encoding::DynamicFlags::empty(),
2692 )
2693 }
2694}
2695
2696#[must_use = "FIDL methods require a response to be sent"]
2697#[derive(Debug)]
2698pub struct LogSettingsSetComponentInterestResponder {
2699 control_handle: std::mem::ManuallyDrop<LogSettingsControlHandle>,
2700 tx_id: u32,
2701}
2702
2703impl std::ops::Drop for LogSettingsSetComponentInterestResponder {
2707 fn drop(&mut self) {
2708 self.control_handle.shutdown();
2709 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2711 }
2712}
2713
2714impl fidl::endpoints::Responder for LogSettingsSetComponentInterestResponder {
2715 type ControlHandle = LogSettingsControlHandle;
2716
2717 fn control_handle(&self) -> &LogSettingsControlHandle {
2718 &self.control_handle
2719 }
2720
2721 fn drop_without_shutdown(mut self) {
2722 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2724 std::mem::forget(self);
2726 }
2727}
2728
2729impl LogSettingsSetComponentInterestResponder {
2730 pub fn send(self) -> Result<(), fidl::Error> {
2734 let _result = self.send_raw();
2735 if _result.is_err() {
2736 self.control_handle.shutdown();
2737 }
2738 self.drop_without_shutdown();
2739 _result
2740 }
2741
2742 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2744 let _result = self.send_raw();
2745 self.drop_without_shutdown();
2746 _result
2747 }
2748
2749 fn send_raw(&self) -> Result<(), fidl::Error> {
2750 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2751 (),
2752 self.tx_id,
2753 0x35f7004d2367f6c1,
2754 fidl::encoding::DynamicFlags::empty(),
2755 )
2756 }
2757}
2758
2759#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2760pub struct LogStreamMarker;
2761
2762impl fidl::endpoints::ProtocolMarker for LogStreamMarker {
2763 type Proxy = LogStreamProxy;
2764 type RequestStream = LogStreamRequestStream;
2765 #[cfg(target_os = "fuchsia")]
2766 type SynchronousProxy = LogStreamSynchronousProxy;
2767
2768 const DEBUG_NAME: &'static str = "fuchsia.diagnostics.LogStream";
2769}
2770impl fidl::endpoints::DiscoverableProtocolMarker for LogStreamMarker {}
2771
2772pub trait LogStreamProxyInterface: Send + Sync {
2773 fn r#connect(&self, socket: fidl::Socket, opts: &LogStreamOptions) -> Result<(), fidl::Error>;
2774}
2775#[derive(Debug)]
2776#[cfg(target_os = "fuchsia")]
2777pub struct LogStreamSynchronousProxy {
2778 client: fidl::client::sync::Client,
2779}
2780
2781#[cfg(target_os = "fuchsia")]
2782impl fidl::endpoints::SynchronousProxy for LogStreamSynchronousProxy {
2783 type Proxy = LogStreamProxy;
2784 type Protocol = LogStreamMarker;
2785
2786 fn from_channel(inner: fidl::Channel) -> Self {
2787 Self::new(inner)
2788 }
2789
2790 fn into_channel(self) -> fidl::Channel {
2791 self.client.into_channel()
2792 }
2793
2794 fn as_channel(&self) -> &fidl::Channel {
2795 self.client.as_channel()
2796 }
2797}
2798
2799#[cfg(target_os = "fuchsia")]
2800impl LogStreamSynchronousProxy {
2801 pub fn new(channel: fidl::Channel) -> Self {
2802 let protocol_name = <LogStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2803 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2804 }
2805
2806 pub fn into_channel(self) -> fidl::Channel {
2807 self.client.into_channel()
2808 }
2809
2810 pub fn wait_for_event(
2813 &self,
2814 deadline: zx::MonotonicInstant,
2815 ) -> Result<LogStreamEvent, fidl::Error> {
2816 LogStreamEvent::decode(self.client.wait_for_event(deadline)?)
2817 }
2818
2819 pub fn r#connect(
2831 &self,
2832 mut socket: fidl::Socket,
2833 mut opts: &LogStreamOptions,
2834 ) -> Result<(), fidl::Error> {
2835 self.client.send::<LogStreamConnectRequest>(
2836 (socket, opts),
2837 0x745eb34f10d51a88,
2838 fidl::encoding::DynamicFlags::FLEXIBLE,
2839 )
2840 }
2841}
2842
2843#[cfg(target_os = "fuchsia")]
2844impl From<LogStreamSynchronousProxy> for zx::Handle {
2845 fn from(value: LogStreamSynchronousProxy) -> Self {
2846 value.into_channel().into()
2847 }
2848}
2849
2850#[cfg(target_os = "fuchsia")]
2851impl From<fidl::Channel> for LogStreamSynchronousProxy {
2852 fn from(value: fidl::Channel) -> Self {
2853 Self::new(value)
2854 }
2855}
2856
2857#[cfg(target_os = "fuchsia")]
2858impl fidl::endpoints::FromClient for LogStreamSynchronousProxy {
2859 type Protocol = LogStreamMarker;
2860
2861 fn from_client(value: fidl::endpoints::ClientEnd<LogStreamMarker>) -> Self {
2862 Self::new(value.into_channel())
2863 }
2864}
2865
2866#[derive(Debug, Clone)]
2867pub struct LogStreamProxy {
2868 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2869}
2870
2871impl fidl::endpoints::Proxy for LogStreamProxy {
2872 type Protocol = LogStreamMarker;
2873
2874 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2875 Self::new(inner)
2876 }
2877
2878 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2879 self.client.into_channel().map_err(|client| Self { client })
2880 }
2881
2882 fn as_channel(&self) -> &::fidl::AsyncChannel {
2883 self.client.as_channel()
2884 }
2885}
2886
2887impl LogStreamProxy {
2888 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2890 let protocol_name = <LogStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2891 Self { client: fidl::client::Client::new(channel, protocol_name) }
2892 }
2893
2894 pub fn take_event_stream(&self) -> LogStreamEventStream {
2900 LogStreamEventStream { event_receiver: self.client.take_event_receiver() }
2901 }
2902
2903 pub fn r#connect(
2915 &self,
2916 mut socket: fidl::Socket,
2917 mut opts: &LogStreamOptions,
2918 ) -> Result<(), fidl::Error> {
2919 LogStreamProxyInterface::r#connect(self, socket, opts)
2920 }
2921}
2922
2923impl LogStreamProxyInterface for LogStreamProxy {
2924 fn r#connect(
2925 &self,
2926 mut socket: fidl::Socket,
2927 mut opts: &LogStreamOptions,
2928 ) -> Result<(), fidl::Error> {
2929 self.client.send::<LogStreamConnectRequest>(
2930 (socket, opts),
2931 0x745eb34f10d51a88,
2932 fidl::encoding::DynamicFlags::FLEXIBLE,
2933 )
2934 }
2935}
2936
2937pub struct LogStreamEventStream {
2938 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2939}
2940
2941impl std::marker::Unpin for LogStreamEventStream {}
2942
2943impl futures::stream::FusedStream for LogStreamEventStream {
2944 fn is_terminated(&self) -> bool {
2945 self.event_receiver.is_terminated()
2946 }
2947}
2948
2949impl futures::Stream for LogStreamEventStream {
2950 type Item = Result<LogStreamEvent, fidl::Error>;
2951
2952 fn poll_next(
2953 mut self: std::pin::Pin<&mut Self>,
2954 cx: &mut std::task::Context<'_>,
2955 ) -> std::task::Poll<Option<Self::Item>> {
2956 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2957 &mut self.event_receiver,
2958 cx
2959 )?) {
2960 Some(buf) => std::task::Poll::Ready(Some(LogStreamEvent::decode(buf))),
2961 None => std::task::Poll::Ready(None),
2962 }
2963 }
2964}
2965
2966#[derive(Debug)]
2967pub enum LogStreamEvent {
2968 #[non_exhaustive]
2969 _UnknownEvent {
2970 ordinal: u64,
2972 },
2973}
2974
2975impl LogStreamEvent {
2976 fn decode(
2978 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2979 ) -> Result<LogStreamEvent, fidl::Error> {
2980 let (bytes, _handles) = buf.split_mut();
2981 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2982 debug_assert_eq!(tx_header.tx_id, 0);
2983 match tx_header.ordinal {
2984 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2985 Ok(LogStreamEvent::_UnknownEvent { ordinal: tx_header.ordinal })
2986 }
2987 _ => Err(fidl::Error::UnknownOrdinal {
2988 ordinal: tx_header.ordinal,
2989 protocol_name: <LogStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2990 }),
2991 }
2992 }
2993}
2994
2995pub struct LogStreamRequestStream {
2997 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2998 is_terminated: bool,
2999}
3000
3001impl std::marker::Unpin for LogStreamRequestStream {}
3002
3003impl futures::stream::FusedStream for LogStreamRequestStream {
3004 fn is_terminated(&self) -> bool {
3005 self.is_terminated
3006 }
3007}
3008
3009impl fidl::endpoints::RequestStream for LogStreamRequestStream {
3010 type Protocol = LogStreamMarker;
3011 type ControlHandle = LogStreamControlHandle;
3012
3013 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3014 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3015 }
3016
3017 fn control_handle(&self) -> Self::ControlHandle {
3018 LogStreamControlHandle { inner: self.inner.clone() }
3019 }
3020
3021 fn into_inner(
3022 self,
3023 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3024 {
3025 (self.inner, self.is_terminated)
3026 }
3027
3028 fn from_inner(
3029 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3030 is_terminated: bool,
3031 ) -> Self {
3032 Self { inner, is_terminated }
3033 }
3034}
3035
3036impl futures::Stream for LogStreamRequestStream {
3037 type Item = Result<LogStreamRequest, fidl::Error>;
3038
3039 fn poll_next(
3040 mut self: std::pin::Pin<&mut Self>,
3041 cx: &mut std::task::Context<'_>,
3042 ) -> std::task::Poll<Option<Self::Item>> {
3043 let this = &mut *self;
3044 if this.inner.check_shutdown(cx) {
3045 this.is_terminated = true;
3046 return std::task::Poll::Ready(None);
3047 }
3048 if this.is_terminated {
3049 panic!("polled LogStreamRequestStream after completion");
3050 }
3051 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3052 |bytes, handles| {
3053 match this.inner.channel().read_etc(cx, bytes, handles) {
3054 std::task::Poll::Ready(Ok(())) => {}
3055 std::task::Poll::Pending => return std::task::Poll::Pending,
3056 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3057 this.is_terminated = true;
3058 return std::task::Poll::Ready(None);
3059 }
3060 std::task::Poll::Ready(Err(e)) => {
3061 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3062 e.into(),
3063 ))))
3064 }
3065 }
3066
3067 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3069
3070 std::task::Poll::Ready(Some(match header.ordinal {
3071 0x745eb34f10d51a88 => {
3072 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3073 let mut req = fidl::new_empty!(
3074 LogStreamConnectRequest,
3075 fidl::encoding::DefaultFuchsiaResourceDialect
3076 );
3077 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LogStreamConnectRequest>(&header, _body_bytes, handles, &mut req)?;
3078 let control_handle = LogStreamControlHandle { inner: this.inner.clone() };
3079 Ok(LogStreamRequest::Connect {
3080 socket: req.socket,
3081 opts: req.opts,
3082
3083 control_handle,
3084 })
3085 }
3086 _ if header.tx_id == 0
3087 && header
3088 .dynamic_flags()
3089 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3090 {
3091 Ok(LogStreamRequest::_UnknownMethod {
3092 ordinal: header.ordinal,
3093 control_handle: LogStreamControlHandle { inner: this.inner.clone() },
3094 method_type: fidl::MethodType::OneWay,
3095 })
3096 }
3097 _ if header
3098 .dynamic_flags()
3099 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3100 {
3101 this.inner.send_framework_err(
3102 fidl::encoding::FrameworkErr::UnknownMethod,
3103 header.tx_id,
3104 header.ordinal,
3105 header.dynamic_flags(),
3106 (bytes, handles),
3107 )?;
3108 Ok(LogStreamRequest::_UnknownMethod {
3109 ordinal: header.ordinal,
3110 control_handle: LogStreamControlHandle { inner: this.inner.clone() },
3111 method_type: fidl::MethodType::TwoWay,
3112 })
3113 }
3114 _ => Err(fidl::Error::UnknownOrdinal {
3115 ordinal: header.ordinal,
3116 protocol_name:
3117 <LogStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3118 }),
3119 }))
3120 },
3121 )
3122 }
3123}
3124
3125#[derive(Debug)]
3126pub enum LogStreamRequest {
3127 Connect { socket: fidl::Socket, opts: LogStreamOptions, control_handle: LogStreamControlHandle },
3139 #[non_exhaustive]
3141 _UnknownMethod {
3142 ordinal: u64,
3144 control_handle: LogStreamControlHandle,
3145 method_type: fidl::MethodType,
3146 },
3147}
3148
3149impl LogStreamRequest {
3150 #[allow(irrefutable_let_patterns)]
3151 pub fn into_connect(self) -> Option<(fidl::Socket, LogStreamOptions, LogStreamControlHandle)> {
3152 if let LogStreamRequest::Connect { socket, opts, control_handle } = self {
3153 Some((socket, opts, control_handle))
3154 } else {
3155 None
3156 }
3157 }
3158
3159 pub fn method_name(&self) -> &'static str {
3161 match *self {
3162 LogStreamRequest::Connect { .. } => "connect",
3163 LogStreamRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
3164 "unknown one-way method"
3165 }
3166 LogStreamRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
3167 "unknown two-way method"
3168 }
3169 }
3170 }
3171}
3172
3173#[derive(Debug, Clone)]
3174pub struct LogStreamControlHandle {
3175 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3176}
3177
3178impl fidl::endpoints::ControlHandle for LogStreamControlHandle {
3179 fn shutdown(&self) {
3180 self.inner.shutdown()
3181 }
3182 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3183 self.inner.shutdown_with_epitaph(status)
3184 }
3185
3186 fn is_closed(&self) -> bool {
3187 self.inner.channel().is_closed()
3188 }
3189 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3190 self.inner.channel().on_closed()
3191 }
3192
3193 #[cfg(target_os = "fuchsia")]
3194 fn signal_peer(
3195 &self,
3196 clear_mask: zx::Signals,
3197 set_mask: zx::Signals,
3198 ) -> Result<(), zx_status::Status> {
3199 use fidl::Peered;
3200 self.inner.channel().signal_peer(clear_mask, set_mask)
3201 }
3202}
3203
3204impl LogStreamControlHandle {}
3205
3206mod internal {
3207 use super::*;
3208
3209 impl fidl::encoding::ResourceTypeMarker for ArchiveAccessorStreamDiagnosticsRequest {
3210 type Borrowed<'a> = &'a mut Self;
3211 fn take_or_borrow<'a>(
3212 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3213 ) -> Self::Borrowed<'a> {
3214 value
3215 }
3216 }
3217
3218 unsafe impl fidl::encoding::TypeMarker for ArchiveAccessorStreamDiagnosticsRequest {
3219 type Owned = Self;
3220
3221 #[inline(always)]
3222 fn inline_align(_context: fidl::encoding::Context) -> usize {
3223 8
3224 }
3225
3226 #[inline(always)]
3227 fn inline_size(_context: fidl::encoding::Context) -> usize {
3228 24
3229 }
3230 }
3231
3232 unsafe impl
3233 fidl::encoding::Encode<
3234 ArchiveAccessorStreamDiagnosticsRequest,
3235 fidl::encoding::DefaultFuchsiaResourceDialect,
3236 > for &mut ArchiveAccessorStreamDiagnosticsRequest
3237 {
3238 #[inline]
3239 unsafe fn encode(
3240 self,
3241 encoder: &mut fidl::encoding::Encoder<
3242 '_,
3243 fidl::encoding::DefaultFuchsiaResourceDialect,
3244 >,
3245 offset: usize,
3246 _depth: fidl::encoding::Depth,
3247 ) -> fidl::Result<()> {
3248 encoder.debug_check_bounds::<ArchiveAccessorStreamDiagnosticsRequest>(offset);
3249 fidl::encoding::Encode::<ArchiveAccessorStreamDiagnosticsRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
3251 (
3252 <StreamParameters as fidl::encoding::ValueTypeMarker>::borrow(&self.stream_parameters),
3253 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BatchIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.result_stream),
3254 ),
3255 encoder, offset, _depth
3256 )
3257 }
3258 }
3259 unsafe impl<
3260 T0: fidl::encoding::Encode<StreamParameters, fidl::encoding::DefaultFuchsiaResourceDialect>,
3261 T1: fidl::encoding::Encode<
3262 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BatchIteratorMarker>>,
3263 fidl::encoding::DefaultFuchsiaResourceDialect,
3264 >,
3265 >
3266 fidl::encoding::Encode<
3267 ArchiveAccessorStreamDiagnosticsRequest,
3268 fidl::encoding::DefaultFuchsiaResourceDialect,
3269 > for (T0, T1)
3270 {
3271 #[inline]
3272 unsafe fn encode(
3273 self,
3274 encoder: &mut fidl::encoding::Encoder<
3275 '_,
3276 fidl::encoding::DefaultFuchsiaResourceDialect,
3277 >,
3278 offset: usize,
3279 depth: fidl::encoding::Depth,
3280 ) -> fidl::Result<()> {
3281 encoder.debug_check_bounds::<ArchiveAccessorStreamDiagnosticsRequest>(offset);
3282 unsafe {
3285 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
3286 (ptr as *mut u64).write_unaligned(0);
3287 }
3288 self.0.encode(encoder, offset + 0, depth)?;
3290 self.1.encode(encoder, offset + 16, depth)?;
3291 Ok(())
3292 }
3293 }
3294
3295 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3296 for ArchiveAccessorStreamDiagnosticsRequest
3297 {
3298 #[inline(always)]
3299 fn new_empty() -> Self {
3300 Self {
3301 stream_parameters: fidl::new_empty!(
3302 StreamParameters,
3303 fidl::encoding::DefaultFuchsiaResourceDialect
3304 ),
3305 result_stream: fidl::new_empty!(
3306 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BatchIteratorMarker>>,
3307 fidl::encoding::DefaultFuchsiaResourceDialect
3308 ),
3309 }
3310 }
3311
3312 #[inline]
3313 unsafe fn decode(
3314 &mut self,
3315 decoder: &mut fidl::encoding::Decoder<
3316 '_,
3317 fidl::encoding::DefaultFuchsiaResourceDialect,
3318 >,
3319 offset: usize,
3320 _depth: fidl::encoding::Depth,
3321 ) -> fidl::Result<()> {
3322 decoder.debug_check_bounds::<Self>(offset);
3323 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
3325 let padval = unsafe { (ptr as *const u64).read_unaligned() };
3326 let mask = 0xffffffff00000000u64;
3327 let maskedval = padval & mask;
3328 if maskedval != 0 {
3329 return Err(fidl::Error::NonZeroPadding {
3330 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
3331 });
3332 }
3333 fidl::decode!(
3334 StreamParameters,
3335 fidl::encoding::DefaultFuchsiaResourceDialect,
3336 &mut self.stream_parameters,
3337 decoder,
3338 offset + 0,
3339 _depth
3340 )?;
3341 fidl::decode!(
3342 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BatchIteratorMarker>>,
3343 fidl::encoding::DefaultFuchsiaResourceDialect,
3344 &mut self.result_stream,
3345 decoder,
3346 offset + 16,
3347 _depth
3348 )?;
3349 Ok(())
3350 }
3351 }
3352
3353 impl fidl::encoding::ResourceTypeMarker for BatchIteratorGetNextResponse {
3354 type Borrowed<'a> = &'a mut Self;
3355 fn take_or_borrow<'a>(
3356 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3357 ) -> Self::Borrowed<'a> {
3358 value
3359 }
3360 }
3361
3362 unsafe impl fidl::encoding::TypeMarker for BatchIteratorGetNextResponse {
3363 type Owned = Self;
3364
3365 #[inline(always)]
3366 fn inline_align(_context: fidl::encoding::Context) -> usize {
3367 8
3368 }
3369
3370 #[inline(always)]
3371 fn inline_size(_context: fidl::encoding::Context) -> usize {
3372 16
3373 }
3374 }
3375
3376 unsafe impl
3377 fidl::encoding::Encode<
3378 BatchIteratorGetNextResponse,
3379 fidl::encoding::DefaultFuchsiaResourceDialect,
3380 > for &mut BatchIteratorGetNextResponse
3381 {
3382 #[inline]
3383 unsafe fn encode(
3384 self,
3385 encoder: &mut fidl::encoding::Encoder<
3386 '_,
3387 fidl::encoding::DefaultFuchsiaResourceDialect,
3388 >,
3389 offset: usize,
3390 _depth: fidl::encoding::Depth,
3391 ) -> fidl::Result<()> {
3392 encoder.debug_check_bounds::<BatchIteratorGetNextResponse>(offset);
3393 fidl::encoding::Encode::<BatchIteratorGetNextResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
3395 (
3396 <fidl::encoding::Vector<FormattedContent, 64> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.batch),
3397 ),
3398 encoder, offset, _depth
3399 )
3400 }
3401 }
3402 unsafe impl<
3403 T0: fidl::encoding::Encode<
3404 fidl::encoding::Vector<FormattedContent, 64>,
3405 fidl::encoding::DefaultFuchsiaResourceDialect,
3406 >,
3407 >
3408 fidl::encoding::Encode<
3409 BatchIteratorGetNextResponse,
3410 fidl::encoding::DefaultFuchsiaResourceDialect,
3411 > for (T0,)
3412 {
3413 #[inline]
3414 unsafe fn encode(
3415 self,
3416 encoder: &mut fidl::encoding::Encoder<
3417 '_,
3418 fidl::encoding::DefaultFuchsiaResourceDialect,
3419 >,
3420 offset: usize,
3421 depth: fidl::encoding::Depth,
3422 ) -> fidl::Result<()> {
3423 encoder.debug_check_bounds::<BatchIteratorGetNextResponse>(offset);
3424 self.0.encode(encoder, offset + 0, depth)?;
3428 Ok(())
3429 }
3430 }
3431
3432 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3433 for BatchIteratorGetNextResponse
3434 {
3435 #[inline(always)]
3436 fn new_empty() -> Self {
3437 Self {
3438 batch: fidl::new_empty!(fidl::encoding::Vector<FormattedContent, 64>, fidl::encoding::DefaultFuchsiaResourceDialect),
3439 }
3440 }
3441
3442 #[inline]
3443 unsafe fn decode(
3444 &mut self,
3445 decoder: &mut fidl::encoding::Decoder<
3446 '_,
3447 fidl::encoding::DefaultFuchsiaResourceDialect,
3448 >,
3449 offset: usize,
3450 _depth: fidl::encoding::Depth,
3451 ) -> fidl::Result<()> {
3452 decoder.debug_check_bounds::<Self>(offset);
3453 fidl::decode!(fidl::encoding::Vector<FormattedContent, 64>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.batch, decoder, offset + 0, _depth)?;
3455 Ok(())
3456 }
3457 }
3458
3459 impl fidl::encoding::ResourceTypeMarker for LogStreamConnectRequest {
3460 type Borrowed<'a> = &'a mut Self;
3461 fn take_or_borrow<'a>(
3462 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3463 ) -> Self::Borrowed<'a> {
3464 value
3465 }
3466 }
3467
3468 unsafe impl fidl::encoding::TypeMarker for LogStreamConnectRequest {
3469 type Owned = Self;
3470
3471 #[inline(always)]
3472 fn inline_align(_context: fidl::encoding::Context) -> usize {
3473 8
3474 }
3475
3476 #[inline(always)]
3477 fn inline_size(_context: fidl::encoding::Context) -> usize {
3478 24
3479 }
3480 }
3481
3482 unsafe impl
3483 fidl::encoding::Encode<
3484 LogStreamConnectRequest,
3485 fidl::encoding::DefaultFuchsiaResourceDialect,
3486 > for &mut LogStreamConnectRequest
3487 {
3488 #[inline]
3489 unsafe fn encode(
3490 self,
3491 encoder: &mut fidl::encoding::Encoder<
3492 '_,
3493 fidl::encoding::DefaultFuchsiaResourceDialect,
3494 >,
3495 offset: usize,
3496 _depth: fidl::encoding::Depth,
3497 ) -> fidl::Result<()> {
3498 encoder.debug_check_bounds::<LogStreamConnectRequest>(offset);
3499 fidl::encoding::Encode::<
3501 LogStreamConnectRequest,
3502 fidl::encoding::DefaultFuchsiaResourceDialect,
3503 >::encode(
3504 (
3505 <fidl::encoding::HandleType<
3506 fidl::Socket,
3507 { fidl::ObjectType::SOCKET.into_raw() },
3508 16392,
3509 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3510 &mut self.socket
3511 ),
3512 <LogStreamOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.opts),
3513 ),
3514 encoder,
3515 offset,
3516 _depth,
3517 )
3518 }
3519 }
3520 unsafe impl<
3521 T0: fidl::encoding::Encode<
3522 fidl::encoding::HandleType<
3523 fidl::Socket,
3524 { fidl::ObjectType::SOCKET.into_raw() },
3525 16392,
3526 >,
3527 fidl::encoding::DefaultFuchsiaResourceDialect,
3528 >,
3529 T1: fidl::encoding::Encode<LogStreamOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
3530 >
3531 fidl::encoding::Encode<
3532 LogStreamConnectRequest,
3533 fidl::encoding::DefaultFuchsiaResourceDialect,
3534 > for (T0, T1)
3535 {
3536 #[inline]
3537 unsafe fn encode(
3538 self,
3539 encoder: &mut fidl::encoding::Encoder<
3540 '_,
3541 fidl::encoding::DefaultFuchsiaResourceDialect,
3542 >,
3543 offset: usize,
3544 depth: fidl::encoding::Depth,
3545 ) -> fidl::Result<()> {
3546 encoder.debug_check_bounds::<LogStreamConnectRequest>(offset);
3547 unsafe {
3550 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
3551 (ptr as *mut u64).write_unaligned(0);
3552 }
3553 self.0.encode(encoder, offset + 0, depth)?;
3555 self.1.encode(encoder, offset + 8, depth)?;
3556 Ok(())
3557 }
3558 }
3559
3560 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3561 for LogStreamConnectRequest
3562 {
3563 #[inline(always)]
3564 fn new_empty() -> Self {
3565 Self {
3566 socket: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 16392>, fidl::encoding::DefaultFuchsiaResourceDialect),
3567 opts: fidl::new_empty!(
3568 LogStreamOptions,
3569 fidl::encoding::DefaultFuchsiaResourceDialect
3570 ),
3571 }
3572 }
3573
3574 #[inline]
3575 unsafe fn decode(
3576 &mut self,
3577 decoder: &mut fidl::encoding::Decoder<
3578 '_,
3579 fidl::encoding::DefaultFuchsiaResourceDialect,
3580 >,
3581 offset: usize,
3582 _depth: fidl::encoding::Depth,
3583 ) -> fidl::Result<()> {
3584 decoder.debug_check_bounds::<Self>(offset);
3585 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
3587 let padval = unsafe { (ptr as *const u64).read_unaligned() };
3588 let mask = 0xffffffff00000000u64;
3589 let maskedval = padval & mask;
3590 if maskedval != 0 {
3591 return Err(fidl::Error::NonZeroPadding {
3592 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
3593 });
3594 }
3595 fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 16392>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.socket, decoder, offset + 0, _depth)?;
3596 fidl::decode!(
3597 LogStreamOptions,
3598 fidl::encoding::DefaultFuchsiaResourceDialect,
3599 &mut self.opts,
3600 decoder,
3601 offset + 8,
3602 _depth
3603 )?;
3604 Ok(())
3605 }
3606 }
3607
3608 impl fidl::encoding::ResourceTypeMarker for FormattedContent {
3609 type Borrowed<'a> = &'a mut Self;
3610 fn take_or_borrow<'a>(
3611 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3612 ) -> Self::Borrowed<'a> {
3613 value
3614 }
3615 }
3616
3617 unsafe impl fidl::encoding::TypeMarker for FormattedContent {
3618 type Owned = Self;
3619
3620 #[inline(always)]
3621 fn inline_align(_context: fidl::encoding::Context) -> usize {
3622 8
3623 }
3624
3625 #[inline(always)]
3626 fn inline_size(_context: fidl::encoding::Context) -> usize {
3627 16
3628 }
3629 }
3630
3631 unsafe impl
3632 fidl::encoding::Encode<FormattedContent, fidl::encoding::DefaultFuchsiaResourceDialect>
3633 for &mut FormattedContent
3634 {
3635 #[inline]
3636 unsafe fn encode(
3637 self,
3638 encoder: &mut fidl::encoding::Encoder<
3639 '_,
3640 fidl::encoding::DefaultFuchsiaResourceDialect,
3641 >,
3642 offset: usize,
3643 _depth: fidl::encoding::Depth,
3644 ) -> fidl::Result<()> {
3645 encoder.debug_check_bounds::<FormattedContent>(offset);
3646 encoder.write_num::<u64>(self.ordinal(), offset);
3647 match self {
3648 FormattedContent::Json(ref mut val) => {
3649 fidl::encoding::encode_in_envelope::<fidl_fuchsia_mem::Buffer, fidl::encoding::DefaultFuchsiaResourceDialect>(
3650 <fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
3651 encoder, offset + 8, _depth
3652 )
3653 }
3654 FormattedContent::Text(ref mut val) => {
3655 fidl::encoding::encode_in_envelope::<fidl_fuchsia_mem::Buffer, fidl::encoding::DefaultFuchsiaResourceDialect>(
3656 <fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
3657 encoder, offset + 8, _depth
3658 )
3659 }
3660 FormattedContent::Cbor(ref mut val) => {
3661 fidl::encoding::encode_in_envelope::<fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect>(
3662 <fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
3663 encoder, offset + 8, _depth
3664 )
3665 }
3666 FormattedContent::Fxt(ref mut val) => {
3667 fidl::encoding::encode_in_envelope::<fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect>(
3668 <fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
3669 encoder, offset + 8, _depth
3670 )
3671 }
3672 FormattedContent::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
3673 }
3674 }
3675 }
3676
3677 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3678 for FormattedContent
3679 {
3680 #[inline(always)]
3681 fn new_empty() -> Self {
3682 Self::__SourceBreaking { unknown_ordinal: 0 }
3683 }
3684
3685 #[inline]
3686 unsafe fn decode(
3687 &mut self,
3688 decoder: &mut fidl::encoding::Decoder<
3689 '_,
3690 fidl::encoding::DefaultFuchsiaResourceDialect,
3691 >,
3692 offset: usize,
3693 mut depth: fidl::encoding::Depth,
3694 ) -> fidl::Result<()> {
3695 decoder.debug_check_bounds::<Self>(offset);
3696 #[allow(unused_variables)]
3697 let next_out_of_line = decoder.next_out_of_line();
3698 let handles_before = decoder.remaining_handles();
3699 let (ordinal, inlined, num_bytes, num_handles) =
3700 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
3701
3702 let member_inline_size = match ordinal {
3703 1 => <fidl_fuchsia_mem::Buffer as fidl::encoding::TypeMarker>::inline_size(
3704 decoder.context,
3705 ),
3706 2 => <fidl_fuchsia_mem::Buffer as fidl::encoding::TypeMarker>::inline_size(
3707 decoder.context,
3708 ),
3709 3 => <fidl::encoding::HandleType<
3710 fidl::Vmo,
3711 { fidl::ObjectType::VMO.into_raw() },
3712 2147483648,
3713 > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3714 4 => <fidl::encoding::HandleType<
3715 fidl::Vmo,
3716 { fidl::ObjectType::VMO.into_raw() },
3717 2147483648,
3718 > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3719 0 => return Err(fidl::Error::UnknownUnionTag),
3720 _ => num_bytes as usize,
3721 };
3722
3723 if inlined != (member_inline_size <= 4) {
3724 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3725 }
3726 let _inner_offset;
3727 if inlined {
3728 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
3729 _inner_offset = offset + 8;
3730 } else {
3731 depth.increment()?;
3732 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3733 }
3734 match ordinal {
3735 1 => {
3736 #[allow(irrefutable_let_patterns)]
3737 if let FormattedContent::Json(_) = self {
3738 } else {
3740 *self = FormattedContent::Json(fidl::new_empty!(
3742 fidl_fuchsia_mem::Buffer,
3743 fidl::encoding::DefaultFuchsiaResourceDialect
3744 ));
3745 }
3746 #[allow(irrefutable_let_patterns)]
3747 if let FormattedContent::Json(ref mut val) = self {
3748 fidl::decode!(
3749 fidl_fuchsia_mem::Buffer,
3750 fidl::encoding::DefaultFuchsiaResourceDialect,
3751 val,
3752 decoder,
3753 _inner_offset,
3754 depth
3755 )?;
3756 } else {
3757 unreachable!()
3758 }
3759 }
3760 2 => {
3761 #[allow(irrefutable_let_patterns)]
3762 if let FormattedContent::Text(_) = self {
3763 } else {
3765 *self = FormattedContent::Text(fidl::new_empty!(
3767 fidl_fuchsia_mem::Buffer,
3768 fidl::encoding::DefaultFuchsiaResourceDialect
3769 ));
3770 }
3771 #[allow(irrefutable_let_patterns)]
3772 if let FormattedContent::Text(ref mut val) = self {
3773 fidl::decode!(
3774 fidl_fuchsia_mem::Buffer,
3775 fidl::encoding::DefaultFuchsiaResourceDialect,
3776 val,
3777 decoder,
3778 _inner_offset,
3779 depth
3780 )?;
3781 } else {
3782 unreachable!()
3783 }
3784 }
3785 3 => {
3786 #[allow(irrefutable_let_patterns)]
3787 if let FormattedContent::Cbor(_) = self {
3788 } else {
3790 *self = FormattedContent::Cbor(
3792 fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
3793 );
3794 }
3795 #[allow(irrefutable_let_patterns)]
3796 if let FormattedContent::Cbor(ref mut val) = self {
3797 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
3798 } else {
3799 unreachable!()
3800 }
3801 }
3802 4 => {
3803 #[allow(irrefutable_let_patterns)]
3804 if let FormattedContent::Fxt(_) = self {
3805 } else {
3807 *self = FormattedContent::Fxt(
3809 fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
3810 );
3811 }
3812 #[allow(irrefutable_let_patterns)]
3813 if let FormattedContent::Fxt(ref mut val) = self {
3814 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
3815 } else {
3816 unreachable!()
3817 }
3818 }
3819 #[allow(deprecated)]
3820 ordinal => {
3821 for _ in 0..num_handles {
3822 decoder.drop_next_handle()?;
3823 }
3824 *self = FormattedContent::__SourceBreaking { unknown_ordinal: ordinal };
3825 }
3826 }
3827 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
3828 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3829 }
3830 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3831 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3832 }
3833 Ok(())
3834 }
3835 }
3836}