1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fdomain_client::fidl::{ControlHandle as _, FDomainFlexibleIntoResult as _, Responder as _};
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9pub use fidl_fuchsia_diagnostics__common::*;
10use futures::future::{self, MaybeDone, TryFutureExt};
11use zx_status;
12
13#[derive(Debug, PartialEq)]
14pub struct ArchiveAccessorStreamDiagnosticsRequest {
15 pub stream_parameters: StreamParameters,
16 pub result_stream: fdomain_client::fidl::ServerEnd<BatchIteratorMarker>,
17}
18
19impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
20 for ArchiveAccessorStreamDiagnosticsRequest
21{
22}
23
24#[derive(Debug, PartialEq)]
25pub struct BatchIteratorGetNextResponse {
26 pub batch: Vec<FormattedContent>,
27}
28
29impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
30 for BatchIteratorGetNextResponse
31{
32}
33
34#[derive(Debug, PartialEq)]
35pub struct LogStreamConnectRequest {
36 pub socket: fdomain_client::Socket,
37 pub opts: LogStreamOptions,
38}
39
40impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect> for LogStreamConnectRequest {}
41
42#[derive(Debug)]
45pub enum FormattedContent {
46 Json(fdomain_fuchsia_mem::Buffer),
49 Text(fdomain_fuchsia_mem::Buffer),
52 Cbor(fdomain_client::Vmo),
56 Fxt(fdomain_client::Vmo),
62 #[doc(hidden)]
63 __SourceBreaking { unknown_ordinal: u64 },
64}
65
66#[macro_export]
68macro_rules! FormattedContentUnknown {
69 () => {
70 _
71 };
72}
73
74impl PartialEq for FormattedContent {
76 fn eq(&self, other: &Self) -> bool {
77 match (self, other) {
78 (Self::Json(x), Self::Json(y)) => *x == *y,
79 (Self::Text(x), Self::Text(y)) => *x == *y,
80 (Self::Cbor(x), Self::Cbor(y)) => *x == *y,
81 (Self::Fxt(x), Self::Fxt(y)) => *x == *y,
82 _ => false,
83 }
84 }
85}
86
87impl FormattedContent {
88 #[inline]
89 pub fn ordinal(&self) -> u64 {
90 match *self {
91 Self::Json(_) => 1,
92 Self::Text(_) => 2,
93 Self::Cbor(_) => 3,
94 Self::Fxt(_) => 4,
95 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
96 }
97 }
98
99 #[inline]
100 pub fn unknown_variant_for_testing() -> Self {
101 Self::__SourceBreaking { unknown_ordinal: 0 }
102 }
103
104 #[inline]
105 pub fn is_unknown(&self) -> bool {
106 match self {
107 Self::__SourceBreaking { .. } => true,
108 _ => false,
109 }
110 }
111}
112
113impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect> for FormattedContent {}
114
115#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
116pub struct ArchiveAccessorMarker;
117
118impl fdomain_client::fidl::ProtocolMarker for ArchiveAccessorMarker {
119 type Proxy = ArchiveAccessorProxy;
120 type RequestStream = ArchiveAccessorRequestStream;
121
122 const DEBUG_NAME: &'static str = "fuchsia.diagnostics.ArchiveAccessor";
123}
124impl fdomain_client::fidl::DiscoverableProtocolMarker for ArchiveAccessorMarker {}
125
126pub trait ArchiveAccessorProxyInterface: Send + Sync {
127 fn r#stream_diagnostics(
128 &self,
129 stream_parameters: &StreamParameters,
130 result_stream: fdomain_client::fidl::ServerEnd<BatchIteratorMarker>,
131 ) -> Result<(), fidl::Error>;
132 type WaitForReadyResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
133 fn r#wait_for_ready(&self) -> Self::WaitForReadyResponseFut;
134}
135
136#[derive(Debug, Clone)]
137pub struct ArchiveAccessorProxy {
138 client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
139}
140
141impl fdomain_client::fidl::Proxy for ArchiveAccessorProxy {
142 type Protocol = ArchiveAccessorMarker;
143
144 fn from_channel(inner: fdomain_client::Channel) -> Self {
145 Self::new(inner)
146 }
147
148 fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
149 self.client.into_channel().map_err(|client| Self { client })
150 }
151
152 fn as_channel(&self) -> &fdomain_client::Channel {
153 self.client.as_channel()
154 }
155}
156
157impl ArchiveAccessorProxy {
158 pub fn new(channel: fdomain_client::Channel) -> Self {
160 let protocol_name =
161 <ArchiveAccessorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
162 Self { client: fidl::client::Client::new(channel, protocol_name) }
163 }
164
165 pub fn take_event_stream(&self) -> ArchiveAccessorEventStream {
171 ArchiveAccessorEventStream { event_receiver: self.client.take_event_receiver() }
172 }
173
174 pub fn r#stream_diagnostics(
192 &self,
193 mut stream_parameters: &StreamParameters,
194 mut result_stream: fdomain_client::fidl::ServerEnd<BatchIteratorMarker>,
195 ) -> Result<(), fidl::Error> {
196 ArchiveAccessorProxyInterface::r#stream_diagnostics(self, stream_parameters, result_stream)
197 }
198
199 pub fn r#wait_for_ready(
202 &self,
203 ) -> fidl::client::QueryResponseFut<(), fdomain_client::fidl::FDomainResourceDialect> {
204 ArchiveAccessorProxyInterface::r#wait_for_ready(self)
205 }
206}
207
208impl ArchiveAccessorProxyInterface for ArchiveAccessorProxy {
209 fn r#stream_diagnostics(
210 &self,
211 mut stream_parameters: &StreamParameters,
212 mut result_stream: fdomain_client::fidl::ServerEnd<BatchIteratorMarker>,
213 ) -> Result<(), fidl::Error> {
214 self.client.send::<ArchiveAccessorStreamDiagnosticsRequest>(
215 (stream_parameters, result_stream),
216 0x20c73e2ecd653c3e,
217 fidl::encoding::DynamicFlags::FLEXIBLE,
218 )
219 }
220
221 type WaitForReadyResponseFut =
222 fidl::client::QueryResponseFut<(), fdomain_client::fidl::FDomainResourceDialect>;
223 fn r#wait_for_ready(&self) -> Self::WaitForReadyResponseFut {
224 fn _decode(
225 mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
226 ) -> Result<(), fidl::Error> {
227 let _response = fidl::client::decode_transaction_body::<
228 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
229 fdomain_client::fidl::FDomainResourceDialect,
230 0x122963198011bd24,
231 >(_buf?)?
232 .into_result_fdomain::<ArchiveAccessorMarker>("wait_for_ready")?;
233 Ok(_response)
234 }
235 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
236 (),
237 0x122963198011bd24,
238 fidl::encoding::DynamicFlags::FLEXIBLE,
239 _decode,
240 )
241 }
242}
243
244pub struct ArchiveAccessorEventStream {
245 event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
246}
247
248impl std::marker::Unpin for ArchiveAccessorEventStream {}
249
250impl futures::stream::FusedStream for ArchiveAccessorEventStream {
251 fn is_terminated(&self) -> bool {
252 self.event_receiver.is_terminated()
253 }
254}
255
256impl futures::Stream for ArchiveAccessorEventStream {
257 type Item = Result<ArchiveAccessorEvent, fidl::Error>;
258
259 fn poll_next(
260 mut self: std::pin::Pin<&mut Self>,
261 cx: &mut std::task::Context<'_>,
262 ) -> std::task::Poll<Option<Self::Item>> {
263 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
264 &mut self.event_receiver,
265 cx
266 )?) {
267 Some(buf) => std::task::Poll::Ready(Some(ArchiveAccessorEvent::decode(buf))),
268 None => std::task::Poll::Ready(None),
269 }
270 }
271}
272
273#[derive(Debug)]
274pub enum ArchiveAccessorEvent {
275 #[non_exhaustive]
276 _UnknownEvent {
277 ordinal: u64,
279 },
280}
281
282impl ArchiveAccessorEvent {
283 fn decode(
285 mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
286 ) -> Result<ArchiveAccessorEvent, fidl::Error> {
287 let (bytes, _handles) = buf.split_mut();
288 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
289 debug_assert_eq!(tx_header.tx_id, 0);
290 match tx_header.ordinal {
291 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
292 Ok(ArchiveAccessorEvent::_UnknownEvent { ordinal: tx_header.ordinal })
293 }
294 _ => Err(fidl::Error::UnknownOrdinal {
295 ordinal: tx_header.ordinal,
296 protocol_name:
297 <ArchiveAccessorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
298 }),
299 }
300 }
301}
302
303pub struct ArchiveAccessorRequestStream {
305 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
306 is_terminated: bool,
307}
308
309impl std::marker::Unpin for ArchiveAccessorRequestStream {}
310
311impl futures::stream::FusedStream for ArchiveAccessorRequestStream {
312 fn is_terminated(&self) -> bool {
313 self.is_terminated
314 }
315}
316
317impl fdomain_client::fidl::RequestStream for ArchiveAccessorRequestStream {
318 type Protocol = ArchiveAccessorMarker;
319 type ControlHandle = ArchiveAccessorControlHandle;
320
321 fn from_channel(channel: fdomain_client::Channel) -> Self {
322 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
323 }
324
325 fn control_handle(&self) -> Self::ControlHandle {
326 ArchiveAccessorControlHandle { inner: self.inner.clone() }
327 }
328
329 fn into_inner(
330 self,
331 ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
332 {
333 (self.inner, self.is_terminated)
334 }
335
336 fn from_inner(
337 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
338 is_terminated: bool,
339 ) -> Self {
340 Self { inner, is_terminated }
341 }
342}
343
344impl futures::Stream for ArchiveAccessorRequestStream {
345 type Item = Result<ArchiveAccessorRequest, fidl::Error>;
346
347 fn poll_next(
348 mut self: std::pin::Pin<&mut Self>,
349 cx: &mut std::task::Context<'_>,
350 ) -> std::task::Poll<Option<Self::Item>> {
351 let this = &mut *self;
352 if this.inner.check_shutdown(cx) {
353 this.is_terminated = true;
354 return std::task::Poll::Ready(None);
355 }
356 if this.is_terminated {
357 panic!("polled ArchiveAccessorRequestStream after completion");
358 }
359 fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
360 |bytes, handles| {
361 match this.inner.channel().read_etc(cx, bytes, handles) {
362 std::task::Poll::Ready(Ok(())) => {}
363 std::task::Poll::Pending => return std::task::Poll::Pending,
364 std::task::Poll::Ready(Err(None)) => {
365 this.is_terminated = true;
366 return std::task::Poll::Ready(None);
367 }
368 std::task::Poll::Ready(Err(Some(e))) => {
369 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
370 e.into(),
371 ))))
372 }
373 }
374
375 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
377
378 std::task::Poll::Ready(Some(match header.ordinal {
379 0x20c73e2ecd653c3e => {
380 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
381 let mut req = fidl::new_empty!(ArchiveAccessorStreamDiagnosticsRequest, fdomain_client::fidl::FDomainResourceDialect);
382 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<ArchiveAccessorStreamDiagnosticsRequest>(&header, _body_bytes, handles, &mut req)?;
383 let control_handle = ArchiveAccessorControlHandle {
384 inner: this.inner.clone(),
385 };
386 Ok(ArchiveAccessorRequest::StreamDiagnostics {stream_parameters: req.stream_parameters,
387result_stream: req.result_stream,
388
389 control_handle,
390 })
391 }
392 0x122963198011bd24 => {
393 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
394 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fdomain_client::fidl::FDomainResourceDialect);
395 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
396 let control_handle = ArchiveAccessorControlHandle {
397 inner: this.inner.clone(),
398 };
399 Ok(ArchiveAccessorRequest::WaitForReady {
400 responder: ArchiveAccessorWaitForReadyResponder {
401 control_handle: std::mem::ManuallyDrop::new(control_handle),
402 tx_id: header.tx_id,
403 },
404 })
405 }
406 _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
407 Ok(ArchiveAccessorRequest::_UnknownMethod {
408 ordinal: header.ordinal,
409 control_handle: ArchiveAccessorControlHandle { inner: this.inner.clone() },
410 method_type: fidl::MethodType::OneWay,
411 })
412 }
413 _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
414 this.inner.send_framework_err(
415 fidl::encoding::FrameworkErr::UnknownMethod,
416 header.tx_id,
417 header.ordinal,
418 header.dynamic_flags(),
419 (bytes, handles),
420 )?;
421 Ok(ArchiveAccessorRequest::_UnknownMethod {
422 ordinal: header.ordinal,
423 control_handle: ArchiveAccessorControlHandle { inner: this.inner.clone() },
424 method_type: fidl::MethodType::TwoWay,
425 })
426 }
427 _ => Err(fidl::Error::UnknownOrdinal {
428 ordinal: header.ordinal,
429 protocol_name: <ArchiveAccessorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
430 }),
431 }))
432 },
433 )
434 }
435}
436
437#[derive(Debug)]
439pub enum ArchiveAccessorRequest {
440 StreamDiagnostics {
458 stream_parameters: StreamParameters,
459 result_stream: fdomain_client::fidl::ServerEnd<BatchIteratorMarker>,
460 control_handle: ArchiveAccessorControlHandle,
461 },
462 WaitForReady { responder: ArchiveAccessorWaitForReadyResponder },
465 #[non_exhaustive]
467 _UnknownMethod {
468 ordinal: u64,
470 control_handle: ArchiveAccessorControlHandle,
471 method_type: fidl::MethodType,
472 },
473}
474
475impl ArchiveAccessorRequest {
476 #[allow(irrefutable_let_patterns)]
477 pub fn into_stream_diagnostics(
478 self,
479 ) -> Option<(
480 StreamParameters,
481 fdomain_client::fidl::ServerEnd<BatchIteratorMarker>,
482 ArchiveAccessorControlHandle,
483 )> {
484 if let ArchiveAccessorRequest::StreamDiagnostics {
485 stream_parameters,
486 result_stream,
487 control_handle,
488 } = self
489 {
490 Some((stream_parameters, result_stream, control_handle))
491 } else {
492 None
493 }
494 }
495
496 #[allow(irrefutable_let_patterns)]
497 pub fn into_wait_for_ready(self) -> Option<(ArchiveAccessorWaitForReadyResponder)> {
498 if let ArchiveAccessorRequest::WaitForReady { responder } = self {
499 Some((responder))
500 } else {
501 None
502 }
503 }
504
505 pub fn method_name(&self) -> &'static str {
507 match *self {
508 ArchiveAccessorRequest::StreamDiagnostics { .. } => "stream_diagnostics",
509 ArchiveAccessorRequest::WaitForReady { .. } => "wait_for_ready",
510 ArchiveAccessorRequest::_UnknownMethod {
511 method_type: fidl::MethodType::OneWay,
512 ..
513 } => "unknown one-way method",
514 ArchiveAccessorRequest::_UnknownMethod {
515 method_type: fidl::MethodType::TwoWay,
516 ..
517 } => "unknown two-way method",
518 }
519 }
520}
521
522#[derive(Debug, Clone)]
523pub struct ArchiveAccessorControlHandle {
524 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
525}
526
527impl fdomain_client::fidl::ControlHandle for ArchiveAccessorControlHandle {
528 fn shutdown(&self) {
529 self.inner.shutdown()
530 }
531
532 fn is_closed(&self) -> bool {
533 self.inner.channel().is_closed()
534 }
535 fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
536 self.inner.channel().on_closed()
537 }
538}
539
540impl ArchiveAccessorControlHandle {}
541
542#[must_use = "FIDL methods require a response to be sent"]
543#[derive(Debug)]
544pub struct ArchiveAccessorWaitForReadyResponder {
545 control_handle: std::mem::ManuallyDrop<ArchiveAccessorControlHandle>,
546 tx_id: u32,
547}
548
549impl std::ops::Drop for ArchiveAccessorWaitForReadyResponder {
553 fn drop(&mut self) {
554 self.control_handle.shutdown();
555 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
557 }
558}
559
560impl fdomain_client::fidl::Responder for ArchiveAccessorWaitForReadyResponder {
561 type ControlHandle = ArchiveAccessorControlHandle;
562
563 fn control_handle(&self) -> &ArchiveAccessorControlHandle {
564 &self.control_handle
565 }
566
567 fn drop_without_shutdown(mut self) {
568 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
570 std::mem::forget(self);
572 }
573}
574
575impl ArchiveAccessorWaitForReadyResponder {
576 pub fn send(self) -> Result<(), fidl::Error> {
580 let _result = self.send_raw();
581 if _result.is_err() {
582 self.control_handle.shutdown();
583 }
584 self.drop_without_shutdown();
585 _result
586 }
587
588 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
590 let _result = self.send_raw();
591 self.drop_without_shutdown();
592 _result
593 }
594
595 fn send_raw(&self) -> Result<(), fidl::Error> {
596 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
597 fidl::encoding::Flexible::new(()),
598 self.tx_id,
599 0x122963198011bd24,
600 fidl::encoding::DynamicFlags::FLEXIBLE,
601 )
602 }
603}
604
605#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
606pub struct BatchIteratorMarker;
607
608impl fdomain_client::fidl::ProtocolMarker for BatchIteratorMarker {
609 type Proxy = BatchIteratorProxy;
610 type RequestStream = BatchIteratorRequestStream;
611
612 const DEBUG_NAME: &'static str = "(anonymous) BatchIterator";
613}
614pub type BatchIteratorGetNextResult = Result<Vec<FormattedContent>, ReaderError>;
615
616pub trait BatchIteratorProxyInterface: Send + Sync {
617 type GetNextResponseFut: std::future::Future<Output = Result<BatchIteratorGetNextResult, fidl::Error>>
618 + Send;
619 fn r#get_next(&self) -> Self::GetNextResponseFut;
620 type WaitForReadyResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
621 fn r#wait_for_ready(&self) -> Self::WaitForReadyResponseFut;
622}
623
624#[derive(Debug, Clone)]
625pub struct BatchIteratorProxy {
626 client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
627}
628
629impl fdomain_client::fidl::Proxy for BatchIteratorProxy {
630 type Protocol = BatchIteratorMarker;
631
632 fn from_channel(inner: fdomain_client::Channel) -> Self {
633 Self::new(inner)
634 }
635
636 fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
637 self.client.into_channel().map_err(|client| Self { client })
638 }
639
640 fn as_channel(&self) -> &fdomain_client::Channel {
641 self.client.as_channel()
642 }
643}
644
645impl BatchIteratorProxy {
646 pub fn new(channel: fdomain_client::Channel) -> Self {
648 let protocol_name =
649 <BatchIteratorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
650 Self { client: fidl::client::Client::new(channel, protocol_name) }
651 }
652
653 pub fn take_event_stream(&self) -> BatchIteratorEventStream {
659 BatchIteratorEventStream { event_receiver: self.client.take_event_receiver() }
660 }
661
662 pub fn r#get_next(
686 &self,
687 ) -> fidl::client::QueryResponseFut<
688 BatchIteratorGetNextResult,
689 fdomain_client::fidl::FDomainResourceDialect,
690 > {
691 BatchIteratorProxyInterface::r#get_next(self)
692 }
693
694 pub fn r#wait_for_ready(
697 &self,
698 ) -> fidl::client::QueryResponseFut<(), fdomain_client::fidl::FDomainResourceDialect> {
699 BatchIteratorProxyInterface::r#wait_for_ready(self)
700 }
701}
702
703impl BatchIteratorProxyInterface for BatchIteratorProxy {
704 type GetNextResponseFut = fidl::client::QueryResponseFut<
705 BatchIteratorGetNextResult,
706 fdomain_client::fidl::FDomainResourceDialect,
707 >;
708 fn r#get_next(&self) -> Self::GetNextResponseFut {
709 fn _decode(
710 mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
711 ) -> Result<BatchIteratorGetNextResult, fidl::Error> {
712 let _response = fidl::client::decode_transaction_body::<
713 fidl::encoding::FlexibleResultType<BatchIteratorGetNextResponse, ReaderError>,
714 fdomain_client::fidl::FDomainResourceDialect,
715 0x781986486c6254a5,
716 >(_buf?)?
717 .into_result_fdomain::<BatchIteratorMarker>("get_next")?;
718 Ok(_response.map(|x| x.batch))
719 }
720 self.client
721 .send_query_and_decode::<fidl::encoding::EmptyPayload, BatchIteratorGetNextResult>(
722 (),
723 0x781986486c6254a5,
724 fidl::encoding::DynamicFlags::FLEXIBLE,
725 _decode,
726 )
727 }
728
729 type WaitForReadyResponseFut =
730 fidl::client::QueryResponseFut<(), fdomain_client::fidl::FDomainResourceDialect>;
731 fn r#wait_for_ready(&self) -> Self::WaitForReadyResponseFut {
732 fn _decode(
733 mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
734 ) -> Result<(), fidl::Error> {
735 let _response = fidl::client::decode_transaction_body::<
736 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
737 fdomain_client::fidl::FDomainResourceDialect,
738 0x70598ee271597603,
739 >(_buf?)?
740 .into_result_fdomain::<BatchIteratorMarker>("wait_for_ready")?;
741 Ok(_response)
742 }
743 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
744 (),
745 0x70598ee271597603,
746 fidl::encoding::DynamicFlags::FLEXIBLE,
747 _decode,
748 )
749 }
750}
751
752pub struct BatchIteratorEventStream {
753 event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
754}
755
756impl std::marker::Unpin for BatchIteratorEventStream {}
757
758impl futures::stream::FusedStream for BatchIteratorEventStream {
759 fn is_terminated(&self) -> bool {
760 self.event_receiver.is_terminated()
761 }
762}
763
764impl futures::Stream for BatchIteratorEventStream {
765 type Item = Result<BatchIteratorEvent, fidl::Error>;
766
767 fn poll_next(
768 mut self: std::pin::Pin<&mut Self>,
769 cx: &mut std::task::Context<'_>,
770 ) -> std::task::Poll<Option<Self::Item>> {
771 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
772 &mut self.event_receiver,
773 cx
774 )?) {
775 Some(buf) => std::task::Poll::Ready(Some(BatchIteratorEvent::decode(buf))),
776 None => std::task::Poll::Ready(None),
777 }
778 }
779}
780
781#[derive(Debug)]
782pub enum BatchIteratorEvent {
783 #[non_exhaustive]
784 _UnknownEvent {
785 ordinal: u64,
787 },
788}
789
790impl BatchIteratorEvent {
791 fn decode(
793 mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
794 ) -> Result<BatchIteratorEvent, fidl::Error> {
795 let (bytes, _handles) = buf.split_mut();
796 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
797 debug_assert_eq!(tx_header.tx_id, 0);
798 match tx_header.ordinal {
799 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
800 Ok(BatchIteratorEvent::_UnknownEvent { ordinal: tx_header.ordinal })
801 }
802 _ => Err(fidl::Error::UnknownOrdinal {
803 ordinal: tx_header.ordinal,
804 protocol_name:
805 <BatchIteratorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
806 }),
807 }
808 }
809}
810
811pub struct BatchIteratorRequestStream {
813 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
814 is_terminated: bool,
815}
816
817impl std::marker::Unpin for BatchIteratorRequestStream {}
818
819impl futures::stream::FusedStream for BatchIteratorRequestStream {
820 fn is_terminated(&self) -> bool {
821 self.is_terminated
822 }
823}
824
825impl fdomain_client::fidl::RequestStream for BatchIteratorRequestStream {
826 type Protocol = BatchIteratorMarker;
827 type ControlHandle = BatchIteratorControlHandle;
828
829 fn from_channel(channel: fdomain_client::Channel) -> Self {
830 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
831 }
832
833 fn control_handle(&self) -> Self::ControlHandle {
834 BatchIteratorControlHandle { inner: self.inner.clone() }
835 }
836
837 fn into_inner(
838 self,
839 ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
840 {
841 (self.inner, self.is_terminated)
842 }
843
844 fn from_inner(
845 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
846 is_terminated: bool,
847 ) -> Self {
848 Self { inner, is_terminated }
849 }
850}
851
852impl futures::Stream for BatchIteratorRequestStream {
853 type Item = Result<BatchIteratorRequest, fidl::Error>;
854
855 fn poll_next(
856 mut self: std::pin::Pin<&mut Self>,
857 cx: &mut std::task::Context<'_>,
858 ) -> std::task::Poll<Option<Self::Item>> {
859 let this = &mut *self;
860 if this.inner.check_shutdown(cx) {
861 this.is_terminated = true;
862 return std::task::Poll::Ready(None);
863 }
864 if this.is_terminated {
865 panic!("polled BatchIteratorRequestStream after completion");
866 }
867 fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
868 |bytes, handles| {
869 match this.inner.channel().read_etc(cx, bytes, handles) {
870 std::task::Poll::Ready(Ok(())) => {}
871 std::task::Poll::Pending => return std::task::Poll::Pending,
872 std::task::Poll::Ready(Err(None)) => {
873 this.is_terminated = true;
874 return std::task::Poll::Ready(None);
875 }
876 std::task::Poll::Ready(Err(Some(e))) => {
877 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
878 e.into(),
879 ))))
880 }
881 }
882
883 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
885
886 std::task::Poll::Ready(Some(match header.ordinal {
887 0x781986486c6254a5 => {
888 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
889 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fdomain_client::fidl::FDomainResourceDialect);
890 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
891 let control_handle = BatchIteratorControlHandle {
892 inner: this.inner.clone(),
893 };
894 Ok(BatchIteratorRequest::GetNext {
895 responder: BatchIteratorGetNextResponder {
896 control_handle: std::mem::ManuallyDrop::new(control_handle),
897 tx_id: header.tx_id,
898 },
899 })
900 }
901 0x70598ee271597603 => {
902 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
903 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fdomain_client::fidl::FDomainResourceDialect);
904 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
905 let control_handle = BatchIteratorControlHandle {
906 inner: this.inner.clone(),
907 };
908 Ok(BatchIteratorRequest::WaitForReady {
909 responder: BatchIteratorWaitForReadyResponder {
910 control_handle: std::mem::ManuallyDrop::new(control_handle),
911 tx_id: header.tx_id,
912 },
913 })
914 }
915 _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
916 Ok(BatchIteratorRequest::_UnknownMethod {
917 ordinal: header.ordinal,
918 control_handle: BatchIteratorControlHandle { inner: this.inner.clone() },
919 method_type: fidl::MethodType::OneWay,
920 })
921 }
922 _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
923 this.inner.send_framework_err(
924 fidl::encoding::FrameworkErr::UnknownMethod,
925 header.tx_id,
926 header.ordinal,
927 header.dynamic_flags(),
928 (bytes, handles),
929 )?;
930 Ok(BatchIteratorRequest::_UnknownMethod {
931 ordinal: header.ordinal,
932 control_handle: BatchIteratorControlHandle { inner: this.inner.clone() },
933 method_type: fidl::MethodType::TwoWay,
934 })
935 }
936 _ => Err(fidl::Error::UnknownOrdinal {
937 ordinal: header.ordinal,
938 protocol_name: <BatchIteratorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
939 }),
940 }))
941 },
942 )
943 }
944}
945
946#[derive(Debug)]
949pub enum BatchIteratorRequest {
950 GetNext { responder: BatchIteratorGetNextResponder },
974 WaitForReady { responder: BatchIteratorWaitForReadyResponder },
977 #[non_exhaustive]
979 _UnknownMethod {
980 ordinal: u64,
982 control_handle: BatchIteratorControlHandle,
983 method_type: fidl::MethodType,
984 },
985}
986
987impl BatchIteratorRequest {
988 #[allow(irrefutable_let_patterns)]
989 pub fn into_get_next(self) -> Option<(BatchIteratorGetNextResponder)> {
990 if let BatchIteratorRequest::GetNext { responder } = self {
991 Some((responder))
992 } else {
993 None
994 }
995 }
996
997 #[allow(irrefutable_let_patterns)]
998 pub fn into_wait_for_ready(self) -> Option<(BatchIteratorWaitForReadyResponder)> {
999 if let BatchIteratorRequest::WaitForReady { responder } = self {
1000 Some((responder))
1001 } else {
1002 None
1003 }
1004 }
1005
1006 pub fn method_name(&self) -> &'static str {
1008 match *self {
1009 BatchIteratorRequest::GetNext { .. } => "get_next",
1010 BatchIteratorRequest::WaitForReady { .. } => "wait_for_ready",
1011 BatchIteratorRequest::_UnknownMethod {
1012 method_type: fidl::MethodType::OneWay, ..
1013 } => "unknown one-way method",
1014 BatchIteratorRequest::_UnknownMethod {
1015 method_type: fidl::MethodType::TwoWay, ..
1016 } => "unknown two-way method",
1017 }
1018 }
1019}
1020
1021#[derive(Debug, Clone)]
1022pub struct BatchIteratorControlHandle {
1023 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1024}
1025
1026impl fdomain_client::fidl::ControlHandle for BatchIteratorControlHandle {
1027 fn shutdown(&self) {
1028 self.inner.shutdown()
1029 }
1030
1031 fn is_closed(&self) -> bool {
1032 self.inner.channel().is_closed()
1033 }
1034 fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
1035 self.inner.channel().on_closed()
1036 }
1037}
1038
1039impl BatchIteratorControlHandle {}
1040
1041#[must_use = "FIDL methods require a response to be sent"]
1042#[derive(Debug)]
1043pub struct BatchIteratorGetNextResponder {
1044 control_handle: std::mem::ManuallyDrop<BatchIteratorControlHandle>,
1045 tx_id: u32,
1046}
1047
1048impl std::ops::Drop for BatchIteratorGetNextResponder {
1052 fn drop(&mut self) {
1053 self.control_handle.shutdown();
1054 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1056 }
1057}
1058
1059impl fdomain_client::fidl::Responder for BatchIteratorGetNextResponder {
1060 type ControlHandle = BatchIteratorControlHandle;
1061
1062 fn control_handle(&self) -> &BatchIteratorControlHandle {
1063 &self.control_handle
1064 }
1065
1066 fn drop_without_shutdown(mut self) {
1067 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1069 std::mem::forget(self);
1071 }
1072}
1073
1074impl BatchIteratorGetNextResponder {
1075 pub fn send(
1079 self,
1080 mut result: Result<Vec<FormattedContent>, ReaderError>,
1081 ) -> Result<(), fidl::Error> {
1082 let _result = self.send_raw(result);
1083 if _result.is_err() {
1084 self.control_handle.shutdown();
1085 }
1086 self.drop_without_shutdown();
1087 _result
1088 }
1089
1090 pub fn send_no_shutdown_on_err(
1092 self,
1093 mut result: Result<Vec<FormattedContent>, ReaderError>,
1094 ) -> Result<(), fidl::Error> {
1095 let _result = self.send_raw(result);
1096 self.drop_without_shutdown();
1097 _result
1098 }
1099
1100 fn send_raw(
1101 &self,
1102 mut result: Result<Vec<FormattedContent>, ReaderError>,
1103 ) -> Result<(), fidl::Error> {
1104 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1105 BatchIteratorGetNextResponse,
1106 ReaderError,
1107 >>(
1108 fidl::encoding::FlexibleResult::new(
1109 result.as_mut().map_err(|e| *e).map(|batch| (batch.as_mut_slice(),)),
1110 ),
1111 self.tx_id,
1112 0x781986486c6254a5,
1113 fidl::encoding::DynamicFlags::FLEXIBLE,
1114 )
1115 }
1116}
1117
1118#[must_use = "FIDL methods require a response to be sent"]
1119#[derive(Debug)]
1120pub struct BatchIteratorWaitForReadyResponder {
1121 control_handle: std::mem::ManuallyDrop<BatchIteratorControlHandle>,
1122 tx_id: u32,
1123}
1124
1125impl std::ops::Drop for BatchIteratorWaitForReadyResponder {
1129 fn drop(&mut self) {
1130 self.control_handle.shutdown();
1131 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1133 }
1134}
1135
1136impl fdomain_client::fidl::Responder for BatchIteratorWaitForReadyResponder {
1137 type ControlHandle = BatchIteratorControlHandle;
1138
1139 fn control_handle(&self) -> &BatchIteratorControlHandle {
1140 &self.control_handle
1141 }
1142
1143 fn drop_without_shutdown(mut self) {
1144 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1146 std::mem::forget(self);
1148 }
1149}
1150
1151impl BatchIteratorWaitForReadyResponder {
1152 pub fn send(self) -> Result<(), fidl::Error> {
1156 let _result = self.send_raw();
1157 if _result.is_err() {
1158 self.control_handle.shutdown();
1159 }
1160 self.drop_without_shutdown();
1161 _result
1162 }
1163
1164 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1166 let _result = self.send_raw();
1167 self.drop_without_shutdown();
1168 _result
1169 }
1170
1171 fn send_raw(&self) -> Result<(), fidl::Error> {
1172 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
1173 fidl::encoding::Flexible::new(()),
1174 self.tx_id,
1175 0x70598ee271597603,
1176 fidl::encoding::DynamicFlags::FLEXIBLE,
1177 )
1178 }
1179}
1180
1181#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1182pub struct LogFlusherMarker;
1183
1184impl fdomain_client::fidl::ProtocolMarker for LogFlusherMarker {
1185 type Proxy = LogFlusherProxy;
1186 type RequestStream = LogFlusherRequestStream;
1187
1188 const DEBUG_NAME: &'static str = "fuchsia.diagnostics.LogFlusher";
1189}
1190impl fdomain_client::fidl::DiscoverableProtocolMarker for LogFlusherMarker {}
1191
1192pub trait LogFlusherProxyInterface: Send + Sync {
1193 type WaitUntilFlushedResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1194 fn r#wait_until_flushed(&self) -> Self::WaitUntilFlushedResponseFut;
1195}
1196
1197#[derive(Debug, Clone)]
1198pub struct LogFlusherProxy {
1199 client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
1200}
1201
1202impl fdomain_client::fidl::Proxy for LogFlusherProxy {
1203 type Protocol = LogFlusherMarker;
1204
1205 fn from_channel(inner: fdomain_client::Channel) -> Self {
1206 Self::new(inner)
1207 }
1208
1209 fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
1210 self.client.into_channel().map_err(|client| Self { client })
1211 }
1212
1213 fn as_channel(&self) -> &fdomain_client::Channel {
1214 self.client.as_channel()
1215 }
1216}
1217
1218impl LogFlusherProxy {
1219 pub fn new(channel: fdomain_client::Channel) -> Self {
1221 let protocol_name = <LogFlusherMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
1222 Self { client: fidl::client::Client::new(channel, protocol_name) }
1223 }
1224
1225 pub fn take_event_stream(&self) -> LogFlusherEventStream {
1231 LogFlusherEventStream { event_receiver: self.client.take_event_receiver() }
1232 }
1233
1234 pub fn r#wait_until_flushed(
1250 &self,
1251 ) -> fidl::client::QueryResponseFut<(), fdomain_client::fidl::FDomainResourceDialect> {
1252 LogFlusherProxyInterface::r#wait_until_flushed(self)
1253 }
1254}
1255
1256impl LogFlusherProxyInterface for LogFlusherProxy {
1257 type WaitUntilFlushedResponseFut =
1258 fidl::client::QueryResponseFut<(), fdomain_client::fidl::FDomainResourceDialect>;
1259 fn r#wait_until_flushed(&self) -> Self::WaitUntilFlushedResponseFut {
1260 fn _decode(
1261 mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1262 ) -> Result<(), fidl::Error> {
1263 let _response = fidl::client::decode_transaction_body::<
1264 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
1265 fdomain_client::fidl::FDomainResourceDialect,
1266 0x7dc4892e46748b5b,
1267 >(_buf?)?
1268 .into_result_fdomain::<LogFlusherMarker>("wait_until_flushed")?;
1269 Ok(_response)
1270 }
1271 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
1272 (),
1273 0x7dc4892e46748b5b,
1274 fidl::encoding::DynamicFlags::FLEXIBLE,
1275 _decode,
1276 )
1277 }
1278}
1279
1280pub struct LogFlusherEventStream {
1281 event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
1282}
1283
1284impl std::marker::Unpin for LogFlusherEventStream {}
1285
1286impl futures::stream::FusedStream for LogFlusherEventStream {
1287 fn is_terminated(&self) -> bool {
1288 self.event_receiver.is_terminated()
1289 }
1290}
1291
1292impl futures::Stream for LogFlusherEventStream {
1293 type Item = Result<LogFlusherEvent, fidl::Error>;
1294
1295 fn poll_next(
1296 mut self: std::pin::Pin<&mut Self>,
1297 cx: &mut std::task::Context<'_>,
1298 ) -> std::task::Poll<Option<Self::Item>> {
1299 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1300 &mut self.event_receiver,
1301 cx
1302 )?) {
1303 Some(buf) => std::task::Poll::Ready(Some(LogFlusherEvent::decode(buf))),
1304 None => std::task::Poll::Ready(None),
1305 }
1306 }
1307}
1308
1309#[derive(Debug)]
1310pub enum LogFlusherEvent {
1311 #[non_exhaustive]
1312 _UnknownEvent {
1313 ordinal: u64,
1315 },
1316}
1317
1318impl LogFlusherEvent {
1319 fn decode(
1321 mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1322 ) -> Result<LogFlusherEvent, fidl::Error> {
1323 let (bytes, _handles) = buf.split_mut();
1324 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1325 debug_assert_eq!(tx_header.tx_id, 0);
1326 match tx_header.ordinal {
1327 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1328 Ok(LogFlusherEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1329 }
1330 _ => Err(fidl::Error::UnknownOrdinal {
1331 ordinal: tx_header.ordinal,
1332 protocol_name:
1333 <LogFlusherMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1334 }),
1335 }
1336 }
1337}
1338
1339pub struct LogFlusherRequestStream {
1341 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1342 is_terminated: bool,
1343}
1344
1345impl std::marker::Unpin for LogFlusherRequestStream {}
1346
1347impl futures::stream::FusedStream for LogFlusherRequestStream {
1348 fn is_terminated(&self) -> bool {
1349 self.is_terminated
1350 }
1351}
1352
1353impl fdomain_client::fidl::RequestStream for LogFlusherRequestStream {
1354 type Protocol = LogFlusherMarker;
1355 type ControlHandle = LogFlusherControlHandle;
1356
1357 fn from_channel(channel: fdomain_client::Channel) -> Self {
1358 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1359 }
1360
1361 fn control_handle(&self) -> Self::ControlHandle {
1362 LogFlusherControlHandle { inner: self.inner.clone() }
1363 }
1364
1365 fn into_inner(
1366 self,
1367 ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
1368 {
1369 (self.inner, self.is_terminated)
1370 }
1371
1372 fn from_inner(
1373 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1374 is_terminated: bool,
1375 ) -> Self {
1376 Self { inner, is_terminated }
1377 }
1378}
1379
1380impl futures::Stream for LogFlusherRequestStream {
1381 type Item = Result<LogFlusherRequest, fidl::Error>;
1382
1383 fn poll_next(
1384 mut self: std::pin::Pin<&mut Self>,
1385 cx: &mut std::task::Context<'_>,
1386 ) -> std::task::Poll<Option<Self::Item>> {
1387 let this = &mut *self;
1388 if this.inner.check_shutdown(cx) {
1389 this.is_terminated = true;
1390 return std::task::Poll::Ready(None);
1391 }
1392 if this.is_terminated {
1393 panic!("polled LogFlusherRequestStream after completion");
1394 }
1395 fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
1396 |bytes, handles| {
1397 match this.inner.channel().read_etc(cx, bytes, handles) {
1398 std::task::Poll::Ready(Ok(())) => {}
1399 std::task::Poll::Pending => return std::task::Poll::Pending,
1400 std::task::Poll::Ready(Err(None)) => {
1401 this.is_terminated = true;
1402 return std::task::Poll::Ready(None);
1403 }
1404 std::task::Poll::Ready(Err(Some(e))) => {
1405 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1406 e.into(),
1407 ))))
1408 }
1409 }
1410
1411 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1413
1414 std::task::Poll::Ready(Some(match header.ordinal {
1415 0x7dc4892e46748b5b => {
1416 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1417 let mut req = fidl::new_empty!(
1418 fidl::encoding::EmptyPayload,
1419 fdomain_client::fidl::FDomainResourceDialect
1420 );
1421 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1422 let control_handle = LogFlusherControlHandle { inner: this.inner.clone() };
1423 Ok(LogFlusherRequest::WaitUntilFlushed {
1424 responder: LogFlusherWaitUntilFlushedResponder {
1425 control_handle: std::mem::ManuallyDrop::new(control_handle),
1426 tx_id: header.tx_id,
1427 },
1428 })
1429 }
1430 _ if header.tx_id == 0
1431 && header
1432 .dynamic_flags()
1433 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1434 {
1435 Ok(LogFlusherRequest::_UnknownMethod {
1436 ordinal: header.ordinal,
1437 control_handle: LogFlusherControlHandle { inner: this.inner.clone() },
1438 method_type: fidl::MethodType::OneWay,
1439 })
1440 }
1441 _ if header
1442 .dynamic_flags()
1443 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1444 {
1445 this.inner.send_framework_err(
1446 fidl::encoding::FrameworkErr::UnknownMethod,
1447 header.tx_id,
1448 header.ordinal,
1449 header.dynamic_flags(),
1450 (bytes, handles),
1451 )?;
1452 Ok(LogFlusherRequest::_UnknownMethod {
1453 ordinal: header.ordinal,
1454 control_handle: LogFlusherControlHandle { inner: this.inner.clone() },
1455 method_type: fidl::MethodType::TwoWay,
1456 })
1457 }
1458 _ => Err(fidl::Error::UnknownOrdinal {
1459 ordinal: header.ordinal,
1460 protocol_name:
1461 <LogFlusherMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1462 }),
1463 }))
1464 },
1465 )
1466 }
1467}
1468
1469#[derive(Debug)]
1470pub enum LogFlusherRequest {
1471 WaitUntilFlushed { responder: LogFlusherWaitUntilFlushedResponder },
1487 #[non_exhaustive]
1489 _UnknownMethod {
1490 ordinal: u64,
1492 control_handle: LogFlusherControlHandle,
1493 method_type: fidl::MethodType,
1494 },
1495}
1496
1497impl LogFlusherRequest {
1498 #[allow(irrefutable_let_patterns)]
1499 pub fn into_wait_until_flushed(self) -> Option<(LogFlusherWaitUntilFlushedResponder)> {
1500 if let LogFlusherRequest::WaitUntilFlushed { responder } = self {
1501 Some((responder))
1502 } else {
1503 None
1504 }
1505 }
1506
1507 pub fn method_name(&self) -> &'static str {
1509 match *self {
1510 LogFlusherRequest::WaitUntilFlushed { .. } => "wait_until_flushed",
1511 LogFlusherRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
1512 "unknown one-way method"
1513 }
1514 LogFlusherRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
1515 "unknown two-way method"
1516 }
1517 }
1518 }
1519}
1520
1521#[derive(Debug, Clone)]
1522pub struct LogFlusherControlHandle {
1523 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1524}
1525
1526impl fdomain_client::fidl::ControlHandle for LogFlusherControlHandle {
1527 fn shutdown(&self) {
1528 self.inner.shutdown()
1529 }
1530
1531 fn is_closed(&self) -> bool {
1532 self.inner.channel().is_closed()
1533 }
1534 fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
1535 self.inner.channel().on_closed()
1536 }
1537}
1538
1539impl LogFlusherControlHandle {}
1540
1541#[must_use = "FIDL methods require a response to be sent"]
1542#[derive(Debug)]
1543pub struct LogFlusherWaitUntilFlushedResponder {
1544 control_handle: std::mem::ManuallyDrop<LogFlusherControlHandle>,
1545 tx_id: u32,
1546}
1547
1548impl std::ops::Drop for LogFlusherWaitUntilFlushedResponder {
1552 fn drop(&mut self) {
1553 self.control_handle.shutdown();
1554 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1556 }
1557}
1558
1559impl fdomain_client::fidl::Responder for LogFlusherWaitUntilFlushedResponder {
1560 type ControlHandle = LogFlusherControlHandle;
1561
1562 fn control_handle(&self) -> &LogFlusherControlHandle {
1563 &self.control_handle
1564 }
1565
1566 fn drop_without_shutdown(mut self) {
1567 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1569 std::mem::forget(self);
1571 }
1572}
1573
1574impl LogFlusherWaitUntilFlushedResponder {
1575 pub fn send(self) -> Result<(), fidl::Error> {
1579 let _result = self.send_raw();
1580 if _result.is_err() {
1581 self.control_handle.shutdown();
1582 }
1583 self.drop_without_shutdown();
1584 _result
1585 }
1586
1587 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1589 let _result = self.send_raw();
1590 self.drop_without_shutdown();
1591 _result
1592 }
1593
1594 fn send_raw(&self) -> Result<(), fidl::Error> {
1595 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
1596 fidl::encoding::Flexible::new(()),
1597 self.tx_id,
1598 0x7dc4892e46748b5b,
1599 fidl::encoding::DynamicFlags::FLEXIBLE,
1600 )
1601 }
1602}
1603
1604#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1605pub struct LogSettingsMarker;
1606
1607impl fdomain_client::fidl::ProtocolMarker for LogSettingsMarker {
1608 type Proxy = LogSettingsProxy;
1609 type RequestStream = LogSettingsRequestStream;
1610
1611 const DEBUG_NAME: &'static str = "fuchsia.diagnostics.LogSettings";
1612}
1613impl fdomain_client::fidl::DiscoverableProtocolMarker for LogSettingsMarker {}
1614
1615pub trait LogSettingsProxyInterface: Send + Sync {
1616 fn r#register_interest(&self, selectors: &[LogInterestSelector]) -> Result<(), fidl::Error>;
1617 type SetInterestResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1618 fn r#set_interest(&self, selectors: &[LogInterestSelector]) -> Self::SetInterestResponseFut;
1619 type SetComponentInterestResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
1620 + Send;
1621 fn r#set_component_interest(
1622 &self,
1623 payload: &LogSettingsSetComponentInterestRequest,
1624 ) -> Self::SetComponentInterestResponseFut;
1625}
1626
1627#[derive(Debug, Clone)]
1628pub struct LogSettingsProxy {
1629 client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
1630}
1631
1632impl fdomain_client::fidl::Proxy for LogSettingsProxy {
1633 type Protocol = LogSettingsMarker;
1634
1635 fn from_channel(inner: fdomain_client::Channel) -> Self {
1636 Self::new(inner)
1637 }
1638
1639 fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
1640 self.client.into_channel().map_err(|client| Self { client })
1641 }
1642
1643 fn as_channel(&self) -> &fdomain_client::Channel {
1644 self.client.as_channel()
1645 }
1646}
1647
1648impl LogSettingsProxy {
1649 pub fn new(channel: fdomain_client::Channel) -> Self {
1651 let protocol_name = <LogSettingsMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
1652 Self { client: fidl::client::Client::new(channel, protocol_name) }
1653 }
1654
1655 pub fn take_event_stream(&self) -> LogSettingsEventStream {
1661 LogSettingsEventStream { event_receiver: self.client.take_event_receiver() }
1662 }
1663
1664 pub fn r#register_interest(
1665 &self,
1666 mut selectors: &[LogInterestSelector],
1667 ) -> Result<(), fidl::Error> {
1668 LogSettingsProxyInterface::r#register_interest(self, selectors)
1669 }
1670
1671 pub fn r#set_interest(
1687 &self,
1688 mut selectors: &[LogInterestSelector],
1689 ) -> fidl::client::QueryResponseFut<(), fdomain_client::fidl::FDomainResourceDialect> {
1690 LogSettingsProxyInterface::r#set_interest(self, selectors)
1691 }
1692
1693 pub fn r#set_component_interest(
1709 &self,
1710 mut payload: &LogSettingsSetComponentInterestRequest,
1711 ) -> fidl::client::QueryResponseFut<(), fdomain_client::fidl::FDomainResourceDialect> {
1712 LogSettingsProxyInterface::r#set_component_interest(self, payload)
1713 }
1714}
1715
1716impl LogSettingsProxyInterface for LogSettingsProxy {
1717 fn r#register_interest(
1718 &self,
1719 mut selectors: &[LogInterestSelector],
1720 ) -> Result<(), fidl::Error> {
1721 self.client.send::<LogSettingsRegisterInterestRequest>(
1722 (selectors,),
1723 0x49d7c14eec975fb,
1724 fidl::encoding::DynamicFlags::empty(),
1725 )
1726 }
1727
1728 type SetInterestResponseFut =
1729 fidl::client::QueryResponseFut<(), fdomain_client::fidl::FDomainResourceDialect>;
1730 fn r#set_interest(
1731 &self,
1732 mut selectors: &[LogInterestSelector],
1733 ) -> Self::SetInterestResponseFut {
1734 fn _decode(
1735 mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1736 ) -> Result<(), fidl::Error> {
1737 let _response = fidl::client::decode_transaction_body::<
1738 fidl::encoding::EmptyPayload,
1739 fdomain_client::fidl::FDomainResourceDialect,
1740 0x71beced9d2411f90,
1741 >(_buf?)?;
1742 Ok(_response)
1743 }
1744 self.client.send_query_and_decode::<LogSettingsSetInterestRequest, ()>(
1745 (selectors,),
1746 0x71beced9d2411f90,
1747 fidl::encoding::DynamicFlags::empty(),
1748 _decode,
1749 )
1750 }
1751
1752 type SetComponentInterestResponseFut =
1753 fidl::client::QueryResponseFut<(), fdomain_client::fidl::FDomainResourceDialect>;
1754 fn r#set_component_interest(
1755 &self,
1756 mut payload: &LogSettingsSetComponentInterestRequest,
1757 ) -> Self::SetComponentInterestResponseFut {
1758 fn _decode(
1759 mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1760 ) -> Result<(), fidl::Error> {
1761 let _response = fidl::client::decode_transaction_body::<
1762 fidl::encoding::EmptyPayload,
1763 fdomain_client::fidl::FDomainResourceDialect,
1764 0x35f7004d2367f6c1,
1765 >(_buf?)?;
1766 Ok(_response)
1767 }
1768 self.client.send_query_and_decode::<LogSettingsSetComponentInterestRequest, ()>(
1769 payload,
1770 0x35f7004d2367f6c1,
1771 fidl::encoding::DynamicFlags::empty(),
1772 _decode,
1773 )
1774 }
1775}
1776
1777pub struct LogSettingsEventStream {
1778 event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
1779}
1780
1781impl std::marker::Unpin for LogSettingsEventStream {}
1782
1783impl futures::stream::FusedStream for LogSettingsEventStream {
1784 fn is_terminated(&self) -> bool {
1785 self.event_receiver.is_terminated()
1786 }
1787}
1788
1789impl futures::Stream for LogSettingsEventStream {
1790 type Item = Result<LogSettingsEvent, fidl::Error>;
1791
1792 fn poll_next(
1793 mut self: std::pin::Pin<&mut Self>,
1794 cx: &mut std::task::Context<'_>,
1795 ) -> std::task::Poll<Option<Self::Item>> {
1796 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1797 &mut self.event_receiver,
1798 cx
1799 )?) {
1800 Some(buf) => std::task::Poll::Ready(Some(LogSettingsEvent::decode(buf))),
1801 None => std::task::Poll::Ready(None),
1802 }
1803 }
1804}
1805
1806#[derive(Debug)]
1807pub enum LogSettingsEvent {}
1808
1809impl LogSettingsEvent {
1810 fn decode(
1812 mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1813 ) -> Result<LogSettingsEvent, fidl::Error> {
1814 let (bytes, _handles) = buf.split_mut();
1815 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1816 debug_assert_eq!(tx_header.tx_id, 0);
1817 match tx_header.ordinal {
1818 _ => Err(fidl::Error::UnknownOrdinal {
1819 ordinal: tx_header.ordinal,
1820 protocol_name:
1821 <LogSettingsMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1822 }),
1823 }
1824 }
1825}
1826
1827pub struct LogSettingsRequestStream {
1829 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1830 is_terminated: bool,
1831}
1832
1833impl std::marker::Unpin for LogSettingsRequestStream {}
1834
1835impl futures::stream::FusedStream for LogSettingsRequestStream {
1836 fn is_terminated(&self) -> bool {
1837 self.is_terminated
1838 }
1839}
1840
1841impl fdomain_client::fidl::RequestStream for LogSettingsRequestStream {
1842 type Protocol = LogSettingsMarker;
1843 type ControlHandle = LogSettingsControlHandle;
1844
1845 fn from_channel(channel: fdomain_client::Channel) -> Self {
1846 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1847 }
1848
1849 fn control_handle(&self) -> Self::ControlHandle {
1850 LogSettingsControlHandle { inner: self.inner.clone() }
1851 }
1852
1853 fn into_inner(
1854 self,
1855 ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
1856 {
1857 (self.inner, self.is_terminated)
1858 }
1859
1860 fn from_inner(
1861 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1862 is_terminated: bool,
1863 ) -> Self {
1864 Self { inner, is_terminated }
1865 }
1866}
1867
1868impl futures::Stream for LogSettingsRequestStream {
1869 type Item = Result<LogSettingsRequest, fidl::Error>;
1870
1871 fn poll_next(
1872 mut self: std::pin::Pin<&mut Self>,
1873 cx: &mut std::task::Context<'_>,
1874 ) -> std::task::Poll<Option<Self::Item>> {
1875 let this = &mut *self;
1876 if this.inner.check_shutdown(cx) {
1877 this.is_terminated = true;
1878 return std::task::Poll::Ready(None);
1879 }
1880 if this.is_terminated {
1881 panic!("polled LogSettingsRequestStream after completion");
1882 }
1883 fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
1884 |bytes, handles| {
1885 match this.inner.channel().read_etc(cx, bytes, handles) {
1886 std::task::Poll::Ready(Ok(())) => {}
1887 std::task::Poll::Pending => return std::task::Poll::Pending,
1888 std::task::Poll::Ready(Err(None)) => {
1889 this.is_terminated = true;
1890 return std::task::Poll::Ready(None);
1891 }
1892 std::task::Poll::Ready(Err(Some(e))) => {
1893 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1894 e.into(),
1895 ))))
1896 }
1897 }
1898
1899 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1901
1902 std::task::Poll::Ready(Some(match header.ordinal {
1903 0x49d7c14eec975fb => {
1904 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1905 let mut req = fidl::new_empty!(
1906 LogSettingsRegisterInterestRequest,
1907 fdomain_client::fidl::FDomainResourceDialect
1908 );
1909 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<LogSettingsRegisterInterestRequest>(&header, _body_bytes, handles, &mut req)?;
1910 let control_handle = LogSettingsControlHandle { inner: this.inner.clone() };
1911 Ok(LogSettingsRequest::RegisterInterest {
1912 selectors: req.selectors,
1913
1914 control_handle,
1915 })
1916 }
1917 0x71beced9d2411f90 => {
1918 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1919 let mut req = fidl::new_empty!(
1920 LogSettingsSetInterestRequest,
1921 fdomain_client::fidl::FDomainResourceDialect
1922 );
1923 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<LogSettingsSetInterestRequest>(&header, _body_bytes, handles, &mut req)?;
1924 let control_handle = LogSettingsControlHandle { inner: this.inner.clone() };
1925 Ok(LogSettingsRequest::SetInterest {
1926 selectors: req.selectors,
1927
1928 responder: LogSettingsSetInterestResponder {
1929 control_handle: std::mem::ManuallyDrop::new(control_handle),
1930 tx_id: header.tx_id,
1931 },
1932 })
1933 }
1934 0x35f7004d2367f6c1 => {
1935 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1936 let mut req = fidl::new_empty!(
1937 LogSettingsSetComponentInterestRequest,
1938 fdomain_client::fidl::FDomainResourceDialect
1939 );
1940 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<LogSettingsSetComponentInterestRequest>(&header, _body_bytes, handles, &mut req)?;
1941 let control_handle = LogSettingsControlHandle { inner: this.inner.clone() };
1942 Ok(LogSettingsRequest::SetComponentInterest {
1943 payload: req,
1944 responder: LogSettingsSetComponentInterestResponder {
1945 control_handle: std::mem::ManuallyDrop::new(control_handle),
1946 tx_id: header.tx_id,
1947 },
1948 })
1949 }
1950 _ => Err(fidl::Error::UnknownOrdinal {
1951 ordinal: header.ordinal,
1952 protocol_name:
1953 <LogSettingsMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1954 }),
1955 }))
1956 },
1957 )
1958 }
1959}
1960
1961#[derive(Debug)]
1964pub enum LogSettingsRequest {
1965 RegisterInterest {
1966 selectors: Vec<LogInterestSelector>,
1967 control_handle: LogSettingsControlHandle,
1968 },
1969 SetInterest { selectors: Vec<LogInterestSelector>, responder: LogSettingsSetInterestResponder },
1985 SetComponentInterest {
2001 payload: LogSettingsSetComponentInterestRequest,
2002 responder: LogSettingsSetComponentInterestResponder,
2003 },
2004}
2005
2006impl LogSettingsRequest {
2007 #[allow(irrefutable_let_patterns)]
2008 pub fn into_register_interest(
2009 self,
2010 ) -> Option<(Vec<LogInterestSelector>, LogSettingsControlHandle)> {
2011 if let LogSettingsRequest::RegisterInterest { selectors, control_handle } = self {
2012 Some((selectors, control_handle))
2013 } else {
2014 None
2015 }
2016 }
2017
2018 #[allow(irrefutable_let_patterns)]
2019 pub fn into_set_interest(
2020 self,
2021 ) -> Option<(Vec<LogInterestSelector>, LogSettingsSetInterestResponder)> {
2022 if let LogSettingsRequest::SetInterest { selectors, responder } = self {
2023 Some((selectors, responder))
2024 } else {
2025 None
2026 }
2027 }
2028
2029 #[allow(irrefutable_let_patterns)]
2030 pub fn into_set_component_interest(
2031 self,
2032 ) -> Option<(LogSettingsSetComponentInterestRequest, LogSettingsSetComponentInterestResponder)>
2033 {
2034 if let LogSettingsRequest::SetComponentInterest { payload, responder } = self {
2035 Some((payload, responder))
2036 } else {
2037 None
2038 }
2039 }
2040
2041 pub fn method_name(&self) -> &'static str {
2043 match *self {
2044 LogSettingsRequest::RegisterInterest { .. } => "register_interest",
2045 LogSettingsRequest::SetInterest { .. } => "set_interest",
2046 LogSettingsRequest::SetComponentInterest { .. } => "set_component_interest",
2047 }
2048 }
2049}
2050
2051#[derive(Debug, Clone)]
2052pub struct LogSettingsControlHandle {
2053 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
2054}
2055
2056impl fdomain_client::fidl::ControlHandle for LogSettingsControlHandle {
2057 fn shutdown(&self) {
2058 self.inner.shutdown()
2059 }
2060
2061 fn is_closed(&self) -> bool {
2062 self.inner.channel().is_closed()
2063 }
2064 fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
2065 self.inner.channel().on_closed()
2066 }
2067}
2068
2069impl LogSettingsControlHandle {}
2070
2071#[must_use = "FIDL methods require a response to be sent"]
2072#[derive(Debug)]
2073pub struct LogSettingsSetInterestResponder {
2074 control_handle: std::mem::ManuallyDrop<LogSettingsControlHandle>,
2075 tx_id: u32,
2076}
2077
2078impl std::ops::Drop for LogSettingsSetInterestResponder {
2082 fn drop(&mut self) {
2083 self.control_handle.shutdown();
2084 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2086 }
2087}
2088
2089impl fdomain_client::fidl::Responder for LogSettingsSetInterestResponder {
2090 type ControlHandle = LogSettingsControlHandle;
2091
2092 fn control_handle(&self) -> &LogSettingsControlHandle {
2093 &self.control_handle
2094 }
2095
2096 fn drop_without_shutdown(mut self) {
2097 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2099 std::mem::forget(self);
2101 }
2102}
2103
2104impl LogSettingsSetInterestResponder {
2105 pub fn send(self) -> Result<(), fidl::Error> {
2109 let _result = self.send_raw();
2110 if _result.is_err() {
2111 self.control_handle.shutdown();
2112 }
2113 self.drop_without_shutdown();
2114 _result
2115 }
2116
2117 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2119 let _result = self.send_raw();
2120 self.drop_without_shutdown();
2121 _result
2122 }
2123
2124 fn send_raw(&self) -> Result<(), fidl::Error> {
2125 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2126 (),
2127 self.tx_id,
2128 0x71beced9d2411f90,
2129 fidl::encoding::DynamicFlags::empty(),
2130 )
2131 }
2132}
2133
2134#[must_use = "FIDL methods require a response to be sent"]
2135#[derive(Debug)]
2136pub struct LogSettingsSetComponentInterestResponder {
2137 control_handle: std::mem::ManuallyDrop<LogSettingsControlHandle>,
2138 tx_id: u32,
2139}
2140
2141impl std::ops::Drop for LogSettingsSetComponentInterestResponder {
2145 fn drop(&mut self) {
2146 self.control_handle.shutdown();
2147 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2149 }
2150}
2151
2152impl fdomain_client::fidl::Responder for LogSettingsSetComponentInterestResponder {
2153 type ControlHandle = LogSettingsControlHandle;
2154
2155 fn control_handle(&self) -> &LogSettingsControlHandle {
2156 &self.control_handle
2157 }
2158
2159 fn drop_without_shutdown(mut self) {
2160 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2162 std::mem::forget(self);
2164 }
2165}
2166
2167impl LogSettingsSetComponentInterestResponder {
2168 pub fn send(self) -> Result<(), fidl::Error> {
2172 let _result = self.send_raw();
2173 if _result.is_err() {
2174 self.control_handle.shutdown();
2175 }
2176 self.drop_without_shutdown();
2177 _result
2178 }
2179
2180 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2182 let _result = self.send_raw();
2183 self.drop_without_shutdown();
2184 _result
2185 }
2186
2187 fn send_raw(&self) -> Result<(), fidl::Error> {
2188 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2189 (),
2190 self.tx_id,
2191 0x35f7004d2367f6c1,
2192 fidl::encoding::DynamicFlags::empty(),
2193 )
2194 }
2195}
2196
2197#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2198pub struct LogStreamMarker;
2199
2200impl fdomain_client::fidl::ProtocolMarker for LogStreamMarker {
2201 type Proxy = LogStreamProxy;
2202 type RequestStream = LogStreamRequestStream;
2203
2204 const DEBUG_NAME: &'static str = "fuchsia.diagnostics.LogStream";
2205}
2206impl fdomain_client::fidl::DiscoverableProtocolMarker for LogStreamMarker {}
2207
2208pub trait LogStreamProxyInterface: Send + Sync {
2209 fn r#connect(
2210 &self,
2211 socket: fdomain_client::Socket,
2212 opts: &LogStreamOptions,
2213 ) -> Result<(), fidl::Error>;
2214}
2215
2216#[derive(Debug, Clone)]
2217pub struct LogStreamProxy {
2218 client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
2219}
2220
2221impl fdomain_client::fidl::Proxy for LogStreamProxy {
2222 type Protocol = LogStreamMarker;
2223
2224 fn from_channel(inner: fdomain_client::Channel) -> Self {
2225 Self::new(inner)
2226 }
2227
2228 fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
2229 self.client.into_channel().map_err(|client| Self { client })
2230 }
2231
2232 fn as_channel(&self) -> &fdomain_client::Channel {
2233 self.client.as_channel()
2234 }
2235}
2236
2237impl LogStreamProxy {
2238 pub fn new(channel: fdomain_client::Channel) -> Self {
2240 let protocol_name = <LogStreamMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
2241 Self { client: fidl::client::Client::new(channel, protocol_name) }
2242 }
2243
2244 pub fn take_event_stream(&self) -> LogStreamEventStream {
2250 LogStreamEventStream { event_receiver: self.client.take_event_receiver() }
2251 }
2252
2253 pub fn r#connect(
2265 &self,
2266 mut socket: fdomain_client::Socket,
2267 mut opts: &LogStreamOptions,
2268 ) -> Result<(), fidl::Error> {
2269 LogStreamProxyInterface::r#connect(self, socket, opts)
2270 }
2271}
2272
2273impl LogStreamProxyInterface for LogStreamProxy {
2274 fn r#connect(
2275 &self,
2276 mut socket: fdomain_client::Socket,
2277 mut opts: &LogStreamOptions,
2278 ) -> Result<(), fidl::Error> {
2279 self.client.send::<LogStreamConnectRequest>(
2280 (socket, opts),
2281 0x745eb34f10d51a88,
2282 fidl::encoding::DynamicFlags::FLEXIBLE,
2283 )
2284 }
2285}
2286
2287pub struct LogStreamEventStream {
2288 event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
2289}
2290
2291impl std::marker::Unpin for LogStreamEventStream {}
2292
2293impl futures::stream::FusedStream for LogStreamEventStream {
2294 fn is_terminated(&self) -> bool {
2295 self.event_receiver.is_terminated()
2296 }
2297}
2298
2299impl futures::Stream for LogStreamEventStream {
2300 type Item = Result<LogStreamEvent, fidl::Error>;
2301
2302 fn poll_next(
2303 mut self: std::pin::Pin<&mut Self>,
2304 cx: &mut std::task::Context<'_>,
2305 ) -> std::task::Poll<Option<Self::Item>> {
2306 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2307 &mut self.event_receiver,
2308 cx
2309 )?) {
2310 Some(buf) => std::task::Poll::Ready(Some(LogStreamEvent::decode(buf))),
2311 None => std::task::Poll::Ready(None),
2312 }
2313 }
2314}
2315
2316#[derive(Debug)]
2317pub enum LogStreamEvent {
2318 #[non_exhaustive]
2319 _UnknownEvent {
2320 ordinal: u64,
2322 },
2323}
2324
2325impl LogStreamEvent {
2326 fn decode(
2328 mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2329 ) -> Result<LogStreamEvent, fidl::Error> {
2330 let (bytes, _handles) = buf.split_mut();
2331 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2332 debug_assert_eq!(tx_header.tx_id, 0);
2333 match tx_header.ordinal {
2334 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2335 Ok(LogStreamEvent::_UnknownEvent { ordinal: tx_header.ordinal })
2336 }
2337 _ => Err(fidl::Error::UnknownOrdinal {
2338 ordinal: tx_header.ordinal,
2339 protocol_name:
2340 <LogStreamMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
2341 }),
2342 }
2343 }
2344}
2345
2346pub struct LogStreamRequestStream {
2348 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
2349 is_terminated: bool,
2350}
2351
2352impl std::marker::Unpin for LogStreamRequestStream {}
2353
2354impl futures::stream::FusedStream for LogStreamRequestStream {
2355 fn is_terminated(&self) -> bool {
2356 self.is_terminated
2357 }
2358}
2359
2360impl fdomain_client::fidl::RequestStream for LogStreamRequestStream {
2361 type Protocol = LogStreamMarker;
2362 type ControlHandle = LogStreamControlHandle;
2363
2364 fn from_channel(channel: fdomain_client::Channel) -> Self {
2365 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2366 }
2367
2368 fn control_handle(&self) -> Self::ControlHandle {
2369 LogStreamControlHandle { inner: self.inner.clone() }
2370 }
2371
2372 fn into_inner(
2373 self,
2374 ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
2375 {
2376 (self.inner, self.is_terminated)
2377 }
2378
2379 fn from_inner(
2380 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
2381 is_terminated: bool,
2382 ) -> Self {
2383 Self { inner, is_terminated }
2384 }
2385}
2386
2387impl futures::Stream for LogStreamRequestStream {
2388 type Item = Result<LogStreamRequest, fidl::Error>;
2389
2390 fn poll_next(
2391 mut self: std::pin::Pin<&mut Self>,
2392 cx: &mut std::task::Context<'_>,
2393 ) -> std::task::Poll<Option<Self::Item>> {
2394 let this = &mut *self;
2395 if this.inner.check_shutdown(cx) {
2396 this.is_terminated = true;
2397 return std::task::Poll::Ready(None);
2398 }
2399 if this.is_terminated {
2400 panic!("polled LogStreamRequestStream after completion");
2401 }
2402 fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
2403 |bytes, handles| {
2404 match this.inner.channel().read_etc(cx, bytes, handles) {
2405 std::task::Poll::Ready(Ok(())) => {}
2406 std::task::Poll::Pending => return std::task::Poll::Pending,
2407 std::task::Poll::Ready(Err(None)) => {
2408 this.is_terminated = true;
2409 return std::task::Poll::Ready(None);
2410 }
2411 std::task::Poll::Ready(Err(Some(e))) => {
2412 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2413 e.into(),
2414 ))))
2415 }
2416 }
2417
2418 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2420
2421 std::task::Poll::Ready(Some(match header.ordinal {
2422 0x745eb34f10d51a88 => {
2423 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2424 let mut req = fidl::new_empty!(
2425 LogStreamConnectRequest,
2426 fdomain_client::fidl::FDomainResourceDialect
2427 );
2428 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<LogStreamConnectRequest>(&header, _body_bytes, handles, &mut req)?;
2429 let control_handle = LogStreamControlHandle { inner: this.inner.clone() };
2430 Ok(LogStreamRequest::Connect {
2431 socket: req.socket,
2432 opts: req.opts,
2433
2434 control_handle,
2435 })
2436 }
2437 _ if header.tx_id == 0
2438 && header
2439 .dynamic_flags()
2440 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2441 {
2442 Ok(LogStreamRequest::_UnknownMethod {
2443 ordinal: header.ordinal,
2444 control_handle: LogStreamControlHandle { inner: this.inner.clone() },
2445 method_type: fidl::MethodType::OneWay,
2446 })
2447 }
2448 _ if header
2449 .dynamic_flags()
2450 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2451 {
2452 this.inner.send_framework_err(
2453 fidl::encoding::FrameworkErr::UnknownMethod,
2454 header.tx_id,
2455 header.ordinal,
2456 header.dynamic_flags(),
2457 (bytes, handles),
2458 )?;
2459 Ok(LogStreamRequest::_UnknownMethod {
2460 ordinal: header.ordinal,
2461 control_handle: LogStreamControlHandle { inner: this.inner.clone() },
2462 method_type: fidl::MethodType::TwoWay,
2463 })
2464 }
2465 _ => Err(fidl::Error::UnknownOrdinal {
2466 ordinal: header.ordinal,
2467 protocol_name:
2468 <LogStreamMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
2469 }),
2470 }))
2471 },
2472 )
2473 }
2474}
2475
2476#[derive(Debug)]
2477pub enum LogStreamRequest {
2478 Connect {
2490 socket: fdomain_client::Socket,
2491 opts: LogStreamOptions,
2492 control_handle: LogStreamControlHandle,
2493 },
2494 #[non_exhaustive]
2496 _UnknownMethod {
2497 ordinal: u64,
2499 control_handle: LogStreamControlHandle,
2500 method_type: fidl::MethodType,
2501 },
2502}
2503
2504impl LogStreamRequest {
2505 #[allow(irrefutable_let_patterns)]
2506 pub fn into_connect(
2507 self,
2508 ) -> Option<(fdomain_client::Socket, LogStreamOptions, LogStreamControlHandle)> {
2509 if let LogStreamRequest::Connect { socket, opts, control_handle } = self {
2510 Some((socket, opts, control_handle))
2511 } else {
2512 None
2513 }
2514 }
2515
2516 pub fn method_name(&self) -> &'static str {
2518 match *self {
2519 LogStreamRequest::Connect { .. } => "connect",
2520 LogStreamRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
2521 "unknown one-way method"
2522 }
2523 LogStreamRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
2524 "unknown two-way method"
2525 }
2526 }
2527 }
2528}
2529
2530#[derive(Debug, Clone)]
2531pub struct LogStreamControlHandle {
2532 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
2533}
2534
2535impl fdomain_client::fidl::ControlHandle for LogStreamControlHandle {
2536 fn shutdown(&self) {
2537 self.inner.shutdown()
2538 }
2539
2540 fn is_closed(&self) -> bool {
2541 self.inner.channel().is_closed()
2542 }
2543 fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
2544 self.inner.channel().on_closed()
2545 }
2546}
2547
2548impl LogStreamControlHandle {}
2549
2550mod internal {
2551 use super::*;
2552
2553 impl fidl::encoding::ResourceTypeMarker for ArchiveAccessorStreamDiagnosticsRequest {
2554 type Borrowed<'a> = &'a mut Self;
2555 fn take_or_borrow<'a>(
2556 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2557 ) -> Self::Borrowed<'a> {
2558 value
2559 }
2560 }
2561
2562 unsafe impl fidl::encoding::TypeMarker for ArchiveAccessorStreamDiagnosticsRequest {
2563 type Owned = Self;
2564
2565 #[inline(always)]
2566 fn inline_align(_context: fidl::encoding::Context) -> usize {
2567 8
2568 }
2569
2570 #[inline(always)]
2571 fn inline_size(_context: fidl::encoding::Context) -> usize {
2572 24
2573 }
2574 }
2575
2576 unsafe impl
2577 fidl::encoding::Encode<
2578 ArchiveAccessorStreamDiagnosticsRequest,
2579 fdomain_client::fidl::FDomainResourceDialect,
2580 > for &mut ArchiveAccessorStreamDiagnosticsRequest
2581 {
2582 #[inline]
2583 unsafe fn encode(
2584 self,
2585 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
2586 offset: usize,
2587 _depth: fidl::encoding::Depth,
2588 ) -> fidl::Result<()> {
2589 encoder.debug_check_bounds::<ArchiveAccessorStreamDiagnosticsRequest>(offset);
2590 fidl::encoding::Encode::<ArchiveAccessorStreamDiagnosticsRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
2592 (
2593 <StreamParameters as fidl::encoding::ValueTypeMarker>::borrow(&self.stream_parameters),
2594 <fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<BatchIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.result_stream),
2595 ),
2596 encoder, offset, _depth
2597 )
2598 }
2599 }
2600 unsafe impl<
2601 T0: fidl::encoding::Encode<StreamParameters, fdomain_client::fidl::FDomainResourceDialect>,
2602 T1: fidl::encoding::Encode<
2603 fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<BatchIteratorMarker>>,
2604 fdomain_client::fidl::FDomainResourceDialect,
2605 >,
2606 >
2607 fidl::encoding::Encode<
2608 ArchiveAccessorStreamDiagnosticsRequest,
2609 fdomain_client::fidl::FDomainResourceDialect,
2610 > for (T0, T1)
2611 {
2612 #[inline]
2613 unsafe fn encode(
2614 self,
2615 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
2616 offset: usize,
2617 depth: fidl::encoding::Depth,
2618 ) -> fidl::Result<()> {
2619 encoder.debug_check_bounds::<ArchiveAccessorStreamDiagnosticsRequest>(offset);
2620 unsafe {
2623 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
2624 (ptr as *mut u64).write_unaligned(0);
2625 }
2626 self.0.encode(encoder, offset + 0, depth)?;
2628 self.1.encode(encoder, offset + 16, depth)?;
2629 Ok(())
2630 }
2631 }
2632
2633 impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
2634 for ArchiveAccessorStreamDiagnosticsRequest
2635 {
2636 #[inline(always)]
2637 fn new_empty() -> Self {
2638 Self {
2639 stream_parameters: fidl::new_empty!(
2640 StreamParameters,
2641 fdomain_client::fidl::FDomainResourceDialect
2642 ),
2643 result_stream: fidl::new_empty!(
2644 fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<BatchIteratorMarker>>,
2645 fdomain_client::fidl::FDomainResourceDialect
2646 ),
2647 }
2648 }
2649
2650 #[inline]
2651 unsafe fn decode(
2652 &mut self,
2653 decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
2654 offset: usize,
2655 _depth: fidl::encoding::Depth,
2656 ) -> fidl::Result<()> {
2657 decoder.debug_check_bounds::<Self>(offset);
2658 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
2660 let padval = unsafe { (ptr as *const u64).read_unaligned() };
2661 let mask = 0xffffffff00000000u64;
2662 let maskedval = padval & mask;
2663 if maskedval != 0 {
2664 return Err(fidl::Error::NonZeroPadding {
2665 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
2666 });
2667 }
2668 fidl::decode!(
2669 StreamParameters,
2670 fdomain_client::fidl::FDomainResourceDialect,
2671 &mut self.stream_parameters,
2672 decoder,
2673 offset + 0,
2674 _depth
2675 )?;
2676 fidl::decode!(
2677 fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<BatchIteratorMarker>>,
2678 fdomain_client::fidl::FDomainResourceDialect,
2679 &mut self.result_stream,
2680 decoder,
2681 offset + 16,
2682 _depth
2683 )?;
2684 Ok(())
2685 }
2686 }
2687
2688 impl fidl::encoding::ResourceTypeMarker for BatchIteratorGetNextResponse {
2689 type Borrowed<'a> = &'a mut Self;
2690 fn take_or_borrow<'a>(
2691 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2692 ) -> Self::Borrowed<'a> {
2693 value
2694 }
2695 }
2696
2697 unsafe impl fidl::encoding::TypeMarker for BatchIteratorGetNextResponse {
2698 type Owned = Self;
2699
2700 #[inline(always)]
2701 fn inline_align(_context: fidl::encoding::Context) -> usize {
2702 8
2703 }
2704
2705 #[inline(always)]
2706 fn inline_size(_context: fidl::encoding::Context) -> usize {
2707 16
2708 }
2709 }
2710
2711 unsafe impl
2712 fidl::encoding::Encode<
2713 BatchIteratorGetNextResponse,
2714 fdomain_client::fidl::FDomainResourceDialect,
2715 > for &mut BatchIteratorGetNextResponse
2716 {
2717 #[inline]
2718 unsafe fn encode(
2719 self,
2720 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
2721 offset: usize,
2722 _depth: fidl::encoding::Depth,
2723 ) -> fidl::Result<()> {
2724 encoder.debug_check_bounds::<BatchIteratorGetNextResponse>(offset);
2725 fidl::encoding::Encode::<BatchIteratorGetNextResponse, fdomain_client::fidl::FDomainResourceDialect>::encode(
2727 (
2728 <fidl::encoding::Vector<FormattedContent, 64> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.batch),
2729 ),
2730 encoder, offset, _depth
2731 )
2732 }
2733 }
2734 unsafe impl<
2735 T0: fidl::encoding::Encode<
2736 fidl::encoding::Vector<FormattedContent, 64>,
2737 fdomain_client::fidl::FDomainResourceDialect,
2738 >,
2739 >
2740 fidl::encoding::Encode<
2741 BatchIteratorGetNextResponse,
2742 fdomain_client::fidl::FDomainResourceDialect,
2743 > for (T0,)
2744 {
2745 #[inline]
2746 unsafe fn encode(
2747 self,
2748 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
2749 offset: usize,
2750 depth: fidl::encoding::Depth,
2751 ) -> fidl::Result<()> {
2752 encoder.debug_check_bounds::<BatchIteratorGetNextResponse>(offset);
2753 self.0.encode(encoder, offset + 0, depth)?;
2757 Ok(())
2758 }
2759 }
2760
2761 impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
2762 for BatchIteratorGetNextResponse
2763 {
2764 #[inline(always)]
2765 fn new_empty() -> Self {
2766 Self {
2767 batch: fidl::new_empty!(fidl::encoding::Vector<FormattedContent, 64>, fdomain_client::fidl::FDomainResourceDialect),
2768 }
2769 }
2770
2771 #[inline]
2772 unsafe fn decode(
2773 &mut self,
2774 decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
2775 offset: usize,
2776 _depth: fidl::encoding::Depth,
2777 ) -> fidl::Result<()> {
2778 decoder.debug_check_bounds::<Self>(offset);
2779 fidl::decode!(fidl::encoding::Vector<FormattedContent, 64>, fdomain_client::fidl::FDomainResourceDialect, &mut self.batch, decoder, offset + 0, _depth)?;
2781 Ok(())
2782 }
2783 }
2784
2785 impl fidl::encoding::ResourceTypeMarker for LogStreamConnectRequest {
2786 type Borrowed<'a> = &'a mut Self;
2787 fn take_or_borrow<'a>(
2788 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2789 ) -> Self::Borrowed<'a> {
2790 value
2791 }
2792 }
2793
2794 unsafe impl fidl::encoding::TypeMarker for LogStreamConnectRequest {
2795 type Owned = Self;
2796
2797 #[inline(always)]
2798 fn inline_align(_context: fidl::encoding::Context) -> usize {
2799 8
2800 }
2801
2802 #[inline(always)]
2803 fn inline_size(_context: fidl::encoding::Context) -> usize {
2804 24
2805 }
2806 }
2807
2808 unsafe impl
2809 fidl::encoding::Encode<
2810 LogStreamConnectRequest,
2811 fdomain_client::fidl::FDomainResourceDialect,
2812 > for &mut LogStreamConnectRequest
2813 {
2814 #[inline]
2815 unsafe fn encode(
2816 self,
2817 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
2818 offset: usize,
2819 _depth: fidl::encoding::Depth,
2820 ) -> fidl::Result<()> {
2821 encoder.debug_check_bounds::<LogStreamConnectRequest>(offset);
2822 fidl::encoding::Encode::<
2824 LogStreamConnectRequest,
2825 fdomain_client::fidl::FDomainResourceDialect,
2826 >::encode(
2827 (
2828 <fidl::encoding::HandleType<
2829 fdomain_client::Socket,
2830 { fidl::ObjectType::SOCKET.into_raw() },
2831 16392,
2832 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2833 &mut self.socket
2834 ),
2835 <LogStreamOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.opts),
2836 ),
2837 encoder,
2838 offset,
2839 _depth,
2840 )
2841 }
2842 }
2843 unsafe impl<
2844 T0: fidl::encoding::Encode<
2845 fidl::encoding::HandleType<
2846 fdomain_client::Socket,
2847 { fidl::ObjectType::SOCKET.into_raw() },
2848 16392,
2849 >,
2850 fdomain_client::fidl::FDomainResourceDialect,
2851 >,
2852 T1: fidl::encoding::Encode<LogStreamOptions, fdomain_client::fidl::FDomainResourceDialect>,
2853 >
2854 fidl::encoding::Encode<
2855 LogStreamConnectRequest,
2856 fdomain_client::fidl::FDomainResourceDialect,
2857 > for (T0, T1)
2858 {
2859 #[inline]
2860 unsafe fn encode(
2861 self,
2862 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
2863 offset: usize,
2864 depth: fidl::encoding::Depth,
2865 ) -> fidl::Result<()> {
2866 encoder.debug_check_bounds::<LogStreamConnectRequest>(offset);
2867 unsafe {
2870 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
2871 (ptr as *mut u64).write_unaligned(0);
2872 }
2873 self.0.encode(encoder, offset + 0, depth)?;
2875 self.1.encode(encoder, offset + 8, depth)?;
2876 Ok(())
2877 }
2878 }
2879
2880 impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
2881 for LogStreamConnectRequest
2882 {
2883 #[inline(always)]
2884 fn new_empty() -> Self {
2885 Self {
2886 socket: fidl::new_empty!(fidl::encoding::HandleType<fdomain_client::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 16392>, fdomain_client::fidl::FDomainResourceDialect),
2887 opts: fidl::new_empty!(
2888 LogStreamOptions,
2889 fdomain_client::fidl::FDomainResourceDialect
2890 ),
2891 }
2892 }
2893
2894 #[inline]
2895 unsafe fn decode(
2896 &mut self,
2897 decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
2898 offset: usize,
2899 _depth: fidl::encoding::Depth,
2900 ) -> fidl::Result<()> {
2901 decoder.debug_check_bounds::<Self>(offset);
2902 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
2904 let padval = unsafe { (ptr as *const u64).read_unaligned() };
2905 let mask = 0xffffffff00000000u64;
2906 let maskedval = padval & mask;
2907 if maskedval != 0 {
2908 return Err(fidl::Error::NonZeroPadding {
2909 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
2910 });
2911 }
2912 fidl::decode!(fidl::encoding::HandleType<fdomain_client::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 16392>, fdomain_client::fidl::FDomainResourceDialect, &mut self.socket, decoder, offset + 0, _depth)?;
2913 fidl::decode!(
2914 LogStreamOptions,
2915 fdomain_client::fidl::FDomainResourceDialect,
2916 &mut self.opts,
2917 decoder,
2918 offset + 8,
2919 _depth
2920 )?;
2921 Ok(())
2922 }
2923 }
2924
2925 impl fidl::encoding::ResourceTypeMarker for FormattedContent {
2926 type Borrowed<'a> = &'a mut Self;
2927 fn take_or_borrow<'a>(
2928 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2929 ) -> Self::Borrowed<'a> {
2930 value
2931 }
2932 }
2933
2934 unsafe impl fidl::encoding::TypeMarker for FormattedContent {
2935 type Owned = Self;
2936
2937 #[inline(always)]
2938 fn inline_align(_context: fidl::encoding::Context) -> usize {
2939 8
2940 }
2941
2942 #[inline(always)]
2943 fn inline_size(_context: fidl::encoding::Context) -> usize {
2944 16
2945 }
2946 }
2947
2948 unsafe impl
2949 fidl::encoding::Encode<FormattedContent, fdomain_client::fidl::FDomainResourceDialect>
2950 for &mut FormattedContent
2951 {
2952 #[inline]
2953 unsafe fn encode(
2954 self,
2955 encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
2956 offset: usize,
2957 _depth: fidl::encoding::Depth,
2958 ) -> fidl::Result<()> {
2959 encoder.debug_check_bounds::<FormattedContent>(offset);
2960 encoder.write_num::<u64>(self.ordinal(), offset);
2961 match self {
2962 FormattedContent::Json(ref mut val) => {
2963 fidl::encoding::encode_in_envelope::<fdomain_fuchsia_mem::Buffer, fdomain_client::fidl::FDomainResourceDialect>(
2964 <fdomain_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
2965 encoder, offset + 8, _depth
2966 )
2967 }
2968 FormattedContent::Text(ref mut val) => {
2969 fidl::encoding::encode_in_envelope::<fdomain_fuchsia_mem::Buffer, fdomain_client::fidl::FDomainResourceDialect>(
2970 <fdomain_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
2971 encoder, offset + 8, _depth
2972 )
2973 }
2974 FormattedContent::Cbor(ref mut val) => {
2975 fidl::encoding::encode_in_envelope::<fidl::encoding::HandleType<fdomain_client::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect>(
2976 <fidl::encoding::HandleType<fdomain_client::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
2977 encoder, offset + 8, _depth
2978 )
2979 }
2980 FormattedContent::Fxt(ref mut val) => {
2981 fidl::encoding::encode_in_envelope::<fidl::encoding::HandleType<fdomain_client::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect>(
2982 <fidl::encoding::HandleType<fdomain_client::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
2983 encoder, offset + 8, _depth
2984 )
2985 }
2986 FormattedContent::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
2987 }
2988 }
2989 }
2990
2991 impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
2992 for FormattedContent
2993 {
2994 #[inline(always)]
2995 fn new_empty() -> Self {
2996 Self::__SourceBreaking { unknown_ordinal: 0 }
2997 }
2998
2999 #[inline]
3000 unsafe fn decode(
3001 &mut self,
3002 decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
3003 offset: usize,
3004 mut depth: fidl::encoding::Depth,
3005 ) -> fidl::Result<()> {
3006 decoder.debug_check_bounds::<Self>(offset);
3007 #[allow(unused_variables)]
3008 let next_out_of_line = decoder.next_out_of_line();
3009 let handles_before = decoder.remaining_handles();
3010 let (ordinal, inlined, num_bytes, num_handles) =
3011 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
3012
3013 let member_inline_size = match ordinal {
3014 1 => <fdomain_fuchsia_mem::Buffer as fidl::encoding::TypeMarker>::inline_size(
3015 decoder.context,
3016 ),
3017 2 => <fdomain_fuchsia_mem::Buffer as fidl::encoding::TypeMarker>::inline_size(
3018 decoder.context,
3019 ),
3020 3 => <fidl::encoding::HandleType<
3021 fdomain_client::Vmo,
3022 { fidl::ObjectType::VMO.into_raw() },
3023 2147483648,
3024 > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3025 4 => <fidl::encoding::HandleType<
3026 fdomain_client::Vmo,
3027 { fidl::ObjectType::VMO.into_raw() },
3028 2147483648,
3029 > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3030 0 => return Err(fidl::Error::UnknownUnionTag),
3031 _ => num_bytes as usize,
3032 };
3033
3034 if inlined != (member_inline_size <= 4) {
3035 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3036 }
3037 let _inner_offset;
3038 if inlined {
3039 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
3040 _inner_offset = offset + 8;
3041 } else {
3042 depth.increment()?;
3043 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3044 }
3045 match ordinal {
3046 1 => {
3047 #[allow(irrefutable_let_patterns)]
3048 if let FormattedContent::Json(_) = self {
3049 } else {
3051 *self = FormattedContent::Json(fidl::new_empty!(
3053 fdomain_fuchsia_mem::Buffer,
3054 fdomain_client::fidl::FDomainResourceDialect
3055 ));
3056 }
3057 #[allow(irrefutable_let_patterns)]
3058 if let FormattedContent::Json(ref mut val) = self {
3059 fidl::decode!(
3060 fdomain_fuchsia_mem::Buffer,
3061 fdomain_client::fidl::FDomainResourceDialect,
3062 val,
3063 decoder,
3064 _inner_offset,
3065 depth
3066 )?;
3067 } else {
3068 unreachable!()
3069 }
3070 }
3071 2 => {
3072 #[allow(irrefutable_let_patterns)]
3073 if let FormattedContent::Text(_) = self {
3074 } else {
3076 *self = FormattedContent::Text(fidl::new_empty!(
3078 fdomain_fuchsia_mem::Buffer,
3079 fdomain_client::fidl::FDomainResourceDialect
3080 ));
3081 }
3082 #[allow(irrefutable_let_patterns)]
3083 if let FormattedContent::Text(ref mut val) = self {
3084 fidl::decode!(
3085 fdomain_fuchsia_mem::Buffer,
3086 fdomain_client::fidl::FDomainResourceDialect,
3087 val,
3088 decoder,
3089 _inner_offset,
3090 depth
3091 )?;
3092 } else {
3093 unreachable!()
3094 }
3095 }
3096 3 => {
3097 #[allow(irrefutable_let_patterns)]
3098 if let FormattedContent::Cbor(_) = self {
3099 } else {
3101 *self = FormattedContent::Cbor(
3103 fidl::new_empty!(fidl::encoding::HandleType<fdomain_client::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect),
3104 );
3105 }
3106 #[allow(irrefutable_let_patterns)]
3107 if let FormattedContent::Cbor(ref mut val) = self {
3108 fidl::decode!(fidl::encoding::HandleType<fdomain_client::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect, val, decoder, _inner_offset, depth)?;
3109 } else {
3110 unreachable!()
3111 }
3112 }
3113 4 => {
3114 #[allow(irrefutable_let_patterns)]
3115 if let FormattedContent::Fxt(_) = self {
3116 } else {
3118 *self = FormattedContent::Fxt(
3120 fidl::new_empty!(fidl::encoding::HandleType<fdomain_client::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect),
3121 );
3122 }
3123 #[allow(irrefutable_let_patterns)]
3124 if let FormattedContent::Fxt(ref mut val) = self {
3125 fidl::decode!(fidl::encoding::HandleType<fdomain_client::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect, val, decoder, _inner_offset, depth)?;
3126 } else {
3127 unreachable!()
3128 }
3129 }
3130 #[allow(deprecated)]
3131 ordinal => {
3132 for _ in 0..num_handles {
3133 decoder.drop_next_handle()?;
3134 }
3135 *self = FormattedContent::__SourceBreaking { unknown_ordinal: ordinal };
3136 }
3137 }
3138 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
3139 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3140 }
3141 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3142 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3143 }
3144 Ok(())
3145 }
3146 }
3147}