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#[derive(Debug, Clone)]
243pub struct ArchiveAccessorProxy {
244 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
245}
246
247impl fidl::endpoints::Proxy for ArchiveAccessorProxy {
248 type Protocol = ArchiveAccessorMarker;
249
250 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
251 Self::new(inner)
252 }
253
254 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
255 self.client.into_channel().map_err(|client| Self { client })
256 }
257
258 fn as_channel(&self) -> &::fidl::AsyncChannel {
259 self.client.as_channel()
260 }
261}
262
263impl ArchiveAccessorProxy {
264 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
266 let protocol_name = <ArchiveAccessorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
267 Self { client: fidl::client::Client::new(channel, protocol_name) }
268 }
269
270 pub fn take_event_stream(&self) -> ArchiveAccessorEventStream {
276 ArchiveAccessorEventStream { event_receiver: self.client.take_event_receiver() }
277 }
278
279 pub fn r#stream_diagnostics(
297 &self,
298 mut stream_parameters: &StreamParameters,
299 mut result_stream: fidl::endpoints::ServerEnd<BatchIteratorMarker>,
300 ) -> Result<(), fidl::Error> {
301 ArchiveAccessorProxyInterface::r#stream_diagnostics(self, stream_parameters, result_stream)
302 }
303
304 pub fn r#wait_for_ready(
307 &self,
308 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
309 ArchiveAccessorProxyInterface::r#wait_for_ready(self)
310 }
311}
312
313impl ArchiveAccessorProxyInterface for ArchiveAccessorProxy {
314 fn r#stream_diagnostics(
315 &self,
316 mut stream_parameters: &StreamParameters,
317 mut result_stream: fidl::endpoints::ServerEnd<BatchIteratorMarker>,
318 ) -> Result<(), fidl::Error> {
319 self.client.send::<ArchiveAccessorStreamDiagnosticsRequest>(
320 (stream_parameters, result_stream),
321 0x20c73e2ecd653c3e,
322 fidl::encoding::DynamicFlags::FLEXIBLE,
323 )
324 }
325
326 type WaitForReadyResponseFut =
327 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
328 fn r#wait_for_ready(&self) -> Self::WaitForReadyResponseFut {
329 fn _decode(
330 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
331 ) -> Result<(), fidl::Error> {
332 let _response = fidl::client::decode_transaction_body::<
333 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
334 fidl::encoding::DefaultFuchsiaResourceDialect,
335 0x122963198011bd24,
336 >(_buf?)?
337 .into_result::<ArchiveAccessorMarker>("wait_for_ready")?;
338 Ok(_response)
339 }
340 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
341 (),
342 0x122963198011bd24,
343 fidl::encoding::DynamicFlags::FLEXIBLE,
344 _decode,
345 )
346 }
347}
348
349pub struct ArchiveAccessorEventStream {
350 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
351}
352
353impl std::marker::Unpin for ArchiveAccessorEventStream {}
354
355impl futures::stream::FusedStream for ArchiveAccessorEventStream {
356 fn is_terminated(&self) -> bool {
357 self.event_receiver.is_terminated()
358 }
359}
360
361impl futures::Stream for ArchiveAccessorEventStream {
362 type Item = Result<ArchiveAccessorEvent, fidl::Error>;
363
364 fn poll_next(
365 mut self: std::pin::Pin<&mut Self>,
366 cx: &mut std::task::Context<'_>,
367 ) -> std::task::Poll<Option<Self::Item>> {
368 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
369 &mut self.event_receiver,
370 cx
371 )?) {
372 Some(buf) => std::task::Poll::Ready(Some(ArchiveAccessorEvent::decode(buf))),
373 None => std::task::Poll::Ready(None),
374 }
375 }
376}
377
378#[derive(Debug)]
379pub enum ArchiveAccessorEvent {
380 #[non_exhaustive]
381 _UnknownEvent {
382 ordinal: u64,
384 },
385}
386
387impl ArchiveAccessorEvent {
388 fn decode(
390 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
391 ) -> Result<ArchiveAccessorEvent, fidl::Error> {
392 let (bytes, _handles) = buf.split_mut();
393 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
394 debug_assert_eq!(tx_header.tx_id, 0);
395 match tx_header.ordinal {
396 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
397 Ok(ArchiveAccessorEvent::_UnknownEvent { ordinal: tx_header.ordinal })
398 }
399 _ => Err(fidl::Error::UnknownOrdinal {
400 ordinal: tx_header.ordinal,
401 protocol_name:
402 <ArchiveAccessorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
403 }),
404 }
405 }
406}
407
408pub struct ArchiveAccessorRequestStream {
410 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
411 is_terminated: bool,
412}
413
414impl std::marker::Unpin for ArchiveAccessorRequestStream {}
415
416impl futures::stream::FusedStream for ArchiveAccessorRequestStream {
417 fn is_terminated(&self) -> bool {
418 self.is_terminated
419 }
420}
421
422impl fidl::endpoints::RequestStream for ArchiveAccessorRequestStream {
423 type Protocol = ArchiveAccessorMarker;
424 type ControlHandle = ArchiveAccessorControlHandle;
425
426 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
427 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
428 }
429
430 fn control_handle(&self) -> Self::ControlHandle {
431 ArchiveAccessorControlHandle { inner: self.inner.clone() }
432 }
433
434 fn into_inner(
435 self,
436 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
437 {
438 (self.inner, self.is_terminated)
439 }
440
441 fn from_inner(
442 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
443 is_terminated: bool,
444 ) -> Self {
445 Self { inner, is_terminated }
446 }
447}
448
449impl futures::Stream for ArchiveAccessorRequestStream {
450 type Item = Result<ArchiveAccessorRequest, fidl::Error>;
451
452 fn poll_next(
453 mut self: std::pin::Pin<&mut Self>,
454 cx: &mut std::task::Context<'_>,
455 ) -> std::task::Poll<Option<Self::Item>> {
456 let this = &mut *self;
457 if this.inner.check_shutdown(cx) {
458 this.is_terminated = true;
459 return std::task::Poll::Ready(None);
460 }
461 if this.is_terminated {
462 panic!("polled ArchiveAccessorRequestStream after completion");
463 }
464 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
465 |bytes, handles| {
466 match this.inner.channel().read_etc(cx, bytes, handles) {
467 std::task::Poll::Ready(Ok(())) => {}
468 std::task::Poll::Pending => return std::task::Poll::Pending,
469 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
470 this.is_terminated = true;
471 return std::task::Poll::Ready(None);
472 }
473 std::task::Poll::Ready(Err(e)) => {
474 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
475 e.into(),
476 ))))
477 }
478 }
479
480 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
482
483 std::task::Poll::Ready(Some(match header.ordinal {
484 0x20c73e2ecd653c3e => {
485 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
486 let mut req = fidl::new_empty!(
487 ArchiveAccessorStreamDiagnosticsRequest,
488 fidl::encoding::DefaultFuchsiaResourceDialect
489 );
490 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ArchiveAccessorStreamDiagnosticsRequest>(&header, _body_bytes, handles, &mut req)?;
491 let control_handle =
492 ArchiveAccessorControlHandle { inner: this.inner.clone() };
493 Ok(ArchiveAccessorRequest::StreamDiagnostics {
494 stream_parameters: req.stream_parameters,
495 result_stream: req.result_stream,
496
497 control_handle,
498 })
499 }
500 0x122963198011bd24 => {
501 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
502 let mut req = fidl::new_empty!(
503 fidl::encoding::EmptyPayload,
504 fidl::encoding::DefaultFuchsiaResourceDialect
505 );
506 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
507 let control_handle =
508 ArchiveAccessorControlHandle { inner: this.inner.clone() };
509 Ok(ArchiveAccessorRequest::WaitForReady {
510 responder: ArchiveAccessorWaitForReadyResponder {
511 control_handle: std::mem::ManuallyDrop::new(control_handle),
512 tx_id: header.tx_id,
513 },
514 })
515 }
516 _ if header.tx_id == 0
517 && header
518 .dynamic_flags()
519 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
520 {
521 Ok(ArchiveAccessorRequest::_UnknownMethod {
522 ordinal: header.ordinal,
523 control_handle: ArchiveAccessorControlHandle {
524 inner: this.inner.clone(),
525 },
526 method_type: fidl::MethodType::OneWay,
527 })
528 }
529 _ if header
530 .dynamic_flags()
531 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
532 {
533 this.inner.send_framework_err(
534 fidl::encoding::FrameworkErr::UnknownMethod,
535 header.tx_id,
536 header.ordinal,
537 header.dynamic_flags(),
538 (bytes, handles),
539 )?;
540 Ok(ArchiveAccessorRequest::_UnknownMethod {
541 ordinal: header.ordinal,
542 control_handle: ArchiveAccessorControlHandle {
543 inner: this.inner.clone(),
544 },
545 method_type: fidl::MethodType::TwoWay,
546 })
547 }
548 _ => Err(fidl::Error::UnknownOrdinal {
549 ordinal: header.ordinal,
550 protocol_name:
551 <ArchiveAccessorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
552 }),
553 }))
554 },
555 )
556 }
557}
558
559#[derive(Debug)]
561pub enum ArchiveAccessorRequest {
562 StreamDiagnostics {
580 stream_parameters: StreamParameters,
581 result_stream: fidl::endpoints::ServerEnd<BatchIteratorMarker>,
582 control_handle: ArchiveAccessorControlHandle,
583 },
584 WaitForReady { responder: ArchiveAccessorWaitForReadyResponder },
587 #[non_exhaustive]
589 _UnknownMethod {
590 ordinal: u64,
592 control_handle: ArchiveAccessorControlHandle,
593 method_type: fidl::MethodType,
594 },
595}
596
597impl ArchiveAccessorRequest {
598 #[allow(irrefutable_let_patterns)]
599 pub fn into_stream_diagnostics(
600 self,
601 ) -> Option<(
602 StreamParameters,
603 fidl::endpoints::ServerEnd<BatchIteratorMarker>,
604 ArchiveAccessorControlHandle,
605 )> {
606 if let ArchiveAccessorRequest::StreamDiagnostics {
607 stream_parameters,
608 result_stream,
609 control_handle,
610 } = self
611 {
612 Some((stream_parameters, result_stream, control_handle))
613 } else {
614 None
615 }
616 }
617
618 #[allow(irrefutable_let_patterns)]
619 pub fn into_wait_for_ready(self) -> Option<(ArchiveAccessorWaitForReadyResponder)> {
620 if let ArchiveAccessorRequest::WaitForReady { responder } = self {
621 Some((responder))
622 } else {
623 None
624 }
625 }
626
627 pub fn method_name(&self) -> &'static str {
629 match *self {
630 ArchiveAccessorRequest::StreamDiagnostics { .. } => "stream_diagnostics",
631 ArchiveAccessorRequest::WaitForReady { .. } => "wait_for_ready",
632 ArchiveAccessorRequest::_UnknownMethod {
633 method_type: fidl::MethodType::OneWay,
634 ..
635 } => "unknown one-way method",
636 ArchiveAccessorRequest::_UnknownMethod {
637 method_type: fidl::MethodType::TwoWay,
638 ..
639 } => "unknown two-way method",
640 }
641 }
642}
643
644#[derive(Debug, Clone)]
645pub struct ArchiveAccessorControlHandle {
646 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
647}
648
649impl fidl::endpoints::ControlHandle for ArchiveAccessorControlHandle {
650 fn shutdown(&self) {
651 self.inner.shutdown()
652 }
653 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
654 self.inner.shutdown_with_epitaph(status)
655 }
656
657 fn is_closed(&self) -> bool {
658 self.inner.channel().is_closed()
659 }
660 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
661 self.inner.channel().on_closed()
662 }
663
664 #[cfg(target_os = "fuchsia")]
665 fn signal_peer(
666 &self,
667 clear_mask: zx::Signals,
668 set_mask: zx::Signals,
669 ) -> Result<(), zx_status::Status> {
670 use fidl::Peered;
671 self.inner.channel().signal_peer(clear_mask, set_mask)
672 }
673}
674
675impl ArchiveAccessorControlHandle {}
676
677#[must_use = "FIDL methods require a response to be sent"]
678#[derive(Debug)]
679pub struct ArchiveAccessorWaitForReadyResponder {
680 control_handle: std::mem::ManuallyDrop<ArchiveAccessorControlHandle>,
681 tx_id: u32,
682}
683
684impl std::ops::Drop for ArchiveAccessorWaitForReadyResponder {
688 fn drop(&mut self) {
689 self.control_handle.shutdown();
690 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
692 }
693}
694
695impl fidl::endpoints::Responder for ArchiveAccessorWaitForReadyResponder {
696 type ControlHandle = ArchiveAccessorControlHandle;
697
698 fn control_handle(&self) -> &ArchiveAccessorControlHandle {
699 &self.control_handle
700 }
701
702 fn drop_without_shutdown(mut self) {
703 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
705 std::mem::forget(self);
707 }
708}
709
710impl ArchiveAccessorWaitForReadyResponder {
711 pub fn send(self) -> Result<(), fidl::Error> {
715 let _result = self.send_raw();
716 if _result.is_err() {
717 self.control_handle.shutdown();
718 }
719 self.drop_without_shutdown();
720 _result
721 }
722
723 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
725 let _result = self.send_raw();
726 self.drop_without_shutdown();
727 _result
728 }
729
730 fn send_raw(&self) -> Result<(), fidl::Error> {
731 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
732 fidl::encoding::Flexible::new(()),
733 self.tx_id,
734 0x122963198011bd24,
735 fidl::encoding::DynamicFlags::FLEXIBLE,
736 )
737 }
738}
739
740#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
741pub struct BatchIteratorMarker;
742
743impl fidl::endpoints::ProtocolMarker for BatchIteratorMarker {
744 type Proxy = BatchIteratorProxy;
745 type RequestStream = BatchIteratorRequestStream;
746 #[cfg(target_os = "fuchsia")]
747 type SynchronousProxy = BatchIteratorSynchronousProxy;
748
749 const DEBUG_NAME: &'static str = "(anonymous) BatchIterator";
750}
751pub type BatchIteratorGetNextResult = Result<Vec<FormattedContent>, ReaderError>;
752
753pub trait BatchIteratorProxyInterface: Send + Sync {
754 type GetNextResponseFut: std::future::Future<Output = Result<BatchIteratorGetNextResult, fidl::Error>>
755 + Send;
756 fn r#get_next(&self) -> Self::GetNextResponseFut;
757 type WaitForReadyResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
758 fn r#wait_for_ready(&self) -> Self::WaitForReadyResponseFut;
759}
760#[derive(Debug)]
761#[cfg(target_os = "fuchsia")]
762pub struct BatchIteratorSynchronousProxy {
763 client: fidl::client::sync::Client,
764}
765
766#[cfg(target_os = "fuchsia")]
767impl fidl::endpoints::SynchronousProxy for BatchIteratorSynchronousProxy {
768 type Proxy = BatchIteratorProxy;
769 type Protocol = BatchIteratorMarker;
770
771 fn from_channel(inner: fidl::Channel) -> Self {
772 Self::new(inner)
773 }
774
775 fn into_channel(self) -> fidl::Channel {
776 self.client.into_channel()
777 }
778
779 fn as_channel(&self) -> &fidl::Channel {
780 self.client.as_channel()
781 }
782}
783
784#[cfg(target_os = "fuchsia")]
785impl BatchIteratorSynchronousProxy {
786 pub fn new(channel: fidl::Channel) -> Self {
787 let protocol_name = <BatchIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
788 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
789 }
790
791 pub fn into_channel(self) -> fidl::Channel {
792 self.client.into_channel()
793 }
794
795 pub fn wait_for_event(
798 &self,
799 deadline: zx::MonotonicInstant,
800 ) -> Result<BatchIteratorEvent, fidl::Error> {
801 BatchIteratorEvent::decode(self.client.wait_for_event(deadline)?)
802 }
803
804 pub fn r#get_next(
828 &self,
829 ___deadline: zx::MonotonicInstant,
830 ) -> Result<BatchIteratorGetNextResult, fidl::Error> {
831 let _response = self.client.send_query::<
832 fidl::encoding::EmptyPayload,
833 fidl::encoding::FlexibleResultType<BatchIteratorGetNextResponse, ReaderError>,
834 >(
835 (),
836 0x781986486c6254a5,
837 fidl::encoding::DynamicFlags::FLEXIBLE,
838 ___deadline,
839 )?
840 .into_result::<BatchIteratorMarker>("get_next")?;
841 Ok(_response.map(|x| x.batch))
842 }
843
844 pub fn r#wait_for_ready(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
847 let _response = self.client.send_query::<
848 fidl::encoding::EmptyPayload,
849 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
850 >(
851 (),
852 0x70598ee271597603,
853 fidl::encoding::DynamicFlags::FLEXIBLE,
854 ___deadline,
855 )?
856 .into_result::<BatchIteratorMarker>("wait_for_ready")?;
857 Ok(_response)
858 }
859}
860
861#[cfg(target_os = "fuchsia")]
862impl From<BatchIteratorSynchronousProxy> for zx::Handle {
863 fn from(value: BatchIteratorSynchronousProxy) -> Self {
864 value.into_channel().into()
865 }
866}
867
868#[cfg(target_os = "fuchsia")]
869impl From<fidl::Channel> for BatchIteratorSynchronousProxy {
870 fn from(value: fidl::Channel) -> Self {
871 Self::new(value)
872 }
873}
874
875#[derive(Debug, Clone)]
876pub struct BatchIteratorProxy {
877 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
878}
879
880impl fidl::endpoints::Proxy for BatchIteratorProxy {
881 type Protocol = BatchIteratorMarker;
882
883 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
884 Self::new(inner)
885 }
886
887 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
888 self.client.into_channel().map_err(|client| Self { client })
889 }
890
891 fn as_channel(&self) -> &::fidl::AsyncChannel {
892 self.client.as_channel()
893 }
894}
895
896impl BatchIteratorProxy {
897 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
899 let protocol_name = <BatchIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
900 Self { client: fidl::client::Client::new(channel, protocol_name) }
901 }
902
903 pub fn take_event_stream(&self) -> BatchIteratorEventStream {
909 BatchIteratorEventStream { event_receiver: self.client.take_event_receiver() }
910 }
911
912 pub fn r#get_next(
936 &self,
937 ) -> fidl::client::QueryResponseFut<
938 BatchIteratorGetNextResult,
939 fidl::encoding::DefaultFuchsiaResourceDialect,
940 > {
941 BatchIteratorProxyInterface::r#get_next(self)
942 }
943
944 pub fn r#wait_for_ready(
947 &self,
948 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
949 BatchIteratorProxyInterface::r#wait_for_ready(self)
950 }
951}
952
953impl BatchIteratorProxyInterface for BatchIteratorProxy {
954 type GetNextResponseFut = fidl::client::QueryResponseFut<
955 BatchIteratorGetNextResult,
956 fidl::encoding::DefaultFuchsiaResourceDialect,
957 >;
958 fn r#get_next(&self) -> Self::GetNextResponseFut {
959 fn _decode(
960 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
961 ) -> Result<BatchIteratorGetNextResult, fidl::Error> {
962 let _response = fidl::client::decode_transaction_body::<
963 fidl::encoding::FlexibleResultType<BatchIteratorGetNextResponse, ReaderError>,
964 fidl::encoding::DefaultFuchsiaResourceDialect,
965 0x781986486c6254a5,
966 >(_buf?)?
967 .into_result::<BatchIteratorMarker>("get_next")?;
968 Ok(_response.map(|x| x.batch))
969 }
970 self.client
971 .send_query_and_decode::<fidl::encoding::EmptyPayload, BatchIteratorGetNextResult>(
972 (),
973 0x781986486c6254a5,
974 fidl::encoding::DynamicFlags::FLEXIBLE,
975 _decode,
976 )
977 }
978
979 type WaitForReadyResponseFut =
980 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
981 fn r#wait_for_ready(&self) -> Self::WaitForReadyResponseFut {
982 fn _decode(
983 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
984 ) -> Result<(), fidl::Error> {
985 let _response = fidl::client::decode_transaction_body::<
986 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
987 fidl::encoding::DefaultFuchsiaResourceDialect,
988 0x70598ee271597603,
989 >(_buf?)?
990 .into_result::<BatchIteratorMarker>("wait_for_ready")?;
991 Ok(_response)
992 }
993 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
994 (),
995 0x70598ee271597603,
996 fidl::encoding::DynamicFlags::FLEXIBLE,
997 _decode,
998 )
999 }
1000}
1001
1002pub struct BatchIteratorEventStream {
1003 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1004}
1005
1006impl std::marker::Unpin for BatchIteratorEventStream {}
1007
1008impl futures::stream::FusedStream for BatchIteratorEventStream {
1009 fn is_terminated(&self) -> bool {
1010 self.event_receiver.is_terminated()
1011 }
1012}
1013
1014impl futures::Stream for BatchIteratorEventStream {
1015 type Item = Result<BatchIteratorEvent, fidl::Error>;
1016
1017 fn poll_next(
1018 mut self: std::pin::Pin<&mut Self>,
1019 cx: &mut std::task::Context<'_>,
1020 ) -> std::task::Poll<Option<Self::Item>> {
1021 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1022 &mut self.event_receiver,
1023 cx
1024 )?) {
1025 Some(buf) => std::task::Poll::Ready(Some(BatchIteratorEvent::decode(buf))),
1026 None => std::task::Poll::Ready(None),
1027 }
1028 }
1029}
1030
1031#[derive(Debug)]
1032pub enum BatchIteratorEvent {
1033 #[non_exhaustive]
1034 _UnknownEvent {
1035 ordinal: u64,
1037 },
1038}
1039
1040impl BatchIteratorEvent {
1041 fn decode(
1043 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1044 ) -> Result<BatchIteratorEvent, fidl::Error> {
1045 let (bytes, _handles) = buf.split_mut();
1046 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1047 debug_assert_eq!(tx_header.tx_id, 0);
1048 match tx_header.ordinal {
1049 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1050 Ok(BatchIteratorEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1051 }
1052 _ => Err(fidl::Error::UnknownOrdinal {
1053 ordinal: tx_header.ordinal,
1054 protocol_name: <BatchIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1055 }),
1056 }
1057 }
1058}
1059
1060pub struct BatchIteratorRequestStream {
1062 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1063 is_terminated: bool,
1064}
1065
1066impl std::marker::Unpin for BatchIteratorRequestStream {}
1067
1068impl futures::stream::FusedStream for BatchIteratorRequestStream {
1069 fn is_terminated(&self) -> bool {
1070 self.is_terminated
1071 }
1072}
1073
1074impl fidl::endpoints::RequestStream for BatchIteratorRequestStream {
1075 type Protocol = BatchIteratorMarker;
1076 type ControlHandle = BatchIteratorControlHandle;
1077
1078 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1079 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1080 }
1081
1082 fn control_handle(&self) -> Self::ControlHandle {
1083 BatchIteratorControlHandle { inner: self.inner.clone() }
1084 }
1085
1086 fn into_inner(
1087 self,
1088 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1089 {
1090 (self.inner, self.is_terminated)
1091 }
1092
1093 fn from_inner(
1094 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1095 is_terminated: bool,
1096 ) -> Self {
1097 Self { inner, is_terminated }
1098 }
1099}
1100
1101impl futures::Stream for BatchIteratorRequestStream {
1102 type Item = Result<BatchIteratorRequest, fidl::Error>;
1103
1104 fn poll_next(
1105 mut self: std::pin::Pin<&mut Self>,
1106 cx: &mut std::task::Context<'_>,
1107 ) -> std::task::Poll<Option<Self::Item>> {
1108 let this = &mut *self;
1109 if this.inner.check_shutdown(cx) {
1110 this.is_terminated = true;
1111 return std::task::Poll::Ready(None);
1112 }
1113 if this.is_terminated {
1114 panic!("polled BatchIteratorRequestStream after completion");
1115 }
1116 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1117 |bytes, handles| {
1118 match this.inner.channel().read_etc(cx, bytes, handles) {
1119 std::task::Poll::Ready(Ok(())) => {}
1120 std::task::Poll::Pending => return std::task::Poll::Pending,
1121 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1122 this.is_terminated = true;
1123 return std::task::Poll::Ready(None);
1124 }
1125 std::task::Poll::Ready(Err(e)) => {
1126 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1127 e.into(),
1128 ))))
1129 }
1130 }
1131
1132 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1134
1135 std::task::Poll::Ready(Some(match header.ordinal {
1136 0x781986486c6254a5 => {
1137 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1138 let mut req = fidl::new_empty!(
1139 fidl::encoding::EmptyPayload,
1140 fidl::encoding::DefaultFuchsiaResourceDialect
1141 );
1142 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1143 let control_handle =
1144 BatchIteratorControlHandle { inner: this.inner.clone() };
1145 Ok(BatchIteratorRequest::GetNext {
1146 responder: BatchIteratorGetNextResponder {
1147 control_handle: std::mem::ManuallyDrop::new(control_handle),
1148 tx_id: header.tx_id,
1149 },
1150 })
1151 }
1152 0x70598ee271597603 => {
1153 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1154 let mut req = fidl::new_empty!(
1155 fidl::encoding::EmptyPayload,
1156 fidl::encoding::DefaultFuchsiaResourceDialect
1157 );
1158 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1159 let control_handle =
1160 BatchIteratorControlHandle { inner: this.inner.clone() };
1161 Ok(BatchIteratorRequest::WaitForReady {
1162 responder: BatchIteratorWaitForReadyResponder {
1163 control_handle: std::mem::ManuallyDrop::new(control_handle),
1164 tx_id: header.tx_id,
1165 },
1166 })
1167 }
1168 _ if header.tx_id == 0
1169 && header
1170 .dynamic_flags()
1171 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1172 {
1173 Ok(BatchIteratorRequest::_UnknownMethod {
1174 ordinal: header.ordinal,
1175 control_handle: BatchIteratorControlHandle {
1176 inner: this.inner.clone(),
1177 },
1178 method_type: fidl::MethodType::OneWay,
1179 })
1180 }
1181 _ if header
1182 .dynamic_flags()
1183 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1184 {
1185 this.inner.send_framework_err(
1186 fidl::encoding::FrameworkErr::UnknownMethod,
1187 header.tx_id,
1188 header.ordinal,
1189 header.dynamic_flags(),
1190 (bytes, handles),
1191 )?;
1192 Ok(BatchIteratorRequest::_UnknownMethod {
1193 ordinal: header.ordinal,
1194 control_handle: BatchIteratorControlHandle {
1195 inner: this.inner.clone(),
1196 },
1197 method_type: fidl::MethodType::TwoWay,
1198 })
1199 }
1200 _ => Err(fidl::Error::UnknownOrdinal {
1201 ordinal: header.ordinal,
1202 protocol_name:
1203 <BatchIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1204 }),
1205 }))
1206 },
1207 )
1208 }
1209}
1210
1211#[derive(Debug)]
1214pub enum BatchIteratorRequest {
1215 GetNext { responder: BatchIteratorGetNextResponder },
1239 WaitForReady { responder: BatchIteratorWaitForReadyResponder },
1242 #[non_exhaustive]
1244 _UnknownMethod {
1245 ordinal: u64,
1247 control_handle: BatchIteratorControlHandle,
1248 method_type: fidl::MethodType,
1249 },
1250}
1251
1252impl BatchIteratorRequest {
1253 #[allow(irrefutable_let_patterns)]
1254 pub fn into_get_next(self) -> Option<(BatchIteratorGetNextResponder)> {
1255 if let BatchIteratorRequest::GetNext { responder } = self {
1256 Some((responder))
1257 } else {
1258 None
1259 }
1260 }
1261
1262 #[allow(irrefutable_let_patterns)]
1263 pub fn into_wait_for_ready(self) -> Option<(BatchIteratorWaitForReadyResponder)> {
1264 if let BatchIteratorRequest::WaitForReady { responder } = self {
1265 Some((responder))
1266 } else {
1267 None
1268 }
1269 }
1270
1271 pub fn method_name(&self) -> &'static str {
1273 match *self {
1274 BatchIteratorRequest::GetNext { .. } => "get_next",
1275 BatchIteratorRequest::WaitForReady { .. } => "wait_for_ready",
1276 BatchIteratorRequest::_UnknownMethod {
1277 method_type: fidl::MethodType::OneWay, ..
1278 } => "unknown one-way method",
1279 BatchIteratorRequest::_UnknownMethod {
1280 method_type: fidl::MethodType::TwoWay, ..
1281 } => "unknown two-way method",
1282 }
1283 }
1284}
1285
1286#[derive(Debug, Clone)]
1287pub struct BatchIteratorControlHandle {
1288 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1289}
1290
1291impl fidl::endpoints::ControlHandle for BatchIteratorControlHandle {
1292 fn shutdown(&self) {
1293 self.inner.shutdown()
1294 }
1295 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1296 self.inner.shutdown_with_epitaph(status)
1297 }
1298
1299 fn is_closed(&self) -> bool {
1300 self.inner.channel().is_closed()
1301 }
1302 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1303 self.inner.channel().on_closed()
1304 }
1305
1306 #[cfg(target_os = "fuchsia")]
1307 fn signal_peer(
1308 &self,
1309 clear_mask: zx::Signals,
1310 set_mask: zx::Signals,
1311 ) -> Result<(), zx_status::Status> {
1312 use fidl::Peered;
1313 self.inner.channel().signal_peer(clear_mask, set_mask)
1314 }
1315}
1316
1317impl BatchIteratorControlHandle {}
1318
1319#[must_use = "FIDL methods require a response to be sent"]
1320#[derive(Debug)]
1321pub struct BatchIteratorGetNextResponder {
1322 control_handle: std::mem::ManuallyDrop<BatchIteratorControlHandle>,
1323 tx_id: u32,
1324}
1325
1326impl std::ops::Drop for BatchIteratorGetNextResponder {
1330 fn drop(&mut self) {
1331 self.control_handle.shutdown();
1332 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1334 }
1335}
1336
1337impl fidl::endpoints::Responder for BatchIteratorGetNextResponder {
1338 type ControlHandle = BatchIteratorControlHandle;
1339
1340 fn control_handle(&self) -> &BatchIteratorControlHandle {
1341 &self.control_handle
1342 }
1343
1344 fn drop_without_shutdown(mut self) {
1345 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1347 std::mem::forget(self);
1349 }
1350}
1351
1352impl BatchIteratorGetNextResponder {
1353 pub fn send(
1357 self,
1358 mut result: Result<Vec<FormattedContent>, ReaderError>,
1359 ) -> Result<(), fidl::Error> {
1360 let _result = self.send_raw(result);
1361 if _result.is_err() {
1362 self.control_handle.shutdown();
1363 }
1364 self.drop_without_shutdown();
1365 _result
1366 }
1367
1368 pub fn send_no_shutdown_on_err(
1370 self,
1371 mut result: Result<Vec<FormattedContent>, ReaderError>,
1372 ) -> Result<(), fidl::Error> {
1373 let _result = self.send_raw(result);
1374 self.drop_without_shutdown();
1375 _result
1376 }
1377
1378 fn send_raw(
1379 &self,
1380 mut result: Result<Vec<FormattedContent>, ReaderError>,
1381 ) -> Result<(), fidl::Error> {
1382 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1383 BatchIteratorGetNextResponse,
1384 ReaderError,
1385 >>(
1386 fidl::encoding::FlexibleResult::new(
1387 result.as_mut().map_err(|e| *e).map(|batch| (batch.as_mut_slice(),)),
1388 ),
1389 self.tx_id,
1390 0x781986486c6254a5,
1391 fidl::encoding::DynamicFlags::FLEXIBLE,
1392 )
1393 }
1394}
1395
1396#[must_use = "FIDL methods require a response to be sent"]
1397#[derive(Debug)]
1398pub struct BatchIteratorWaitForReadyResponder {
1399 control_handle: std::mem::ManuallyDrop<BatchIteratorControlHandle>,
1400 tx_id: u32,
1401}
1402
1403impl std::ops::Drop for BatchIteratorWaitForReadyResponder {
1407 fn drop(&mut self) {
1408 self.control_handle.shutdown();
1409 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1411 }
1412}
1413
1414impl fidl::endpoints::Responder for BatchIteratorWaitForReadyResponder {
1415 type ControlHandle = BatchIteratorControlHandle;
1416
1417 fn control_handle(&self) -> &BatchIteratorControlHandle {
1418 &self.control_handle
1419 }
1420
1421 fn drop_without_shutdown(mut self) {
1422 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1424 std::mem::forget(self);
1426 }
1427}
1428
1429impl BatchIteratorWaitForReadyResponder {
1430 pub fn send(self) -> Result<(), fidl::Error> {
1434 let _result = self.send_raw();
1435 if _result.is_err() {
1436 self.control_handle.shutdown();
1437 }
1438 self.drop_without_shutdown();
1439 _result
1440 }
1441
1442 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1444 let _result = self.send_raw();
1445 self.drop_without_shutdown();
1446 _result
1447 }
1448
1449 fn send_raw(&self) -> Result<(), fidl::Error> {
1450 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
1451 fidl::encoding::Flexible::new(()),
1452 self.tx_id,
1453 0x70598ee271597603,
1454 fidl::encoding::DynamicFlags::FLEXIBLE,
1455 )
1456 }
1457}
1458
1459#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1460pub struct LogSettingsMarker;
1461
1462impl fidl::endpoints::ProtocolMarker for LogSettingsMarker {
1463 type Proxy = LogSettingsProxy;
1464 type RequestStream = LogSettingsRequestStream;
1465 #[cfg(target_os = "fuchsia")]
1466 type SynchronousProxy = LogSettingsSynchronousProxy;
1467
1468 const DEBUG_NAME: &'static str = "fuchsia.diagnostics.LogSettings";
1469}
1470impl fidl::endpoints::DiscoverableProtocolMarker for LogSettingsMarker {}
1471
1472pub trait LogSettingsProxyInterface: Send + Sync {
1473 fn r#register_interest(&self, selectors: &[LogInterestSelector]) -> Result<(), fidl::Error>;
1474 type SetInterestResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1475 fn r#set_interest(&self, selectors: &[LogInterestSelector]) -> Self::SetInterestResponseFut;
1476 type SetComponentInterestResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
1477 + Send;
1478 fn r#set_component_interest(
1479 &self,
1480 payload: &LogSettingsSetComponentInterestRequest,
1481 ) -> Self::SetComponentInterestResponseFut;
1482}
1483#[derive(Debug)]
1484#[cfg(target_os = "fuchsia")]
1485pub struct LogSettingsSynchronousProxy {
1486 client: fidl::client::sync::Client,
1487}
1488
1489#[cfg(target_os = "fuchsia")]
1490impl fidl::endpoints::SynchronousProxy for LogSettingsSynchronousProxy {
1491 type Proxy = LogSettingsProxy;
1492 type Protocol = LogSettingsMarker;
1493
1494 fn from_channel(inner: fidl::Channel) -> Self {
1495 Self::new(inner)
1496 }
1497
1498 fn into_channel(self) -> fidl::Channel {
1499 self.client.into_channel()
1500 }
1501
1502 fn as_channel(&self) -> &fidl::Channel {
1503 self.client.as_channel()
1504 }
1505}
1506
1507#[cfg(target_os = "fuchsia")]
1508impl LogSettingsSynchronousProxy {
1509 pub fn new(channel: fidl::Channel) -> Self {
1510 let protocol_name = <LogSettingsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1511 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1512 }
1513
1514 pub fn into_channel(self) -> fidl::Channel {
1515 self.client.into_channel()
1516 }
1517
1518 pub fn wait_for_event(
1521 &self,
1522 deadline: zx::MonotonicInstant,
1523 ) -> Result<LogSettingsEvent, fidl::Error> {
1524 LogSettingsEvent::decode(self.client.wait_for_event(deadline)?)
1525 }
1526
1527 pub fn r#register_interest(
1528 &self,
1529 mut selectors: &[LogInterestSelector],
1530 ) -> Result<(), fidl::Error> {
1531 self.client.send::<LogSettingsRegisterInterestRequest>(
1532 (selectors,),
1533 0x49d7c14eec975fb,
1534 fidl::encoding::DynamicFlags::empty(),
1535 )
1536 }
1537
1538 pub fn r#set_interest(
1554 &self,
1555 mut selectors: &[LogInterestSelector],
1556 ___deadline: zx::MonotonicInstant,
1557 ) -> Result<(), fidl::Error> {
1558 let _response =
1559 self.client.send_query::<LogSettingsSetInterestRequest, fidl::encoding::EmptyPayload>(
1560 (selectors,),
1561 0x71beced9d2411f90,
1562 fidl::encoding::DynamicFlags::empty(),
1563 ___deadline,
1564 )?;
1565 Ok(_response)
1566 }
1567
1568 pub fn r#set_component_interest(
1584 &self,
1585 mut payload: &LogSettingsSetComponentInterestRequest,
1586 ___deadline: zx::MonotonicInstant,
1587 ) -> Result<(), fidl::Error> {
1588 let _response = self
1589 .client
1590 .send_query::<LogSettingsSetComponentInterestRequest, fidl::encoding::EmptyPayload>(
1591 payload,
1592 0x35f7004d2367f6c1,
1593 fidl::encoding::DynamicFlags::empty(),
1594 ___deadline,
1595 )?;
1596 Ok(_response)
1597 }
1598}
1599
1600#[cfg(target_os = "fuchsia")]
1601impl From<LogSettingsSynchronousProxy> for zx::Handle {
1602 fn from(value: LogSettingsSynchronousProxy) -> Self {
1603 value.into_channel().into()
1604 }
1605}
1606
1607#[cfg(target_os = "fuchsia")]
1608impl From<fidl::Channel> for LogSettingsSynchronousProxy {
1609 fn from(value: fidl::Channel) -> Self {
1610 Self::new(value)
1611 }
1612}
1613
1614#[derive(Debug, Clone)]
1615pub struct LogSettingsProxy {
1616 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1617}
1618
1619impl fidl::endpoints::Proxy for LogSettingsProxy {
1620 type Protocol = LogSettingsMarker;
1621
1622 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1623 Self::new(inner)
1624 }
1625
1626 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1627 self.client.into_channel().map_err(|client| Self { client })
1628 }
1629
1630 fn as_channel(&self) -> &::fidl::AsyncChannel {
1631 self.client.as_channel()
1632 }
1633}
1634
1635impl LogSettingsProxy {
1636 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1638 let protocol_name = <LogSettingsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1639 Self { client: fidl::client::Client::new(channel, protocol_name) }
1640 }
1641
1642 pub fn take_event_stream(&self) -> LogSettingsEventStream {
1648 LogSettingsEventStream { event_receiver: self.client.take_event_receiver() }
1649 }
1650
1651 pub fn r#register_interest(
1652 &self,
1653 mut selectors: &[LogInterestSelector],
1654 ) -> Result<(), fidl::Error> {
1655 LogSettingsProxyInterface::r#register_interest(self, selectors)
1656 }
1657
1658 pub fn r#set_interest(
1674 &self,
1675 mut selectors: &[LogInterestSelector],
1676 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1677 LogSettingsProxyInterface::r#set_interest(self, selectors)
1678 }
1679
1680 pub fn r#set_component_interest(
1696 &self,
1697 mut payload: &LogSettingsSetComponentInterestRequest,
1698 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1699 LogSettingsProxyInterface::r#set_component_interest(self, payload)
1700 }
1701}
1702
1703impl LogSettingsProxyInterface for LogSettingsProxy {
1704 fn r#register_interest(
1705 &self,
1706 mut selectors: &[LogInterestSelector],
1707 ) -> Result<(), fidl::Error> {
1708 self.client.send::<LogSettingsRegisterInterestRequest>(
1709 (selectors,),
1710 0x49d7c14eec975fb,
1711 fidl::encoding::DynamicFlags::empty(),
1712 )
1713 }
1714
1715 type SetInterestResponseFut =
1716 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1717 fn r#set_interest(
1718 &self,
1719 mut selectors: &[LogInterestSelector],
1720 ) -> Self::SetInterestResponseFut {
1721 fn _decode(
1722 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1723 ) -> Result<(), fidl::Error> {
1724 let _response = fidl::client::decode_transaction_body::<
1725 fidl::encoding::EmptyPayload,
1726 fidl::encoding::DefaultFuchsiaResourceDialect,
1727 0x71beced9d2411f90,
1728 >(_buf?)?;
1729 Ok(_response)
1730 }
1731 self.client.send_query_and_decode::<LogSettingsSetInterestRequest, ()>(
1732 (selectors,),
1733 0x71beced9d2411f90,
1734 fidl::encoding::DynamicFlags::empty(),
1735 _decode,
1736 )
1737 }
1738
1739 type SetComponentInterestResponseFut =
1740 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1741 fn r#set_component_interest(
1742 &self,
1743 mut payload: &LogSettingsSetComponentInterestRequest,
1744 ) -> Self::SetComponentInterestResponseFut {
1745 fn _decode(
1746 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1747 ) -> Result<(), fidl::Error> {
1748 let _response = fidl::client::decode_transaction_body::<
1749 fidl::encoding::EmptyPayload,
1750 fidl::encoding::DefaultFuchsiaResourceDialect,
1751 0x35f7004d2367f6c1,
1752 >(_buf?)?;
1753 Ok(_response)
1754 }
1755 self.client.send_query_and_decode::<LogSettingsSetComponentInterestRequest, ()>(
1756 payload,
1757 0x35f7004d2367f6c1,
1758 fidl::encoding::DynamicFlags::empty(),
1759 _decode,
1760 )
1761 }
1762}
1763
1764pub struct LogSettingsEventStream {
1765 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1766}
1767
1768impl std::marker::Unpin for LogSettingsEventStream {}
1769
1770impl futures::stream::FusedStream for LogSettingsEventStream {
1771 fn is_terminated(&self) -> bool {
1772 self.event_receiver.is_terminated()
1773 }
1774}
1775
1776impl futures::Stream for LogSettingsEventStream {
1777 type Item = Result<LogSettingsEvent, 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 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1784 &mut self.event_receiver,
1785 cx
1786 )?) {
1787 Some(buf) => std::task::Poll::Ready(Some(LogSettingsEvent::decode(buf))),
1788 None => std::task::Poll::Ready(None),
1789 }
1790 }
1791}
1792
1793#[derive(Debug)]
1794pub enum LogSettingsEvent {}
1795
1796impl LogSettingsEvent {
1797 fn decode(
1799 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1800 ) -> Result<LogSettingsEvent, fidl::Error> {
1801 let (bytes, _handles) = buf.split_mut();
1802 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1803 debug_assert_eq!(tx_header.tx_id, 0);
1804 match tx_header.ordinal {
1805 _ => Err(fidl::Error::UnknownOrdinal {
1806 ordinal: tx_header.ordinal,
1807 protocol_name: <LogSettingsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1808 }),
1809 }
1810 }
1811}
1812
1813pub struct LogSettingsRequestStream {
1815 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1816 is_terminated: bool,
1817}
1818
1819impl std::marker::Unpin for LogSettingsRequestStream {}
1820
1821impl futures::stream::FusedStream for LogSettingsRequestStream {
1822 fn is_terminated(&self) -> bool {
1823 self.is_terminated
1824 }
1825}
1826
1827impl fidl::endpoints::RequestStream for LogSettingsRequestStream {
1828 type Protocol = LogSettingsMarker;
1829 type ControlHandle = LogSettingsControlHandle;
1830
1831 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1832 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1833 }
1834
1835 fn control_handle(&self) -> Self::ControlHandle {
1836 LogSettingsControlHandle { inner: self.inner.clone() }
1837 }
1838
1839 fn into_inner(
1840 self,
1841 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1842 {
1843 (self.inner, self.is_terminated)
1844 }
1845
1846 fn from_inner(
1847 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1848 is_terminated: bool,
1849 ) -> Self {
1850 Self { inner, is_terminated }
1851 }
1852}
1853
1854impl futures::Stream for LogSettingsRequestStream {
1855 type Item = Result<LogSettingsRequest, fidl::Error>;
1856
1857 fn poll_next(
1858 mut self: std::pin::Pin<&mut Self>,
1859 cx: &mut std::task::Context<'_>,
1860 ) -> std::task::Poll<Option<Self::Item>> {
1861 let this = &mut *self;
1862 if this.inner.check_shutdown(cx) {
1863 this.is_terminated = true;
1864 return std::task::Poll::Ready(None);
1865 }
1866 if this.is_terminated {
1867 panic!("polled LogSettingsRequestStream after completion");
1868 }
1869 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1870 |bytes, handles| {
1871 match this.inner.channel().read_etc(cx, bytes, handles) {
1872 std::task::Poll::Ready(Ok(())) => {}
1873 std::task::Poll::Pending => return std::task::Poll::Pending,
1874 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1875 this.is_terminated = true;
1876 return std::task::Poll::Ready(None);
1877 }
1878 std::task::Poll::Ready(Err(e)) => {
1879 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1880 e.into(),
1881 ))))
1882 }
1883 }
1884
1885 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1887
1888 std::task::Poll::Ready(Some(match header.ordinal {
1889 0x49d7c14eec975fb => {
1890 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1891 let mut req = fidl::new_empty!(
1892 LogSettingsRegisterInterestRequest,
1893 fidl::encoding::DefaultFuchsiaResourceDialect
1894 );
1895 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LogSettingsRegisterInterestRequest>(&header, _body_bytes, handles, &mut req)?;
1896 let control_handle = LogSettingsControlHandle { inner: this.inner.clone() };
1897 Ok(LogSettingsRequest::RegisterInterest {
1898 selectors: req.selectors,
1899
1900 control_handle,
1901 })
1902 }
1903 0x71beced9d2411f90 => {
1904 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1905 let mut req = fidl::new_empty!(
1906 LogSettingsSetInterestRequest,
1907 fidl::encoding::DefaultFuchsiaResourceDialect
1908 );
1909 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LogSettingsSetInterestRequest>(&header, _body_bytes, handles, &mut req)?;
1910 let control_handle = LogSettingsControlHandle { inner: this.inner.clone() };
1911 Ok(LogSettingsRequest::SetInterest {
1912 selectors: req.selectors,
1913
1914 responder: LogSettingsSetInterestResponder {
1915 control_handle: std::mem::ManuallyDrop::new(control_handle),
1916 tx_id: header.tx_id,
1917 },
1918 })
1919 }
1920 0x35f7004d2367f6c1 => {
1921 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1922 let mut req = fidl::new_empty!(
1923 LogSettingsSetComponentInterestRequest,
1924 fidl::encoding::DefaultFuchsiaResourceDialect
1925 );
1926 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LogSettingsSetComponentInterestRequest>(&header, _body_bytes, handles, &mut req)?;
1927 let control_handle = LogSettingsControlHandle { inner: this.inner.clone() };
1928 Ok(LogSettingsRequest::SetComponentInterest {
1929 payload: req,
1930 responder: LogSettingsSetComponentInterestResponder {
1931 control_handle: std::mem::ManuallyDrop::new(control_handle),
1932 tx_id: header.tx_id,
1933 },
1934 })
1935 }
1936 _ => Err(fidl::Error::UnknownOrdinal {
1937 ordinal: header.ordinal,
1938 protocol_name:
1939 <LogSettingsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1940 }),
1941 }))
1942 },
1943 )
1944 }
1945}
1946
1947#[derive(Debug)]
1950pub enum LogSettingsRequest {
1951 RegisterInterest {
1952 selectors: Vec<LogInterestSelector>,
1953 control_handle: LogSettingsControlHandle,
1954 },
1955 SetInterest { selectors: Vec<LogInterestSelector>, responder: LogSettingsSetInterestResponder },
1971 SetComponentInterest {
1987 payload: LogSettingsSetComponentInterestRequest,
1988 responder: LogSettingsSetComponentInterestResponder,
1989 },
1990}
1991
1992impl LogSettingsRequest {
1993 #[allow(irrefutable_let_patterns)]
1994 pub fn into_register_interest(
1995 self,
1996 ) -> Option<(Vec<LogInterestSelector>, LogSettingsControlHandle)> {
1997 if let LogSettingsRequest::RegisterInterest { selectors, control_handle } = self {
1998 Some((selectors, control_handle))
1999 } else {
2000 None
2001 }
2002 }
2003
2004 #[allow(irrefutable_let_patterns)]
2005 pub fn into_set_interest(
2006 self,
2007 ) -> Option<(Vec<LogInterestSelector>, LogSettingsSetInterestResponder)> {
2008 if let LogSettingsRequest::SetInterest { selectors, responder } = self {
2009 Some((selectors, responder))
2010 } else {
2011 None
2012 }
2013 }
2014
2015 #[allow(irrefutable_let_patterns)]
2016 pub fn into_set_component_interest(
2017 self,
2018 ) -> Option<(LogSettingsSetComponentInterestRequest, LogSettingsSetComponentInterestResponder)>
2019 {
2020 if let LogSettingsRequest::SetComponentInterest { payload, responder } = self {
2021 Some((payload, responder))
2022 } else {
2023 None
2024 }
2025 }
2026
2027 pub fn method_name(&self) -> &'static str {
2029 match *self {
2030 LogSettingsRequest::RegisterInterest { .. } => "register_interest",
2031 LogSettingsRequest::SetInterest { .. } => "set_interest",
2032 LogSettingsRequest::SetComponentInterest { .. } => "set_component_interest",
2033 }
2034 }
2035}
2036
2037#[derive(Debug, Clone)]
2038pub struct LogSettingsControlHandle {
2039 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2040}
2041
2042impl fidl::endpoints::ControlHandle for LogSettingsControlHandle {
2043 fn shutdown(&self) {
2044 self.inner.shutdown()
2045 }
2046 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2047 self.inner.shutdown_with_epitaph(status)
2048 }
2049
2050 fn is_closed(&self) -> bool {
2051 self.inner.channel().is_closed()
2052 }
2053 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2054 self.inner.channel().on_closed()
2055 }
2056
2057 #[cfg(target_os = "fuchsia")]
2058 fn signal_peer(
2059 &self,
2060 clear_mask: zx::Signals,
2061 set_mask: zx::Signals,
2062 ) -> Result<(), zx_status::Status> {
2063 use fidl::Peered;
2064 self.inner.channel().signal_peer(clear_mask, set_mask)
2065 }
2066}
2067
2068impl LogSettingsControlHandle {}
2069
2070#[must_use = "FIDL methods require a response to be sent"]
2071#[derive(Debug)]
2072pub struct LogSettingsSetInterestResponder {
2073 control_handle: std::mem::ManuallyDrop<LogSettingsControlHandle>,
2074 tx_id: u32,
2075}
2076
2077impl std::ops::Drop for LogSettingsSetInterestResponder {
2081 fn drop(&mut self) {
2082 self.control_handle.shutdown();
2083 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2085 }
2086}
2087
2088impl fidl::endpoints::Responder for LogSettingsSetInterestResponder {
2089 type ControlHandle = LogSettingsControlHandle;
2090
2091 fn control_handle(&self) -> &LogSettingsControlHandle {
2092 &self.control_handle
2093 }
2094
2095 fn drop_without_shutdown(mut self) {
2096 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2098 std::mem::forget(self);
2100 }
2101}
2102
2103impl LogSettingsSetInterestResponder {
2104 pub fn send(self) -> Result<(), fidl::Error> {
2108 let _result = self.send_raw();
2109 if _result.is_err() {
2110 self.control_handle.shutdown();
2111 }
2112 self.drop_without_shutdown();
2113 _result
2114 }
2115
2116 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2118 let _result = self.send_raw();
2119 self.drop_without_shutdown();
2120 _result
2121 }
2122
2123 fn send_raw(&self) -> Result<(), fidl::Error> {
2124 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2125 (),
2126 self.tx_id,
2127 0x71beced9d2411f90,
2128 fidl::encoding::DynamicFlags::empty(),
2129 )
2130 }
2131}
2132
2133#[must_use = "FIDL methods require a response to be sent"]
2134#[derive(Debug)]
2135pub struct LogSettingsSetComponentInterestResponder {
2136 control_handle: std::mem::ManuallyDrop<LogSettingsControlHandle>,
2137 tx_id: u32,
2138}
2139
2140impl std::ops::Drop for LogSettingsSetComponentInterestResponder {
2144 fn drop(&mut self) {
2145 self.control_handle.shutdown();
2146 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2148 }
2149}
2150
2151impl fidl::endpoints::Responder for LogSettingsSetComponentInterestResponder {
2152 type ControlHandle = LogSettingsControlHandle;
2153
2154 fn control_handle(&self) -> &LogSettingsControlHandle {
2155 &self.control_handle
2156 }
2157
2158 fn drop_without_shutdown(mut self) {
2159 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2161 std::mem::forget(self);
2163 }
2164}
2165
2166impl LogSettingsSetComponentInterestResponder {
2167 pub fn send(self) -> Result<(), fidl::Error> {
2171 let _result = self.send_raw();
2172 if _result.is_err() {
2173 self.control_handle.shutdown();
2174 }
2175 self.drop_without_shutdown();
2176 _result
2177 }
2178
2179 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2181 let _result = self.send_raw();
2182 self.drop_without_shutdown();
2183 _result
2184 }
2185
2186 fn send_raw(&self) -> Result<(), fidl::Error> {
2187 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2188 (),
2189 self.tx_id,
2190 0x35f7004d2367f6c1,
2191 fidl::encoding::DynamicFlags::empty(),
2192 )
2193 }
2194}
2195
2196#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2197pub struct LogStreamMarker;
2198
2199impl fidl::endpoints::ProtocolMarker for LogStreamMarker {
2200 type Proxy = LogStreamProxy;
2201 type RequestStream = LogStreamRequestStream;
2202 #[cfg(target_os = "fuchsia")]
2203 type SynchronousProxy = LogStreamSynchronousProxy;
2204
2205 const DEBUG_NAME: &'static str = "fuchsia.diagnostics.LogStream";
2206}
2207impl fidl::endpoints::DiscoverableProtocolMarker for LogStreamMarker {}
2208
2209pub trait LogStreamProxyInterface: Send + Sync {
2210 fn r#connect(&self, socket: fidl::Socket, opts: &LogStreamOptions) -> Result<(), fidl::Error>;
2211}
2212#[derive(Debug)]
2213#[cfg(target_os = "fuchsia")]
2214pub struct LogStreamSynchronousProxy {
2215 client: fidl::client::sync::Client,
2216}
2217
2218#[cfg(target_os = "fuchsia")]
2219impl fidl::endpoints::SynchronousProxy for LogStreamSynchronousProxy {
2220 type Proxy = LogStreamProxy;
2221 type Protocol = LogStreamMarker;
2222
2223 fn from_channel(inner: fidl::Channel) -> Self {
2224 Self::new(inner)
2225 }
2226
2227 fn into_channel(self) -> fidl::Channel {
2228 self.client.into_channel()
2229 }
2230
2231 fn as_channel(&self) -> &fidl::Channel {
2232 self.client.as_channel()
2233 }
2234}
2235
2236#[cfg(target_os = "fuchsia")]
2237impl LogStreamSynchronousProxy {
2238 pub fn new(channel: fidl::Channel) -> Self {
2239 let protocol_name = <LogStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2240 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2241 }
2242
2243 pub fn into_channel(self) -> fidl::Channel {
2244 self.client.into_channel()
2245 }
2246
2247 pub fn wait_for_event(
2250 &self,
2251 deadline: zx::MonotonicInstant,
2252 ) -> Result<LogStreamEvent, fidl::Error> {
2253 LogStreamEvent::decode(self.client.wait_for_event(deadline)?)
2254 }
2255
2256 pub fn r#connect(
2268 &self,
2269 mut socket: fidl::Socket,
2270 mut opts: &LogStreamOptions,
2271 ) -> Result<(), fidl::Error> {
2272 self.client.send::<LogStreamConnectRequest>(
2273 (socket, opts),
2274 0x745eb34f10d51a88,
2275 fidl::encoding::DynamicFlags::FLEXIBLE,
2276 )
2277 }
2278}
2279
2280#[cfg(target_os = "fuchsia")]
2281impl From<LogStreamSynchronousProxy> for zx::Handle {
2282 fn from(value: LogStreamSynchronousProxy) -> Self {
2283 value.into_channel().into()
2284 }
2285}
2286
2287#[cfg(target_os = "fuchsia")]
2288impl From<fidl::Channel> for LogStreamSynchronousProxy {
2289 fn from(value: fidl::Channel) -> Self {
2290 Self::new(value)
2291 }
2292}
2293
2294#[derive(Debug, Clone)]
2295pub struct LogStreamProxy {
2296 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2297}
2298
2299impl fidl::endpoints::Proxy for LogStreamProxy {
2300 type Protocol = LogStreamMarker;
2301
2302 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2303 Self::new(inner)
2304 }
2305
2306 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2307 self.client.into_channel().map_err(|client| Self { client })
2308 }
2309
2310 fn as_channel(&self) -> &::fidl::AsyncChannel {
2311 self.client.as_channel()
2312 }
2313}
2314
2315impl LogStreamProxy {
2316 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2318 let protocol_name = <LogStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2319 Self { client: fidl::client::Client::new(channel, protocol_name) }
2320 }
2321
2322 pub fn take_event_stream(&self) -> LogStreamEventStream {
2328 LogStreamEventStream { event_receiver: self.client.take_event_receiver() }
2329 }
2330
2331 pub fn r#connect(
2343 &self,
2344 mut socket: fidl::Socket,
2345 mut opts: &LogStreamOptions,
2346 ) -> Result<(), fidl::Error> {
2347 LogStreamProxyInterface::r#connect(self, socket, opts)
2348 }
2349}
2350
2351impl LogStreamProxyInterface for LogStreamProxy {
2352 fn r#connect(
2353 &self,
2354 mut socket: fidl::Socket,
2355 mut opts: &LogStreamOptions,
2356 ) -> Result<(), fidl::Error> {
2357 self.client.send::<LogStreamConnectRequest>(
2358 (socket, opts),
2359 0x745eb34f10d51a88,
2360 fidl::encoding::DynamicFlags::FLEXIBLE,
2361 )
2362 }
2363}
2364
2365pub struct LogStreamEventStream {
2366 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2367}
2368
2369impl std::marker::Unpin for LogStreamEventStream {}
2370
2371impl futures::stream::FusedStream for LogStreamEventStream {
2372 fn is_terminated(&self) -> bool {
2373 self.event_receiver.is_terminated()
2374 }
2375}
2376
2377impl futures::Stream for LogStreamEventStream {
2378 type Item = Result<LogStreamEvent, fidl::Error>;
2379
2380 fn poll_next(
2381 mut self: std::pin::Pin<&mut Self>,
2382 cx: &mut std::task::Context<'_>,
2383 ) -> std::task::Poll<Option<Self::Item>> {
2384 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2385 &mut self.event_receiver,
2386 cx
2387 )?) {
2388 Some(buf) => std::task::Poll::Ready(Some(LogStreamEvent::decode(buf))),
2389 None => std::task::Poll::Ready(None),
2390 }
2391 }
2392}
2393
2394#[derive(Debug)]
2395pub enum LogStreamEvent {
2396 #[non_exhaustive]
2397 _UnknownEvent {
2398 ordinal: u64,
2400 },
2401}
2402
2403impl LogStreamEvent {
2404 fn decode(
2406 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2407 ) -> Result<LogStreamEvent, fidl::Error> {
2408 let (bytes, _handles) = buf.split_mut();
2409 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2410 debug_assert_eq!(tx_header.tx_id, 0);
2411 match tx_header.ordinal {
2412 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2413 Ok(LogStreamEvent::_UnknownEvent { ordinal: tx_header.ordinal })
2414 }
2415 _ => Err(fidl::Error::UnknownOrdinal {
2416 ordinal: tx_header.ordinal,
2417 protocol_name: <LogStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2418 }),
2419 }
2420 }
2421}
2422
2423pub struct LogStreamRequestStream {
2425 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2426 is_terminated: bool,
2427}
2428
2429impl std::marker::Unpin for LogStreamRequestStream {}
2430
2431impl futures::stream::FusedStream for LogStreamRequestStream {
2432 fn is_terminated(&self) -> bool {
2433 self.is_terminated
2434 }
2435}
2436
2437impl fidl::endpoints::RequestStream for LogStreamRequestStream {
2438 type Protocol = LogStreamMarker;
2439 type ControlHandle = LogStreamControlHandle;
2440
2441 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2442 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2443 }
2444
2445 fn control_handle(&self) -> Self::ControlHandle {
2446 LogStreamControlHandle { inner: self.inner.clone() }
2447 }
2448
2449 fn into_inner(
2450 self,
2451 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2452 {
2453 (self.inner, self.is_terminated)
2454 }
2455
2456 fn from_inner(
2457 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2458 is_terminated: bool,
2459 ) -> Self {
2460 Self { inner, is_terminated }
2461 }
2462}
2463
2464impl futures::Stream for LogStreamRequestStream {
2465 type Item = Result<LogStreamRequest, fidl::Error>;
2466
2467 fn poll_next(
2468 mut self: std::pin::Pin<&mut Self>,
2469 cx: &mut std::task::Context<'_>,
2470 ) -> std::task::Poll<Option<Self::Item>> {
2471 let this = &mut *self;
2472 if this.inner.check_shutdown(cx) {
2473 this.is_terminated = true;
2474 return std::task::Poll::Ready(None);
2475 }
2476 if this.is_terminated {
2477 panic!("polled LogStreamRequestStream after completion");
2478 }
2479 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2480 |bytes, handles| {
2481 match this.inner.channel().read_etc(cx, bytes, handles) {
2482 std::task::Poll::Ready(Ok(())) => {}
2483 std::task::Poll::Pending => return std::task::Poll::Pending,
2484 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2485 this.is_terminated = true;
2486 return std::task::Poll::Ready(None);
2487 }
2488 std::task::Poll::Ready(Err(e)) => {
2489 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2490 e.into(),
2491 ))))
2492 }
2493 }
2494
2495 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2497
2498 std::task::Poll::Ready(Some(match header.ordinal {
2499 0x745eb34f10d51a88 => {
2500 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2501 let mut req = fidl::new_empty!(
2502 LogStreamConnectRequest,
2503 fidl::encoding::DefaultFuchsiaResourceDialect
2504 );
2505 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LogStreamConnectRequest>(&header, _body_bytes, handles, &mut req)?;
2506 let control_handle = LogStreamControlHandle { inner: this.inner.clone() };
2507 Ok(LogStreamRequest::Connect {
2508 socket: req.socket,
2509 opts: req.opts,
2510
2511 control_handle,
2512 })
2513 }
2514 _ if header.tx_id == 0
2515 && header
2516 .dynamic_flags()
2517 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2518 {
2519 Ok(LogStreamRequest::_UnknownMethod {
2520 ordinal: header.ordinal,
2521 control_handle: LogStreamControlHandle { inner: this.inner.clone() },
2522 method_type: fidl::MethodType::OneWay,
2523 })
2524 }
2525 _ if header
2526 .dynamic_flags()
2527 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2528 {
2529 this.inner.send_framework_err(
2530 fidl::encoding::FrameworkErr::UnknownMethod,
2531 header.tx_id,
2532 header.ordinal,
2533 header.dynamic_flags(),
2534 (bytes, handles),
2535 )?;
2536 Ok(LogStreamRequest::_UnknownMethod {
2537 ordinal: header.ordinal,
2538 control_handle: LogStreamControlHandle { inner: this.inner.clone() },
2539 method_type: fidl::MethodType::TwoWay,
2540 })
2541 }
2542 _ => Err(fidl::Error::UnknownOrdinal {
2543 ordinal: header.ordinal,
2544 protocol_name:
2545 <LogStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2546 }),
2547 }))
2548 },
2549 )
2550 }
2551}
2552
2553#[derive(Debug)]
2554pub enum LogStreamRequest {
2555 Connect { socket: fidl::Socket, opts: LogStreamOptions, control_handle: LogStreamControlHandle },
2567 #[non_exhaustive]
2569 _UnknownMethod {
2570 ordinal: u64,
2572 control_handle: LogStreamControlHandle,
2573 method_type: fidl::MethodType,
2574 },
2575}
2576
2577impl LogStreamRequest {
2578 #[allow(irrefutable_let_patterns)]
2579 pub fn into_connect(self) -> Option<(fidl::Socket, LogStreamOptions, LogStreamControlHandle)> {
2580 if let LogStreamRequest::Connect { socket, opts, control_handle } = self {
2581 Some((socket, opts, control_handle))
2582 } else {
2583 None
2584 }
2585 }
2586
2587 pub fn method_name(&self) -> &'static str {
2589 match *self {
2590 LogStreamRequest::Connect { .. } => "connect",
2591 LogStreamRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
2592 "unknown one-way method"
2593 }
2594 LogStreamRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
2595 "unknown two-way method"
2596 }
2597 }
2598 }
2599}
2600
2601#[derive(Debug, Clone)]
2602pub struct LogStreamControlHandle {
2603 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2604}
2605
2606impl fidl::endpoints::ControlHandle for LogStreamControlHandle {
2607 fn shutdown(&self) {
2608 self.inner.shutdown()
2609 }
2610 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2611 self.inner.shutdown_with_epitaph(status)
2612 }
2613
2614 fn is_closed(&self) -> bool {
2615 self.inner.channel().is_closed()
2616 }
2617 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2618 self.inner.channel().on_closed()
2619 }
2620
2621 #[cfg(target_os = "fuchsia")]
2622 fn signal_peer(
2623 &self,
2624 clear_mask: zx::Signals,
2625 set_mask: zx::Signals,
2626 ) -> Result<(), zx_status::Status> {
2627 use fidl::Peered;
2628 self.inner.channel().signal_peer(clear_mask, set_mask)
2629 }
2630}
2631
2632impl LogStreamControlHandle {}
2633
2634mod internal {
2635 use super::*;
2636
2637 impl fidl::encoding::ResourceTypeMarker for ArchiveAccessorStreamDiagnosticsRequest {
2638 type Borrowed<'a> = &'a mut Self;
2639 fn take_or_borrow<'a>(
2640 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2641 ) -> Self::Borrowed<'a> {
2642 value
2643 }
2644 }
2645
2646 unsafe impl fidl::encoding::TypeMarker for ArchiveAccessorStreamDiagnosticsRequest {
2647 type Owned = Self;
2648
2649 #[inline(always)]
2650 fn inline_align(_context: fidl::encoding::Context) -> usize {
2651 8
2652 }
2653
2654 #[inline(always)]
2655 fn inline_size(_context: fidl::encoding::Context) -> usize {
2656 24
2657 }
2658 }
2659
2660 unsafe impl
2661 fidl::encoding::Encode<
2662 ArchiveAccessorStreamDiagnosticsRequest,
2663 fidl::encoding::DefaultFuchsiaResourceDialect,
2664 > for &mut ArchiveAccessorStreamDiagnosticsRequest
2665 {
2666 #[inline]
2667 unsafe fn encode(
2668 self,
2669 encoder: &mut fidl::encoding::Encoder<
2670 '_,
2671 fidl::encoding::DefaultFuchsiaResourceDialect,
2672 >,
2673 offset: usize,
2674 _depth: fidl::encoding::Depth,
2675 ) -> fidl::Result<()> {
2676 encoder.debug_check_bounds::<ArchiveAccessorStreamDiagnosticsRequest>(offset);
2677 fidl::encoding::Encode::<ArchiveAccessorStreamDiagnosticsRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2679 (
2680 <StreamParameters as fidl::encoding::ValueTypeMarker>::borrow(&self.stream_parameters),
2681 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BatchIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.result_stream),
2682 ),
2683 encoder, offset, _depth
2684 )
2685 }
2686 }
2687 unsafe impl<
2688 T0: fidl::encoding::Encode<StreamParameters, fidl::encoding::DefaultFuchsiaResourceDialect>,
2689 T1: fidl::encoding::Encode<
2690 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BatchIteratorMarker>>,
2691 fidl::encoding::DefaultFuchsiaResourceDialect,
2692 >,
2693 >
2694 fidl::encoding::Encode<
2695 ArchiveAccessorStreamDiagnosticsRequest,
2696 fidl::encoding::DefaultFuchsiaResourceDialect,
2697 > for (T0, T1)
2698 {
2699 #[inline]
2700 unsafe fn encode(
2701 self,
2702 encoder: &mut fidl::encoding::Encoder<
2703 '_,
2704 fidl::encoding::DefaultFuchsiaResourceDialect,
2705 >,
2706 offset: usize,
2707 depth: fidl::encoding::Depth,
2708 ) -> fidl::Result<()> {
2709 encoder.debug_check_bounds::<ArchiveAccessorStreamDiagnosticsRequest>(offset);
2710 unsafe {
2713 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
2714 (ptr as *mut u64).write_unaligned(0);
2715 }
2716 self.0.encode(encoder, offset + 0, depth)?;
2718 self.1.encode(encoder, offset + 16, depth)?;
2719 Ok(())
2720 }
2721 }
2722
2723 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2724 for ArchiveAccessorStreamDiagnosticsRequest
2725 {
2726 #[inline(always)]
2727 fn new_empty() -> Self {
2728 Self {
2729 stream_parameters: fidl::new_empty!(
2730 StreamParameters,
2731 fidl::encoding::DefaultFuchsiaResourceDialect
2732 ),
2733 result_stream: fidl::new_empty!(
2734 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BatchIteratorMarker>>,
2735 fidl::encoding::DefaultFuchsiaResourceDialect
2736 ),
2737 }
2738 }
2739
2740 #[inline]
2741 unsafe fn decode(
2742 &mut self,
2743 decoder: &mut fidl::encoding::Decoder<
2744 '_,
2745 fidl::encoding::DefaultFuchsiaResourceDialect,
2746 >,
2747 offset: usize,
2748 _depth: fidl::encoding::Depth,
2749 ) -> fidl::Result<()> {
2750 decoder.debug_check_bounds::<Self>(offset);
2751 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
2753 let padval = unsafe { (ptr as *const u64).read_unaligned() };
2754 let mask = 0xffffffff00000000u64;
2755 let maskedval = padval & mask;
2756 if maskedval != 0 {
2757 return Err(fidl::Error::NonZeroPadding {
2758 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
2759 });
2760 }
2761 fidl::decode!(
2762 StreamParameters,
2763 fidl::encoding::DefaultFuchsiaResourceDialect,
2764 &mut self.stream_parameters,
2765 decoder,
2766 offset + 0,
2767 _depth
2768 )?;
2769 fidl::decode!(
2770 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BatchIteratorMarker>>,
2771 fidl::encoding::DefaultFuchsiaResourceDialect,
2772 &mut self.result_stream,
2773 decoder,
2774 offset + 16,
2775 _depth
2776 )?;
2777 Ok(())
2778 }
2779 }
2780
2781 impl fidl::encoding::ResourceTypeMarker for BatchIteratorGetNextResponse {
2782 type Borrowed<'a> = &'a mut Self;
2783 fn take_or_borrow<'a>(
2784 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2785 ) -> Self::Borrowed<'a> {
2786 value
2787 }
2788 }
2789
2790 unsafe impl fidl::encoding::TypeMarker for BatchIteratorGetNextResponse {
2791 type Owned = Self;
2792
2793 #[inline(always)]
2794 fn inline_align(_context: fidl::encoding::Context) -> usize {
2795 8
2796 }
2797
2798 #[inline(always)]
2799 fn inline_size(_context: fidl::encoding::Context) -> usize {
2800 16
2801 }
2802 }
2803
2804 unsafe impl
2805 fidl::encoding::Encode<
2806 BatchIteratorGetNextResponse,
2807 fidl::encoding::DefaultFuchsiaResourceDialect,
2808 > for &mut BatchIteratorGetNextResponse
2809 {
2810 #[inline]
2811 unsafe fn encode(
2812 self,
2813 encoder: &mut fidl::encoding::Encoder<
2814 '_,
2815 fidl::encoding::DefaultFuchsiaResourceDialect,
2816 >,
2817 offset: usize,
2818 _depth: fidl::encoding::Depth,
2819 ) -> fidl::Result<()> {
2820 encoder.debug_check_bounds::<BatchIteratorGetNextResponse>(offset);
2821 fidl::encoding::Encode::<BatchIteratorGetNextResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2823 (
2824 <fidl::encoding::Vector<FormattedContent, 64> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.batch),
2825 ),
2826 encoder, offset, _depth
2827 )
2828 }
2829 }
2830 unsafe impl<
2831 T0: fidl::encoding::Encode<
2832 fidl::encoding::Vector<FormattedContent, 64>,
2833 fidl::encoding::DefaultFuchsiaResourceDialect,
2834 >,
2835 >
2836 fidl::encoding::Encode<
2837 BatchIteratorGetNextResponse,
2838 fidl::encoding::DefaultFuchsiaResourceDialect,
2839 > for (T0,)
2840 {
2841 #[inline]
2842 unsafe fn encode(
2843 self,
2844 encoder: &mut fidl::encoding::Encoder<
2845 '_,
2846 fidl::encoding::DefaultFuchsiaResourceDialect,
2847 >,
2848 offset: usize,
2849 depth: fidl::encoding::Depth,
2850 ) -> fidl::Result<()> {
2851 encoder.debug_check_bounds::<BatchIteratorGetNextResponse>(offset);
2852 self.0.encode(encoder, offset + 0, depth)?;
2856 Ok(())
2857 }
2858 }
2859
2860 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2861 for BatchIteratorGetNextResponse
2862 {
2863 #[inline(always)]
2864 fn new_empty() -> Self {
2865 Self {
2866 batch: fidl::new_empty!(fidl::encoding::Vector<FormattedContent, 64>, fidl::encoding::DefaultFuchsiaResourceDialect),
2867 }
2868 }
2869
2870 #[inline]
2871 unsafe fn decode(
2872 &mut self,
2873 decoder: &mut fidl::encoding::Decoder<
2874 '_,
2875 fidl::encoding::DefaultFuchsiaResourceDialect,
2876 >,
2877 offset: usize,
2878 _depth: fidl::encoding::Depth,
2879 ) -> fidl::Result<()> {
2880 decoder.debug_check_bounds::<Self>(offset);
2881 fidl::decode!(fidl::encoding::Vector<FormattedContent, 64>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.batch, decoder, offset + 0, _depth)?;
2883 Ok(())
2884 }
2885 }
2886
2887 impl fidl::encoding::ResourceTypeMarker for LogStreamConnectRequest {
2888 type Borrowed<'a> = &'a mut Self;
2889 fn take_or_borrow<'a>(
2890 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2891 ) -> Self::Borrowed<'a> {
2892 value
2893 }
2894 }
2895
2896 unsafe impl fidl::encoding::TypeMarker for LogStreamConnectRequest {
2897 type Owned = Self;
2898
2899 #[inline(always)]
2900 fn inline_align(_context: fidl::encoding::Context) -> usize {
2901 8
2902 }
2903
2904 #[inline(always)]
2905 fn inline_size(_context: fidl::encoding::Context) -> usize {
2906 24
2907 }
2908 }
2909
2910 unsafe impl
2911 fidl::encoding::Encode<
2912 LogStreamConnectRequest,
2913 fidl::encoding::DefaultFuchsiaResourceDialect,
2914 > for &mut LogStreamConnectRequest
2915 {
2916 #[inline]
2917 unsafe fn encode(
2918 self,
2919 encoder: &mut fidl::encoding::Encoder<
2920 '_,
2921 fidl::encoding::DefaultFuchsiaResourceDialect,
2922 >,
2923 offset: usize,
2924 _depth: fidl::encoding::Depth,
2925 ) -> fidl::Result<()> {
2926 encoder.debug_check_bounds::<LogStreamConnectRequest>(offset);
2927 fidl::encoding::Encode::<
2929 LogStreamConnectRequest,
2930 fidl::encoding::DefaultFuchsiaResourceDialect,
2931 >::encode(
2932 (
2933 <fidl::encoding::HandleType<
2934 fidl::Socket,
2935 { fidl::ObjectType::SOCKET.into_raw() },
2936 16392,
2937 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2938 &mut self.socket
2939 ),
2940 <LogStreamOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.opts),
2941 ),
2942 encoder,
2943 offset,
2944 _depth,
2945 )
2946 }
2947 }
2948 unsafe impl<
2949 T0: fidl::encoding::Encode<
2950 fidl::encoding::HandleType<
2951 fidl::Socket,
2952 { fidl::ObjectType::SOCKET.into_raw() },
2953 16392,
2954 >,
2955 fidl::encoding::DefaultFuchsiaResourceDialect,
2956 >,
2957 T1: fidl::encoding::Encode<LogStreamOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
2958 >
2959 fidl::encoding::Encode<
2960 LogStreamConnectRequest,
2961 fidl::encoding::DefaultFuchsiaResourceDialect,
2962 > for (T0, T1)
2963 {
2964 #[inline]
2965 unsafe fn encode(
2966 self,
2967 encoder: &mut fidl::encoding::Encoder<
2968 '_,
2969 fidl::encoding::DefaultFuchsiaResourceDialect,
2970 >,
2971 offset: usize,
2972 depth: fidl::encoding::Depth,
2973 ) -> fidl::Result<()> {
2974 encoder.debug_check_bounds::<LogStreamConnectRequest>(offset);
2975 unsafe {
2978 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
2979 (ptr as *mut u64).write_unaligned(0);
2980 }
2981 self.0.encode(encoder, offset + 0, depth)?;
2983 self.1.encode(encoder, offset + 8, depth)?;
2984 Ok(())
2985 }
2986 }
2987
2988 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2989 for LogStreamConnectRequest
2990 {
2991 #[inline(always)]
2992 fn new_empty() -> Self {
2993 Self {
2994 socket: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 16392>, fidl::encoding::DefaultFuchsiaResourceDialect),
2995 opts: fidl::new_empty!(
2996 LogStreamOptions,
2997 fidl::encoding::DefaultFuchsiaResourceDialect
2998 ),
2999 }
3000 }
3001
3002 #[inline]
3003 unsafe fn decode(
3004 &mut self,
3005 decoder: &mut fidl::encoding::Decoder<
3006 '_,
3007 fidl::encoding::DefaultFuchsiaResourceDialect,
3008 >,
3009 offset: usize,
3010 _depth: fidl::encoding::Depth,
3011 ) -> fidl::Result<()> {
3012 decoder.debug_check_bounds::<Self>(offset);
3013 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
3015 let padval = unsafe { (ptr as *const u64).read_unaligned() };
3016 let mask = 0xffffffff00000000u64;
3017 let maskedval = padval & mask;
3018 if maskedval != 0 {
3019 return Err(fidl::Error::NonZeroPadding {
3020 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
3021 });
3022 }
3023 fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 16392>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.socket, decoder, offset + 0, _depth)?;
3024 fidl::decode!(
3025 LogStreamOptions,
3026 fidl::encoding::DefaultFuchsiaResourceDialect,
3027 &mut self.opts,
3028 decoder,
3029 offset + 8,
3030 _depth
3031 )?;
3032 Ok(())
3033 }
3034 }
3035
3036 impl fidl::encoding::ResourceTypeMarker for FormattedContent {
3037 type Borrowed<'a> = &'a mut Self;
3038 fn take_or_borrow<'a>(
3039 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3040 ) -> Self::Borrowed<'a> {
3041 value
3042 }
3043 }
3044
3045 unsafe impl fidl::encoding::TypeMarker for FormattedContent {
3046 type Owned = Self;
3047
3048 #[inline(always)]
3049 fn inline_align(_context: fidl::encoding::Context) -> usize {
3050 8
3051 }
3052
3053 #[inline(always)]
3054 fn inline_size(_context: fidl::encoding::Context) -> usize {
3055 16
3056 }
3057 }
3058
3059 unsafe impl
3060 fidl::encoding::Encode<FormattedContent, fidl::encoding::DefaultFuchsiaResourceDialect>
3061 for &mut FormattedContent
3062 {
3063 #[inline]
3064 unsafe fn encode(
3065 self,
3066 encoder: &mut fidl::encoding::Encoder<
3067 '_,
3068 fidl::encoding::DefaultFuchsiaResourceDialect,
3069 >,
3070 offset: usize,
3071 _depth: fidl::encoding::Depth,
3072 ) -> fidl::Result<()> {
3073 encoder.debug_check_bounds::<FormattedContent>(offset);
3074 encoder.write_num::<u64>(self.ordinal(), offset);
3075 match self {
3076 FormattedContent::Json(ref mut val) => {
3077 fidl::encoding::encode_in_envelope::<fidl_fuchsia_mem::Buffer, fidl::encoding::DefaultFuchsiaResourceDialect>(
3078 <fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
3079 encoder, offset + 8, _depth
3080 )
3081 }
3082 FormattedContent::Text(ref mut val) => {
3083 fidl::encoding::encode_in_envelope::<fidl_fuchsia_mem::Buffer, fidl::encoding::DefaultFuchsiaResourceDialect>(
3084 <fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
3085 encoder, offset + 8, _depth
3086 )
3087 }
3088 FormattedContent::Cbor(ref mut val) => {
3089 fidl::encoding::encode_in_envelope::<fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect>(
3090 <fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
3091 encoder, offset + 8, _depth
3092 )
3093 }
3094 FormattedContent::Fxt(ref mut val) => {
3095 fidl::encoding::encode_in_envelope::<fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect>(
3096 <fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
3097 encoder, offset + 8, _depth
3098 )
3099 }
3100 FormattedContent::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
3101 }
3102 }
3103 }
3104
3105 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3106 for FormattedContent
3107 {
3108 #[inline(always)]
3109 fn new_empty() -> Self {
3110 Self::__SourceBreaking { unknown_ordinal: 0 }
3111 }
3112
3113 #[inline]
3114 unsafe fn decode(
3115 &mut self,
3116 decoder: &mut fidl::encoding::Decoder<
3117 '_,
3118 fidl::encoding::DefaultFuchsiaResourceDialect,
3119 >,
3120 offset: usize,
3121 mut depth: fidl::encoding::Depth,
3122 ) -> fidl::Result<()> {
3123 decoder.debug_check_bounds::<Self>(offset);
3124 #[allow(unused_variables)]
3125 let next_out_of_line = decoder.next_out_of_line();
3126 let handles_before = decoder.remaining_handles();
3127 let (ordinal, inlined, num_bytes, num_handles) =
3128 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
3129
3130 let member_inline_size = match ordinal {
3131 1 => <fidl_fuchsia_mem::Buffer as fidl::encoding::TypeMarker>::inline_size(
3132 decoder.context,
3133 ),
3134 2 => <fidl_fuchsia_mem::Buffer as fidl::encoding::TypeMarker>::inline_size(
3135 decoder.context,
3136 ),
3137 3 => <fidl::encoding::HandleType<
3138 fidl::Vmo,
3139 { fidl::ObjectType::VMO.into_raw() },
3140 2147483648,
3141 > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3142 4 => <fidl::encoding::HandleType<
3143 fidl::Vmo,
3144 { fidl::ObjectType::VMO.into_raw() },
3145 2147483648,
3146 > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3147 0 => return Err(fidl::Error::UnknownUnionTag),
3148 _ => num_bytes as usize,
3149 };
3150
3151 if inlined != (member_inline_size <= 4) {
3152 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3153 }
3154 let _inner_offset;
3155 if inlined {
3156 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
3157 _inner_offset = offset + 8;
3158 } else {
3159 depth.increment()?;
3160 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3161 }
3162 match ordinal {
3163 1 => {
3164 #[allow(irrefutable_let_patterns)]
3165 if let FormattedContent::Json(_) = self {
3166 } else {
3168 *self = FormattedContent::Json(fidl::new_empty!(
3170 fidl_fuchsia_mem::Buffer,
3171 fidl::encoding::DefaultFuchsiaResourceDialect
3172 ));
3173 }
3174 #[allow(irrefutable_let_patterns)]
3175 if let FormattedContent::Json(ref mut val) = self {
3176 fidl::decode!(
3177 fidl_fuchsia_mem::Buffer,
3178 fidl::encoding::DefaultFuchsiaResourceDialect,
3179 val,
3180 decoder,
3181 _inner_offset,
3182 depth
3183 )?;
3184 } else {
3185 unreachable!()
3186 }
3187 }
3188 2 => {
3189 #[allow(irrefutable_let_patterns)]
3190 if let FormattedContent::Text(_) = self {
3191 } else {
3193 *self = FormattedContent::Text(fidl::new_empty!(
3195 fidl_fuchsia_mem::Buffer,
3196 fidl::encoding::DefaultFuchsiaResourceDialect
3197 ));
3198 }
3199 #[allow(irrefutable_let_patterns)]
3200 if let FormattedContent::Text(ref mut val) = self {
3201 fidl::decode!(
3202 fidl_fuchsia_mem::Buffer,
3203 fidl::encoding::DefaultFuchsiaResourceDialect,
3204 val,
3205 decoder,
3206 _inner_offset,
3207 depth
3208 )?;
3209 } else {
3210 unreachable!()
3211 }
3212 }
3213 3 => {
3214 #[allow(irrefutable_let_patterns)]
3215 if let FormattedContent::Cbor(_) = self {
3216 } else {
3218 *self = FormattedContent::Cbor(
3220 fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
3221 );
3222 }
3223 #[allow(irrefutable_let_patterns)]
3224 if let FormattedContent::Cbor(ref mut val) = self {
3225 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
3226 } else {
3227 unreachable!()
3228 }
3229 }
3230 4 => {
3231 #[allow(irrefutable_let_patterns)]
3232 if let FormattedContent::Fxt(_) = self {
3233 } else {
3235 *self = FormattedContent::Fxt(
3237 fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
3238 );
3239 }
3240 #[allow(irrefutable_let_patterns)]
3241 if let FormattedContent::Fxt(ref mut val) = self {
3242 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
3243 } else {
3244 unreachable!()
3245 }
3246 }
3247 #[allow(deprecated)]
3248 ordinal => {
3249 for _ in 0..num_handles {
3250 decoder.drop_next_handle()?;
3251 }
3252 *self = FormattedContent::__SourceBreaking { unknown_ordinal: ordinal };
3253 }
3254 }
3255 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
3256 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3257 }
3258 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3259 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3260 }
3261 Ok(())
3262 }
3263 }
3264}