Skip to main content

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