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 CONNECT: u64 = 0x64cc4b58ae95c61b;
173    pub const WAIT_FOR_INTEREST_CHANGE: u64 = 0x1dad20560c197242;
174    pub const CONNECT_STRUCTURED: u64 = 0x635424b504b2a74c;
175}
176
177mod internal {
178    use super::*;
179    unsafe impl fidl::encoding::TypeMarker for InterestChangeError {
180        type Owned = Self;
181
182        #[inline(always)]
183        fn inline_align(_context: fidl::encoding::Context) -> usize {
184            std::mem::align_of::<u32>()
185        }
186
187        #[inline(always)]
188        fn inline_size(_context: fidl::encoding::Context) -> usize {
189            std::mem::size_of::<u32>()
190        }
191
192        #[inline(always)]
193        fn encode_is_copy() -> bool {
194            true
195        }
196
197        #[inline(always)]
198        fn decode_is_copy() -> bool {
199            false
200        }
201    }
202
203    impl fidl::encoding::ValueTypeMarker for InterestChangeError {
204        type Borrowed<'a> = Self;
205        #[inline(always)]
206        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
207            *value
208        }
209    }
210
211    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
212        for InterestChangeError
213    {
214        #[inline]
215        unsafe fn encode(
216            self,
217            encoder: &mut fidl::encoding::Encoder<'_, D>,
218            offset: usize,
219            _depth: fidl::encoding::Depth,
220        ) -> fidl::Result<()> {
221            encoder.debug_check_bounds::<Self>(offset);
222            encoder.write_num(self.into_primitive(), offset);
223            Ok(())
224        }
225    }
226
227    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InterestChangeError {
228        #[inline(always)]
229        fn new_empty() -> Self {
230            Self::CalledTwice
231        }
232
233        #[inline]
234        unsafe fn decode(
235            &mut self,
236            decoder: &mut fidl::encoding::Decoder<'_, D>,
237            offset: usize,
238            _depth: fidl::encoding::Depth,
239        ) -> fidl::Result<()> {
240            decoder.debug_check_bounds::<Self>(offset);
241            let prim = decoder.read_num::<u32>(offset);
242
243            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
244            Ok(())
245        }
246    }
247    unsafe impl fidl::encoding::TypeMarker for LogLevelFilter {
248        type Owned = Self;
249
250        #[inline(always)]
251        fn inline_align(_context: fidl::encoding::Context) -> usize {
252            std::mem::align_of::<i8>()
253        }
254
255        #[inline(always)]
256        fn inline_size(_context: fidl::encoding::Context) -> usize {
257            std::mem::size_of::<i8>()
258        }
259
260        #[inline(always)]
261        fn encode_is_copy() -> bool {
262            true
263        }
264
265        #[inline(always)]
266        fn decode_is_copy() -> bool {
267            false
268        }
269    }
270
271    impl fidl::encoding::ValueTypeMarker for LogLevelFilter {
272        type Borrowed<'a> = Self;
273        #[inline(always)]
274        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
275            *value
276        }
277    }
278
279    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for LogLevelFilter {
280        #[inline]
281        unsafe fn encode(
282            self,
283            encoder: &mut fidl::encoding::Encoder<'_, D>,
284            offset: usize,
285            _depth: fidl::encoding::Depth,
286        ) -> fidl::Result<()> {
287            encoder.debug_check_bounds::<Self>(offset);
288            encoder.write_num(self.into_primitive(), offset);
289            Ok(())
290        }
291    }
292
293    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LogLevelFilter {
294        #[inline(always)]
295        fn new_empty() -> Self {
296            Self::Trace
297        }
298
299        #[inline]
300        unsafe fn decode(
301            &mut self,
302            decoder: &mut fidl::encoding::Decoder<'_, D>,
303            offset: usize,
304            _depth: fidl::encoding::Depth,
305        ) -> fidl::Result<()> {
306            decoder.debug_check_bounds::<Self>(offset);
307            let prim = decoder.read_num::<i8>(offset);
308
309            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
310            Ok(())
311        }
312    }
313
314    impl fidl::encoding::ValueTypeMarker for LogFilterOptions {
315        type Borrowed<'a> = &'a Self;
316        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
317            value
318        }
319    }
320
321    unsafe impl fidl::encoding::TypeMarker for LogFilterOptions {
322        type Owned = Self;
323
324        #[inline(always)]
325        fn inline_align(_context: fidl::encoding::Context) -> usize {
326            8
327        }
328
329        #[inline(always)]
330        fn inline_size(_context: fidl::encoding::Context) -> usize {
331            56
332        }
333    }
334
335    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<LogFilterOptions, D>
336        for &LogFilterOptions
337    {
338        #[inline]
339        unsafe fn encode(
340            self,
341            encoder: &mut fidl::encoding::Encoder<'_, D>,
342            offset: usize,
343            _depth: fidl::encoding::Depth,
344        ) -> fidl::Result<()> {
345            encoder.debug_check_bounds::<LogFilterOptions>(offset);
346            // Delegate to tuple encoding.
347            fidl::encoding::Encode::<LogFilterOptions, D>::encode(
348                (
349                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.filter_by_pid),
350                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.pid),
351                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.filter_by_tid),
352                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.tid),
353                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.verbosity),
354                    <LogLevelFilter as fidl::encoding::ValueTypeMarker>::borrow(&self.min_severity),
355                    <fidl::encoding::Vector<fidl::encoding::BoundedString<63>, 16> as fidl::encoding::ValueTypeMarker>::borrow(&self.tags),
356                ),
357                encoder, offset, _depth
358            )
359        }
360    }
361    unsafe impl<
362            D: fidl::encoding::ResourceDialect,
363            T0: fidl::encoding::Encode<bool, D>,
364            T1: fidl::encoding::Encode<u64, D>,
365            T2: fidl::encoding::Encode<bool, D>,
366            T3: fidl::encoding::Encode<u64, D>,
367            T4: fidl::encoding::Encode<u8, D>,
368            T5: fidl::encoding::Encode<LogLevelFilter, D>,
369            T6: fidl::encoding::Encode<
370                fidl::encoding::Vector<fidl::encoding::BoundedString<63>, 16>,
371                D,
372            >,
373        > fidl::encoding::Encode<LogFilterOptions, D> for (T0, T1, T2, T3, T4, T5, T6)
374    {
375        #[inline]
376        unsafe fn encode(
377            self,
378            encoder: &mut fidl::encoding::Encoder<'_, D>,
379            offset: usize,
380            depth: fidl::encoding::Depth,
381        ) -> fidl::Result<()> {
382            encoder.debug_check_bounds::<LogFilterOptions>(offset);
383            // Zero out padding regions. There's no need to apply masks
384            // because the unmasked parts will be overwritten by fields.
385            unsafe {
386                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
387                (ptr as *mut u64).write_unaligned(0);
388            }
389            unsafe {
390                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
391                (ptr as *mut u64).write_unaligned(0);
392            }
393            unsafe {
394                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
395                (ptr as *mut u64).write_unaligned(0);
396            }
397            // Write the fields.
398            self.0.encode(encoder, offset + 0, depth)?;
399            self.1.encode(encoder, offset + 8, depth)?;
400            self.2.encode(encoder, offset + 16, depth)?;
401            self.3.encode(encoder, offset + 24, depth)?;
402            self.4.encode(encoder, offset + 32, depth)?;
403            self.5.encode(encoder, offset + 33, depth)?;
404            self.6.encode(encoder, offset + 40, depth)?;
405            Ok(())
406        }
407    }
408
409    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LogFilterOptions {
410        #[inline(always)]
411        fn new_empty() -> Self {
412            Self {
413                filter_by_pid: fidl::new_empty!(bool, D),
414                pid: fidl::new_empty!(u64, D),
415                filter_by_tid: fidl::new_empty!(bool, D),
416                tid: fidl::new_empty!(u64, D),
417                verbosity: fidl::new_empty!(u8, D),
418                min_severity: fidl::new_empty!(LogLevelFilter, D),
419                tags: fidl::new_empty!(
420                    fidl::encoding::Vector<fidl::encoding::BoundedString<63>, 16>,
421                    D
422                ),
423            }
424        }
425
426        #[inline]
427        unsafe fn decode(
428            &mut self,
429            decoder: &mut fidl::encoding::Decoder<'_, D>,
430            offset: usize,
431            _depth: fidl::encoding::Depth,
432        ) -> fidl::Result<()> {
433            decoder.debug_check_bounds::<Self>(offset);
434            // Verify that padding bytes are zero.
435            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
436            let padval = unsafe { (ptr as *const u64).read_unaligned() };
437            let mask = 0xffffffffffffff00u64;
438            let maskedval = padval & mask;
439            if maskedval != 0 {
440                return Err(fidl::Error::NonZeroPadding {
441                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
442                });
443            }
444            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
445            let padval = unsafe { (ptr as *const u64).read_unaligned() };
446            let mask = 0xffffffffffffff00u64;
447            let maskedval = padval & mask;
448            if maskedval != 0 {
449                return Err(fidl::Error::NonZeroPadding {
450                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
451                });
452            }
453            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
454            let padval = unsafe { (ptr as *const u64).read_unaligned() };
455            let mask = 0xffffffffffff0000u64;
456            let maskedval = padval & mask;
457            if maskedval != 0 {
458                return Err(fidl::Error::NonZeroPadding {
459                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
460                });
461            }
462            fidl::decode!(bool, D, &mut self.filter_by_pid, decoder, offset + 0, _depth)?;
463            fidl::decode!(u64, D, &mut self.pid, decoder, offset + 8, _depth)?;
464            fidl::decode!(bool, D, &mut self.filter_by_tid, decoder, offset + 16, _depth)?;
465            fidl::decode!(u64, D, &mut self.tid, decoder, offset + 24, _depth)?;
466            fidl::decode!(u8, D, &mut self.verbosity, decoder, offset + 32, _depth)?;
467            fidl::decode!(LogLevelFilter, D, &mut self.min_severity, decoder, offset + 33, _depth)?;
468            fidl::decode!(
469                fidl::encoding::Vector<fidl::encoding::BoundedString<63>, 16>,
470                D,
471                &mut self.tags,
472                decoder,
473                offset + 40,
474                _depth
475            )?;
476            Ok(())
477        }
478    }
479
480    impl fidl::encoding::ValueTypeMarker for LogListenerSafeLogManyRequest {
481        type Borrowed<'a> = &'a Self;
482        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
483            value
484        }
485    }
486
487    unsafe impl fidl::encoding::TypeMarker for LogListenerSafeLogManyRequest {
488        type Owned = Self;
489
490        #[inline(always)]
491        fn inline_align(_context: fidl::encoding::Context) -> usize {
492            8
493        }
494
495        #[inline(always)]
496        fn inline_size(_context: fidl::encoding::Context) -> usize {
497            16
498        }
499    }
500
501    unsafe impl<D: fidl::encoding::ResourceDialect>
502        fidl::encoding::Encode<LogListenerSafeLogManyRequest, D>
503        for &LogListenerSafeLogManyRequest
504    {
505        #[inline]
506        unsafe fn encode(
507            self,
508            encoder: &mut fidl::encoding::Encoder<'_, D>,
509            offset: usize,
510            _depth: fidl::encoding::Depth,
511        ) -> fidl::Result<()> {
512            encoder.debug_check_bounds::<LogListenerSafeLogManyRequest>(offset);
513            // Delegate to tuple encoding.
514            fidl::encoding::Encode::<LogListenerSafeLogManyRequest, D>::encode(
515                (
516                    <fidl::encoding::UnboundedVector<LogMessage> as fidl::encoding::ValueTypeMarker>::borrow(&self.log),
517                ),
518                encoder, offset, _depth
519            )
520        }
521    }
522    unsafe impl<
523            D: fidl::encoding::ResourceDialect,
524            T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<LogMessage>, D>,
525        > fidl::encoding::Encode<LogListenerSafeLogManyRequest, D> for (T0,)
526    {
527        #[inline]
528        unsafe fn encode(
529            self,
530            encoder: &mut fidl::encoding::Encoder<'_, D>,
531            offset: usize,
532            depth: fidl::encoding::Depth,
533        ) -> fidl::Result<()> {
534            encoder.debug_check_bounds::<LogListenerSafeLogManyRequest>(offset);
535            // Zero out padding regions. There's no need to apply masks
536            // because the unmasked parts will be overwritten by fields.
537            // Write the fields.
538            self.0.encode(encoder, offset + 0, depth)?;
539            Ok(())
540        }
541    }
542
543    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
544        for LogListenerSafeLogManyRequest
545    {
546        #[inline(always)]
547        fn new_empty() -> Self {
548            Self { log: fidl::new_empty!(fidl::encoding::UnboundedVector<LogMessage>, D) }
549        }
550
551        #[inline]
552        unsafe fn decode(
553            &mut self,
554            decoder: &mut fidl::encoding::Decoder<'_, D>,
555            offset: usize,
556            _depth: fidl::encoding::Depth,
557        ) -> fidl::Result<()> {
558            decoder.debug_check_bounds::<Self>(offset);
559            // Verify that padding bytes are zero.
560            fidl::decode!(
561                fidl::encoding::UnboundedVector<LogMessage>,
562                D,
563                &mut self.log,
564                decoder,
565                offset + 0,
566                _depth
567            )?;
568            Ok(())
569        }
570    }
571
572    impl fidl::encoding::ValueTypeMarker for LogListenerSafeLogRequest {
573        type Borrowed<'a> = &'a Self;
574        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
575            value
576        }
577    }
578
579    unsafe impl fidl::encoding::TypeMarker for LogListenerSafeLogRequest {
580        type Owned = Self;
581
582        #[inline(always)]
583        fn inline_align(_context: fidl::encoding::Context) -> usize {
584            8
585        }
586
587        #[inline(always)]
588        fn inline_size(_context: fidl::encoding::Context) -> usize {
589            64
590        }
591    }
592
593    unsafe impl<D: fidl::encoding::ResourceDialect>
594        fidl::encoding::Encode<LogListenerSafeLogRequest, D> for &LogListenerSafeLogRequest
595    {
596        #[inline]
597        unsafe fn encode(
598            self,
599            encoder: &mut fidl::encoding::Encoder<'_, D>,
600            offset: usize,
601            _depth: fidl::encoding::Depth,
602        ) -> fidl::Result<()> {
603            encoder.debug_check_bounds::<LogListenerSafeLogRequest>(offset);
604            // Delegate to tuple encoding.
605            fidl::encoding::Encode::<LogListenerSafeLogRequest, D>::encode(
606                (<LogMessage as fidl::encoding::ValueTypeMarker>::borrow(&self.log),),
607                encoder,
608                offset,
609                _depth,
610            )
611        }
612    }
613    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<LogMessage, D>>
614        fidl::encoding::Encode<LogListenerSafeLogRequest, D> for (T0,)
615    {
616        #[inline]
617        unsafe fn encode(
618            self,
619            encoder: &mut fidl::encoding::Encoder<'_, D>,
620            offset: usize,
621            depth: fidl::encoding::Depth,
622        ) -> fidl::Result<()> {
623            encoder.debug_check_bounds::<LogListenerSafeLogRequest>(offset);
624            // Zero out padding regions. There's no need to apply masks
625            // because the unmasked parts will be overwritten by fields.
626            // Write the fields.
627            self.0.encode(encoder, offset + 0, depth)?;
628            Ok(())
629        }
630    }
631
632    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
633        for LogListenerSafeLogRequest
634    {
635        #[inline(always)]
636        fn new_empty() -> Self {
637            Self { log: fidl::new_empty!(LogMessage, D) }
638        }
639
640        #[inline]
641        unsafe fn decode(
642            &mut self,
643            decoder: &mut fidl::encoding::Decoder<'_, D>,
644            offset: usize,
645            _depth: fidl::encoding::Depth,
646        ) -> fidl::Result<()> {
647            decoder.debug_check_bounds::<Self>(offset);
648            // Verify that padding bytes are zero.
649            fidl::decode!(LogMessage, D, &mut self.log, decoder, offset + 0, _depth)?;
650            Ok(())
651        }
652    }
653
654    impl fidl::encoding::ValueTypeMarker for LogMessage {
655        type Borrowed<'a> = &'a Self;
656        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
657            value
658        }
659    }
660
661    unsafe impl fidl::encoding::TypeMarker for LogMessage {
662        type Owned = Self;
663
664        #[inline(always)]
665        fn inline_align(_context: fidl::encoding::Context) -> usize {
666            8
667        }
668
669        #[inline(always)]
670        fn inline_size(_context: fidl::encoding::Context) -> usize {
671            64
672        }
673    }
674
675    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<LogMessage, D>
676        for &LogMessage
677    {
678        #[inline]
679        unsafe fn encode(
680            self,
681            encoder: &mut fidl::encoding::Encoder<'_, D>,
682            offset: usize,
683            _depth: fidl::encoding::Depth,
684        ) -> fidl::Result<()> {
685            encoder.debug_check_bounds::<LogMessage>(offset);
686            // Delegate to tuple encoding.
687            fidl::encoding::Encode::<LogMessage, D>::encode(
688                (
689                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.pid),
690                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.tid),
691                    <fidl::BootInstant as fidl::encoding::ValueTypeMarker>::borrow(&self.time),
692                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.severity),
693                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.dropped_logs),
694                    <fidl::encoding::Vector<fidl::encoding::BoundedString<63>, 5> as fidl::encoding::ValueTypeMarker>::borrow(&self.tags),
695                    <fidl::encoding::BoundedString<32768> as fidl::encoding::ValueTypeMarker>::borrow(&self.msg),
696                ),
697                encoder, offset, _depth
698            )
699        }
700    }
701    unsafe impl<
702            D: fidl::encoding::ResourceDialect,
703            T0: fidl::encoding::Encode<u64, D>,
704            T1: fidl::encoding::Encode<u64, D>,
705            T2: fidl::encoding::Encode<fidl::BootInstant, D>,
706            T3: fidl::encoding::Encode<i32, D>,
707            T4: fidl::encoding::Encode<u32, D>,
708            T5: fidl::encoding::Encode<fidl::encoding::Vector<fidl::encoding::BoundedString<63>, 5>, D>,
709            T6: fidl::encoding::Encode<fidl::encoding::BoundedString<32768>, D>,
710        > fidl::encoding::Encode<LogMessage, D> for (T0, T1, T2, T3, T4, T5, T6)
711    {
712        #[inline]
713        unsafe fn encode(
714            self,
715            encoder: &mut fidl::encoding::Encoder<'_, D>,
716            offset: usize,
717            depth: fidl::encoding::Depth,
718        ) -> fidl::Result<()> {
719            encoder.debug_check_bounds::<LogMessage>(offset);
720            // Zero out padding regions. There's no need to apply masks
721            // because the unmasked parts will be overwritten by fields.
722            // Write the fields.
723            self.0.encode(encoder, offset + 0, depth)?;
724            self.1.encode(encoder, offset + 8, depth)?;
725            self.2.encode(encoder, offset + 16, depth)?;
726            self.3.encode(encoder, offset + 24, depth)?;
727            self.4.encode(encoder, offset + 28, depth)?;
728            self.5.encode(encoder, offset + 32, depth)?;
729            self.6.encode(encoder, offset + 48, depth)?;
730            Ok(())
731        }
732    }
733
734    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LogMessage {
735        #[inline(always)]
736        fn new_empty() -> Self {
737            Self {
738                pid: fidl::new_empty!(u64, D),
739                tid: fidl::new_empty!(u64, D),
740                time: fidl::new_empty!(fidl::BootInstant, D),
741                severity: fidl::new_empty!(i32, D),
742                dropped_logs: fidl::new_empty!(u32, D),
743                tags: fidl::new_empty!(
744                    fidl::encoding::Vector<fidl::encoding::BoundedString<63>, 5>,
745                    D
746                ),
747                msg: fidl::new_empty!(fidl::encoding::BoundedString<32768>, D),
748            }
749        }
750
751        #[inline]
752        unsafe fn decode(
753            &mut self,
754            decoder: &mut fidl::encoding::Decoder<'_, D>,
755            offset: usize,
756            _depth: fidl::encoding::Depth,
757        ) -> fidl::Result<()> {
758            decoder.debug_check_bounds::<Self>(offset);
759            // Verify that padding bytes are zero.
760            fidl::decode!(u64, D, &mut self.pid, decoder, offset + 0, _depth)?;
761            fidl::decode!(u64, D, &mut self.tid, decoder, offset + 8, _depth)?;
762            fidl::decode!(fidl::BootInstant, D, &mut self.time, decoder, offset + 16, _depth)?;
763            fidl::decode!(i32, D, &mut self.severity, decoder, offset + 24, _depth)?;
764            fidl::decode!(u32, D, &mut self.dropped_logs, decoder, offset + 28, _depth)?;
765            fidl::decode!(
766                fidl::encoding::Vector<fidl::encoding::BoundedString<63>, 5>,
767                D,
768                &mut self.tags,
769                decoder,
770                offset + 32,
771                _depth
772            )?;
773            fidl::decode!(
774                fidl::encoding::BoundedString<32768>,
775                D,
776                &mut self.msg,
777                decoder,
778                offset + 48,
779                _depth
780            )?;
781            Ok(())
782        }
783    }
784
785    impl fidl::encoding::ValueTypeMarker for LogSinkWaitForInterestChangeResponse {
786        type Borrowed<'a> = &'a Self;
787        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
788            value
789        }
790    }
791
792    unsafe impl fidl::encoding::TypeMarker for LogSinkWaitForInterestChangeResponse {
793        type Owned = Self;
794
795        #[inline(always)]
796        fn inline_align(_context: fidl::encoding::Context) -> usize {
797            8
798        }
799
800        #[inline(always)]
801        fn inline_size(_context: fidl::encoding::Context) -> usize {
802            16
803        }
804    }
805
806    unsafe impl<D: fidl::encoding::ResourceDialect>
807        fidl::encoding::Encode<LogSinkWaitForInterestChangeResponse, D>
808        for &LogSinkWaitForInterestChangeResponse
809    {
810        #[inline]
811        unsafe fn encode(
812            self,
813            encoder: &mut fidl::encoding::Encoder<'_, D>,
814            offset: usize,
815            _depth: fidl::encoding::Depth,
816        ) -> fidl::Result<()> {
817            encoder.debug_check_bounds::<LogSinkWaitForInterestChangeResponse>(offset);
818            // Delegate to tuple encoding.
819            fidl::encoding::Encode::<LogSinkWaitForInterestChangeResponse, D>::encode(
820                (
821                    <fidl_fuchsia_diagnostics_types__common::Interest as fidl::encoding::ValueTypeMarker>::borrow(&self.data),
822                ),
823                encoder, offset, _depth
824            )
825        }
826    }
827    unsafe impl<
828            D: fidl::encoding::ResourceDialect,
829            T0: fidl::encoding::Encode<fidl_fuchsia_diagnostics_types__common::Interest, D>,
830        > fidl::encoding::Encode<LogSinkWaitForInterestChangeResponse, D> for (T0,)
831    {
832        #[inline]
833        unsafe fn encode(
834            self,
835            encoder: &mut fidl::encoding::Encoder<'_, D>,
836            offset: usize,
837            depth: fidl::encoding::Depth,
838        ) -> fidl::Result<()> {
839            encoder.debug_check_bounds::<LogSinkWaitForInterestChangeResponse>(offset);
840            // Zero out padding regions. There's no need to apply masks
841            // because the unmasked parts will be overwritten by fields.
842            // Write the fields.
843            self.0.encode(encoder, offset + 0, depth)?;
844            Ok(())
845        }
846    }
847
848    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
849        for LogSinkWaitForInterestChangeResponse
850    {
851        #[inline(always)]
852        fn new_empty() -> Self {
853            Self { data: fidl::new_empty!(fidl_fuchsia_diagnostics_types__common::Interest, D) }
854        }
855
856        #[inline]
857        unsafe fn decode(
858            &mut self,
859            decoder: &mut fidl::encoding::Decoder<'_, D>,
860            offset: usize,
861            _depth: fidl::encoding::Depth,
862        ) -> fidl::Result<()> {
863            decoder.debug_check_bounds::<Self>(offset);
864            // Verify that padding bytes are zero.
865            fidl::decode!(
866                fidl_fuchsia_diagnostics_types__common::Interest,
867                D,
868                &mut self.data,
869                decoder,
870                offset + 0,
871                _depth
872            )?;
873            Ok(())
874        }
875    }
876}