fidl_fuchsia_logger__common/
fidl_fuchsia_logger__common.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::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11/// Default log level used to initialize loggers.
12pub const LOG_LEVEL_DEFAULT: LogLevelFilter = LogLevelFilter::Info;
13
14/// Maximum available log severity.
15pub const LOG_SEVERITY_MAX_STEP: u8 = 6;
16
17/// The interval between discrete log severity levels
18pub const LOG_SEVERITY_STEP_SIZE: u8 = 16;
19
20/// The interval between discrete log verbosity levels
21pub const LOG_VERBOSITY_STEP_SIZE: u8 = 1;
22
23/// Max byte size for message payload.
24pub const MAX_DATAGRAM_LEN_BYTES: u32 = 32768;
25
26/// Max log bytes per call to a listener.
27pub const MAX_LOG_MANY_SIZE_BYTES: u64 = 16384;
28
29/// Max number of tags that can be passed to filter by listener.
30pub const MAX_TAGS: u8 = 16;
31
32/// Max tags that will be attached to a LogMessage.
33pub const MAX_TAGS_PER_LOG_MESSAGE: u8 = 5;
34
35/// Max tag length that can be passed to filter by listener.
36pub const MAX_TAG_LEN_BYTES: u8 = 63;
37
38#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
39#[repr(u32)]
40pub enum InterestChangeError {
41    /// Incorrectly called WaitForInterestChange twice
42    /// without waiting for the first call to return.
43    CalledTwice = 1,
44}
45
46impl InterestChangeError {
47    #[inline]
48    pub fn from_primitive(prim: u32) -> Option<Self> {
49        match prim {
50            1 => Some(Self::CalledTwice),
51            _ => None,
52        }
53    }
54
55    #[inline]
56    pub const fn into_primitive(self) -> u32 {
57        self as u32
58    }
59}
60
61/// Log levels used with log related filtering.
62/// Filtering uses a heuristic based on a threshold of
63/// minimum severity level - with any log equal to or
64/// greater than the threshold being included in the
65/// printable logs.
66#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
67#[repr(i8)]
68pub enum LogLevelFilter {
69    Trace = 16,
70    Debug = 32,
71    Info = 48,
72    Warn = 64,
73    Error = 80,
74    Fatal = 96,
75    None = 127,
76}
77
78impl LogLevelFilter {
79    #[inline]
80    pub fn from_primitive(prim: i8) -> Option<Self> {
81        match prim {
82            16 => Some(Self::Trace),
83            32 => Some(Self::Debug),
84            48 => Some(Self::Info),
85            64 => Some(Self::Warn),
86            80 => Some(Self::Error),
87            96 => Some(Self::Fatal),
88            127 => Some(Self::None),
89            _ => None,
90        }
91    }
92
93    #[inline]
94    pub const fn into_primitive(self) -> i8 {
95        self as i8
96    }
97}
98
99#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
100pub struct LogFilterOptions {
101    pub filter_by_pid: bool,
102    pub pid: u64,
103    pub filter_by_tid: bool,
104    pub tid: u64,
105    /// If more than zero, logs would be filtered based on verbosity and
106    /// `min_severity` would be ignored.
107    pub verbosity: u8,
108    /// Severity used as threshold to determine logging level.
109    pub min_severity: LogLevelFilter,
110    /// If non-empty, return all messages which contain at least one specified
111    /// tag.  If empty, messages will not be filtered by tag.
112    /// Passed tags should not be more than `MAX_TAG_LEN_BYTES` bytes in length
113    /// and max tags can be `MAX_TAGS`.
114    /// Listener would be discarded if the limit is not followed.
115    pub tags: Vec<String>,
116}
117
118impl fidl::Persistable for LogFilterOptions {}
119
120#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
121pub struct LogListenerSafeLogManyRequest {
122    pub log: Vec<LogMessage>,
123}
124
125impl fidl::Persistable for LogListenerSafeLogManyRequest {}
126
127#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
128pub struct LogListenerSafeLogRequest {
129    pub log: LogMessage,
130}
131
132impl fidl::Persistable for LogListenerSafeLogRequest {}
133
134#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
135pub struct LogMessage {
136    pub pid: u64,
137    pub tid: u64,
138    /// [zx_clock_get_boot](https://fuchsia.dev/fuchsia-src/reference/syscalls/clock_get_boot.md)
139    pub time: fidl::BootInstant,
140    pub severity: i32,
141    /// See [wire_format.h](https://cs.opensource.google/fuchsia/fuchsia/+/main:zircon/system/ulib/syslog/include/lib/syslog/wire_format.h).
142    /// As messages can be served out of order, this should only be logged if more than
143    /// last count.
144    pub dropped_logs: u32,
145    pub tags: Vec<String>,
146    pub msg: String,
147}
148
149impl fidl::Persistable for LogMessage {}
150
151#[derive(Clone, Debug, PartialEq)]
152pub struct LogSinkWaitForInterestChangeResponse {
153    pub data: fidl_fuchsia_diagnostics_types__common::Interest,
154}
155
156impl fidl::Persistable for LogSinkWaitForInterestChangeResponse {}
157
158pub mod log_ordinals {
159    pub const LISTEN_SAFE: u64 = 0x4e523b04952a61b1;
160    pub const DUMP_LOGS_SAFE: u64 = 0x14e39f9cada72519;
161    pub const LISTEN_SAFE_WITH_SELECTORS: u64 = 0x1b365178771a007e;
162}
163
164pub mod log_listener_safe_ordinals {
165    pub const LOG: u64 = 0x51a39de355d5bd0a;
166    pub const LOG_MANY: u64 = 0x1f056431bcd626a;
167    pub const DONE: u64 = 0x34986151fcb584b8;
168}
169
170pub mod log_sink_ordinals {
171    pub const ON_INIT: u64 = 0x61e0ad0e16df6aba;
172    pub const WAIT_FOR_INTEREST_CHANGE: u64 = 0x1dad20560c197242;
173    pub const CONNECT_STRUCTURED: u64 = 0x635424b504b2a74c;
174}
175
176mod internal {
177    use super::*;
178    unsafe impl fidl::encoding::TypeMarker for InterestChangeError {
179        type Owned = Self;
180
181        #[inline(always)]
182        fn inline_align(_context: fidl::encoding::Context) -> usize {
183            std::mem::align_of::<u32>()
184        }
185
186        #[inline(always)]
187        fn inline_size(_context: fidl::encoding::Context) -> usize {
188            std::mem::size_of::<u32>()
189        }
190
191        #[inline(always)]
192        fn encode_is_copy() -> bool {
193            true
194        }
195
196        #[inline(always)]
197        fn decode_is_copy() -> bool {
198            false
199        }
200    }
201
202    impl fidl::encoding::ValueTypeMarker for InterestChangeError {
203        type Borrowed<'a> = Self;
204        #[inline(always)]
205        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
206            *value
207        }
208    }
209
210    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
211        for InterestChangeError
212    {
213        #[inline]
214        unsafe fn encode(
215            self,
216            encoder: &mut fidl::encoding::Encoder<'_, D>,
217            offset: usize,
218            _depth: fidl::encoding::Depth,
219        ) -> fidl::Result<()> {
220            encoder.debug_check_bounds::<Self>(offset);
221            encoder.write_num(self.into_primitive(), offset);
222            Ok(())
223        }
224    }
225
226    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InterestChangeError {
227        #[inline(always)]
228        fn new_empty() -> Self {
229            Self::CalledTwice
230        }
231
232        #[inline]
233        unsafe fn decode(
234            &mut self,
235            decoder: &mut fidl::encoding::Decoder<'_, D>,
236            offset: usize,
237            _depth: fidl::encoding::Depth,
238        ) -> fidl::Result<()> {
239            decoder.debug_check_bounds::<Self>(offset);
240            let prim = decoder.read_num::<u32>(offset);
241
242            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
243            Ok(())
244        }
245    }
246    unsafe impl fidl::encoding::TypeMarker for LogLevelFilter {
247        type Owned = Self;
248
249        #[inline(always)]
250        fn inline_align(_context: fidl::encoding::Context) -> usize {
251            std::mem::align_of::<i8>()
252        }
253
254        #[inline(always)]
255        fn inline_size(_context: fidl::encoding::Context) -> usize {
256            std::mem::size_of::<i8>()
257        }
258
259        #[inline(always)]
260        fn encode_is_copy() -> bool {
261            true
262        }
263
264        #[inline(always)]
265        fn decode_is_copy() -> bool {
266            false
267        }
268    }
269
270    impl fidl::encoding::ValueTypeMarker for LogLevelFilter {
271        type Borrowed<'a> = Self;
272        #[inline(always)]
273        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
274            *value
275        }
276    }
277
278    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for LogLevelFilter {
279        #[inline]
280        unsafe fn encode(
281            self,
282            encoder: &mut fidl::encoding::Encoder<'_, D>,
283            offset: usize,
284            _depth: fidl::encoding::Depth,
285        ) -> fidl::Result<()> {
286            encoder.debug_check_bounds::<Self>(offset);
287            encoder.write_num(self.into_primitive(), offset);
288            Ok(())
289        }
290    }
291
292    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LogLevelFilter {
293        #[inline(always)]
294        fn new_empty() -> Self {
295            Self::Trace
296        }
297
298        #[inline]
299        unsafe fn decode(
300            &mut self,
301            decoder: &mut fidl::encoding::Decoder<'_, D>,
302            offset: usize,
303            _depth: fidl::encoding::Depth,
304        ) -> fidl::Result<()> {
305            decoder.debug_check_bounds::<Self>(offset);
306            let prim = decoder.read_num::<i8>(offset);
307
308            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
309            Ok(())
310        }
311    }
312
313    impl fidl::encoding::ValueTypeMarker for LogFilterOptions {
314        type Borrowed<'a> = &'a Self;
315        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
316            value
317        }
318    }
319
320    unsafe impl fidl::encoding::TypeMarker for LogFilterOptions {
321        type Owned = Self;
322
323        #[inline(always)]
324        fn inline_align(_context: fidl::encoding::Context) -> usize {
325            8
326        }
327
328        #[inline(always)]
329        fn inline_size(_context: fidl::encoding::Context) -> usize {
330            56
331        }
332    }
333
334    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<LogFilterOptions, D>
335        for &LogFilterOptions
336    {
337        #[inline]
338        unsafe fn encode(
339            self,
340            encoder: &mut fidl::encoding::Encoder<'_, D>,
341            offset: usize,
342            _depth: fidl::encoding::Depth,
343        ) -> fidl::Result<()> {
344            encoder.debug_check_bounds::<LogFilterOptions>(offset);
345            // Delegate to tuple encoding.
346            fidl::encoding::Encode::<LogFilterOptions, D>::encode(
347                (
348                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.filter_by_pid),
349                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.pid),
350                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.filter_by_tid),
351                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.tid),
352                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.verbosity),
353                    <LogLevelFilter as fidl::encoding::ValueTypeMarker>::borrow(&self.min_severity),
354                    <fidl::encoding::Vector<fidl::encoding::BoundedString<63>, 16> as fidl::encoding::ValueTypeMarker>::borrow(&self.tags),
355                ),
356                encoder, offset, _depth
357            )
358        }
359    }
360    unsafe impl<
361        D: fidl::encoding::ResourceDialect,
362        T0: fidl::encoding::Encode<bool, D>,
363        T1: fidl::encoding::Encode<u64, D>,
364        T2: fidl::encoding::Encode<bool, D>,
365        T3: fidl::encoding::Encode<u64, D>,
366        T4: fidl::encoding::Encode<u8, D>,
367        T5: fidl::encoding::Encode<LogLevelFilter, D>,
368        T6: fidl::encoding::Encode<fidl::encoding::Vector<fidl::encoding::BoundedString<63>, 16>, D>,
369    > fidl::encoding::Encode<LogFilterOptions, D> for (T0, T1, T2, T3, T4, T5, T6)
370    {
371        #[inline]
372        unsafe fn encode(
373            self,
374            encoder: &mut fidl::encoding::Encoder<'_, D>,
375            offset: usize,
376            depth: fidl::encoding::Depth,
377        ) -> fidl::Result<()> {
378            encoder.debug_check_bounds::<LogFilterOptions>(offset);
379            // Zero out padding regions. There's no need to apply masks
380            // because the unmasked parts will be overwritten by fields.
381            unsafe {
382                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
383                (ptr as *mut u64).write_unaligned(0);
384            }
385            unsafe {
386                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
387                (ptr as *mut u64).write_unaligned(0);
388            }
389            unsafe {
390                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
391                (ptr as *mut u64).write_unaligned(0);
392            }
393            // Write the fields.
394            self.0.encode(encoder, offset + 0, depth)?;
395            self.1.encode(encoder, offset + 8, depth)?;
396            self.2.encode(encoder, offset + 16, depth)?;
397            self.3.encode(encoder, offset + 24, depth)?;
398            self.4.encode(encoder, offset + 32, depth)?;
399            self.5.encode(encoder, offset + 33, depth)?;
400            self.6.encode(encoder, offset + 40, depth)?;
401            Ok(())
402        }
403    }
404
405    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LogFilterOptions {
406        #[inline(always)]
407        fn new_empty() -> Self {
408            Self {
409                filter_by_pid: fidl::new_empty!(bool, D),
410                pid: fidl::new_empty!(u64, D),
411                filter_by_tid: fidl::new_empty!(bool, D),
412                tid: fidl::new_empty!(u64, D),
413                verbosity: fidl::new_empty!(u8, D),
414                min_severity: fidl::new_empty!(LogLevelFilter, D),
415                tags: fidl::new_empty!(
416                    fidl::encoding::Vector<fidl::encoding::BoundedString<63>, 16>,
417                    D
418                ),
419            }
420        }
421
422        #[inline]
423        unsafe fn decode(
424            &mut self,
425            decoder: &mut fidl::encoding::Decoder<'_, D>,
426            offset: usize,
427            _depth: fidl::encoding::Depth,
428        ) -> fidl::Result<()> {
429            decoder.debug_check_bounds::<Self>(offset);
430            // Verify that padding bytes are zero.
431            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
432            let padval = unsafe { (ptr as *const u64).read_unaligned() };
433            let mask = 0xffffffffffffff00u64;
434            let maskedval = padval & mask;
435            if maskedval != 0 {
436                return Err(fidl::Error::NonZeroPadding {
437                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
438                });
439            }
440            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
441            let padval = unsafe { (ptr as *const u64).read_unaligned() };
442            let mask = 0xffffffffffffff00u64;
443            let maskedval = padval & mask;
444            if maskedval != 0 {
445                return Err(fidl::Error::NonZeroPadding {
446                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
447                });
448            }
449            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
450            let padval = unsafe { (ptr as *const u64).read_unaligned() };
451            let mask = 0xffffffffffff0000u64;
452            let maskedval = padval & mask;
453            if maskedval != 0 {
454                return Err(fidl::Error::NonZeroPadding {
455                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
456                });
457            }
458            fidl::decode!(bool, D, &mut self.filter_by_pid, decoder, offset + 0, _depth)?;
459            fidl::decode!(u64, D, &mut self.pid, decoder, offset + 8, _depth)?;
460            fidl::decode!(bool, D, &mut self.filter_by_tid, decoder, offset + 16, _depth)?;
461            fidl::decode!(u64, D, &mut self.tid, decoder, offset + 24, _depth)?;
462            fidl::decode!(u8, D, &mut self.verbosity, decoder, offset + 32, _depth)?;
463            fidl::decode!(LogLevelFilter, D, &mut self.min_severity, decoder, offset + 33, _depth)?;
464            fidl::decode!(
465                fidl::encoding::Vector<fidl::encoding::BoundedString<63>, 16>,
466                D,
467                &mut self.tags,
468                decoder,
469                offset + 40,
470                _depth
471            )?;
472            Ok(())
473        }
474    }
475
476    impl fidl::encoding::ValueTypeMarker for LogListenerSafeLogManyRequest {
477        type Borrowed<'a> = &'a Self;
478        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
479            value
480        }
481    }
482
483    unsafe impl fidl::encoding::TypeMarker for LogListenerSafeLogManyRequest {
484        type Owned = Self;
485
486        #[inline(always)]
487        fn inline_align(_context: fidl::encoding::Context) -> usize {
488            8
489        }
490
491        #[inline(always)]
492        fn inline_size(_context: fidl::encoding::Context) -> usize {
493            16
494        }
495    }
496
497    unsafe impl<D: fidl::encoding::ResourceDialect>
498        fidl::encoding::Encode<LogListenerSafeLogManyRequest, D>
499        for &LogListenerSafeLogManyRequest
500    {
501        #[inline]
502        unsafe fn encode(
503            self,
504            encoder: &mut fidl::encoding::Encoder<'_, D>,
505            offset: usize,
506            _depth: fidl::encoding::Depth,
507        ) -> fidl::Result<()> {
508            encoder.debug_check_bounds::<LogListenerSafeLogManyRequest>(offset);
509            // Delegate to tuple encoding.
510            fidl::encoding::Encode::<LogListenerSafeLogManyRequest, D>::encode(
511                (
512                    <fidl::encoding::UnboundedVector<LogMessage> as fidl::encoding::ValueTypeMarker>::borrow(&self.log),
513                ),
514                encoder, offset, _depth
515            )
516        }
517    }
518    unsafe impl<
519        D: fidl::encoding::ResourceDialect,
520        T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<LogMessage>, D>,
521    > fidl::encoding::Encode<LogListenerSafeLogManyRequest, D> for (T0,)
522    {
523        #[inline]
524        unsafe fn encode(
525            self,
526            encoder: &mut fidl::encoding::Encoder<'_, D>,
527            offset: usize,
528            depth: fidl::encoding::Depth,
529        ) -> fidl::Result<()> {
530            encoder.debug_check_bounds::<LogListenerSafeLogManyRequest>(offset);
531            // Zero out padding regions. There's no need to apply masks
532            // because the unmasked parts will be overwritten by fields.
533            // Write the fields.
534            self.0.encode(encoder, offset + 0, depth)?;
535            Ok(())
536        }
537    }
538
539    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
540        for LogListenerSafeLogManyRequest
541    {
542        #[inline(always)]
543        fn new_empty() -> Self {
544            Self { log: fidl::new_empty!(fidl::encoding::UnboundedVector<LogMessage>, D) }
545        }
546
547        #[inline]
548        unsafe fn decode(
549            &mut self,
550            decoder: &mut fidl::encoding::Decoder<'_, D>,
551            offset: usize,
552            _depth: fidl::encoding::Depth,
553        ) -> fidl::Result<()> {
554            decoder.debug_check_bounds::<Self>(offset);
555            // Verify that padding bytes are zero.
556            fidl::decode!(
557                fidl::encoding::UnboundedVector<LogMessage>,
558                D,
559                &mut self.log,
560                decoder,
561                offset + 0,
562                _depth
563            )?;
564            Ok(())
565        }
566    }
567
568    impl fidl::encoding::ValueTypeMarker for LogListenerSafeLogRequest {
569        type Borrowed<'a> = &'a Self;
570        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
571            value
572        }
573    }
574
575    unsafe impl fidl::encoding::TypeMarker for LogListenerSafeLogRequest {
576        type Owned = Self;
577
578        #[inline(always)]
579        fn inline_align(_context: fidl::encoding::Context) -> usize {
580            8
581        }
582
583        #[inline(always)]
584        fn inline_size(_context: fidl::encoding::Context) -> usize {
585            64
586        }
587    }
588
589    unsafe impl<D: fidl::encoding::ResourceDialect>
590        fidl::encoding::Encode<LogListenerSafeLogRequest, D> for &LogListenerSafeLogRequest
591    {
592        #[inline]
593        unsafe fn encode(
594            self,
595            encoder: &mut fidl::encoding::Encoder<'_, D>,
596            offset: usize,
597            _depth: fidl::encoding::Depth,
598        ) -> fidl::Result<()> {
599            encoder.debug_check_bounds::<LogListenerSafeLogRequest>(offset);
600            // Delegate to tuple encoding.
601            fidl::encoding::Encode::<LogListenerSafeLogRequest, D>::encode(
602                (<LogMessage as fidl::encoding::ValueTypeMarker>::borrow(&self.log),),
603                encoder,
604                offset,
605                _depth,
606            )
607        }
608    }
609    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<LogMessage, D>>
610        fidl::encoding::Encode<LogListenerSafeLogRequest, D> for (T0,)
611    {
612        #[inline]
613        unsafe fn encode(
614            self,
615            encoder: &mut fidl::encoding::Encoder<'_, D>,
616            offset: usize,
617            depth: fidl::encoding::Depth,
618        ) -> fidl::Result<()> {
619            encoder.debug_check_bounds::<LogListenerSafeLogRequest>(offset);
620            // Zero out padding regions. There's no need to apply masks
621            // because the unmasked parts will be overwritten by fields.
622            // Write the fields.
623            self.0.encode(encoder, offset + 0, depth)?;
624            Ok(())
625        }
626    }
627
628    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
629        for LogListenerSafeLogRequest
630    {
631        #[inline(always)]
632        fn new_empty() -> Self {
633            Self { log: fidl::new_empty!(LogMessage, D) }
634        }
635
636        #[inline]
637        unsafe fn decode(
638            &mut self,
639            decoder: &mut fidl::encoding::Decoder<'_, D>,
640            offset: usize,
641            _depth: fidl::encoding::Depth,
642        ) -> fidl::Result<()> {
643            decoder.debug_check_bounds::<Self>(offset);
644            // Verify that padding bytes are zero.
645            fidl::decode!(LogMessage, D, &mut self.log, decoder, offset + 0, _depth)?;
646            Ok(())
647        }
648    }
649
650    impl fidl::encoding::ValueTypeMarker for LogMessage {
651        type Borrowed<'a> = &'a Self;
652        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
653            value
654        }
655    }
656
657    unsafe impl fidl::encoding::TypeMarker for LogMessage {
658        type Owned = Self;
659
660        #[inline(always)]
661        fn inline_align(_context: fidl::encoding::Context) -> usize {
662            8
663        }
664
665        #[inline(always)]
666        fn inline_size(_context: fidl::encoding::Context) -> usize {
667            64
668        }
669    }
670
671    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<LogMessage, D>
672        for &LogMessage
673    {
674        #[inline]
675        unsafe fn encode(
676            self,
677            encoder: &mut fidl::encoding::Encoder<'_, D>,
678            offset: usize,
679            _depth: fidl::encoding::Depth,
680        ) -> fidl::Result<()> {
681            encoder.debug_check_bounds::<LogMessage>(offset);
682            // Delegate to tuple encoding.
683            fidl::encoding::Encode::<LogMessage, D>::encode(
684                (
685                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.pid),
686                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.tid),
687                    <fidl::BootInstant as fidl::encoding::ValueTypeMarker>::borrow(&self.time),
688                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.severity),
689                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.dropped_logs),
690                    <fidl::encoding::Vector<fidl::encoding::BoundedString<63>, 5> as fidl::encoding::ValueTypeMarker>::borrow(&self.tags),
691                    <fidl::encoding::BoundedString<32768> as fidl::encoding::ValueTypeMarker>::borrow(&self.msg),
692                ),
693                encoder, offset, _depth
694            )
695        }
696    }
697    unsafe impl<
698        D: fidl::encoding::ResourceDialect,
699        T0: fidl::encoding::Encode<u64, D>,
700        T1: fidl::encoding::Encode<u64, D>,
701        T2: fidl::encoding::Encode<fidl::BootInstant, D>,
702        T3: fidl::encoding::Encode<i32, D>,
703        T4: fidl::encoding::Encode<u32, D>,
704        T5: fidl::encoding::Encode<fidl::encoding::Vector<fidl::encoding::BoundedString<63>, 5>, D>,
705        T6: fidl::encoding::Encode<fidl::encoding::BoundedString<32768>, D>,
706    > fidl::encoding::Encode<LogMessage, D> for (T0, T1, T2, T3, T4, T5, T6)
707    {
708        #[inline]
709        unsafe fn encode(
710            self,
711            encoder: &mut fidl::encoding::Encoder<'_, D>,
712            offset: usize,
713            depth: fidl::encoding::Depth,
714        ) -> fidl::Result<()> {
715            encoder.debug_check_bounds::<LogMessage>(offset);
716            // Zero out padding regions. There's no need to apply masks
717            // because the unmasked parts will be overwritten by fields.
718            // Write the fields.
719            self.0.encode(encoder, offset + 0, depth)?;
720            self.1.encode(encoder, offset + 8, depth)?;
721            self.2.encode(encoder, offset + 16, depth)?;
722            self.3.encode(encoder, offset + 24, depth)?;
723            self.4.encode(encoder, offset + 28, depth)?;
724            self.5.encode(encoder, offset + 32, depth)?;
725            self.6.encode(encoder, offset + 48, depth)?;
726            Ok(())
727        }
728    }
729
730    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LogMessage {
731        #[inline(always)]
732        fn new_empty() -> Self {
733            Self {
734                pid: fidl::new_empty!(u64, D),
735                tid: fidl::new_empty!(u64, D),
736                time: fidl::new_empty!(fidl::BootInstant, D),
737                severity: fidl::new_empty!(i32, D),
738                dropped_logs: fidl::new_empty!(u32, D),
739                tags: fidl::new_empty!(
740                    fidl::encoding::Vector<fidl::encoding::BoundedString<63>, 5>,
741                    D
742                ),
743                msg: fidl::new_empty!(fidl::encoding::BoundedString<32768>, D),
744            }
745        }
746
747        #[inline]
748        unsafe fn decode(
749            &mut self,
750            decoder: &mut fidl::encoding::Decoder<'_, D>,
751            offset: usize,
752            _depth: fidl::encoding::Depth,
753        ) -> fidl::Result<()> {
754            decoder.debug_check_bounds::<Self>(offset);
755            // Verify that padding bytes are zero.
756            fidl::decode!(u64, D, &mut self.pid, decoder, offset + 0, _depth)?;
757            fidl::decode!(u64, D, &mut self.tid, decoder, offset + 8, _depth)?;
758            fidl::decode!(fidl::BootInstant, D, &mut self.time, decoder, offset + 16, _depth)?;
759            fidl::decode!(i32, D, &mut self.severity, decoder, offset + 24, _depth)?;
760            fidl::decode!(u32, D, &mut self.dropped_logs, decoder, offset + 28, _depth)?;
761            fidl::decode!(
762                fidl::encoding::Vector<fidl::encoding::BoundedString<63>, 5>,
763                D,
764                &mut self.tags,
765                decoder,
766                offset + 32,
767                _depth
768            )?;
769            fidl::decode!(
770                fidl::encoding::BoundedString<32768>,
771                D,
772                &mut self.msg,
773                decoder,
774                offset + 48,
775                _depth
776            )?;
777            Ok(())
778        }
779    }
780
781    impl fidl::encoding::ValueTypeMarker for LogSinkWaitForInterestChangeResponse {
782        type Borrowed<'a> = &'a Self;
783        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
784            value
785        }
786    }
787
788    unsafe impl fidl::encoding::TypeMarker for LogSinkWaitForInterestChangeResponse {
789        type Owned = Self;
790
791        #[inline(always)]
792        fn inline_align(_context: fidl::encoding::Context) -> usize {
793            8
794        }
795
796        #[inline(always)]
797        fn inline_size(_context: fidl::encoding::Context) -> usize {
798            16
799        }
800    }
801
802    unsafe impl<D: fidl::encoding::ResourceDialect>
803        fidl::encoding::Encode<LogSinkWaitForInterestChangeResponse, D>
804        for &LogSinkWaitForInterestChangeResponse
805    {
806        #[inline]
807        unsafe fn encode(
808            self,
809            encoder: &mut fidl::encoding::Encoder<'_, D>,
810            offset: usize,
811            _depth: fidl::encoding::Depth,
812        ) -> fidl::Result<()> {
813            encoder.debug_check_bounds::<LogSinkWaitForInterestChangeResponse>(offset);
814            // Delegate to tuple encoding.
815            fidl::encoding::Encode::<LogSinkWaitForInterestChangeResponse, D>::encode(
816                (
817                    <fidl_fuchsia_diagnostics_types__common::Interest as fidl::encoding::ValueTypeMarker>::borrow(&self.data),
818                ),
819                encoder, offset, _depth
820            )
821        }
822    }
823    unsafe impl<
824        D: fidl::encoding::ResourceDialect,
825        T0: fidl::encoding::Encode<fidl_fuchsia_diagnostics_types__common::Interest, D>,
826    > fidl::encoding::Encode<LogSinkWaitForInterestChangeResponse, D> for (T0,)
827    {
828        #[inline]
829        unsafe fn encode(
830            self,
831            encoder: &mut fidl::encoding::Encoder<'_, D>,
832            offset: usize,
833            depth: fidl::encoding::Depth,
834        ) -> fidl::Result<()> {
835            encoder.debug_check_bounds::<LogSinkWaitForInterestChangeResponse>(offset);
836            // Zero out padding regions. There's no need to apply masks
837            // because the unmasked parts will be overwritten by fields.
838            // Write the fields.
839            self.0.encode(encoder, offset + 0, depth)?;
840            Ok(())
841        }
842    }
843
844    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
845        for LogSinkWaitForInterestChangeResponse
846    {
847        #[inline(always)]
848        fn new_empty() -> Self {
849            Self { data: fidl::new_empty!(fidl_fuchsia_diagnostics_types__common::Interest, D) }
850        }
851
852        #[inline]
853        unsafe fn decode(
854            &mut self,
855            decoder: &mut fidl::encoding::Decoder<'_, D>,
856            offset: usize,
857            _depth: fidl::encoding::Depth,
858        ) -> fidl::Result<()> {
859            decoder.debug_check_bounds::<Self>(offset);
860            // Verify that padding bytes are zero.
861            fidl::decode!(
862                fidl_fuchsia_diagnostics_types__common::Interest,
863                D,
864                &mut self.data,
865                decoder,
866                offset + 0,
867                _depth
868            )?;
869            Ok(())
870        }
871    }
872}