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