fidl_fuchsia_logger/
fidl_fuchsia_logger.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![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_logger_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct LogDumpLogsSafeRequest {
16    pub log_listener: fidl::endpoints::ClientEnd<LogListenerSafeMarker>,
17    pub options: Option<Box<LogFilterOptions>>,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for LogDumpLogsSafeRequest {}
21
22#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
23pub struct LogListenSafeRequest {
24    pub log_listener: fidl::endpoints::ClientEnd<LogListenerSafeMarker>,
25    pub options: Option<Box<LogFilterOptions>>,
26}
27
28impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for LogListenSafeRequest {}
29
30#[derive(Debug, PartialEq)]
31pub struct LogListenSafeWithSelectorsRequest {
32    pub log_listener: fidl::endpoints::ClientEnd<LogListenerSafeMarker>,
33    pub options: Option<Box<LogFilterOptions>>,
34    pub selectors: Vec<fidl_fuchsia_diagnostics::LogInterestSelector>,
35}
36
37impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
38    for LogListenSafeWithSelectorsRequest
39{
40}
41
42#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
43pub struct LogSinkConnectRequest {
44    pub socket: fidl::Socket,
45}
46
47impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for LogSinkConnectRequest {}
48
49#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
50pub struct LogSinkConnectStructuredRequest {
51    pub socket: fidl::Socket,
52}
53
54impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
55    for LogSinkConnectStructuredRequest
56{
57}
58
59#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
60pub struct LogMarker;
61
62impl fidl::endpoints::ProtocolMarker for LogMarker {
63    type Proxy = LogProxy;
64    type RequestStream = LogRequestStream;
65    #[cfg(target_os = "fuchsia")]
66    type SynchronousProxy = LogSynchronousProxy;
67
68    const DEBUG_NAME: &'static str = "fuchsia.logger.Log";
69}
70impl fidl::endpoints::DiscoverableProtocolMarker for LogMarker {}
71
72pub trait LogProxyInterface: Send + Sync {
73    fn r#listen_safe(
74        &self,
75        log_listener: fidl::endpoints::ClientEnd<LogListenerSafeMarker>,
76        options: Option<&LogFilterOptions>,
77    ) -> Result<(), fidl::Error>;
78    fn r#dump_logs_safe(
79        &self,
80        log_listener: fidl::endpoints::ClientEnd<LogListenerSafeMarker>,
81        options: Option<&LogFilterOptions>,
82    ) -> Result<(), fidl::Error>;
83    fn r#listen_safe_with_selectors(
84        &self,
85        log_listener: fidl::endpoints::ClientEnd<LogListenerSafeMarker>,
86        options: Option<&LogFilterOptions>,
87        selectors: &[fidl_fuchsia_diagnostics::LogInterestSelector],
88    ) -> Result<(), fidl::Error>;
89}
90#[derive(Debug)]
91#[cfg(target_os = "fuchsia")]
92pub struct LogSynchronousProxy {
93    client: fidl::client::sync::Client,
94}
95
96#[cfg(target_os = "fuchsia")]
97impl fidl::endpoints::SynchronousProxy for LogSynchronousProxy {
98    type Proxy = LogProxy;
99    type Protocol = LogMarker;
100
101    fn from_channel(inner: fidl::Channel) -> Self {
102        Self::new(inner)
103    }
104
105    fn into_channel(self) -> fidl::Channel {
106        self.client.into_channel()
107    }
108
109    fn as_channel(&self) -> &fidl::Channel {
110        self.client.as_channel()
111    }
112}
113
114#[cfg(target_os = "fuchsia")]
115impl LogSynchronousProxy {
116    pub fn new(channel: fidl::Channel) -> Self {
117        let protocol_name = <LogMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
118        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
119    }
120
121    pub fn into_channel(self) -> fidl::Channel {
122        self.client.into_channel()
123    }
124
125    /// Waits until an event arrives and returns it. It is safe for other
126    /// threads to make concurrent requests while waiting for an event.
127    pub fn wait_for_event(&self, deadline: zx::MonotonicInstant) -> Result<LogEvent, fidl::Error> {
128        LogEvent::decode(self.client.wait_for_event(deadline)?)
129    }
130
131    /// Dumps all cached logs by calling LogMany() in batches followed by Log() for each new log
132    /// message.
133    /// A null `options` indicates no filtering is requested.
134    pub fn r#listen_safe(
135        &self,
136        mut log_listener: fidl::endpoints::ClientEnd<LogListenerSafeMarker>,
137        mut options: Option<&LogFilterOptions>,
138    ) -> Result<(), fidl::Error> {
139        self.client.send::<LogListenSafeRequest>(
140            (log_listener, options),
141            0x4e523b04952a61b1,
142            fidl::encoding::DynamicFlags::empty(),
143        )
144    }
145
146    /// Dumps all cached logs by calling LogMany() followed by Done() on `log_listener`.
147    /// A null `options` indicates no filtering is requested.
148    pub fn r#dump_logs_safe(
149        &self,
150        mut log_listener: fidl::endpoints::ClientEnd<LogListenerSafeMarker>,
151        mut options: Option<&LogFilterOptions>,
152    ) -> Result<(), fidl::Error> {
153        self.client.send::<LogDumpLogsSafeRequest>(
154            (log_listener, options),
155            0x14e39f9cada72519,
156            fidl::encoding::DynamicFlags::empty(),
157        )
158    }
159
160    /// Listens to new log entries by calling Log() on `log_listener`.
161    /// A null `options` indicates no filtering is requested.
162    pub fn r#listen_safe_with_selectors(
163        &self,
164        mut log_listener: fidl::endpoints::ClientEnd<LogListenerSafeMarker>,
165        mut options: Option<&LogFilterOptions>,
166        mut selectors: &[fidl_fuchsia_diagnostics::LogInterestSelector],
167    ) -> Result<(), fidl::Error> {
168        self.client.send::<LogListenSafeWithSelectorsRequest>(
169            (log_listener, options, selectors),
170            0x1b365178771a007e,
171            fidl::encoding::DynamicFlags::empty(),
172        )
173    }
174}
175
176#[cfg(target_os = "fuchsia")]
177impl From<LogSynchronousProxy> for zx::Handle {
178    fn from(value: LogSynchronousProxy) -> Self {
179        value.into_channel().into()
180    }
181}
182
183#[cfg(target_os = "fuchsia")]
184impl From<fidl::Channel> for LogSynchronousProxy {
185    fn from(value: fidl::Channel) -> Self {
186        Self::new(value)
187    }
188}
189
190#[derive(Debug, Clone)]
191pub struct LogProxy {
192    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
193}
194
195impl fidl::endpoints::Proxy for LogProxy {
196    type Protocol = LogMarker;
197
198    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
199        Self::new(inner)
200    }
201
202    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
203        self.client.into_channel().map_err(|client| Self { client })
204    }
205
206    fn as_channel(&self) -> &::fidl::AsyncChannel {
207        self.client.as_channel()
208    }
209}
210
211impl LogProxy {
212    /// Create a new Proxy for fuchsia.logger/Log.
213    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
214        let protocol_name = <LogMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
215        Self { client: fidl::client::Client::new(channel, protocol_name) }
216    }
217
218    /// Get a Stream of events from the remote end of the protocol.
219    ///
220    /// # Panics
221    ///
222    /// Panics if the event stream was already taken.
223    pub fn take_event_stream(&self) -> LogEventStream {
224        LogEventStream { event_receiver: self.client.take_event_receiver() }
225    }
226
227    /// Dumps all cached logs by calling LogMany() in batches followed by Log() for each new log
228    /// message.
229    /// A null `options` indicates no filtering is requested.
230    pub fn r#listen_safe(
231        &self,
232        mut log_listener: fidl::endpoints::ClientEnd<LogListenerSafeMarker>,
233        mut options: Option<&LogFilterOptions>,
234    ) -> Result<(), fidl::Error> {
235        LogProxyInterface::r#listen_safe(self, log_listener, options)
236    }
237
238    /// Dumps all cached logs by calling LogMany() followed by Done() on `log_listener`.
239    /// A null `options` indicates no filtering is requested.
240    pub fn r#dump_logs_safe(
241        &self,
242        mut log_listener: fidl::endpoints::ClientEnd<LogListenerSafeMarker>,
243        mut options: Option<&LogFilterOptions>,
244    ) -> Result<(), fidl::Error> {
245        LogProxyInterface::r#dump_logs_safe(self, log_listener, options)
246    }
247
248    /// Listens to new log entries by calling Log() on `log_listener`.
249    /// A null `options` indicates no filtering is requested.
250    pub fn r#listen_safe_with_selectors(
251        &self,
252        mut log_listener: fidl::endpoints::ClientEnd<LogListenerSafeMarker>,
253        mut options: Option<&LogFilterOptions>,
254        mut selectors: &[fidl_fuchsia_diagnostics::LogInterestSelector],
255    ) -> Result<(), fidl::Error> {
256        LogProxyInterface::r#listen_safe_with_selectors(self, log_listener, options, selectors)
257    }
258}
259
260impl LogProxyInterface for LogProxy {
261    fn r#listen_safe(
262        &self,
263        mut log_listener: fidl::endpoints::ClientEnd<LogListenerSafeMarker>,
264        mut options: Option<&LogFilterOptions>,
265    ) -> Result<(), fidl::Error> {
266        self.client.send::<LogListenSafeRequest>(
267            (log_listener, options),
268            0x4e523b04952a61b1,
269            fidl::encoding::DynamicFlags::empty(),
270        )
271    }
272
273    fn r#dump_logs_safe(
274        &self,
275        mut log_listener: fidl::endpoints::ClientEnd<LogListenerSafeMarker>,
276        mut options: Option<&LogFilterOptions>,
277    ) -> Result<(), fidl::Error> {
278        self.client.send::<LogDumpLogsSafeRequest>(
279            (log_listener, options),
280            0x14e39f9cada72519,
281            fidl::encoding::DynamicFlags::empty(),
282        )
283    }
284
285    fn r#listen_safe_with_selectors(
286        &self,
287        mut log_listener: fidl::endpoints::ClientEnd<LogListenerSafeMarker>,
288        mut options: Option<&LogFilterOptions>,
289        mut selectors: &[fidl_fuchsia_diagnostics::LogInterestSelector],
290    ) -> Result<(), fidl::Error> {
291        self.client.send::<LogListenSafeWithSelectorsRequest>(
292            (log_listener, options, selectors),
293            0x1b365178771a007e,
294            fidl::encoding::DynamicFlags::empty(),
295        )
296    }
297}
298
299pub struct LogEventStream {
300    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
301}
302
303impl std::marker::Unpin for LogEventStream {}
304
305impl futures::stream::FusedStream for LogEventStream {
306    fn is_terminated(&self) -> bool {
307        self.event_receiver.is_terminated()
308    }
309}
310
311impl futures::Stream for LogEventStream {
312    type Item = Result<LogEvent, fidl::Error>;
313
314    fn poll_next(
315        mut self: std::pin::Pin<&mut Self>,
316        cx: &mut std::task::Context<'_>,
317    ) -> std::task::Poll<Option<Self::Item>> {
318        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
319            &mut self.event_receiver,
320            cx
321        )?) {
322            Some(buf) => std::task::Poll::Ready(Some(LogEvent::decode(buf))),
323            None => std::task::Poll::Ready(None),
324        }
325    }
326}
327
328#[derive(Debug)]
329pub enum LogEvent {}
330
331impl LogEvent {
332    /// Decodes a message buffer as a [`LogEvent`].
333    fn decode(
334        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
335    ) -> Result<LogEvent, fidl::Error> {
336        let (bytes, _handles) = buf.split_mut();
337        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
338        debug_assert_eq!(tx_header.tx_id, 0);
339        match tx_header.ordinal {
340            _ => Err(fidl::Error::UnknownOrdinal {
341                ordinal: tx_header.ordinal,
342                protocol_name: <LogMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
343            }),
344        }
345    }
346}
347
348/// A Stream of incoming requests for fuchsia.logger/Log.
349pub struct LogRequestStream {
350    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
351    is_terminated: bool,
352}
353
354impl std::marker::Unpin for LogRequestStream {}
355
356impl futures::stream::FusedStream for LogRequestStream {
357    fn is_terminated(&self) -> bool {
358        self.is_terminated
359    }
360}
361
362impl fidl::endpoints::RequestStream for LogRequestStream {
363    type Protocol = LogMarker;
364    type ControlHandle = LogControlHandle;
365
366    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
367        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
368    }
369
370    fn control_handle(&self) -> Self::ControlHandle {
371        LogControlHandle { inner: self.inner.clone() }
372    }
373
374    fn into_inner(
375        self,
376    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
377    {
378        (self.inner, self.is_terminated)
379    }
380
381    fn from_inner(
382        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
383        is_terminated: bool,
384    ) -> Self {
385        Self { inner, is_terminated }
386    }
387}
388
389impl futures::Stream for LogRequestStream {
390    type Item = Result<LogRequest, fidl::Error>;
391
392    fn poll_next(
393        mut self: std::pin::Pin<&mut Self>,
394        cx: &mut std::task::Context<'_>,
395    ) -> std::task::Poll<Option<Self::Item>> {
396        let this = &mut *self;
397        if this.inner.check_shutdown(cx) {
398            this.is_terminated = true;
399            return std::task::Poll::Ready(None);
400        }
401        if this.is_terminated {
402            panic!("polled LogRequestStream after completion");
403        }
404        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
405            |bytes, handles| {
406                match this.inner.channel().read_etc(cx, bytes, handles) {
407                    std::task::Poll::Ready(Ok(())) => {}
408                    std::task::Poll::Pending => return std::task::Poll::Pending,
409                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
410                        this.is_terminated = true;
411                        return std::task::Poll::Ready(None);
412                    }
413                    std::task::Poll::Ready(Err(e)) => {
414                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
415                            e.into(),
416                        ))))
417                    }
418                }
419
420                // A message has been received from the channel
421                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
422
423                std::task::Poll::Ready(Some(match header.ordinal {
424                    0x4e523b04952a61b1 => {
425                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
426                        let mut req = fidl::new_empty!(
427                            LogListenSafeRequest,
428                            fidl::encoding::DefaultFuchsiaResourceDialect
429                        );
430                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LogListenSafeRequest>(&header, _body_bytes, handles, &mut req)?;
431                        let control_handle = LogControlHandle { inner: this.inner.clone() };
432                        Ok(LogRequest::ListenSafe {
433                            log_listener: req.log_listener,
434                            options: req.options,
435
436                            control_handle,
437                        })
438                    }
439                    0x14e39f9cada72519 => {
440                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
441                        let mut req = fidl::new_empty!(
442                            LogDumpLogsSafeRequest,
443                            fidl::encoding::DefaultFuchsiaResourceDialect
444                        );
445                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LogDumpLogsSafeRequest>(&header, _body_bytes, handles, &mut req)?;
446                        let control_handle = LogControlHandle { inner: this.inner.clone() };
447                        Ok(LogRequest::DumpLogsSafe {
448                            log_listener: req.log_listener,
449                            options: req.options,
450
451                            control_handle,
452                        })
453                    }
454                    0x1b365178771a007e => {
455                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
456                        let mut req = fidl::new_empty!(
457                            LogListenSafeWithSelectorsRequest,
458                            fidl::encoding::DefaultFuchsiaResourceDialect
459                        );
460                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LogListenSafeWithSelectorsRequest>(&header, _body_bytes, handles, &mut req)?;
461                        let control_handle = LogControlHandle { inner: this.inner.clone() };
462                        Ok(LogRequest::ListenSafeWithSelectors {
463                            log_listener: req.log_listener,
464                            options: req.options,
465                            selectors: req.selectors,
466
467                            control_handle,
468                        })
469                    }
470                    _ => Err(fidl::Error::UnknownOrdinal {
471                        ordinal: header.ordinal,
472                        protocol_name: <LogMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
473                    }),
474                }))
475            },
476        )
477    }
478}
479
480/// Interface for LogListenerSafe to register to listen to logs.
481#[derive(Debug)]
482pub enum LogRequest {
483    /// Dumps all cached logs by calling LogMany() in batches followed by Log() for each new log
484    /// message.
485    /// A null `options` indicates no filtering is requested.
486    ListenSafe {
487        log_listener: fidl::endpoints::ClientEnd<LogListenerSafeMarker>,
488        options: Option<Box<LogFilterOptions>>,
489        control_handle: LogControlHandle,
490    },
491    /// Dumps all cached logs by calling LogMany() followed by Done() on `log_listener`.
492    /// A null `options` indicates no filtering is requested.
493    DumpLogsSafe {
494        log_listener: fidl::endpoints::ClientEnd<LogListenerSafeMarker>,
495        options: Option<Box<LogFilterOptions>>,
496        control_handle: LogControlHandle,
497    },
498    /// Listens to new log entries by calling Log() on `log_listener`.
499    /// A null `options` indicates no filtering is requested.
500    ListenSafeWithSelectors {
501        log_listener: fidl::endpoints::ClientEnd<LogListenerSafeMarker>,
502        options: Option<Box<LogFilterOptions>>,
503        selectors: Vec<fidl_fuchsia_diagnostics::LogInterestSelector>,
504        control_handle: LogControlHandle,
505    },
506}
507
508impl LogRequest {
509    #[allow(irrefutable_let_patterns)]
510    pub fn into_listen_safe(
511        self,
512    ) -> Option<(
513        fidl::endpoints::ClientEnd<LogListenerSafeMarker>,
514        Option<Box<LogFilterOptions>>,
515        LogControlHandle,
516    )> {
517        if let LogRequest::ListenSafe { log_listener, options, control_handle } = self {
518            Some((log_listener, options, control_handle))
519        } else {
520            None
521        }
522    }
523
524    #[allow(irrefutable_let_patterns)]
525    pub fn into_dump_logs_safe(
526        self,
527    ) -> Option<(
528        fidl::endpoints::ClientEnd<LogListenerSafeMarker>,
529        Option<Box<LogFilterOptions>>,
530        LogControlHandle,
531    )> {
532        if let LogRequest::DumpLogsSafe { log_listener, options, control_handle } = self {
533            Some((log_listener, options, control_handle))
534        } else {
535            None
536        }
537    }
538
539    #[allow(irrefutable_let_patterns)]
540    pub fn into_listen_safe_with_selectors(
541        self,
542    ) -> Option<(
543        fidl::endpoints::ClientEnd<LogListenerSafeMarker>,
544        Option<Box<LogFilterOptions>>,
545        Vec<fidl_fuchsia_diagnostics::LogInterestSelector>,
546        LogControlHandle,
547    )> {
548        if let LogRequest::ListenSafeWithSelectors {
549            log_listener,
550            options,
551            selectors,
552            control_handle,
553        } = self
554        {
555            Some((log_listener, options, selectors, control_handle))
556        } else {
557            None
558        }
559    }
560
561    /// Name of the method defined in FIDL
562    pub fn method_name(&self) -> &'static str {
563        match *self {
564            LogRequest::ListenSafe { .. } => "listen_safe",
565            LogRequest::DumpLogsSafe { .. } => "dump_logs_safe",
566            LogRequest::ListenSafeWithSelectors { .. } => "listen_safe_with_selectors",
567        }
568    }
569}
570
571#[derive(Debug, Clone)]
572pub struct LogControlHandle {
573    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
574}
575
576impl fidl::endpoints::ControlHandle for LogControlHandle {
577    fn shutdown(&self) {
578        self.inner.shutdown()
579    }
580    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
581        self.inner.shutdown_with_epitaph(status)
582    }
583
584    fn is_closed(&self) -> bool {
585        self.inner.channel().is_closed()
586    }
587    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
588        self.inner.channel().on_closed()
589    }
590
591    #[cfg(target_os = "fuchsia")]
592    fn signal_peer(
593        &self,
594        clear_mask: zx::Signals,
595        set_mask: zx::Signals,
596    ) -> Result<(), zx_status::Status> {
597        use fidl::Peered;
598        self.inner.channel().signal_peer(clear_mask, set_mask)
599    }
600}
601
602impl LogControlHandle {}
603
604#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
605pub struct LogListenerSafeMarker;
606
607impl fidl::endpoints::ProtocolMarker for LogListenerSafeMarker {
608    type Proxy = LogListenerSafeProxy;
609    type RequestStream = LogListenerSafeRequestStream;
610    #[cfg(target_os = "fuchsia")]
611    type SynchronousProxy = LogListenerSafeSynchronousProxy;
612
613    const DEBUG_NAME: &'static str = "(anonymous) LogListenerSafe";
614}
615
616pub trait LogListenerSafeProxyInterface: Send + Sync {
617    type LogResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
618    fn r#log(&self, log: &LogMessage) -> Self::LogResponseFut;
619    type LogManyResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
620    fn r#log_many(&self, log: &[LogMessage]) -> Self::LogManyResponseFut;
621    fn r#done(&self) -> Result<(), fidl::Error>;
622}
623#[derive(Debug)]
624#[cfg(target_os = "fuchsia")]
625pub struct LogListenerSafeSynchronousProxy {
626    client: fidl::client::sync::Client,
627}
628
629#[cfg(target_os = "fuchsia")]
630impl fidl::endpoints::SynchronousProxy for LogListenerSafeSynchronousProxy {
631    type Proxy = LogListenerSafeProxy;
632    type Protocol = LogListenerSafeMarker;
633
634    fn from_channel(inner: fidl::Channel) -> Self {
635        Self::new(inner)
636    }
637
638    fn into_channel(self) -> fidl::Channel {
639        self.client.into_channel()
640    }
641
642    fn as_channel(&self) -> &fidl::Channel {
643        self.client.as_channel()
644    }
645}
646
647#[cfg(target_os = "fuchsia")]
648impl LogListenerSafeSynchronousProxy {
649    pub fn new(channel: fidl::Channel) -> Self {
650        let protocol_name = <LogListenerSafeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
651        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
652    }
653
654    pub fn into_channel(self) -> fidl::Channel {
655        self.client.into_channel()
656    }
657
658    /// Waits until an event arrives and returns it. It is safe for other
659    /// threads to make concurrent requests while waiting for an event.
660    pub fn wait_for_event(
661        &self,
662        deadline: zx::MonotonicInstant,
663    ) -> Result<LogListenerSafeEvent, fidl::Error> {
664        LogListenerSafeEvent::decode(self.client.wait_for_event(deadline)?)
665    }
666
667    /// Called for single messages.
668    ///
669    /// The return value is used for flow control, and implementers should acknowledge receipt of
670    /// each message in order to continue receiving future messages.
671    pub fn r#log(
672        &self,
673        mut log: &LogMessage,
674        ___deadline: zx::MonotonicInstant,
675    ) -> Result<(), fidl::Error> {
676        let _response =
677            self.client.send_query::<LogListenerSafeLogRequest, fidl::encoding::EmptyPayload>(
678                (log,),
679                0x51a39de355d5bd0a,
680                fidl::encoding::DynamicFlags::empty(),
681                ___deadline,
682            )?;
683        Ok(_response)
684    }
685
686    /// Called when serving cached logs.
687    ///
688    /// Max logs size per call is `MAX_LOG_MANY_SIZE_BYTES` bytes.
689    ///
690    /// The return value is used for flow control, and implementers should acknowledge receipt of
691    /// each batch in order to continue receiving future messages.
692    pub fn r#log_many(
693        &self,
694        mut log: &[LogMessage],
695        ___deadline: zx::MonotonicInstant,
696    ) -> Result<(), fidl::Error> {
697        let _response =
698            self.client.send_query::<LogListenerSafeLogManyRequest, fidl::encoding::EmptyPayload>(
699                (log,),
700                0x1f056431bcd626a,
701                fidl::encoding::DynamicFlags::empty(),
702                ___deadline,
703            )?;
704        Ok(_response)
705    }
706
707    /// Called when this listener was passed to `DumpLogsSafe()` and all cached logs have been sent.
708    pub fn r#done(&self) -> Result<(), fidl::Error> {
709        self.client.send::<fidl::encoding::EmptyPayload>(
710            (),
711            0x34986151fcb584b8,
712            fidl::encoding::DynamicFlags::empty(),
713        )
714    }
715}
716
717#[cfg(target_os = "fuchsia")]
718impl From<LogListenerSafeSynchronousProxy> for zx::Handle {
719    fn from(value: LogListenerSafeSynchronousProxy) -> Self {
720        value.into_channel().into()
721    }
722}
723
724#[cfg(target_os = "fuchsia")]
725impl From<fidl::Channel> for LogListenerSafeSynchronousProxy {
726    fn from(value: fidl::Channel) -> Self {
727        Self::new(value)
728    }
729}
730
731#[derive(Debug, Clone)]
732pub struct LogListenerSafeProxy {
733    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
734}
735
736impl fidl::endpoints::Proxy for LogListenerSafeProxy {
737    type Protocol = LogListenerSafeMarker;
738
739    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
740        Self::new(inner)
741    }
742
743    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
744        self.client.into_channel().map_err(|client| Self { client })
745    }
746
747    fn as_channel(&self) -> &::fidl::AsyncChannel {
748        self.client.as_channel()
749    }
750}
751
752impl LogListenerSafeProxy {
753    /// Create a new Proxy for fuchsia.logger/LogListenerSafe.
754    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
755        let protocol_name = <LogListenerSafeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
756        Self { client: fidl::client::Client::new(channel, protocol_name) }
757    }
758
759    /// Get a Stream of events from the remote end of the protocol.
760    ///
761    /// # Panics
762    ///
763    /// Panics if the event stream was already taken.
764    pub fn take_event_stream(&self) -> LogListenerSafeEventStream {
765        LogListenerSafeEventStream { event_receiver: self.client.take_event_receiver() }
766    }
767
768    /// Called for single messages.
769    ///
770    /// The return value is used for flow control, and implementers should acknowledge receipt of
771    /// each message in order to continue receiving future messages.
772    pub fn r#log(
773        &self,
774        mut log: &LogMessage,
775    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
776        LogListenerSafeProxyInterface::r#log(self, log)
777    }
778
779    /// Called when serving cached logs.
780    ///
781    /// Max logs size per call is `MAX_LOG_MANY_SIZE_BYTES` bytes.
782    ///
783    /// The return value is used for flow control, and implementers should acknowledge receipt of
784    /// each batch in order to continue receiving future messages.
785    pub fn r#log_many(
786        &self,
787        mut log: &[LogMessage],
788    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
789        LogListenerSafeProxyInterface::r#log_many(self, log)
790    }
791
792    /// Called when this listener was passed to `DumpLogsSafe()` and all cached logs have been sent.
793    pub fn r#done(&self) -> Result<(), fidl::Error> {
794        LogListenerSafeProxyInterface::r#done(self)
795    }
796}
797
798impl LogListenerSafeProxyInterface for LogListenerSafeProxy {
799    type LogResponseFut =
800        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
801    fn r#log(&self, mut log: &LogMessage) -> Self::LogResponseFut {
802        fn _decode(
803            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
804        ) -> Result<(), fidl::Error> {
805            let _response = fidl::client::decode_transaction_body::<
806                fidl::encoding::EmptyPayload,
807                fidl::encoding::DefaultFuchsiaResourceDialect,
808                0x51a39de355d5bd0a,
809            >(_buf?)?;
810            Ok(_response)
811        }
812        self.client.send_query_and_decode::<LogListenerSafeLogRequest, ()>(
813            (log,),
814            0x51a39de355d5bd0a,
815            fidl::encoding::DynamicFlags::empty(),
816            _decode,
817        )
818    }
819
820    type LogManyResponseFut =
821        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
822    fn r#log_many(&self, mut log: &[LogMessage]) -> Self::LogManyResponseFut {
823        fn _decode(
824            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
825        ) -> Result<(), fidl::Error> {
826            let _response = fidl::client::decode_transaction_body::<
827                fidl::encoding::EmptyPayload,
828                fidl::encoding::DefaultFuchsiaResourceDialect,
829                0x1f056431bcd626a,
830            >(_buf?)?;
831            Ok(_response)
832        }
833        self.client.send_query_and_decode::<LogListenerSafeLogManyRequest, ()>(
834            (log,),
835            0x1f056431bcd626a,
836            fidl::encoding::DynamicFlags::empty(),
837            _decode,
838        )
839    }
840
841    fn r#done(&self) -> Result<(), fidl::Error> {
842        self.client.send::<fidl::encoding::EmptyPayload>(
843            (),
844            0x34986151fcb584b8,
845            fidl::encoding::DynamicFlags::empty(),
846        )
847    }
848}
849
850pub struct LogListenerSafeEventStream {
851    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
852}
853
854impl std::marker::Unpin for LogListenerSafeEventStream {}
855
856impl futures::stream::FusedStream for LogListenerSafeEventStream {
857    fn is_terminated(&self) -> bool {
858        self.event_receiver.is_terminated()
859    }
860}
861
862impl futures::Stream for LogListenerSafeEventStream {
863    type Item = Result<LogListenerSafeEvent, fidl::Error>;
864
865    fn poll_next(
866        mut self: std::pin::Pin<&mut Self>,
867        cx: &mut std::task::Context<'_>,
868    ) -> std::task::Poll<Option<Self::Item>> {
869        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
870            &mut self.event_receiver,
871            cx
872        )?) {
873            Some(buf) => std::task::Poll::Ready(Some(LogListenerSafeEvent::decode(buf))),
874            None => std::task::Poll::Ready(None),
875        }
876    }
877}
878
879#[derive(Debug)]
880pub enum LogListenerSafeEvent {}
881
882impl LogListenerSafeEvent {
883    /// Decodes a message buffer as a [`LogListenerSafeEvent`].
884    fn decode(
885        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
886    ) -> Result<LogListenerSafeEvent, fidl::Error> {
887        let (bytes, _handles) = buf.split_mut();
888        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
889        debug_assert_eq!(tx_header.tx_id, 0);
890        match tx_header.ordinal {
891            _ => Err(fidl::Error::UnknownOrdinal {
892                ordinal: tx_header.ordinal,
893                protocol_name:
894                    <LogListenerSafeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
895            }),
896        }
897    }
898}
899
900/// A Stream of incoming requests for fuchsia.logger/LogListenerSafe.
901pub struct LogListenerSafeRequestStream {
902    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
903    is_terminated: bool,
904}
905
906impl std::marker::Unpin for LogListenerSafeRequestStream {}
907
908impl futures::stream::FusedStream for LogListenerSafeRequestStream {
909    fn is_terminated(&self) -> bool {
910        self.is_terminated
911    }
912}
913
914impl fidl::endpoints::RequestStream for LogListenerSafeRequestStream {
915    type Protocol = LogListenerSafeMarker;
916    type ControlHandle = LogListenerSafeControlHandle;
917
918    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
919        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
920    }
921
922    fn control_handle(&self) -> Self::ControlHandle {
923        LogListenerSafeControlHandle { inner: self.inner.clone() }
924    }
925
926    fn into_inner(
927        self,
928    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
929    {
930        (self.inner, self.is_terminated)
931    }
932
933    fn from_inner(
934        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
935        is_terminated: bool,
936    ) -> Self {
937        Self { inner, is_terminated }
938    }
939}
940
941impl futures::Stream for LogListenerSafeRequestStream {
942    type Item = Result<LogListenerSafeRequest, fidl::Error>;
943
944    fn poll_next(
945        mut self: std::pin::Pin<&mut Self>,
946        cx: &mut std::task::Context<'_>,
947    ) -> std::task::Poll<Option<Self::Item>> {
948        let this = &mut *self;
949        if this.inner.check_shutdown(cx) {
950            this.is_terminated = true;
951            return std::task::Poll::Ready(None);
952        }
953        if this.is_terminated {
954            panic!("polled LogListenerSafeRequestStream after completion");
955        }
956        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
957            |bytes, handles| {
958                match this.inner.channel().read_etc(cx, bytes, handles) {
959                    std::task::Poll::Ready(Ok(())) => {}
960                    std::task::Poll::Pending => return std::task::Poll::Pending,
961                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
962                        this.is_terminated = true;
963                        return std::task::Poll::Ready(None);
964                    }
965                    std::task::Poll::Ready(Err(e)) => {
966                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
967                            e.into(),
968                        ))))
969                    }
970                }
971
972                // A message has been received from the channel
973                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
974
975                std::task::Poll::Ready(Some(match header.ordinal {
976                    0x51a39de355d5bd0a => {
977                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
978                        let mut req = fidl::new_empty!(
979                            LogListenerSafeLogRequest,
980                            fidl::encoding::DefaultFuchsiaResourceDialect
981                        );
982                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LogListenerSafeLogRequest>(&header, _body_bytes, handles, &mut req)?;
983                        let control_handle =
984                            LogListenerSafeControlHandle { inner: this.inner.clone() };
985                        Ok(LogListenerSafeRequest::Log {
986                            log: req.log,
987
988                            responder: LogListenerSafeLogResponder {
989                                control_handle: std::mem::ManuallyDrop::new(control_handle),
990                                tx_id: header.tx_id,
991                            },
992                        })
993                    }
994                    0x1f056431bcd626a => {
995                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
996                        let mut req = fidl::new_empty!(
997                            LogListenerSafeLogManyRequest,
998                            fidl::encoding::DefaultFuchsiaResourceDialect
999                        );
1000                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LogListenerSafeLogManyRequest>(&header, _body_bytes, handles, &mut req)?;
1001                        let control_handle =
1002                            LogListenerSafeControlHandle { inner: this.inner.clone() };
1003                        Ok(LogListenerSafeRequest::LogMany {
1004                            log: req.log,
1005
1006                            responder: LogListenerSafeLogManyResponder {
1007                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1008                                tx_id: header.tx_id,
1009                            },
1010                        })
1011                    }
1012                    0x34986151fcb584b8 => {
1013                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1014                        let mut req = fidl::new_empty!(
1015                            fidl::encoding::EmptyPayload,
1016                            fidl::encoding::DefaultFuchsiaResourceDialect
1017                        );
1018                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1019                        let control_handle =
1020                            LogListenerSafeControlHandle { inner: this.inner.clone() };
1021                        Ok(LogListenerSafeRequest::Done { control_handle })
1022                    }
1023                    _ => Err(fidl::Error::UnknownOrdinal {
1024                        ordinal: header.ordinal,
1025                        protocol_name:
1026                            <LogListenerSafeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1027                    }),
1028                }))
1029            },
1030        )
1031    }
1032}
1033
1034/// A listener who will notify the `Log` of the receipt of each message.
1035#[derive(Debug)]
1036pub enum LogListenerSafeRequest {
1037    /// Called for single messages.
1038    ///
1039    /// The return value is used for flow control, and implementers should acknowledge receipt of
1040    /// each message in order to continue receiving future messages.
1041    Log { log: LogMessage, responder: LogListenerSafeLogResponder },
1042    /// Called when serving cached logs.
1043    ///
1044    /// Max logs size per call is `MAX_LOG_MANY_SIZE_BYTES` bytes.
1045    ///
1046    /// The return value is used for flow control, and implementers should acknowledge receipt of
1047    /// each batch in order to continue receiving future messages.
1048    LogMany { log: Vec<LogMessage>, responder: LogListenerSafeLogManyResponder },
1049    /// Called when this listener was passed to `DumpLogsSafe()` and all cached logs have been sent.
1050    Done { control_handle: LogListenerSafeControlHandle },
1051}
1052
1053impl LogListenerSafeRequest {
1054    #[allow(irrefutable_let_patterns)]
1055    pub fn into_log(self) -> Option<(LogMessage, LogListenerSafeLogResponder)> {
1056        if let LogListenerSafeRequest::Log { log, responder } = self {
1057            Some((log, responder))
1058        } else {
1059            None
1060        }
1061    }
1062
1063    #[allow(irrefutable_let_patterns)]
1064    pub fn into_log_many(self) -> Option<(Vec<LogMessage>, LogListenerSafeLogManyResponder)> {
1065        if let LogListenerSafeRequest::LogMany { log, responder } = self {
1066            Some((log, responder))
1067        } else {
1068            None
1069        }
1070    }
1071
1072    #[allow(irrefutable_let_patterns)]
1073    pub fn into_done(self) -> Option<(LogListenerSafeControlHandle)> {
1074        if let LogListenerSafeRequest::Done { control_handle } = self {
1075            Some((control_handle))
1076        } else {
1077            None
1078        }
1079    }
1080
1081    /// Name of the method defined in FIDL
1082    pub fn method_name(&self) -> &'static str {
1083        match *self {
1084            LogListenerSafeRequest::Log { .. } => "log",
1085            LogListenerSafeRequest::LogMany { .. } => "log_many",
1086            LogListenerSafeRequest::Done { .. } => "done",
1087        }
1088    }
1089}
1090
1091#[derive(Debug, Clone)]
1092pub struct LogListenerSafeControlHandle {
1093    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1094}
1095
1096impl fidl::endpoints::ControlHandle for LogListenerSafeControlHandle {
1097    fn shutdown(&self) {
1098        self.inner.shutdown()
1099    }
1100    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1101        self.inner.shutdown_with_epitaph(status)
1102    }
1103
1104    fn is_closed(&self) -> bool {
1105        self.inner.channel().is_closed()
1106    }
1107    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1108        self.inner.channel().on_closed()
1109    }
1110
1111    #[cfg(target_os = "fuchsia")]
1112    fn signal_peer(
1113        &self,
1114        clear_mask: zx::Signals,
1115        set_mask: zx::Signals,
1116    ) -> Result<(), zx_status::Status> {
1117        use fidl::Peered;
1118        self.inner.channel().signal_peer(clear_mask, set_mask)
1119    }
1120}
1121
1122impl LogListenerSafeControlHandle {}
1123
1124#[must_use = "FIDL methods require a response to be sent"]
1125#[derive(Debug)]
1126pub struct LogListenerSafeLogResponder {
1127    control_handle: std::mem::ManuallyDrop<LogListenerSafeControlHandle>,
1128    tx_id: u32,
1129}
1130
1131/// Set the the channel to be shutdown (see [`LogListenerSafeControlHandle::shutdown`])
1132/// if the responder is dropped without sending a response, so that the client
1133/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1134impl std::ops::Drop for LogListenerSafeLogResponder {
1135    fn drop(&mut self) {
1136        self.control_handle.shutdown();
1137        // Safety: drops once, never accessed again
1138        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1139    }
1140}
1141
1142impl fidl::endpoints::Responder for LogListenerSafeLogResponder {
1143    type ControlHandle = LogListenerSafeControlHandle;
1144
1145    fn control_handle(&self) -> &LogListenerSafeControlHandle {
1146        &self.control_handle
1147    }
1148
1149    fn drop_without_shutdown(mut self) {
1150        // Safety: drops once, never accessed again due to mem::forget
1151        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1152        // Prevent Drop from running (which would shut down the channel)
1153        std::mem::forget(self);
1154    }
1155}
1156
1157impl LogListenerSafeLogResponder {
1158    /// Sends a response to the FIDL transaction.
1159    ///
1160    /// Sets the channel to shutdown if an error occurs.
1161    pub fn send(self) -> Result<(), fidl::Error> {
1162        let _result = self.send_raw();
1163        if _result.is_err() {
1164            self.control_handle.shutdown();
1165        }
1166        self.drop_without_shutdown();
1167        _result
1168    }
1169
1170    /// Similar to "send" but does not shutdown the channel if an error occurs.
1171    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1172        let _result = self.send_raw();
1173        self.drop_without_shutdown();
1174        _result
1175    }
1176
1177    fn send_raw(&self) -> Result<(), fidl::Error> {
1178        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1179            (),
1180            self.tx_id,
1181            0x51a39de355d5bd0a,
1182            fidl::encoding::DynamicFlags::empty(),
1183        )
1184    }
1185}
1186
1187#[must_use = "FIDL methods require a response to be sent"]
1188#[derive(Debug)]
1189pub struct LogListenerSafeLogManyResponder {
1190    control_handle: std::mem::ManuallyDrop<LogListenerSafeControlHandle>,
1191    tx_id: u32,
1192}
1193
1194/// Set the the channel to be shutdown (see [`LogListenerSafeControlHandle::shutdown`])
1195/// if the responder is dropped without sending a response, so that the client
1196/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1197impl std::ops::Drop for LogListenerSafeLogManyResponder {
1198    fn drop(&mut self) {
1199        self.control_handle.shutdown();
1200        // Safety: drops once, never accessed again
1201        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1202    }
1203}
1204
1205impl fidl::endpoints::Responder for LogListenerSafeLogManyResponder {
1206    type ControlHandle = LogListenerSafeControlHandle;
1207
1208    fn control_handle(&self) -> &LogListenerSafeControlHandle {
1209        &self.control_handle
1210    }
1211
1212    fn drop_without_shutdown(mut self) {
1213        // Safety: drops once, never accessed again due to mem::forget
1214        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1215        // Prevent Drop from running (which would shut down the channel)
1216        std::mem::forget(self);
1217    }
1218}
1219
1220impl LogListenerSafeLogManyResponder {
1221    /// Sends a response to the FIDL transaction.
1222    ///
1223    /// Sets the channel to shutdown if an error occurs.
1224    pub fn send(self) -> Result<(), fidl::Error> {
1225        let _result = self.send_raw();
1226        if _result.is_err() {
1227            self.control_handle.shutdown();
1228        }
1229        self.drop_without_shutdown();
1230        _result
1231    }
1232
1233    /// Similar to "send" but does not shutdown the channel if an error occurs.
1234    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1235        let _result = self.send_raw();
1236        self.drop_without_shutdown();
1237        _result
1238    }
1239
1240    fn send_raw(&self) -> Result<(), fidl::Error> {
1241        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1242            (),
1243            self.tx_id,
1244            0x1f056431bcd626a,
1245            fidl::encoding::DynamicFlags::empty(),
1246        )
1247    }
1248}
1249
1250#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1251pub struct LogSinkMarker;
1252
1253impl fidl::endpoints::ProtocolMarker for LogSinkMarker {
1254    type Proxy = LogSinkProxy;
1255    type RequestStream = LogSinkRequestStream;
1256    #[cfg(target_os = "fuchsia")]
1257    type SynchronousProxy = LogSinkSynchronousProxy;
1258
1259    const DEBUG_NAME: &'static str = "fuchsia.logger.LogSink";
1260}
1261impl fidl::endpoints::DiscoverableProtocolMarker for LogSinkMarker {}
1262pub type LogSinkWaitForInterestChangeResult =
1263    Result<fidl_fuchsia_diagnostics_types::Interest, InterestChangeError>;
1264
1265pub trait LogSinkProxyInterface: Send + Sync {
1266    fn r#connect(&self, socket: fidl::Socket) -> Result<(), fidl::Error>;
1267    type WaitForInterestChangeResponseFut: std::future::Future<Output = Result<LogSinkWaitForInterestChangeResult, fidl::Error>>
1268        + Send;
1269    fn r#wait_for_interest_change(&self) -> Self::WaitForInterestChangeResponseFut;
1270    fn r#connect_structured(&self, socket: fidl::Socket) -> Result<(), fidl::Error>;
1271}
1272#[derive(Debug)]
1273#[cfg(target_os = "fuchsia")]
1274pub struct LogSinkSynchronousProxy {
1275    client: fidl::client::sync::Client,
1276}
1277
1278#[cfg(target_os = "fuchsia")]
1279impl fidl::endpoints::SynchronousProxy for LogSinkSynchronousProxy {
1280    type Proxy = LogSinkProxy;
1281    type Protocol = LogSinkMarker;
1282
1283    fn from_channel(inner: fidl::Channel) -> Self {
1284        Self::new(inner)
1285    }
1286
1287    fn into_channel(self) -> fidl::Channel {
1288        self.client.into_channel()
1289    }
1290
1291    fn as_channel(&self) -> &fidl::Channel {
1292        self.client.as_channel()
1293    }
1294}
1295
1296#[cfg(target_os = "fuchsia")]
1297impl LogSinkSynchronousProxy {
1298    pub fn new(channel: fidl::Channel) -> Self {
1299        let protocol_name = <LogSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1300        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1301    }
1302
1303    pub fn into_channel(self) -> fidl::Channel {
1304        self.client.into_channel()
1305    }
1306
1307    /// Waits until an event arrives and returns it. It is safe for other
1308    /// threads to make concurrent requests while waiting for an event.
1309    pub fn wait_for_event(
1310        &self,
1311        deadline: zx::MonotonicInstant,
1312    ) -> Result<LogSinkEvent, fidl::Error> {
1313        LogSinkEvent::decode(self.client.wait_for_event(deadline)?)
1314    }
1315
1316    /// Send this socket to be drained.
1317    ///
1318    /// See [wire_format.h](https://cs.opensource.google/fuchsia/fuchsia/+/main:zircon/system/ulib/syslog/include/lib/syslog/wire_format.h)
1319    /// for what is expected to be received over the socket.
1320    pub fn r#connect(&self, mut socket: fidl::Socket) -> Result<(), fidl::Error> {
1321        self.client.send::<LogSinkConnectRequest>(
1322            (socket,),
1323            0x64cc4b58ae95c61b,
1324            fidl::encoding::DynamicFlags::empty(),
1325        )
1326    }
1327
1328    /// LogSink implementers will return to this hanging-get whenever the scope of
1329    /// their interest changes. Clients are expected to emit messages based on
1330    /// the registered Interest. In the event that an empty interest is
1331    /// conveyed, clients should emit messages based on their default
1332    /// e.g. compile time configuration. Each client may only poll this once at a time.
1333    /// Invoking WaitForInterestChange a second time before the first call returns will
1334    /// result in an error being returned.
1335    pub fn r#wait_for_interest_change(
1336        &self,
1337        ___deadline: zx::MonotonicInstant,
1338    ) -> Result<LogSinkWaitForInterestChangeResult, fidl::Error> {
1339        let _response =
1340            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
1341                LogSinkWaitForInterestChangeResponse,
1342                InterestChangeError,
1343            >>(
1344                (),
1345                0x1dad20560c197242,
1346                fidl::encoding::DynamicFlags::empty(),
1347                ___deadline,
1348            )?;
1349        Ok(_response.map(|x| x.data))
1350    }
1351
1352    /// Send this socket to be drained, using the structured logs format.
1353    ///
1354    /// See [Encoding structured records](https://fuchsia.dev/fuchsia-src/reference/platform-spec/diagnostics/logs-encoding)
1355    /// for what is expected to be received over the socket.
1356    pub fn r#connect_structured(&self, mut socket: fidl::Socket) -> Result<(), fidl::Error> {
1357        self.client.send::<LogSinkConnectStructuredRequest>(
1358            (socket,),
1359            0x635424b504b2a74c,
1360            fidl::encoding::DynamicFlags::empty(),
1361        )
1362    }
1363}
1364
1365#[cfg(target_os = "fuchsia")]
1366impl From<LogSinkSynchronousProxy> for zx::Handle {
1367    fn from(value: LogSinkSynchronousProxy) -> Self {
1368        value.into_channel().into()
1369    }
1370}
1371
1372#[cfg(target_os = "fuchsia")]
1373impl From<fidl::Channel> for LogSinkSynchronousProxy {
1374    fn from(value: fidl::Channel) -> Self {
1375        Self::new(value)
1376    }
1377}
1378
1379#[derive(Debug, Clone)]
1380pub struct LogSinkProxy {
1381    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1382}
1383
1384impl fidl::endpoints::Proxy for LogSinkProxy {
1385    type Protocol = LogSinkMarker;
1386
1387    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1388        Self::new(inner)
1389    }
1390
1391    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1392        self.client.into_channel().map_err(|client| Self { client })
1393    }
1394
1395    fn as_channel(&self) -> &::fidl::AsyncChannel {
1396        self.client.as_channel()
1397    }
1398}
1399
1400impl LogSinkProxy {
1401    /// Create a new Proxy for fuchsia.logger/LogSink.
1402    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1403        let protocol_name = <LogSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1404        Self { client: fidl::client::Client::new(channel, protocol_name) }
1405    }
1406
1407    /// Get a Stream of events from the remote end of the protocol.
1408    ///
1409    /// # Panics
1410    ///
1411    /// Panics if the event stream was already taken.
1412    pub fn take_event_stream(&self) -> LogSinkEventStream {
1413        LogSinkEventStream { event_receiver: self.client.take_event_receiver() }
1414    }
1415
1416    /// Send this socket to be drained.
1417    ///
1418    /// See [wire_format.h](https://cs.opensource.google/fuchsia/fuchsia/+/main:zircon/system/ulib/syslog/include/lib/syslog/wire_format.h)
1419    /// for what is expected to be received over the socket.
1420    pub fn r#connect(&self, mut socket: fidl::Socket) -> Result<(), fidl::Error> {
1421        LogSinkProxyInterface::r#connect(self, socket)
1422    }
1423
1424    /// LogSink implementers will return to this hanging-get whenever the scope of
1425    /// their interest changes. Clients are expected to emit messages based on
1426    /// the registered Interest. In the event that an empty interest is
1427    /// conveyed, clients should emit messages based on their default
1428    /// e.g. compile time configuration. Each client may only poll this once at a time.
1429    /// Invoking WaitForInterestChange a second time before the first call returns will
1430    /// result in an error being returned.
1431    pub fn r#wait_for_interest_change(
1432        &self,
1433    ) -> fidl::client::QueryResponseFut<
1434        LogSinkWaitForInterestChangeResult,
1435        fidl::encoding::DefaultFuchsiaResourceDialect,
1436    > {
1437        LogSinkProxyInterface::r#wait_for_interest_change(self)
1438    }
1439
1440    /// Send this socket to be drained, using the structured logs format.
1441    ///
1442    /// See [Encoding structured records](https://fuchsia.dev/fuchsia-src/reference/platform-spec/diagnostics/logs-encoding)
1443    /// for what is expected to be received over the socket.
1444    pub fn r#connect_structured(&self, mut socket: fidl::Socket) -> Result<(), fidl::Error> {
1445        LogSinkProxyInterface::r#connect_structured(self, socket)
1446    }
1447}
1448
1449impl LogSinkProxyInterface for LogSinkProxy {
1450    fn r#connect(&self, mut socket: fidl::Socket) -> Result<(), fidl::Error> {
1451        self.client.send::<LogSinkConnectRequest>(
1452            (socket,),
1453            0x64cc4b58ae95c61b,
1454            fidl::encoding::DynamicFlags::empty(),
1455        )
1456    }
1457
1458    type WaitForInterestChangeResponseFut = fidl::client::QueryResponseFut<
1459        LogSinkWaitForInterestChangeResult,
1460        fidl::encoding::DefaultFuchsiaResourceDialect,
1461    >;
1462    fn r#wait_for_interest_change(&self) -> Self::WaitForInterestChangeResponseFut {
1463        fn _decode(
1464            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1465        ) -> Result<LogSinkWaitForInterestChangeResult, fidl::Error> {
1466            let _response = fidl::client::decode_transaction_body::<
1467                fidl::encoding::ResultType<
1468                    LogSinkWaitForInterestChangeResponse,
1469                    InterestChangeError,
1470                >,
1471                fidl::encoding::DefaultFuchsiaResourceDialect,
1472                0x1dad20560c197242,
1473            >(_buf?)?;
1474            Ok(_response.map(|x| x.data))
1475        }
1476        self.client.send_query_and_decode::<
1477            fidl::encoding::EmptyPayload,
1478            LogSinkWaitForInterestChangeResult,
1479        >(
1480            (),
1481            0x1dad20560c197242,
1482            fidl::encoding::DynamicFlags::empty(),
1483            _decode,
1484        )
1485    }
1486
1487    fn r#connect_structured(&self, mut socket: fidl::Socket) -> Result<(), fidl::Error> {
1488        self.client.send::<LogSinkConnectStructuredRequest>(
1489            (socket,),
1490            0x635424b504b2a74c,
1491            fidl::encoding::DynamicFlags::empty(),
1492        )
1493    }
1494}
1495
1496pub struct LogSinkEventStream {
1497    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1498}
1499
1500impl std::marker::Unpin for LogSinkEventStream {}
1501
1502impl futures::stream::FusedStream for LogSinkEventStream {
1503    fn is_terminated(&self) -> bool {
1504        self.event_receiver.is_terminated()
1505    }
1506}
1507
1508impl futures::Stream for LogSinkEventStream {
1509    type Item = Result<LogSinkEvent, fidl::Error>;
1510
1511    fn poll_next(
1512        mut self: std::pin::Pin<&mut Self>,
1513        cx: &mut std::task::Context<'_>,
1514    ) -> std::task::Poll<Option<Self::Item>> {
1515        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1516            &mut self.event_receiver,
1517            cx
1518        )?) {
1519            Some(buf) => std::task::Poll::Ready(Some(LogSinkEvent::decode(buf))),
1520            None => std::task::Poll::Ready(None),
1521        }
1522    }
1523}
1524
1525#[derive(Debug)]
1526pub enum LogSinkEvent {
1527    #[non_exhaustive]
1528    _UnknownEvent {
1529        /// Ordinal of the event that was sent.
1530        ordinal: u64,
1531    },
1532}
1533
1534impl LogSinkEvent {
1535    /// Decodes a message buffer as a [`LogSinkEvent`].
1536    fn decode(
1537        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1538    ) -> Result<LogSinkEvent, fidl::Error> {
1539        let (bytes, _handles) = buf.split_mut();
1540        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1541        debug_assert_eq!(tx_header.tx_id, 0);
1542        match tx_header.ordinal {
1543            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1544                Ok(LogSinkEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1545            }
1546            _ => Err(fidl::Error::UnknownOrdinal {
1547                ordinal: tx_header.ordinal,
1548                protocol_name: <LogSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1549            }),
1550        }
1551    }
1552}
1553
1554/// A Stream of incoming requests for fuchsia.logger/LogSink.
1555pub struct LogSinkRequestStream {
1556    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1557    is_terminated: bool,
1558}
1559
1560impl std::marker::Unpin for LogSinkRequestStream {}
1561
1562impl futures::stream::FusedStream for LogSinkRequestStream {
1563    fn is_terminated(&self) -> bool {
1564        self.is_terminated
1565    }
1566}
1567
1568impl fidl::endpoints::RequestStream for LogSinkRequestStream {
1569    type Protocol = LogSinkMarker;
1570    type ControlHandle = LogSinkControlHandle;
1571
1572    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1573        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1574    }
1575
1576    fn control_handle(&self) -> Self::ControlHandle {
1577        LogSinkControlHandle { inner: self.inner.clone() }
1578    }
1579
1580    fn into_inner(
1581        self,
1582    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1583    {
1584        (self.inner, self.is_terminated)
1585    }
1586
1587    fn from_inner(
1588        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1589        is_terminated: bool,
1590    ) -> Self {
1591        Self { inner, is_terminated }
1592    }
1593}
1594
1595impl futures::Stream for LogSinkRequestStream {
1596    type Item = Result<LogSinkRequest, fidl::Error>;
1597
1598    fn poll_next(
1599        mut self: std::pin::Pin<&mut Self>,
1600        cx: &mut std::task::Context<'_>,
1601    ) -> std::task::Poll<Option<Self::Item>> {
1602        let this = &mut *self;
1603        if this.inner.check_shutdown(cx) {
1604            this.is_terminated = true;
1605            return std::task::Poll::Ready(None);
1606        }
1607        if this.is_terminated {
1608            panic!("polled LogSinkRequestStream after completion");
1609        }
1610        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1611            |bytes, handles| {
1612                match this.inner.channel().read_etc(cx, bytes, handles) {
1613                    std::task::Poll::Ready(Ok(())) => {}
1614                    std::task::Poll::Pending => return std::task::Poll::Pending,
1615                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1616                        this.is_terminated = true;
1617                        return std::task::Poll::Ready(None);
1618                    }
1619                    std::task::Poll::Ready(Err(e)) => {
1620                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1621                            e.into(),
1622                        ))))
1623                    }
1624                }
1625
1626                // A message has been received from the channel
1627                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1628
1629                std::task::Poll::Ready(Some(match header.ordinal {
1630                    0x64cc4b58ae95c61b => {
1631                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1632                        let mut req = fidl::new_empty!(
1633                            LogSinkConnectRequest,
1634                            fidl::encoding::DefaultFuchsiaResourceDialect
1635                        );
1636                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LogSinkConnectRequest>(&header, _body_bytes, handles, &mut req)?;
1637                        let control_handle = LogSinkControlHandle { inner: this.inner.clone() };
1638                        Ok(LogSinkRequest::Connect { socket: req.socket, control_handle })
1639                    }
1640                    0x1dad20560c197242 => {
1641                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1642                        let mut req = fidl::new_empty!(
1643                            fidl::encoding::EmptyPayload,
1644                            fidl::encoding::DefaultFuchsiaResourceDialect
1645                        );
1646                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1647                        let control_handle = LogSinkControlHandle { inner: this.inner.clone() };
1648                        Ok(LogSinkRequest::WaitForInterestChange {
1649                            responder: LogSinkWaitForInterestChangeResponder {
1650                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1651                                tx_id: header.tx_id,
1652                            },
1653                        })
1654                    }
1655                    0x635424b504b2a74c => {
1656                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1657                        let mut req = fidl::new_empty!(
1658                            LogSinkConnectStructuredRequest,
1659                            fidl::encoding::DefaultFuchsiaResourceDialect
1660                        );
1661                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LogSinkConnectStructuredRequest>(&header, _body_bytes, handles, &mut req)?;
1662                        let control_handle = LogSinkControlHandle { inner: this.inner.clone() };
1663                        Ok(LogSinkRequest::ConnectStructured { socket: req.socket, control_handle })
1664                    }
1665                    _ if header.tx_id == 0
1666                        && header
1667                            .dynamic_flags()
1668                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1669                    {
1670                        Ok(LogSinkRequest::_UnknownMethod {
1671                            ordinal: header.ordinal,
1672                            control_handle: LogSinkControlHandle { inner: this.inner.clone() },
1673                            method_type: fidl::MethodType::OneWay,
1674                        })
1675                    }
1676                    _ if header
1677                        .dynamic_flags()
1678                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1679                    {
1680                        this.inner.send_framework_err(
1681                            fidl::encoding::FrameworkErr::UnknownMethod,
1682                            header.tx_id,
1683                            header.ordinal,
1684                            header.dynamic_flags(),
1685                            (bytes, handles),
1686                        )?;
1687                        Ok(LogSinkRequest::_UnknownMethod {
1688                            ordinal: header.ordinal,
1689                            control_handle: LogSinkControlHandle { inner: this.inner.clone() },
1690                            method_type: fidl::MethodType::TwoWay,
1691                        })
1692                    }
1693                    _ => Err(fidl::Error::UnknownOrdinal {
1694                        ordinal: header.ordinal,
1695                        protocol_name:
1696                            <LogSinkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1697                    }),
1698                }))
1699            },
1700        )
1701    }
1702}
1703
1704/// Drains a program's logs.
1705#[derive(Debug)]
1706pub enum LogSinkRequest {
1707    /// Send this socket to be drained.
1708    ///
1709    /// See [wire_format.h](https://cs.opensource.google/fuchsia/fuchsia/+/main:zircon/system/ulib/syslog/include/lib/syslog/wire_format.h)
1710    /// for what is expected to be received over the socket.
1711    Connect { socket: fidl::Socket, control_handle: LogSinkControlHandle },
1712    /// LogSink implementers will return to this hanging-get whenever the scope of
1713    /// their interest changes. Clients are expected to emit messages based on
1714    /// the registered Interest. In the event that an empty interest is
1715    /// conveyed, clients should emit messages based on their default
1716    /// e.g. compile time configuration. Each client may only poll this once at a time.
1717    /// Invoking WaitForInterestChange a second time before the first call returns will
1718    /// result in an error being returned.
1719    WaitForInterestChange { responder: LogSinkWaitForInterestChangeResponder },
1720    /// Send this socket to be drained, using the structured logs format.
1721    ///
1722    /// See [Encoding structured records](https://fuchsia.dev/fuchsia-src/reference/platform-spec/diagnostics/logs-encoding)
1723    /// for what is expected to be received over the socket.
1724    ConnectStructured { socket: fidl::Socket, control_handle: LogSinkControlHandle },
1725    /// An interaction was received which does not match any known method.
1726    #[non_exhaustive]
1727    _UnknownMethod {
1728        /// Ordinal of the method that was called.
1729        ordinal: u64,
1730        control_handle: LogSinkControlHandle,
1731        method_type: fidl::MethodType,
1732    },
1733}
1734
1735impl LogSinkRequest {
1736    #[allow(irrefutable_let_patterns)]
1737    pub fn into_connect(self) -> Option<(fidl::Socket, LogSinkControlHandle)> {
1738        if let LogSinkRequest::Connect { socket, control_handle } = self {
1739            Some((socket, control_handle))
1740        } else {
1741            None
1742        }
1743    }
1744
1745    #[allow(irrefutable_let_patterns)]
1746    pub fn into_wait_for_interest_change(self) -> Option<(LogSinkWaitForInterestChangeResponder)> {
1747        if let LogSinkRequest::WaitForInterestChange { responder } = self {
1748            Some((responder))
1749        } else {
1750            None
1751        }
1752    }
1753
1754    #[allow(irrefutable_let_patterns)]
1755    pub fn into_connect_structured(self) -> Option<(fidl::Socket, LogSinkControlHandle)> {
1756        if let LogSinkRequest::ConnectStructured { socket, control_handle } = self {
1757            Some((socket, control_handle))
1758        } else {
1759            None
1760        }
1761    }
1762
1763    /// Name of the method defined in FIDL
1764    pub fn method_name(&self) -> &'static str {
1765        match *self {
1766            LogSinkRequest::Connect { .. } => "connect",
1767            LogSinkRequest::WaitForInterestChange { .. } => "wait_for_interest_change",
1768            LogSinkRequest::ConnectStructured { .. } => "connect_structured",
1769            LogSinkRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
1770                "unknown one-way method"
1771            }
1772            LogSinkRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
1773                "unknown two-way method"
1774            }
1775        }
1776    }
1777}
1778
1779#[derive(Debug, Clone)]
1780pub struct LogSinkControlHandle {
1781    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1782}
1783
1784impl fidl::endpoints::ControlHandle for LogSinkControlHandle {
1785    fn shutdown(&self) {
1786        self.inner.shutdown()
1787    }
1788    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1789        self.inner.shutdown_with_epitaph(status)
1790    }
1791
1792    fn is_closed(&self) -> bool {
1793        self.inner.channel().is_closed()
1794    }
1795    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1796        self.inner.channel().on_closed()
1797    }
1798
1799    #[cfg(target_os = "fuchsia")]
1800    fn signal_peer(
1801        &self,
1802        clear_mask: zx::Signals,
1803        set_mask: zx::Signals,
1804    ) -> Result<(), zx_status::Status> {
1805        use fidl::Peered;
1806        self.inner.channel().signal_peer(clear_mask, set_mask)
1807    }
1808}
1809
1810impl LogSinkControlHandle {}
1811
1812#[must_use = "FIDL methods require a response to be sent"]
1813#[derive(Debug)]
1814pub struct LogSinkWaitForInterestChangeResponder {
1815    control_handle: std::mem::ManuallyDrop<LogSinkControlHandle>,
1816    tx_id: u32,
1817}
1818
1819/// Set the the channel to be shutdown (see [`LogSinkControlHandle::shutdown`])
1820/// if the responder is dropped without sending a response, so that the client
1821/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1822impl std::ops::Drop for LogSinkWaitForInterestChangeResponder {
1823    fn drop(&mut self) {
1824        self.control_handle.shutdown();
1825        // Safety: drops once, never accessed again
1826        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1827    }
1828}
1829
1830impl fidl::endpoints::Responder for LogSinkWaitForInterestChangeResponder {
1831    type ControlHandle = LogSinkControlHandle;
1832
1833    fn control_handle(&self) -> &LogSinkControlHandle {
1834        &self.control_handle
1835    }
1836
1837    fn drop_without_shutdown(mut self) {
1838        // Safety: drops once, never accessed again due to mem::forget
1839        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1840        // Prevent Drop from running (which would shut down the channel)
1841        std::mem::forget(self);
1842    }
1843}
1844
1845impl LogSinkWaitForInterestChangeResponder {
1846    /// Sends a response to the FIDL transaction.
1847    ///
1848    /// Sets the channel to shutdown if an error occurs.
1849    pub fn send(
1850        self,
1851        mut result: Result<&fidl_fuchsia_diagnostics_types::Interest, InterestChangeError>,
1852    ) -> Result<(), fidl::Error> {
1853        let _result = self.send_raw(result);
1854        if _result.is_err() {
1855            self.control_handle.shutdown();
1856        }
1857        self.drop_without_shutdown();
1858        _result
1859    }
1860
1861    /// Similar to "send" but does not shutdown the channel if an error occurs.
1862    pub fn send_no_shutdown_on_err(
1863        self,
1864        mut result: Result<&fidl_fuchsia_diagnostics_types::Interest, InterestChangeError>,
1865    ) -> Result<(), fidl::Error> {
1866        let _result = self.send_raw(result);
1867        self.drop_without_shutdown();
1868        _result
1869    }
1870
1871    fn send_raw(
1872        &self,
1873        mut result: Result<&fidl_fuchsia_diagnostics_types::Interest, InterestChangeError>,
1874    ) -> Result<(), fidl::Error> {
1875        self.control_handle.inner.send::<fidl::encoding::ResultType<
1876            LogSinkWaitForInterestChangeResponse,
1877            InterestChangeError,
1878        >>(
1879            result.map(|data| (data,)),
1880            self.tx_id,
1881            0x1dad20560c197242,
1882            fidl::encoding::DynamicFlags::empty(),
1883        )
1884    }
1885}
1886
1887mod internal {
1888    use super::*;
1889
1890    impl fidl::encoding::ResourceTypeMarker for LogDumpLogsSafeRequest {
1891        type Borrowed<'a> = &'a mut Self;
1892        fn take_or_borrow<'a>(
1893            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1894        ) -> Self::Borrowed<'a> {
1895            value
1896        }
1897    }
1898
1899    unsafe impl fidl::encoding::TypeMarker for LogDumpLogsSafeRequest {
1900        type Owned = Self;
1901
1902        #[inline(always)]
1903        fn inline_align(_context: fidl::encoding::Context) -> usize {
1904            8
1905        }
1906
1907        #[inline(always)]
1908        fn inline_size(_context: fidl::encoding::Context) -> usize {
1909            16
1910        }
1911    }
1912
1913    unsafe impl
1914        fidl::encoding::Encode<
1915            LogDumpLogsSafeRequest,
1916            fidl::encoding::DefaultFuchsiaResourceDialect,
1917        > for &mut LogDumpLogsSafeRequest
1918    {
1919        #[inline]
1920        unsafe fn encode(
1921            self,
1922            encoder: &mut fidl::encoding::Encoder<
1923                '_,
1924                fidl::encoding::DefaultFuchsiaResourceDialect,
1925            >,
1926            offset: usize,
1927            _depth: fidl::encoding::Depth,
1928        ) -> fidl::Result<()> {
1929            encoder.debug_check_bounds::<LogDumpLogsSafeRequest>(offset);
1930            // Delegate to tuple encoding.
1931            fidl::encoding::Encode::<LogDumpLogsSafeRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1932                (
1933                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<LogListenerSafeMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.log_listener),
1934                    <fidl::encoding::Boxed<LogFilterOptions> as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
1935                ),
1936                encoder, offset, _depth
1937            )
1938        }
1939    }
1940    unsafe impl<
1941            T0: fidl::encoding::Encode<
1942                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<LogListenerSafeMarker>>,
1943                fidl::encoding::DefaultFuchsiaResourceDialect,
1944            >,
1945            T1: fidl::encoding::Encode<
1946                fidl::encoding::Boxed<LogFilterOptions>,
1947                fidl::encoding::DefaultFuchsiaResourceDialect,
1948            >,
1949        >
1950        fidl::encoding::Encode<
1951            LogDumpLogsSafeRequest,
1952            fidl::encoding::DefaultFuchsiaResourceDialect,
1953        > for (T0, T1)
1954    {
1955        #[inline]
1956        unsafe fn encode(
1957            self,
1958            encoder: &mut fidl::encoding::Encoder<
1959                '_,
1960                fidl::encoding::DefaultFuchsiaResourceDialect,
1961            >,
1962            offset: usize,
1963            depth: fidl::encoding::Depth,
1964        ) -> fidl::Result<()> {
1965            encoder.debug_check_bounds::<LogDumpLogsSafeRequest>(offset);
1966            // Zero out padding regions. There's no need to apply masks
1967            // because the unmasked parts will be overwritten by fields.
1968            unsafe {
1969                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1970                (ptr as *mut u64).write_unaligned(0);
1971            }
1972            // Write the fields.
1973            self.0.encode(encoder, offset + 0, depth)?;
1974            self.1.encode(encoder, offset + 8, depth)?;
1975            Ok(())
1976        }
1977    }
1978
1979    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1980        for LogDumpLogsSafeRequest
1981    {
1982        #[inline(always)]
1983        fn new_empty() -> Self {
1984            Self {
1985                log_listener: fidl::new_empty!(
1986                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<LogListenerSafeMarker>>,
1987                    fidl::encoding::DefaultFuchsiaResourceDialect
1988                ),
1989                options: fidl::new_empty!(
1990                    fidl::encoding::Boxed<LogFilterOptions>,
1991                    fidl::encoding::DefaultFuchsiaResourceDialect
1992                ),
1993            }
1994        }
1995
1996        #[inline]
1997        unsafe fn decode(
1998            &mut self,
1999            decoder: &mut fidl::encoding::Decoder<
2000                '_,
2001                fidl::encoding::DefaultFuchsiaResourceDialect,
2002            >,
2003            offset: usize,
2004            _depth: fidl::encoding::Depth,
2005        ) -> fidl::Result<()> {
2006            decoder.debug_check_bounds::<Self>(offset);
2007            // Verify that padding bytes are zero.
2008            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
2009            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2010            let mask = 0xffffffff00000000u64;
2011            let maskedval = padval & mask;
2012            if maskedval != 0 {
2013                return Err(fidl::Error::NonZeroPadding {
2014                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
2015                });
2016            }
2017            fidl::decode!(
2018                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<LogListenerSafeMarker>>,
2019                fidl::encoding::DefaultFuchsiaResourceDialect,
2020                &mut self.log_listener,
2021                decoder,
2022                offset + 0,
2023                _depth
2024            )?;
2025            fidl::decode!(
2026                fidl::encoding::Boxed<LogFilterOptions>,
2027                fidl::encoding::DefaultFuchsiaResourceDialect,
2028                &mut self.options,
2029                decoder,
2030                offset + 8,
2031                _depth
2032            )?;
2033            Ok(())
2034        }
2035    }
2036
2037    impl fidl::encoding::ResourceTypeMarker for LogListenSafeRequest {
2038        type Borrowed<'a> = &'a mut Self;
2039        fn take_or_borrow<'a>(
2040            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2041        ) -> Self::Borrowed<'a> {
2042            value
2043        }
2044    }
2045
2046    unsafe impl fidl::encoding::TypeMarker for LogListenSafeRequest {
2047        type Owned = Self;
2048
2049        #[inline(always)]
2050        fn inline_align(_context: fidl::encoding::Context) -> usize {
2051            8
2052        }
2053
2054        #[inline(always)]
2055        fn inline_size(_context: fidl::encoding::Context) -> usize {
2056            16
2057        }
2058    }
2059
2060    unsafe impl
2061        fidl::encoding::Encode<LogListenSafeRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
2062        for &mut LogListenSafeRequest
2063    {
2064        #[inline]
2065        unsafe fn encode(
2066            self,
2067            encoder: &mut fidl::encoding::Encoder<
2068                '_,
2069                fidl::encoding::DefaultFuchsiaResourceDialect,
2070            >,
2071            offset: usize,
2072            _depth: fidl::encoding::Depth,
2073        ) -> fidl::Result<()> {
2074            encoder.debug_check_bounds::<LogListenSafeRequest>(offset);
2075            // Delegate to tuple encoding.
2076            fidl::encoding::Encode::<LogListenSafeRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2077                (
2078                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<LogListenerSafeMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.log_listener),
2079                    <fidl::encoding::Boxed<LogFilterOptions> as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
2080                ),
2081                encoder, offset, _depth
2082            )
2083        }
2084    }
2085    unsafe impl<
2086            T0: fidl::encoding::Encode<
2087                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<LogListenerSafeMarker>>,
2088                fidl::encoding::DefaultFuchsiaResourceDialect,
2089            >,
2090            T1: fidl::encoding::Encode<
2091                fidl::encoding::Boxed<LogFilterOptions>,
2092                fidl::encoding::DefaultFuchsiaResourceDialect,
2093            >,
2094        >
2095        fidl::encoding::Encode<LogListenSafeRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
2096        for (T0, T1)
2097    {
2098        #[inline]
2099        unsafe fn encode(
2100            self,
2101            encoder: &mut fidl::encoding::Encoder<
2102                '_,
2103                fidl::encoding::DefaultFuchsiaResourceDialect,
2104            >,
2105            offset: usize,
2106            depth: fidl::encoding::Depth,
2107        ) -> fidl::Result<()> {
2108            encoder.debug_check_bounds::<LogListenSafeRequest>(offset);
2109            // Zero out padding regions. There's no need to apply masks
2110            // because the unmasked parts will be overwritten by fields.
2111            unsafe {
2112                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
2113                (ptr as *mut u64).write_unaligned(0);
2114            }
2115            // Write the fields.
2116            self.0.encode(encoder, offset + 0, depth)?;
2117            self.1.encode(encoder, offset + 8, depth)?;
2118            Ok(())
2119        }
2120    }
2121
2122    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2123        for LogListenSafeRequest
2124    {
2125        #[inline(always)]
2126        fn new_empty() -> Self {
2127            Self {
2128                log_listener: fidl::new_empty!(
2129                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<LogListenerSafeMarker>>,
2130                    fidl::encoding::DefaultFuchsiaResourceDialect
2131                ),
2132                options: fidl::new_empty!(
2133                    fidl::encoding::Boxed<LogFilterOptions>,
2134                    fidl::encoding::DefaultFuchsiaResourceDialect
2135                ),
2136            }
2137        }
2138
2139        #[inline]
2140        unsafe fn decode(
2141            &mut self,
2142            decoder: &mut fidl::encoding::Decoder<
2143                '_,
2144                fidl::encoding::DefaultFuchsiaResourceDialect,
2145            >,
2146            offset: usize,
2147            _depth: fidl::encoding::Depth,
2148        ) -> fidl::Result<()> {
2149            decoder.debug_check_bounds::<Self>(offset);
2150            // Verify that padding bytes are zero.
2151            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
2152            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2153            let mask = 0xffffffff00000000u64;
2154            let maskedval = padval & mask;
2155            if maskedval != 0 {
2156                return Err(fidl::Error::NonZeroPadding {
2157                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
2158                });
2159            }
2160            fidl::decode!(
2161                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<LogListenerSafeMarker>>,
2162                fidl::encoding::DefaultFuchsiaResourceDialect,
2163                &mut self.log_listener,
2164                decoder,
2165                offset + 0,
2166                _depth
2167            )?;
2168            fidl::decode!(
2169                fidl::encoding::Boxed<LogFilterOptions>,
2170                fidl::encoding::DefaultFuchsiaResourceDialect,
2171                &mut self.options,
2172                decoder,
2173                offset + 8,
2174                _depth
2175            )?;
2176            Ok(())
2177        }
2178    }
2179
2180    impl fidl::encoding::ResourceTypeMarker for LogListenSafeWithSelectorsRequest {
2181        type Borrowed<'a> = &'a mut Self;
2182        fn take_or_borrow<'a>(
2183            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2184        ) -> Self::Borrowed<'a> {
2185            value
2186        }
2187    }
2188
2189    unsafe impl fidl::encoding::TypeMarker for LogListenSafeWithSelectorsRequest {
2190        type Owned = Self;
2191
2192        #[inline(always)]
2193        fn inline_align(_context: fidl::encoding::Context) -> usize {
2194            8
2195        }
2196
2197        #[inline(always)]
2198        fn inline_size(_context: fidl::encoding::Context) -> usize {
2199            32
2200        }
2201    }
2202
2203    unsafe impl
2204        fidl::encoding::Encode<
2205            LogListenSafeWithSelectorsRequest,
2206            fidl::encoding::DefaultFuchsiaResourceDialect,
2207        > for &mut LogListenSafeWithSelectorsRequest
2208    {
2209        #[inline]
2210        unsafe fn encode(
2211            self,
2212            encoder: &mut fidl::encoding::Encoder<
2213                '_,
2214                fidl::encoding::DefaultFuchsiaResourceDialect,
2215            >,
2216            offset: usize,
2217            _depth: fidl::encoding::Depth,
2218        ) -> fidl::Result<()> {
2219            encoder.debug_check_bounds::<LogListenSafeWithSelectorsRequest>(offset);
2220            // Delegate to tuple encoding.
2221            fidl::encoding::Encode::<LogListenSafeWithSelectorsRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2222                (
2223                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<LogListenerSafeMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.log_listener),
2224                    <fidl::encoding::Boxed<LogFilterOptions> as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
2225                    <fidl::encoding::Vector<fidl_fuchsia_diagnostics::LogInterestSelector, 64> as fidl::encoding::ValueTypeMarker>::borrow(&self.selectors),
2226                ),
2227                encoder, offset, _depth
2228            )
2229        }
2230    }
2231    unsafe impl<
2232            T0: fidl::encoding::Encode<
2233                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<LogListenerSafeMarker>>,
2234                fidl::encoding::DefaultFuchsiaResourceDialect,
2235            >,
2236            T1: fidl::encoding::Encode<
2237                fidl::encoding::Boxed<LogFilterOptions>,
2238                fidl::encoding::DefaultFuchsiaResourceDialect,
2239            >,
2240            T2: fidl::encoding::Encode<
2241                fidl::encoding::Vector<fidl_fuchsia_diagnostics::LogInterestSelector, 64>,
2242                fidl::encoding::DefaultFuchsiaResourceDialect,
2243            >,
2244        >
2245        fidl::encoding::Encode<
2246            LogListenSafeWithSelectorsRequest,
2247            fidl::encoding::DefaultFuchsiaResourceDialect,
2248        > for (T0, T1, T2)
2249    {
2250        #[inline]
2251        unsafe fn encode(
2252            self,
2253            encoder: &mut fidl::encoding::Encoder<
2254                '_,
2255                fidl::encoding::DefaultFuchsiaResourceDialect,
2256            >,
2257            offset: usize,
2258            depth: fidl::encoding::Depth,
2259        ) -> fidl::Result<()> {
2260            encoder.debug_check_bounds::<LogListenSafeWithSelectorsRequest>(offset);
2261            // Zero out padding regions. There's no need to apply masks
2262            // because the unmasked parts will be overwritten by fields.
2263            unsafe {
2264                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
2265                (ptr as *mut u64).write_unaligned(0);
2266            }
2267            // Write the fields.
2268            self.0.encode(encoder, offset + 0, depth)?;
2269            self.1.encode(encoder, offset + 8, depth)?;
2270            self.2.encode(encoder, offset + 16, depth)?;
2271            Ok(())
2272        }
2273    }
2274
2275    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2276        for LogListenSafeWithSelectorsRequest
2277    {
2278        #[inline(always)]
2279        fn new_empty() -> Self {
2280            Self {
2281                log_listener: fidl::new_empty!(
2282                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<LogListenerSafeMarker>>,
2283                    fidl::encoding::DefaultFuchsiaResourceDialect
2284                ),
2285                options: fidl::new_empty!(
2286                    fidl::encoding::Boxed<LogFilterOptions>,
2287                    fidl::encoding::DefaultFuchsiaResourceDialect
2288                ),
2289                selectors: fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_diagnostics::LogInterestSelector, 64>, fidl::encoding::DefaultFuchsiaResourceDialect),
2290            }
2291        }
2292
2293        #[inline]
2294        unsafe fn decode(
2295            &mut self,
2296            decoder: &mut fidl::encoding::Decoder<
2297                '_,
2298                fidl::encoding::DefaultFuchsiaResourceDialect,
2299            >,
2300            offset: usize,
2301            _depth: fidl::encoding::Depth,
2302        ) -> fidl::Result<()> {
2303            decoder.debug_check_bounds::<Self>(offset);
2304            // Verify that padding bytes are zero.
2305            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
2306            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2307            let mask = 0xffffffff00000000u64;
2308            let maskedval = padval & mask;
2309            if maskedval != 0 {
2310                return Err(fidl::Error::NonZeroPadding {
2311                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
2312                });
2313            }
2314            fidl::decode!(
2315                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<LogListenerSafeMarker>>,
2316                fidl::encoding::DefaultFuchsiaResourceDialect,
2317                &mut self.log_listener,
2318                decoder,
2319                offset + 0,
2320                _depth
2321            )?;
2322            fidl::decode!(
2323                fidl::encoding::Boxed<LogFilterOptions>,
2324                fidl::encoding::DefaultFuchsiaResourceDialect,
2325                &mut self.options,
2326                decoder,
2327                offset + 8,
2328                _depth
2329            )?;
2330            fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_diagnostics::LogInterestSelector, 64>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.selectors, decoder, offset + 16, _depth)?;
2331            Ok(())
2332        }
2333    }
2334
2335    impl fidl::encoding::ResourceTypeMarker for LogSinkConnectRequest {
2336        type Borrowed<'a> = &'a mut Self;
2337        fn take_or_borrow<'a>(
2338            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2339        ) -> Self::Borrowed<'a> {
2340            value
2341        }
2342    }
2343
2344    unsafe impl fidl::encoding::TypeMarker for LogSinkConnectRequest {
2345        type Owned = Self;
2346
2347        #[inline(always)]
2348        fn inline_align(_context: fidl::encoding::Context) -> usize {
2349            4
2350        }
2351
2352        #[inline(always)]
2353        fn inline_size(_context: fidl::encoding::Context) -> usize {
2354            4
2355        }
2356    }
2357
2358    unsafe impl
2359        fidl::encoding::Encode<LogSinkConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
2360        for &mut LogSinkConnectRequest
2361    {
2362        #[inline]
2363        unsafe fn encode(
2364            self,
2365            encoder: &mut fidl::encoding::Encoder<
2366                '_,
2367                fidl::encoding::DefaultFuchsiaResourceDialect,
2368            >,
2369            offset: usize,
2370            _depth: fidl::encoding::Depth,
2371        ) -> fidl::Result<()> {
2372            encoder.debug_check_bounds::<LogSinkConnectRequest>(offset);
2373            // Delegate to tuple encoding.
2374            fidl::encoding::Encode::<
2375                LogSinkConnectRequest,
2376                fidl::encoding::DefaultFuchsiaResourceDialect,
2377            >::encode(
2378                (<fidl::encoding::HandleType<
2379                    fidl::Socket,
2380                    { fidl::ObjectType::SOCKET.into_raw() },
2381                    2147483648,
2382                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2383                    &mut self.socket
2384                ),),
2385                encoder,
2386                offset,
2387                _depth,
2388            )
2389        }
2390    }
2391    unsafe impl<
2392            T0: fidl::encoding::Encode<
2393                fidl::encoding::HandleType<
2394                    fidl::Socket,
2395                    { fidl::ObjectType::SOCKET.into_raw() },
2396                    2147483648,
2397                >,
2398                fidl::encoding::DefaultFuchsiaResourceDialect,
2399            >,
2400        >
2401        fidl::encoding::Encode<LogSinkConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
2402        for (T0,)
2403    {
2404        #[inline]
2405        unsafe fn encode(
2406            self,
2407            encoder: &mut fidl::encoding::Encoder<
2408                '_,
2409                fidl::encoding::DefaultFuchsiaResourceDialect,
2410            >,
2411            offset: usize,
2412            depth: fidl::encoding::Depth,
2413        ) -> fidl::Result<()> {
2414            encoder.debug_check_bounds::<LogSinkConnectRequest>(offset);
2415            // Zero out padding regions. There's no need to apply masks
2416            // because the unmasked parts will be overwritten by fields.
2417            // Write the fields.
2418            self.0.encode(encoder, offset + 0, depth)?;
2419            Ok(())
2420        }
2421    }
2422
2423    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2424        for LogSinkConnectRequest
2425    {
2426        #[inline(always)]
2427        fn new_empty() -> Self {
2428            Self {
2429                socket: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
2430            }
2431        }
2432
2433        #[inline]
2434        unsafe fn decode(
2435            &mut self,
2436            decoder: &mut fidl::encoding::Decoder<
2437                '_,
2438                fidl::encoding::DefaultFuchsiaResourceDialect,
2439            >,
2440            offset: usize,
2441            _depth: fidl::encoding::Depth,
2442        ) -> fidl::Result<()> {
2443            decoder.debug_check_bounds::<Self>(offset);
2444            // Verify that padding bytes are zero.
2445            fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.socket, decoder, offset + 0, _depth)?;
2446            Ok(())
2447        }
2448    }
2449
2450    impl fidl::encoding::ResourceTypeMarker for LogSinkConnectStructuredRequest {
2451        type Borrowed<'a> = &'a mut Self;
2452        fn take_or_borrow<'a>(
2453            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2454        ) -> Self::Borrowed<'a> {
2455            value
2456        }
2457    }
2458
2459    unsafe impl fidl::encoding::TypeMarker for LogSinkConnectStructuredRequest {
2460        type Owned = Self;
2461
2462        #[inline(always)]
2463        fn inline_align(_context: fidl::encoding::Context) -> usize {
2464            4
2465        }
2466
2467        #[inline(always)]
2468        fn inline_size(_context: fidl::encoding::Context) -> usize {
2469            4
2470        }
2471    }
2472
2473    unsafe impl
2474        fidl::encoding::Encode<
2475            LogSinkConnectStructuredRequest,
2476            fidl::encoding::DefaultFuchsiaResourceDialect,
2477        > for &mut LogSinkConnectStructuredRequest
2478    {
2479        #[inline]
2480        unsafe fn encode(
2481            self,
2482            encoder: &mut fidl::encoding::Encoder<
2483                '_,
2484                fidl::encoding::DefaultFuchsiaResourceDialect,
2485            >,
2486            offset: usize,
2487            _depth: fidl::encoding::Depth,
2488        ) -> fidl::Result<()> {
2489            encoder.debug_check_bounds::<LogSinkConnectStructuredRequest>(offset);
2490            // Delegate to tuple encoding.
2491            fidl::encoding::Encode::<
2492                LogSinkConnectStructuredRequest,
2493                fidl::encoding::DefaultFuchsiaResourceDialect,
2494            >::encode(
2495                (<fidl::encoding::HandleType<
2496                    fidl::Socket,
2497                    { fidl::ObjectType::SOCKET.into_raw() },
2498                    2147483648,
2499                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2500                    &mut self.socket
2501                ),),
2502                encoder,
2503                offset,
2504                _depth,
2505            )
2506        }
2507    }
2508    unsafe impl<
2509            T0: fidl::encoding::Encode<
2510                fidl::encoding::HandleType<
2511                    fidl::Socket,
2512                    { fidl::ObjectType::SOCKET.into_raw() },
2513                    2147483648,
2514                >,
2515                fidl::encoding::DefaultFuchsiaResourceDialect,
2516            >,
2517        >
2518        fidl::encoding::Encode<
2519            LogSinkConnectStructuredRequest,
2520            fidl::encoding::DefaultFuchsiaResourceDialect,
2521        > for (T0,)
2522    {
2523        #[inline]
2524        unsafe fn encode(
2525            self,
2526            encoder: &mut fidl::encoding::Encoder<
2527                '_,
2528                fidl::encoding::DefaultFuchsiaResourceDialect,
2529            >,
2530            offset: usize,
2531            depth: fidl::encoding::Depth,
2532        ) -> fidl::Result<()> {
2533            encoder.debug_check_bounds::<LogSinkConnectStructuredRequest>(offset);
2534            // Zero out padding regions. There's no need to apply masks
2535            // because the unmasked parts will be overwritten by fields.
2536            // Write the fields.
2537            self.0.encode(encoder, offset + 0, depth)?;
2538            Ok(())
2539        }
2540    }
2541
2542    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2543        for LogSinkConnectStructuredRequest
2544    {
2545        #[inline(always)]
2546        fn new_empty() -> Self {
2547            Self {
2548                socket: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
2549            }
2550        }
2551
2552        #[inline]
2553        unsafe fn decode(
2554            &mut self,
2555            decoder: &mut fidl::encoding::Decoder<
2556                '_,
2557                fidl::encoding::DefaultFuchsiaResourceDialect,
2558            >,
2559            offset: usize,
2560            _depth: fidl::encoding::Depth,
2561        ) -> fidl::Result<()> {
2562            decoder.debug_check_bounds::<Self>(offset);
2563            // Verify that padding bytes are zero.
2564            fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.socket, decoder, offset + 0, _depth)?;
2565            Ok(())
2566        }
2567    }
2568}