1#![warn(clippy::all)]
3#![allow(unused_parens, unused_variables, unused_mut, unused_imports, unreachable_code)]
4
5pub mod natural {
6
7 pub use fidl_next_common_fuchsia_logger::natural::*;
8
9 #[derive(Debug, PartialEq)]
10 pub struct LogListenSafeRequest {
11 pub log_listener:
12 ::fidl_next::ClientEnd<crate::LogListenerSafe, ::fidl_next::fuchsia::zx::Channel>,
13
14 pub options: ::core::option::Option<::std::boxed::Box<crate::natural::LogFilterOptions>>,
15 }
16
17 unsafe impl<___E> ::fidl_next::Encode<crate::wire::LogListenSafeRequest<'static>, ___E>
18 for LogListenSafeRequest
19 where
20 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
21 ___E: ::fidl_next::Encoder,
22 ___E: ::fidl_next::fuchsia::HandleEncoder,
23 {
24 #[inline]
25 fn encode(
26 self,
27 encoder_: &mut ___E,
28 out_: &mut ::core::mem::MaybeUninit<crate::wire::LogListenSafeRequest<'static>>,
29 _: (),
30 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
31 ::fidl_next::munge! {
32 let crate::wire::LogListenSafeRequest {
33 log_listener,
34 options,
35
36 } = out_;
37 }
38
39 ::fidl_next::Encode::encode(self.log_listener, encoder_, log_listener, ())?;
40
41 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(log_listener.as_mut_ptr()) };
42
43 ::fidl_next::Encode::encode(self.options, encoder_, options, ())?;
44
45 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(options.as_mut_ptr()) };
46
47 Ok(())
48 }
49 }
50
51 unsafe impl<___E>
52 ::fidl_next::EncodeOption<
53 ::fidl_next::wire::Box<'static, crate::wire::LogListenSafeRequest<'static>>,
54 ___E,
55 > for LogListenSafeRequest
56 where
57 ___E: ::fidl_next::Encoder + ?Sized,
58 LogListenSafeRequest: ::fidl_next::Encode<crate::wire::LogListenSafeRequest<'static>, ___E>,
59 {
60 #[inline]
61 fn encode_option(
62 this: ::core::option::Option<Self>,
63 encoder: &mut ___E,
64 out: &mut ::core::mem::MaybeUninit<
65 ::fidl_next::wire::Box<'static, crate::wire::LogListenSafeRequest<'static>>,
66 >,
67 _: (),
68 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
69 if let Some(inner) = this {
70 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
71 ::fidl_next::wire::Box::encode_present(out);
72 } else {
73 ::fidl_next::wire::Box::encode_absent(out);
74 }
75
76 Ok(())
77 }
78 }
79
80 impl<'de> ::fidl_next::FromWire<crate::wire::LogListenSafeRequest<'de>> for LogListenSafeRequest {
81 #[inline]
82 fn from_wire(wire: crate::wire::LogListenSafeRequest<'de>) -> Self {
83 Self {
84 log_listener: ::fidl_next::FromWire::from_wire(wire.log_listener),
85
86 options: ::fidl_next::FromWire::from_wire(wire.options),
87 }
88 }
89 }
90
91 #[derive(Debug, Default, PartialEq)]
92 pub struct LogSinkOnInitRequest {
93 pub buffer: ::core::option::Option<::fidl_next::fuchsia::zx::Iob>,
94
95 pub interest:
96 ::core::option::Option<::fidl_next_fuchsia_diagnostics_types::natural::Interest>,
97 }
98
99 impl LogSinkOnInitRequest {
100 fn __max_ordinal(&self) -> usize {
101 if self.interest.is_some() {
102 return 2;
103 }
104
105 if self.buffer.is_some() {
106 return 1;
107 }
108
109 0
110 }
111 }
112
113 unsafe impl<___E> ::fidl_next::Encode<crate::wire::LogSinkOnInitRequest<'static>, ___E>
114 for LogSinkOnInitRequest
115 where
116 ___E: ::fidl_next::Encoder + ?Sized,
117 ___E: ::fidl_next::fuchsia::HandleEncoder,
118 {
119 #[inline]
120 fn encode(
121 mut self,
122 encoder: &mut ___E,
123 out: &mut ::core::mem::MaybeUninit<crate::wire::LogSinkOnInitRequest<'static>>,
124 _: (),
125 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
126 ::fidl_next::munge!(let crate::wire::LogSinkOnInitRequest { table } = out);
127
128 let max_ord = self.__max_ordinal();
129
130 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
131 ::fidl_next::Wire::zero_padding(&mut out);
132
133 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
134 ::fidl_next::wire::Envelope,
135 >(encoder, max_ord);
136
137 for i in 1..=max_ord {
138 match i {
139 2 => {
140 if let Some(value) = self.interest.take() {
141 ::fidl_next::wire::Envelope::encode_value::<
142 ::fidl_next_fuchsia_diagnostics_types::wire::Interest<'static>,
143 ___E,
144 >(
145 value, preallocated.encoder, &mut out, ()
146 )?;
147 } else {
148 ::fidl_next::wire::Envelope::encode_zero(&mut out)
149 }
150 }
151
152 1 => {
153 if let Some(value) = self.buffer.take() {
154 ::fidl_next::wire::Envelope::encode_value::<
155 ::fidl_next::wire::fuchsia::Iob,
156 ___E,
157 >(
158 value, preallocated.encoder, &mut out, ()
159 )?;
160 } else {
161 ::fidl_next::wire::Envelope::encode_zero(&mut out)
162 }
163 }
164
165 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
166 }
167 unsafe {
168 preallocated.write_next(out.assume_init_ref());
169 }
170 }
171
172 ::fidl_next::wire::Table::encode_len(table, max_ord);
173
174 Ok(())
175 }
176 }
177
178 impl<'de> ::fidl_next::FromWire<crate::wire::LogSinkOnInitRequest<'de>> for LogSinkOnInitRequest {
179 #[inline]
180 fn from_wire(wire_: crate::wire::LogSinkOnInitRequest<'de>) -> Self {
181 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
182
183 let buffer = wire_.table.get(1);
184
185 let interest = wire_.table.get(2);
186
187 Self {
188
189
190 buffer: buffer.map(|envelope| ::fidl_next::FromWire::from_wire(
191 unsafe { envelope.read_unchecked::<::fidl_next::wire::fuchsia::Iob>() }
192 )),
193
194
195 interest: interest.map(|envelope| ::fidl_next::FromWire::from_wire(
196 unsafe { envelope.read_unchecked::<::fidl_next_fuchsia_diagnostics_types::wire::Interest<'de>>() }
197 )),
198
199 }
200 }
201 }
202}
203
204pub mod wire {
205
206 pub use fidl_next_common_fuchsia_logger::wire::*;
207
208 #[derive(Debug)]
210 #[repr(C)]
211 pub struct LogListenSafeRequest<'de> {
212 pub log_listener:
213 ::fidl_next::ClientEnd<crate::LogListenerSafe, ::fidl_next::wire::fuchsia::Channel>,
214
215 pub options: ::fidl_next::wire::Box<'de, crate::wire::LogFilterOptions<'de>>,
216 }
217
218 static_assertions::const_assert_eq!(std::mem::size_of::<LogListenSafeRequest<'_>>(), 16);
219 static_assertions::const_assert_eq!(std::mem::align_of::<LogListenSafeRequest<'_>>(), 8);
220
221 static_assertions::const_assert_eq!(
222 std::mem::offset_of!(LogListenSafeRequest<'_>, log_listener),
223 0
224 );
225
226 static_assertions::const_assert_eq!(std::mem::offset_of!(LogListenSafeRequest<'_>, options), 8);
227
228 impl ::fidl_next::Constrained for LogListenSafeRequest<'_> {
229 type Constraint = ();
230
231 fn validate(
232 _: ::fidl_next::Slot<'_, Self>,
233 _: Self::Constraint,
234 ) -> Result<(), ::fidl_next::ValidationError> {
235 Ok(())
236 }
237 }
238
239 unsafe impl ::fidl_next::Wire for LogListenSafeRequest<'static> {
240 type Narrowed<'de> = LogListenSafeRequest<'de>;
241
242 #[inline]
243 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
244 ::fidl_next::munge! {
245 let Self {
246 log_listener,
247 options,
248
249 } = &mut *out_;
250 }
251
252 ::fidl_next::Wire::zero_padding(log_listener);
253
254 ::fidl_next::Wire::zero_padding(options);
255
256 unsafe {
257 out_.as_mut_ptr().cast::<u8>().add(4).write_bytes(0, 4);
258 }
259 }
260 }
261
262 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for LogListenSafeRequest<'de>
263 where
264 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
265 ___D: ::fidl_next::Decoder<'de>,
266 ___D: ::fidl_next::fuchsia::HandleDecoder,
267 {
268 fn decode(
269 slot_: ::fidl_next::Slot<'_, Self>,
270 decoder_: &mut ___D,
271 _: (),
272 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
273 if slot_.as_bytes()[4..8] != [0u8; 4] {
274 return Err(::fidl_next::DecodeError::InvalidPadding);
275 }
276
277 ::fidl_next::munge! {
278 let Self {
279 mut log_listener,
280 mut options,
281
282 } = slot_;
283 }
284
285 let _field = log_listener.as_mut();
286
287 ::fidl_next::Decode::decode(log_listener.as_mut(), decoder_, ())?;
288
289 let _field = options.as_mut();
290
291 ::fidl_next::Decode::decode(options.as_mut(), decoder_, ())?;
292
293 Ok(())
294 }
295 }
296
297 impl<'de> ::fidl_next::IntoNatural for LogListenSafeRequest<'de> {
298 type Natural = crate::natural::LogListenSafeRequest;
299 }
300
301 #[repr(C)]
303 pub struct LogSinkOnInitRequest<'de> {
304 pub(crate) table: ::fidl_next::wire::Table<'de>,
305 }
306
307 impl<'de> Drop for LogSinkOnInitRequest<'de> {
308 fn drop(&mut self) {
309 let _ = self.table.get(1).map(|envelope| unsafe {
310 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Iob>()
311 });
312
313 let _ = self.table.get(2)
314 .map(|envelope| unsafe {
315 envelope.read_unchecked::<::fidl_next_fuchsia_diagnostics_types::wire::Interest<'de>>()
316 });
317 }
318 }
319
320 impl ::fidl_next::Constrained for LogSinkOnInitRequest<'_> {
321 type Constraint = ();
322
323 fn validate(
324 _: ::fidl_next::Slot<'_, Self>,
325 _: Self::Constraint,
326 ) -> Result<(), ::fidl_next::ValidationError> {
327 Ok(())
328 }
329 }
330
331 unsafe impl ::fidl_next::Wire for LogSinkOnInitRequest<'static> {
332 type Narrowed<'de> = LogSinkOnInitRequest<'de>;
333
334 #[inline]
335 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
336 ::fidl_next::munge!(let Self { table } = out);
337 ::fidl_next::wire::Table::zero_padding(table);
338 }
339 }
340
341 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for LogSinkOnInitRequest<'de>
342 where
343 ___D: ::fidl_next::Decoder<'de> + ?Sized,
344 ___D: ::fidl_next::fuchsia::HandleDecoder,
345 {
346 fn decode(
347 slot: ::fidl_next::Slot<'_, Self>,
348 decoder: &mut ___D,
349 _: (),
350 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
351 ::fidl_next::munge!(let Self { table } = slot);
352
353 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
354 match ordinal {
355 0 => unsafe { ::core::hint::unreachable_unchecked() },
356
357 1 => {
358 ::fidl_next::wire::Envelope::decode_as::<
359 ___D,
360 ::fidl_next::wire::fuchsia::Iob,
361 >(slot.as_mut(), decoder, ())?;
362
363 Ok(())
364 }
365
366 2 => {
367 ::fidl_next::wire::Envelope::decode_as::<
368 ___D,
369 ::fidl_next_fuchsia_diagnostics_types::wire::Interest<'de>,
370 >(slot.as_mut(), decoder, ())?;
371
372 Ok(())
373 }
374
375 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
376 }
377 })
378 }
379 }
380
381 impl<'de> LogSinkOnInitRequest<'de> {
382 pub fn buffer(&self) -> ::core::option::Option<&::fidl_next::wire::fuchsia::Iob> {
383 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
384 }
385
386 pub fn take_buffer(&mut self) -> ::core::option::Option<::fidl_next::wire::fuchsia::Iob> {
387 unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
388 }
389
390 pub fn interest(
391 &self,
392 ) -> ::core::option::Option<&::fidl_next_fuchsia_diagnostics_types::wire::Interest<'de>>
393 {
394 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
395 }
396
397 pub fn take_interest(
398 &mut self,
399 ) -> ::core::option::Option<::fidl_next_fuchsia_diagnostics_types::wire::Interest<'de>>
400 {
401 unsafe { Some(self.table.get_mut(2)?.take_unchecked()) }
402 }
403 }
404
405 impl<'de> ::core::fmt::Debug for LogSinkOnInitRequest<'de> {
406 fn fmt(
407 &self,
408 f: &mut ::core::fmt::Formatter<'_>,
409 ) -> ::core::result::Result<(), ::core::fmt::Error> {
410 f.debug_struct("LogSinkOnInitRequest")
411 .field("buffer", &self.buffer())
412 .field("interest", &self.interest())
413 .finish()
414 }
415 }
416
417 impl<'de> ::fidl_next::IntoNatural for LogSinkOnInitRequest<'de> {
418 type Natural = crate::natural::LogSinkOnInitRequest;
419 }
420}
421
422pub mod wire_optional {
423
424 pub use fidl_next_common_fuchsia_logger::wire_optional::*;
425}
426
427pub mod generic {
428
429 pub use fidl_next_common_fuchsia_logger::generic::*;
430
431 pub struct LogListenSafeRequest<T0, T1> {
433 pub log_listener: T0,
434
435 pub options: T1,
436 }
437
438 unsafe impl<___E, T0, T1> ::fidl_next::Encode<crate::wire::LogListenSafeRequest<'static>, ___E>
439 for LogListenSafeRequest<T0, T1>
440 where
441 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
442 ___E: ::fidl_next::Encoder,
443 ___E: ::fidl_next::fuchsia::HandleEncoder,
444 T0: ::fidl_next::Encode<
445 ::fidl_next::ClientEnd<crate::LogListenerSafe, ::fidl_next::wire::fuchsia::Channel>,
446 ___E,
447 >,
448 T1: ::fidl_next::Encode<
449 ::fidl_next::wire::Box<'static, crate::wire::LogFilterOptions<'static>>,
450 ___E,
451 >,
452 {
453 #[inline]
454 fn encode(
455 self,
456 encoder_: &mut ___E,
457 out_: &mut ::core::mem::MaybeUninit<crate::wire::LogListenSafeRequest<'static>>,
458 _: (),
459 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
460 ::fidl_next::munge! {
461 let crate::wire::LogListenSafeRequest {
462 log_listener,
463 options,
464
465 } = out_;
466 }
467
468 ::fidl_next::Encode::encode(self.log_listener, encoder_, log_listener, ())?;
469
470 ::fidl_next::Encode::encode(self.options, encoder_, options, ())?;
471
472 Ok(())
473 }
474 }
475
476 unsafe impl<'a, ___E, T0, T1>
477 ::fidl_next::Encode<crate::wire::LogListenSafeRequest<'static>, ___E>
478 for &'a LogListenSafeRequest<T0, T1>
479 where
480 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
481 ___E: ::fidl_next::Encoder,
482 ___E: ::fidl_next::fuchsia::HandleEncoder,
483 &'a T0: ::fidl_next::Encode<
484 ::fidl_next::ClientEnd<crate::LogListenerSafe, ::fidl_next::wire::fuchsia::Channel>,
485 ___E,
486 >,
487 &'a T1: ::fidl_next::Encode<
488 ::fidl_next::wire::Box<'static, crate::wire::LogFilterOptions<'static>>,
489 ___E,
490 >,
491 {
492 #[inline]
493 fn encode(
494 self,
495 encoder_: &mut ___E,
496 out_: &mut ::core::mem::MaybeUninit<crate::wire::LogListenSafeRequest<'static>>,
497 _: (),
498 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
499 ::fidl_next::munge! {
500 let crate::wire::LogListenSafeRequest {
501 log_listener,
502 options,
503
504 } = out_;
505 }
506
507 ::fidl_next::Encode::encode(&self.log_listener, encoder_, log_listener, ())?;
508
509 ::fidl_next::Encode::encode(&self.options, encoder_, options, ())?;
510
511 Ok(())
512 }
513 }
514}
515
516pub use self::natural::*;
517
518#[doc = " Interface for LogListenerSafe to register to listen to logs.\n"]
520#[derive(PartialEq, Debug)]
521pub struct Log;
522
523impl ::fidl_next::Discoverable for Log {
524 const PROTOCOL_NAME: &'static str = "fuchsia.logger.Log";
525}
526
527#[cfg(target_os = "fuchsia")]
528impl ::fidl_next::HasTransport for Log {
529 type Transport = ::fidl_next::fuchsia::zx::Channel;
530}
531
532pub mod log {
533 pub mod prelude {
534 pub use crate::{
535 Log, LogClientHandler, LogLocalClientHandler, LogLocalServerHandler, LogServerHandler,
536 log,
537 };
538
539 pub use crate::natural::LogListenSafeRequest;
540 }
541
542 pub struct ListenSafe;
543
544 impl ::fidl_next::Method for ListenSafe {
545 const ORDINAL: u64 = 5643638173917143473;
546 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
547 ::fidl_next::protocol::Flexibility::Strict;
548
549 type Protocol = crate::Log;
550
551 type Request = crate::wire::LogListenSafeRequest<'static>;
552 }
553
554 mod ___detail {
555 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::Log
556 where
557 ___T: ::fidl_next::Transport,
558 {
559 type Client = LogClient<___T>;
560 type Server = LogServer<___T>;
561 }
562
563 #[repr(transparent)]
565 pub struct LogClient<___T: ::fidl_next::Transport> {
566 #[allow(dead_code)]
567 client: ::fidl_next::protocol::Client<___T>,
568 }
569
570 impl<___T> LogClient<___T>
571 where
572 ___T: ::fidl_next::Transport,
573 {
574 #[doc = " Dumps all cached logs by calling LogMany() in batches followed by Log() for each new log\n message.\n A null `options` indicates no filtering is requested.\n"]
575 pub fn listen_safe(
576 &self,
577
578 log_listener: impl ::fidl_next::Encode<
579 ::fidl_next::ClientEnd<
580 crate::LogListenerSafe,
581 ::fidl_next::wire::fuchsia::Channel,
582 >,
583 <___T as ::fidl_next::Transport>::SendBuffer,
584 >,
585
586 options: impl ::fidl_next::Encode<
587 ::fidl_next::wire::Box<'static, crate::wire::LogFilterOptions<'static>>,
588 <___T as ::fidl_next::Transport>::SendBuffer,
589 >,
590 ) -> ::fidl_next::SendFuture<'_, ___T>
591 where
592 <___T as ::fidl_next::Transport>::SendBuffer:
593 ::fidl_next::encoder::InternalHandleEncoder,
594 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::Encoder,
595 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::fuchsia::HandleEncoder,
596 {
597 self.listen_safe_with(crate::generic::LogListenSafeRequest {
598 log_listener,
599
600 options,
601 })
602 }
603
604 #[doc = " Dumps all cached logs by calling LogMany() in batches followed by Log() for each new log\n message.\n A null `options` indicates no filtering is requested.\n"]
605 pub fn listen_safe_with<___R>(&self, request: ___R) -> ::fidl_next::SendFuture<'_, ___T>
606 where
607 ___R: ::fidl_next::Encode<
608 crate::wire::LogListenSafeRequest<'static>,
609 <___T as ::fidl_next::Transport>::SendBuffer,
610 >,
611 {
612 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
613 5643638173917143473,
614 <super::ListenSafe as ::fidl_next::Method>::FLEXIBILITY,
615 request,
616 ))
617 }
618 }
619
620 #[repr(transparent)]
622 pub struct LogServer<___T: ::fidl_next::Transport> {
623 server: ::fidl_next::protocol::Server<___T>,
624 }
625
626 impl<___T> LogServer<___T> where ___T: ::fidl_next::Transport {}
627 }
628}
629
630#[diagnostic::on_unimplemented(
631 note = "If {Self} implements the non-local LogClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
632)]
633
634pub trait LogLocalClientHandler<
638 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
639 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
640>
641{
642}
643
644impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for Log
645where
646 ___H: LogLocalClientHandler<___T>,
647 ___T: ::fidl_next::Transport,
648{
649 async fn on_event(
650 handler: &mut ___H,
651 mut message: ::fidl_next::Message<___T>,
652 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
653 match *message.header().ordinal {
654 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
655 }
656 }
657}
658
659#[diagnostic::on_unimplemented(
660 note = "If {Self} implements the non-local LogServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
661)]
662
663pub trait LogLocalServerHandler<
667 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
668 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
669>
670{
671 #[doc = " Dumps all cached logs by calling LogMany() in batches followed by Log() for each new log\n message.\n A null `options` indicates no filtering is requested.\n"]
672 fn listen_safe(
673 &mut self,
674
675 request: ::fidl_next::Request<log::ListenSafe, ___T>,
676 ) -> impl ::core::future::Future<Output = ()>;
677}
678
679impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for Log
680where
681 ___H: LogLocalServerHandler<___T>,
682 ___T: ::fidl_next::Transport,
683 for<'de> crate::wire::LogListenSafeRequest<'de>: ::fidl_next::Decode<
684 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
685 Constraint = (),
686 >,
687{
688 async fn on_one_way(
689 handler: &mut ___H,
690 mut message: ::fidl_next::Message<___T>,
691 ) -> ::core::result::Result<
692 (),
693 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
694 > {
695 match *message.header().ordinal {
696 5643638173917143473 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
697 Ok(decoded) => {
698 handler.listen_safe(::fidl_next::Request::from_decoded(decoded)).await;
699 Ok(())
700 }
701 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
702 ordinal: 5643638173917143473,
703 error,
704 }),
705 },
706
707 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
708 }
709 }
710
711 async fn on_two_way(
712 handler: &mut ___H,
713 mut message: ::fidl_next::Message<___T>,
714 responder: ::fidl_next::protocol::Responder<___T>,
715 ) -> ::core::result::Result<
716 (),
717 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
718 > {
719 match *message.header().ordinal {
720 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
721 }
722 }
723}
724
725pub trait LogClientHandler<
729 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
730 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
731>
732{
733}
734
735impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Log
736where
737 ___H: LogClientHandler<___T> + ::core::marker::Send,
738 ___T: ::fidl_next::Transport,
739{
740 async fn on_event(
741 handler: &mut ___H,
742 mut message: ::fidl_next::Message<___T>,
743 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
744 match *message.header().ordinal {
745 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
746 }
747 }
748}
749
750pub trait LogServerHandler<
754 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
755 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
756>
757{
758 #[doc = " Dumps all cached logs by calling LogMany() in batches followed by Log() for each new log\n message.\n A null `options` indicates no filtering is requested.\n"]
759 fn listen_safe(
760 &mut self,
761
762 request: ::fidl_next::Request<log::ListenSafe, ___T>,
763 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
764}
765
766impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Log
767where
768 ___H: LogServerHandler<___T> + ::core::marker::Send,
769 ___T: ::fidl_next::Transport,
770 for<'de> crate::wire::LogListenSafeRequest<'de>: ::fidl_next::Decode<
771 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
772 Constraint = (),
773 >,
774{
775 async fn on_one_way(
776 handler: &mut ___H,
777 mut message: ::fidl_next::Message<___T>,
778 ) -> ::core::result::Result<
779 (),
780 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
781 > {
782 match *message.header().ordinal {
783 5643638173917143473 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
784 Ok(decoded) => {
785 handler.listen_safe(::fidl_next::Request::from_decoded(decoded)).await;
786 Ok(())
787 }
788 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
789 ordinal: 5643638173917143473,
790 error,
791 }),
792 },
793
794 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
795 }
796 }
797
798 async fn on_two_way(
799 handler: &mut ___H,
800 mut message: ::fidl_next::Message<___T>,
801 responder: ::fidl_next::protocol::Responder<___T>,
802 ) -> ::core::result::Result<
803 (),
804 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
805 > {
806 match *message.header().ordinal {
807 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
808 }
809 }
810}
811
812impl<___T> LogClientHandler<___T> for ::fidl_next::IgnoreEvents where ___T: ::fidl_next::Transport {}
813
814impl<___H, ___T> LogLocalClientHandler<___T> for ::fidl_next::Local<___H>
815where
816 ___H: LogClientHandler<___T>,
817 ___T: ::fidl_next::Transport,
818{
819}
820
821impl<___H, ___T> LogLocalServerHandler<___T> for ::fidl_next::Local<___H>
822where
823 ___H: LogServerHandler<___T>,
824 ___T: ::fidl_next::Transport,
825{
826 async fn listen_safe(&mut self, request: ::fidl_next::Request<log::ListenSafe, ___T>) {
827 ___H::listen_safe(&mut self.0, request).await
828 }
829}
830
831#[doc = " Drains a program\'s logs.\n"]
833#[derive(PartialEq, Debug)]
834pub struct LogSink;
835
836impl ::fidl_next::Discoverable for LogSink {
837 const PROTOCOL_NAME: &'static str = "fuchsia.logger.LogSink";
838}
839
840#[cfg(target_os = "fuchsia")]
841impl ::fidl_next::HasTransport for LogSink {
842 type Transport = ::fidl_next::fuchsia::zx::Channel;
843}
844
845pub mod log_sink {
846 pub mod prelude {
847 pub use crate::{
848 LogSink, LogSinkClientHandler, LogSinkLocalClientHandler, LogSinkLocalServerHandler,
849 LogSinkServerHandler, log_sink,
850 };
851
852 pub use crate::natural::InterestChangeError;
853
854 pub use crate::natural::LogSinkOnInitRequest;
855
856 pub use crate::natural::LogSinkWaitForInterestChangeResponse;
857 }
858
859 pub struct OnInit;
860
861 impl ::fidl_next::Method for OnInit {
862 const ORDINAL: u64 = 7052827292487084730;
863 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
864 ::fidl_next::protocol::Flexibility::Flexible;
865
866 type Protocol = crate::LogSink;
867
868 type Request = crate::wire::LogSinkOnInitRequest<'static>;
869 }
870
871 pub struct WaitForInterestChange;
872
873 impl ::fidl_next::Method for WaitForInterestChange {
874 const ORDINAL: u64 = 2138400952013124162;
875 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
876 ::fidl_next::protocol::Flexibility::Strict;
877
878 type Protocol = crate::LogSink;
879
880 type Request = ::fidl_next::wire::EmptyMessageBody;
881 }
882
883 impl ::fidl_next::TwoWayMethod for WaitForInterestChange {
884 type Response = ::fidl_next::wire::Result<
885 'static,
886 crate::wire::LogSinkWaitForInterestChangeResponse<'static>,
887 crate::wire::InterestChangeError,
888 >;
889 }
890
891 impl<___R> ::fidl_next::Respond<___R> for WaitForInterestChange {
892 type Output = ::core::result::Result<
893 crate::generic::LogSinkWaitForInterestChangeResponse<___R>,
894 ::fidl_next::never::Never,
895 >;
896
897 fn respond(response: ___R) -> Self::Output {
898 ::core::result::Result::Ok(crate::generic::LogSinkWaitForInterestChangeResponse {
899 data: response,
900 })
901 }
902 }
903
904 impl<___R> ::fidl_next::RespondErr<___R> for WaitForInterestChange {
905 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
906
907 fn respond_err(response: ___R) -> Self::Output {
908 ::core::result::Result::Err(response)
909 }
910 }
911
912 mod ___detail {
913 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::LogSink
914 where
915 ___T: ::fidl_next::Transport,
916 {
917 type Client = LogSinkClient<___T>;
918 type Server = LogSinkServer<___T>;
919 }
920
921 #[repr(transparent)]
923 pub struct LogSinkClient<___T: ::fidl_next::Transport> {
924 #[allow(dead_code)]
925 client: ::fidl_next::protocol::Client<___T>,
926 }
927
928 impl<___T> LogSinkClient<___T>
929 where
930 ___T: ::fidl_next::Transport,
931 {
932 #[doc = " LogSink implementers will return to this hanging-get whenever the scope of\n their interest changes. Clients are expected to emit messages based on\n the registered Interest. In the event that an empty interest is\n conveyed, clients should emit messages based on their default\n e.g. compile time configuration. Each client may only poll this once at a time.\n Invoking WaitForInterestChange a second time before the first call returns will\n result in an error being returned.\n"]
933 pub fn wait_for_interest_change(
934 &self,
935 ) -> ::fidl_next::TwoWayFuture<'_, super::WaitForInterestChange, ___T> {
936 ::fidl_next::TwoWayFuture::from_untyped(
937 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
938 2138400952013124162,
939 <super::WaitForInterestChange as ::fidl_next::Method>::FLEXIBILITY,
940 (),
941 ),
942 )
943 }
944 }
945
946 #[repr(transparent)]
948 pub struct LogSinkServer<___T: ::fidl_next::Transport> {
949 server: ::fidl_next::protocol::Server<___T>,
950 }
951
952 impl<___T> LogSinkServer<___T>
953 where
954 ___T: ::fidl_next::Transport,
955 {
956 #[doc = " This event is sent whenever Archivist accepts a new connection. Clients may use\n the returned IOBuffer to write logs.\n"]
957
958 pub fn on_init_with<___R>(&self, request: ___R) -> ::fidl_next::SendFuture<'_, ___T>
959 where
960 ___R: ::fidl_next::Encode<
961 <super::OnInit as ::fidl_next::Method>::Request,
962 <___T as ::fidl_next::Transport>::SendBuffer,
963 >,
964 {
965 ::fidl_next::SendFuture::from_untyped(self.server.send_event(
966 7052827292487084730,
967 <super::OnInit as ::fidl_next::Method>::FLEXIBILITY,
968 request,
969 ))
970 }
971 }
972 }
973}
974
975#[diagnostic::on_unimplemented(
976 note = "If {Self} implements the non-local LogSinkClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
977)]
978
979pub trait LogSinkLocalClientHandler<
983 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
984 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
985>
986{
987 #[doc = " This event is sent whenever Archivist accepts a new connection. Clients may use\n the returned IOBuffer to write logs.\n"]
988 fn on_init(
989 &mut self,
990
991 request: ::fidl_next::Request<log_sink::OnInit, ___T>,
992 ) -> impl ::core::future::Future<Output = ()>;
993
994 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
995 ::core::future::ready(())
996 }
997}
998
999impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for LogSink
1000where
1001 ___H: LogSinkLocalClientHandler<___T>,
1002 ___T: ::fidl_next::Transport,
1003 for<'de> crate::wire::LogSinkOnInitRequest<'de>: ::fidl_next::Decode<
1004 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1005 Constraint = (),
1006 >,
1007{
1008 async fn on_event(
1009 handler: &mut ___H,
1010 mut message: ::fidl_next::Message<___T>,
1011 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
1012 match *message.header().ordinal {
1013 7052827292487084730 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
1014 Ok(decoded) => {
1015 handler.on_init(::fidl_next::Request::from_decoded(decoded)).await;
1016 Ok(())
1017 }
1018 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1019 ordinal: 7052827292487084730,
1020 error,
1021 }),
1022 },
1023
1024 ordinal => {
1025 handler.on_unknown_interaction(ordinal).await;
1026 if ::core::matches!(
1027 message.header().flexibility(),
1028 ::fidl_next::protocol::Flexibility::Strict
1029 ) {
1030 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1031 } else {
1032 Ok(())
1033 }
1034 }
1035 }
1036 }
1037}
1038
1039#[diagnostic::on_unimplemented(
1040 note = "If {Self} implements the non-local LogSinkServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
1041)]
1042
1043pub trait LogSinkLocalServerHandler<
1047 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1048 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1049>
1050{
1051 #[doc = " LogSink implementers will return to this hanging-get whenever the scope of\n their interest changes. Clients are expected to emit messages based on\n the registered Interest. In the event that an empty interest is\n conveyed, clients should emit messages based on their default\n e.g. compile time configuration. Each client may only poll this once at a time.\n Invoking WaitForInterestChange a second time before the first call returns will\n result in an error being returned.\n"]
1052 fn wait_for_interest_change(
1053 &mut self,
1054
1055 responder: ::fidl_next::Responder<log_sink::WaitForInterestChange, ___T>,
1056 ) -> impl ::core::future::Future<Output = ()>;
1057
1058 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
1059 ::core::future::ready(())
1060 }
1061}
1062
1063impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for LogSink
1064where
1065 ___H: LogSinkLocalServerHandler<___T>,
1066 ___T: ::fidl_next::Transport,
1067{
1068 async fn on_one_way(
1069 handler: &mut ___H,
1070 mut message: ::fidl_next::Message<___T>,
1071 ) -> ::core::result::Result<
1072 (),
1073 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1074 > {
1075 match *message.header().ordinal {
1076 ordinal => {
1077 handler.on_unknown_interaction(ordinal).await;
1078 if ::core::matches!(
1079 message.header().flexibility(),
1080 ::fidl_next::protocol::Flexibility::Strict
1081 ) {
1082 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1083 } else {
1084 Ok(())
1085 }
1086 }
1087 }
1088 }
1089
1090 async fn on_two_way(
1091 handler: &mut ___H,
1092 mut message: ::fidl_next::Message<___T>,
1093 responder: ::fidl_next::protocol::Responder<___T>,
1094 ) -> ::core::result::Result<
1095 (),
1096 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1097 > {
1098 match *message.header().ordinal {
1099 2138400952013124162 => {
1100 let responder = ::fidl_next::Responder::from_untyped(responder);
1101
1102 handler.wait_for_interest_change(responder).await;
1103 Ok(())
1104 }
1105
1106 ordinal => {
1107 handler.on_unknown_interaction(ordinal).await;
1108 if ::core::matches!(
1109 message.header().flexibility(),
1110 ::fidl_next::protocol::Flexibility::Strict
1111 ) {
1112 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1113 } else {
1114 responder
1115 .respond_framework_error(
1116 ordinal,
1117 ::fidl_next::FrameworkError::UnknownMethod,
1118 )
1119 .expect("encoding a framework error should never fail")
1120 .await?;
1121 Ok(())
1122 }
1123 }
1124 }
1125 }
1126}
1127
1128pub trait LogSinkClientHandler<
1132 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1133 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1134>
1135{
1136 #[doc = " This event is sent whenever Archivist accepts a new connection. Clients may use\n the returned IOBuffer to write logs.\n"]
1137 fn on_init(
1138 &mut self,
1139
1140 request: ::fidl_next::Request<log_sink::OnInit, ___T>,
1141 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1142
1143 fn on_unknown_interaction(
1144 &mut self,
1145 ordinal: u64,
1146 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
1147 ::core::future::ready(())
1148 }
1149}
1150
1151impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for LogSink
1152where
1153 ___H: LogSinkClientHandler<___T> + ::core::marker::Send,
1154 ___T: ::fidl_next::Transport,
1155 for<'de> crate::wire::LogSinkOnInitRequest<'de>: ::fidl_next::Decode<
1156 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1157 Constraint = (),
1158 >,
1159{
1160 async fn on_event(
1161 handler: &mut ___H,
1162 mut message: ::fidl_next::Message<___T>,
1163 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
1164 match *message.header().ordinal {
1165 7052827292487084730 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
1166 Ok(decoded) => {
1167 handler.on_init(::fidl_next::Request::from_decoded(decoded)).await;
1168 Ok(())
1169 }
1170 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1171 ordinal: 7052827292487084730,
1172 error,
1173 }),
1174 },
1175
1176 ordinal => {
1177 handler.on_unknown_interaction(ordinal).await;
1178 if ::core::matches!(
1179 message.header().flexibility(),
1180 ::fidl_next::protocol::Flexibility::Strict
1181 ) {
1182 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1183 } else {
1184 Ok(())
1185 }
1186 }
1187 }
1188 }
1189}
1190
1191pub trait LogSinkServerHandler<
1195 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1196 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1197>
1198{
1199 #[doc = " LogSink implementers will return to this hanging-get whenever the scope of\n their interest changes. Clients are expected to emit messages based on\n the registered Interest. In the event that an empty interest is\n conveyed, clients should emit messages based on their default\n e.g. compile time configuration. Each client may only poll this once at a time.\n Invoking WaitForInterestChange a second time before the first call returns will\n result in an error being returned.\n"]
1200 fn wait_for_interest_change(
1201 &mut self,
1202
1203 responder: ::fidl_next::Responder<log_sink::WaitForInterestChange, ___T>,
1204 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1205
1206 fn on_unknown_interaction(
1207 &mut self,
1208 ordinal: u64,
1209 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
1210 ::core::future::ready(())
1211 }
1212}
1213
1214impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for LogSink
1215where
1216 ___H: LogSinkServerHandler<___T> + ::core::marker::Send,
1217 ___T: ::fidl_next::Transport,
1218{
1219 async fn on_one_way(
1220 handler: &mut ___H,
1221 mut message: ::fidl_next::Message<___T>,
1222 ) -> ::core::result::Result<
1223 (),
1224 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1225 > {
1226 match *message.header().ordinal {
1227 ordinal => {
1228 handler.on_unknown_interaction(ordinal).await;
1229 if ::core::matches!(
1230 message.header().flexibility(),
1231 ::fidl_next::protocol::Flexibility::Strict
1232 ) {
1233 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1234 } else {
1235 Ok(())
1236 }
1237 }
1238 }
1239 }
1240
1241 async fn on_two_way(
1242 handler: &mut ___H,
1243 mut message: ::fidl_next::Message<___T>,
1244 responder: ::fidl_next::protocol::Responder<___T>,
1245 ) -> ::core::result::Result<
1246 (),
1247 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1248 > {
1249 match *message.header().ordinal {
1250 2138400952013124162 => {
1251 let responder = ::fidl_next::Responder::from_untyped(responder);
1252
1253 handler.wait_for_interest_change(responder).await;
1254 Ok(())
1255 }
1256
1257 ordinal => {
1258 handler.on_unknown_interaction(ordinal).await;
1259 if ::core::matches!(
1260 message.header().flexibility(),
1261 ::fidl_next::protocol::Flexibility::Strict
1262 ) {
1263 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1264 } else {
1265 responder
1266 .respond_framework_error(
1267 ordinal,
1268 ::fidl_next::FrameworkError::UnknownMethod,
1269 )
1270 .expect("encoding a framework error should never fail")
1271 .await?;
1272 Ok(())
1273 }
1274 }
1275 }
1276 }
1277}
1278
1279impl<___T> LogSinkClientHandler<___T> for ::fidl_next::IgnoreEvents
1280where
1281 ___T: ::fidl_next::Transport,
1282{
1283 async fn on_init(&mut self, _: ::fidl_next::Request<log_sink::OnInit, ___T>) {}
1284
1285 async fn on_unknown_interaction(&mut self, _: u64) {}
1286}
1287
1288impl<___H, ___T> LogSinkLocalClientHandler<___T> for ::fidl_next::Local<___H>
1289where
1290 ___H: LogSinkClientHandler<___T>,
1291 ___T: ::fidl_next::Transport,
1292{
1293 async fn on_init(&mut self, request: ::fidl_next::Request<log_sink::OnInit, ___T>) {
1294 ___H::on_init(&mut self.0, request).await
1295 }
1296
1297 async fn on_unknown_interaction(&mut self, ordinal: u64) {
1298 ___H::on_unknown_interaction(&mut self.0, ordinal).await
1299 }
1300}
1301
1302impl<___H, ___T> LogSinkLocalServerHandler<___T> for ::fidl_next::Local<___H>
1303where
1304 ___H: LogSinkServerHandler<___T>,
1305 ___T: ::fidl_next::Transport,
1306{
1307 async fn wait_for_interest_change(
1308 &mut self,
1309
1310 responder: ::fidl_next::Responder<log_sink::WaitForInterestChange, ___T>,
1311 ) {
1312 ___H::wait_for_interest_change(&mut self.0, responder).await
1313 }
1314
1315 async fn on_unknown_interaction(&mut self, ordinal: u64) {
1316 ___H::on_unknown_interaction(&mut self.0, ordinal).await
1317 }
1318}
1319
1320pub use fidl_next_common_fuchsia_logger::*;