1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10pub use fidl_fuchsia_metrics_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct MetricEventLoggerFactoryCreateMetricEventLoggerRequest {
16 pub project_spec: ProjectSpec,
17 pub logger: fidl::endpoints::ServerEnd<MetricEventLoggerMarker>,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
21 for MetricEventLoggerFactoryCreateMetricEventLoggerRequest
22{
23}
24
25#[derive(Debug, PartialEq)]
26pub struct MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsRequest {
27 pub project_spec: ProjectSpec,
28 pub experiment_ids: Vec<u32>,
29 pub logger: fidl::endpoints::ServerEnd<MetricEventLoggerMarker>,
30}
31
32impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
33 for MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsRequest
34{
35}
36
37#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
38pub struct MetricEventLoggerMarker;
39
40impl fidl::endpoints::ProtocolMarker for MetricEventLoggerMarker {
41 type Proxy = MetricEventLoggerProxy;
42 type RequestStream = MetricEventLoggerRequestStream;
43 #[cfg(target_os = "fuchsia")]
44 type SynchronousProxy = MetricEventLoggerSynchronousProxy;
45
46 const DEBUG_NAME: &'static str = "(anonymous) MetricEventLogger";
47}
48pub type MetricEventLoggerLogOccurrenceResult = Result<(), Error>;
49pub type MetricEventLoggerLogIntegerResult = Result<(), Error>;
50pub type MetricEventLoggerLogIntegerHistogramResult = Result<(), Error>;
51pub type MetricEventLoggerLogStringResult = Result<(), Error>;
52pub type MetricEventLoggerLogMetricEventsResult = Result<(), Error>;
53
54pub trait MetricEventLoggerProxyInterface: Send + Sync {
55 type LogOccurrenceResponseFut: std::future::Future<Output = Result<MetricEventLoggerLogOccurrenceResult, fidl::Error>>
56 + Send;
57 fn r#log_occurrence(
58 &self,
59 metric_id: u32,
60 count: u64,
61 event_codes: &[u32],
62 ) -> Self::LogOccurrenceResponseFut;
63 type LogIntegerResponseFut: std::future::Future<Output = Result<MetricEventLoggerLogIntegerResult, fidl::Error>>
64 + Send;
65 fn r#log_integer(
66 &self,
67 metric_id: u32,
68 value: i64,
69 event_codes: &[u32],
70 ) -> Self::LogIntegerResponseFut;
71 type LogIntegerHistogramResponseFut: std::future::Future<
72 Output = Result<MetricEventLoggerLogIntegerHistogramResult, fidl::Error>,
73 > + Send;
74 fn r#log_integer_histogram(
75 &self,
76 metric_id: u32,
77 histogram: &[HistogramBucket],
78 event_codes: &[u32],
79 ) -> Self::LogIntegerHistogramResponseFut;
80 type LogStringResponseFut: std::future::Future<Output = Result<MetricEventLoggerLogStringResult, fidl::Error>>
81 + Send;
82 fn r#log_string(
83 &self,
84 metric_id: u32,
85 string_value: &str,
86 event_codes: &[u32],
87 ) -> Self::LogStringResponseFut;
88 type LogMetricEventsResponseFut: std::future::Future<Output = Result<MetricEventLoggerLogMetricEventsResult, fidl::Error>>
89 + Send;
90 fn r#log_metric_events(&self, events: &[MetricEvent]) -> Self::LogMetricEventsResponseFut;
91}
92#[derive(Debug)]
93#[cfg(target_os = "fuchsia")]
94pub struct MetricEventLoggerSynchronousProxy {
95 client: fidl::client::sync::Client,
96}
97
98#[cfg(target_os = "fuchsia")]
99impl fidl::endpoints::SynchronousProxy for MetricEventLoggerSynchronousProxy {
100 type Proxy = MetricEventLoggerProxy;
101 type Protocol = MetricEventLoggerMarker;
102
103 fn from_channel(inner: fidl::Channel) -> Self {
104 Self::new(inner)
105 }
106
107 fn into_channel(self) -> fidl::Channel {
108 self.client.into_channel()
109 }
110
111 fn as_channel(&self) -> &fidl::Channel {
112 self.client.as_channel()
113 }
114}
115
116#[cfg(target_os = "fuchsia")]
117impl MetricEventLoggerSynchronousProxy {
118 pub fn new(channel: fidl::Channel) -> Self {
119 let protocol_name =
120 <MetricEventLoggerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
121 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
122 }
123
124 pub fn into_channel(self) -> fidl::Channel {
125 self.client.into_channel()
126 }
127
128 pub fn wait_for_event(
131 &self,
132 deadline: zx::MonotonicInstant,
133 ) -> Result<MetricEventLoggerEvent, fidl::Error> {
134 MetricEventLoggerEvent::decode(self.client.wait_for_event(deadline)?)
135 }
136
137 pub fn r#log_occurrence(
148 &self,
149 mut metric_id: u32,
150 mut count: u64,
151 mut event_codes: &[u32],
152 ___deadline: zx::MonotonicInstant,
153 ) -> Result<MetricEventLoggerLogOccurrenceResult, fidl::Error> {
154 let _response = self.client.send_query::<
155 MetricEventLoggerLogOccurrenceRequest,
156 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
157 >(
158 (metric_id, count, event_codes,),
159 0x26308985ae2bb3ac,
160 fidl::encoding::DynamicFlags::empty(),
161 ___deadline,
162 )?;
163 Ok(_response.map(|x| x))
164 }
165
166 pub fn r#log_integer(
176 &self,
177 mut metric_id: u32,
178 mut value: i64,
179 mut event_codes: &[u32],
180 ___deadline: zx::MonotonicInstant,
181 ) -> Result<MetricEventLoggerLogIntegerResult, fidl::Error> {
182 let _response = self.client.send_query::<
183 MetricEventLoggerLogIntegerRequest,
184 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
185 >(
186 (metric_id, value, event_codes,),
187 0x5d453303a88bd552,
188 fidl::encoding::DynamicFlags::empty(),
189 ___deadline,
190 )?;
191 Ok(_response.map(|x| x))
192 }
193
194 pub fn r#log_integer_histogram(
205 &self,
206 mut metric_id: u32,
207 mut histogram: &[HistogramBucket],
208 mut event_codes: &[u32],
209 ___deadline: zx::MonotonicInstant,
210 ) -> Result<MetricEventLoggerLogIntegerHistogramResult, fidl::Error> {
211 let _response = self.client.send_query::<
212 MetricEventLoggerLogIntegerHistogramRequest,
213 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
214 >(
215 (metric_id, histogram, event_codes,),
216 0x79ac8a6bc06a01c0,
217 fidl::encoding::DynamicFlags::empty(),
218 ___deadline,
219 )?;
220 Ok(_response.map(|x| x))
221 }
222
223 pub fn r#log_string(
233 &self,
234 mut metric_id: u32,
235 mut string_value: &str,
236 mut event_codes: &[u32],
237 ___deadline: zx::MonotonicInstant,
238 ) -> Result<MetricEventLoggerLogStringResult, fidl::Error> {
239 let _response = self.client.send_query::<
240 MetricEventLoggerLogStringRequest,
241 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
242 >(
243 (metric_id, string_value, event_codes,),
244 0x1611efbdf6ac8300,
245 fidl::encoding::DynamicFlags::empty(),
246 ___deadline,
247 )?;
248 Ok(_response.map(|x| x))
249 }
250
251 pub fn r#log_metric_events(
254 &self,
255 mut events: &[MetricEvent],
256 ___deadline: zx::MonotonicInstant,
257 ) -> Result<MetricEventLoggerLogMetricEventsResult, fidl::Error> {
258 let _response = self.client.send_query::<
259 MetricEventLoggerLogMetricEventsRequest,
260 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
261 >(
262 (events,),
263 0x4d8c26bb74820c6b,
264 fidl::encoding::DynamicFlags::empty(),
265 ___deadline,
266 )?;
267 Ok(_response.map(|x| x))
268 }
269}
270
271#[cfg(target_os = "fuchsia")]
272impl From<MetricEventLoggerSynchronousProxy> for zx::Handle {
273 fn from(value: MetricEventLoggerSynchronousProxy) -> Self {
274 value.into_channel().into()
275 }
276}
277
278#[cfg(target_os = "fuchsia")]
279impl From<fidl::Channel> for MetricEventLoggerSynchronousProxy {
280 fn from(value: fidl::Channel) -> Self {
281 Self::new(value)
282 }
283}
284
285#[derive(Debug, Clone)]
286pub struct MetricEventLoggerProxy {
287 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
288}
289
290impl fidl::endpoints::Proxy for MetricEventLoggerProxy {
291 type Protocol = MetricEventLoggerMarker;
292
293 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
294 Self::new(inner)
295 }
296
297 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
298 self.client.into_channel().map_err(|client| Self { client })
299 }
300
301 fn as_channel(&self) -> &::fidl::AsyncChannel {
302 self.client.as_channel()
303 }
304}
305
306impl MetricEventLoggerProxy {
307 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
309 let protocol_name =
310 <MetricEventLoggerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
311 Self { client: fidl::client::Client::new(channel, protocol_name) }
312 }
313
314 pub fn take_event_stream(&self) -> MetricEventLoggerEventStream {
320 MetricEventLoggerEventStream { event_receiver: self.client.take_event_receiver() }
321 }
322
323 pub fn r#log_occurrence(
334 &self,
335 mut metric_id: u32,
336 mut count: u64,
337 mut event_codes: &[u32],
338 ) -> fidl::client::QueryResponseFut<
339 MetricEventLoggerLogOccurrenceResult,
340 fidl::encoding::DefaultFuchsiaResourceDialect,
341 > {
342 MetricEventLoggerProxyInterface::r#log_occurrence(self, metric_id, count, event_codes)
343 }
344
345 pub fn r#log_integer(
355 &self,
356 mut metric_id: u32,
357 mut value: i64,
358 mut event_codes: &[u32],
359 ) -> fidl::client::QueryResponseFut<
360 MetricEventLoggerLogIntegerResult,
361 fidl::encoding::DefaultFuchsiaResourceDialect,
362 > {
363 MetricEventLoggerProxyInterface::r#log_integer(self, metric_id, value, event_codes)
364 }
365
366 pub fn r#log_integer_histogram(
377 &self,
378 mut metric_id: u32,
379 mut histogram: &[HistogramBucket],
380 mut event_codes: &[u32],
381 ) -> fidl::client::QueryResponseFut<
382 MetricEventLoggerLogIntegerHistogramResult,
383 fidl::encoding::DefaultFuchsiaResourceDialect,
384 > {
385 MetricEventLoggerProxyInterface::r#log_integer_histogram(
386 self,
387 metric_id,
388 histogram,
389 event_codes,
390 )
391 }
392
393 pub fn r#log_string(
403 &self,
404 mut metric_id: u32,
405 mut string_value: &str,
406 mut event_codes: &[u32],
407 ) -> fidl::client::QueryResponseFut<
408 MetricEventLoggerLogStringResult,
409 fidl::encoding::DefaultFuchsiaResourceDialect,
410 > {
411 MetricEventLoggerProxyInterface::r#log_string(self, metric_id, string_value, event_codes)
412 }
413
414 pub fn r#log_metric_events(
417 &self,
418 mut events: &[MetricEvent],
419 ) -> fidl::client::QueryResponseFut<
420 MetricEventLoggerLogMetricEventsResult,
421 fidl::encoding::DefaultFuchsiaResourceDialect,
422 > {
423 MetricEventLoggerProxyInterface::r#log_metric_events(self, events)
424 }
425}
426
427impl MetricEventLoggerProxyInterface for MetricEventLoggerProxy {
428 type LogOccurrenceResponseFut = fidl::client::QueryResponseFut<
429 MetricEventLoggerLogOccurrenceResult,
430 fidl::encoding::DefaultFuchsiaResourceDialect,
431 >;
432 fn r#log_occurrence(
433 &self,
434 mut metric_id: u32,
435 mut count: u64,
436 mut event_codes: &[u32],
437 ) -> Self::LogOccurrenceResponseFut {
438 fn _decode(
439 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
440 ) -> Result<MetricEventLoggerLogOccurrenceResult, fidl::Error> {
441 let _response = fidl::client::decode_transaction_body::<
442 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
443 fidl::encoding::DefaultFuchsiaResourceDialect,
444 0x26308985ae2bb3ac,
445 >(_buf?)?;
446 Ok(_response.map(|x| x))
447 }
448 self.client.send_query_and_decode::<
449 MetricEventLoggerLogOccurrenceRequest,
450 MetricEventLoggerLogOccurrenceResult,
451 >(
452 (metric_id, count, event_codes,),
453 0x26308985ae2bb3ac,
454 fidl::encoding::DynamicFlags::empty(),
455 _decode,
456 )
457 }
458
459 type LogIntegerResponseFut = fidl::client::QueryResponseFut<
460 MetricEventLoggerLogIntegerResult,
461 fidl::encoding::DefaultFuchsiaResourceDialect,
462 >;
463 fn r#log_integer(
464 &self,
465 mut metric_id: u32,
466 mut value: i64,
467 mut event_codes: &[u32],
468 ) -> Self::LogIntegerResponseFut {
469 fn _decode(
470 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
471 ) -> Result<MetricEventLoggerLogIntegerResult, fidl::Error> {
472 let _response = fidl::client::decode_transaction_body::<
473 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
474 fidl::encoding::DefaultFuchsiaResourceDialect,
475 0x5d453303a88bd552,
476 >(_buf?)?;
477 Ok(_response.map(|x| x))
478 }
479 self.client.send_query_and_decode::<
480 MetricEventLoggerLogIntegerRequest,
481 MetricEventLoggerLogIntegerResult,
482 >(
483 (metric_id, value, event_codes,),
484 0x5d453303a88bd552,
485 fidl::encoding::DynamicFlags::empty(),
486 _decode,
487 )
488 }
489
490 type LogIntegerHistogramResponseFut = fidl::client::QueryResponseFut<
491 MetricEventLoggerLogIntegerHistogramResult,
492 fidl::encoding::DefaultFuchsiaResourceDialect,
493 >;
494 fn r#log_integer_histogram(
495 &self,
496 mut metric_id: u32,
497 mut histogram: &[HistogramBucket],
498 mut event_codes: &[u32],
499 ) -> Self::LogIntegerHistogramResponseFut {
500 fn _decode(
501 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
502 ) -> Result<MetricEventLoggerLogIntegerHistogramResult, fidl::Error> {
503 let _response = fidl::client::decode_transaction_body::<
504 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
505 fidl::encoding::DefaultFuchsiaResourceDialect,
506 0x79ac8a6bc06a01c0,
507 >(_buf?)?;
508 Ok(_response.map(|x| x))
509 }
510 self.client.send_query_and_decode::<
511 MetricEventLoggerLogIntegerHistogramRequest,
512 MetricEventLoggerLogIntegerHistogramResult,
513 >(
514 (metric_id, histogram, event_codes,),
515 0x79ac8a6bc06a01c0,
516 fidl::encoding::DynamicFlags::empty(),
517 _decode,
518 )
519 }
520
521 type LogStringResponseFut = fidl::client::QueryResponseFut<
522 MetricEventLoggerLogStringResult,
523 fidl::encoding::DefaultFuchsiaResourceDialect,
524 >;
525 fn r#log_string(
526 &self,
527 mut metric_id: u32,
528 mut string_value: &str,
529 mut event_codes: &[u32],
530 ) -> Self::LogStringResponseFut {
531 fn _decode(
532 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
533 ) -> Result<MetricEventLoggerLogStringResult, fidl::Error> {
534 let _response = fidl::client::decode_transaction_body::<
535 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
536 fidl::encoding::DefaultFuchsiaResourceDialect,
537 0x1611efbdf6ac8300,
538 >(_buf?)?;
539 Ok(_response.map(|x| x))
540 }
541 self.client.send_query_and_decode::<
542 MetricEventLoggerLogStringRequest,
543 MetricEventLoggerLogStringResult,
544 >(
545 (metric_id, string_value, event_codes,),
546 0x1611efbdf6ac8300,
547 fidl::encoding::DynamicFlags::empty(),
548 _decode,
549 )
550 }
551
552 type LogMetricEventsResponseFut = fidl::client::QueryResponseFut<
553 MetricEventLoggerLogMetricEventsResult,
554 fidl::encoding::DefaultFuchsiaResourceDialect,
555 >;
556 fn r#log_metric_events(&self, mut events: &[MetricEvent]) -> Self::LogMetricEventsResponseFut {
557 fn _decode(
558 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
559 ) -> Result<MetricEventLoggerLogMetricEventsResult, fidl::Error> {
560 let _response = fidl::client::decode_transaction_body::<
561 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
562 fidl::encoding::DefaultFuchsiaResourceDialect,
563 0x4d8c26bb74820c6b,
564 >(_buf?)?;
565 Ok(_response.map(|x| x))
566 }
567 self.client.send_query_and_decode::<
568 MetricEventLoggerLogMetricEventsRequest,
569 MetricEventLoggerLogMetricEventsResult,
570 >(
571 (events,),
572 0x4d8c26bb74820c6b,
573 fidl::encoding::DynamicFlags::empty(),
574 _decode,
575 )
576 }
577}
578
579pub struct MetricEventLoggerEventStream {
580 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
581}
582
583impl std::marker::Unpin for MetricEventLoggerEventStream {}
584
585impl futures::stream::FusedStream for MetricEventLoggerEventStream {
586 fn is_terminated(&self) -> bool {
587 self.event_receiver.is_terminated()
588 }
589}
590
591impl futures::Stream for MetricEventLoggerEventStream {
592 type Item = Result<MetricEventLoggerEvent, fidl::Error>;
593
594 fn poll_next(
595 mut self: std::pin::Pin<&mut Self>,
596 cx: &mut std::task::Context<'_>,
597 ) -> std::task::Poll<Option<Self::Item>> {
598 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
599 &mut self.event_receiver,
600 cx
601 )?) {
602 Some(buf) => std::task::Poll::Ready(Some(MetricEventLoggerEvent::decode(buf))),
603 None => std::task::Poll::Ready(None),
604 }
605 }
606}
607
608#[derive(Debug)]
609pub enum MetricEventLoggerEvent {}
610
611impl MetricEventLoggerEvent {
612 fn decode(
614 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
615 ) -> Result<MetricEventLoggerEvent, fidl::Error> {
616 let (bytes, _handles) = buf.split_mut();
617 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
618 debug_assert_eq!(tx_header.tx_id, 0);
619 match tx_header.ordinal {
620 _ => Err(fidl::Error::UnknownOrdinal {
621 ordinal: tx_header.ordinal,
622 protocol_name:
623 <MetricEventLoggerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
624 }),
625 }
626 }
627}
628
629pub struct MetricEventLoggerRequestStream {
631 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
632 is_terminated: bool,
633}
634
635impl std::marker::Unpin for MetricEventLoggerRequestStream {}
636
637impl futures::stream::FusedStream for MetricEventLoggerRequestStream {
638 fn is_terminated(&self) -> bool {
639 self.is_terminated
640 }
641}
642
643impl fidl::endpoints::RequestStream for MetricEventLoggerRequestStream {
644 type Protocol = MetricEventLoggerMarker;
645 type ControlHandle = MetricEventLoggerControlHandle;
646
647 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
648 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
649 }
650
651 fn control_handle(&self) -> Self::ControlHandle {
652 MetricEventLoggerControlHandle { inner: self.inner.clone() }
653 }
654
655 fn into_inner(
656 self,
657 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
658 {
659 (self.inner, self.is_terminated)
660 }
661
662 fn from_inner(
663 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
664 is_terminated: bool,
665 ) -> Self {
666 Self { inner, is_terminated }
667 }
668}
669
670impl futures::Stream for MetricEventLoggerRequestStream {
671 type Item = Result<MetricEventLoggerRequest, fidl::Error>;
672
673 fn poll_next(
674 mut self: std::pin::Pin<&mut Self>,
675 cx: &mut std::task::Context<'_>,
676 ) -> std::task::Poll<Option<Self::Item>> {
677 let this = &mut *self;
678 if this.inner.check_shutdown(cx) {
679 this.is_terminated = true;
680 return std::task::Poll::Ready(None);
681 }
682 if this.is_terminated {
683 panic!("polled MetricEventLoggerRequestStream after completion");
684 }
685 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
686 |bytes, handles| {
687 match this.inner.channel().read_etc(cx, bytes, handles) {
688 std::task::Poll::Ready(Ok(())) => {}
689 std::task::Poll::Pending => return std::task::Poll::Pending,
690 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
691 this.is_terminated = true;
692 return std::task::Poll::Ready(None);
693 }
694 std::task::Poll::Ready(Err(e)) => {
695 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
696 e.into(),
697 ))))
698 }
699 }
700
701 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
703
704 std::task::Poll::Ready(Some(match header.ordinal {
705 0x26308985ae2bb3ac => {
706 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
707 let mut req = fidl::new_empty!(
708 MetricEventLoggerLogOccurrenceRequest,
709 fidl::encoding::DefaultFuchsiaResourceDialect
710 );
711 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MetricEventLoggerLogOccurrenceRequest>(&header, _body_bytes, handles, &mut req)?;
712 let control_handle =
713 MetricEventLoggerControlHandle { inner: this.inner.clone() };
714 Ok(MetricEventLoggerRequest::LogOccurrence {
715 metric_id: req.metric_id,
716 count: req.count,
717 event_codes: req.event_codes,
718
719 responder: MetricEventLoggerLogOccurrenceResponder {
720 control_handle: std::mem::ManuallyDrop::new(control_handle),
721 tx_id: header.tx_id,
722 },
723 })
724 }
725 0x5d453303a88bd552 => {
726 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
727 let mut req = fidl::new_empty!(
728 MetricEventLoggerLogIntegerRequest,
729 fidl::encoding::DefaultFuchsiaResourceDialect
730 );
731 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MetricEventLoggerLogIntegerRequest>(&header, _body_bytes, handles, &mut req)?;
732 let control_handle =
733 MetricEventLoggerControlHandle { inner: this.inner.clone() };
734 Ok(MetricEventLoggerRequest::LogInteger {
735 metric_id: req.metric_id,
736 value: req.value,
737 event_codes: req.event_codes,
738
739 responder: MetricEventLoggerLogIntegerResponder {
740 control_handle: std::mem::ManuallyDrop::new(control_handle),
741 tx_id: header.tx_id,
742 },
743 })
744 }
745 0x79ac8a6bc06a01c0 => {
746 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
747 let mut req = fidl::new_empty!(
748 MetricEventLoggerLogIntegerHistogramRequest,
749 fidl::encoding::DefaultFuchsiaResourceDialect
750 );
751 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MetricEventLoggerLogIntegerHistogramRequest>(&header, _body_bytes, handles, &mut req)?;
752 let control_handle =
753 MetricEventLoggerControlHandle { inner: this.inner.clone() };
754 Ok(MetricEventLoggerRequest::LogIntegerHistogram {
755 metric_id: req.metric_id,
756 histogram: req.histogram,
757 event_codes: req.event_codes,
758
759 responder: MetricEventLoggerLogIntegerHistogramResponder {
760 control_handle: std::mem::ManuallyDrop::new(control_handle),
761 tx_id: header.tx_id,
762 },
763 })
764 }
765 0x1611efbdf6ac8300 => {
766 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
767 let mut req = fidl::new_empty!(
768 MetricEventLoggerLogStringRequest,
769 fidl::encoding::DefaultFuchsiaResourceDialect
770 );
771 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MetricEventLoggerLogStringRequest>(&header, _body_bytes, handles, &mut req)?;
772 let control_handle =
773 MetricEventLoggerControlHandle { inner: this.inner.clone() };
774 Ok(MetricEventLoggerRequest::LogString {
775 metric_id: req.metric_id,
776 string_value: req.string_value,
777 event_codes: req.event_codes,
778
779 responder: MetricEventLoggerLogStringResponder {
780 control_handle: std::mem::ManuallyDrop::new(control_handle),
781 tx_id: header.tx_id,
782 },
783 })
784 }
785 0x4d8c26bb74820c6b => {
786 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
787 let mut req = fidl::new_empty!(
788 MetricEventLoggerLogMetricEventsRequest,
789 fidl::encoding::DefaultFuchsiaResourceDialect
790 );
791 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MetricEventLoggerLogMetricEventsRequest>(&header, _body_bytes, handles, &mut req)?;
792 let control_handle =
793 MetricEventLoggerControlHandle { inner: this.inner.clone() };
794 Ok(MetricEventLoggerRequest::LogMetricEvents {
795 events: req.events,
796
797 responder: MetricEventLoggerLogMetricEventsResponder {
798 control_handle: std::mem::ManuallyDrop::new(control_handle),
799 tx_id: header.tx_id,
800 },
801 })
802 }
803 _ => Err(fidl::Error::UnknownOrdinal {
804 ordinal: header.ordinal,
805 protocol_name:
806 <MetricEventLoggerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
807 }),
808 }))
809 },
810 )
811 }
812}
813
814#[derive(Debug)]
816pub enum MetricEventLoggerRequest {
817 LogOccurrence {
828 metric_id: u32,
829 count: u64,
830 event_codes: Vec<u32>,
831 responder: MetricEventLoggerLogOccurrenceResponder,
832 },
833 LogInteger {
843 metric_id: u32,
844 value: i64,
845 event_codes: Vec<u32>,
846 responder: MetricEventLoggerLogIntegerResponder,
847 },
848 LogIntegerHistogram {
859 metric_id: u32,
860 histogram: Vec<HistogramBucket>,
861 event_codes: Vec<u32>,
862 responder: MetricEventLoggerLogIntegerHistogramResponder,
863 },
864 LogString {
874 metric_id: u32,
875 string_value: String,
876 event_codes: Vec<u32>,
877 responder: MetricEventLoggerLogStringResponder,
878 },
879 LogMetricEvents {
882 events: Vec<MetricEvent>,
883 responder: MetricEventLoggerLogMetricEventsResponder,
884 },
885}
886
887impl MetricEventLoggerRequest {
888 #[allow(irrefutable_let_patterns)]
889 pub fn into_log_occurrence(
890 self,
891 ) -> Option<(u32, u64, Vec<u32>, MetricEventLoggerLogOccurrenceResponder)> {
892 if let MetricEventLoggerRequest::LogOccurrence {
893 metric_id,
894 count,
895 event_codes,
896 responder,
897 } = self
898 {
899 Some((metric_id, count, event_codes, responder))
900 } else {
901 None
902 }
903 }
904
905 #[allow(irrefutable_let_patterns)]
906 pub fn into_log_integer(
907 self,
908 ) -> Option<(u32, i64, Vec<u32>, MetricEventLoggerLogIntegerResponder)> {
909 if let MetricEventLoggerRequest::LogInteger { metric_id, value, event_codes, responder } =
910 self
911 {
912 Some((metric_id, value, event_codes, responder))
913 } else {
914 None
915 }
916 }
917
918 #[allow(irrefutable_let_patterns)]
919 pub fn into_log_integer_histogram(
920 self,
921 ) -> Option<(u32, Vec<HistogramBucket>, Vec<u32>, MetricEventLoggerLogIntegerHistogramResponder)>
922 {
923 if let MetricEventLoggerRequest::LogIntegerHistogram {
924 metric_id,
925 histogram,
926 event_codes,
927 responder,
928 } = self
929 {
930 Some((metric_id, histogram, event_codes, responder))
931 } else {
932 None
933 }
934 }
935
936 #[allow(irrefutable_let_patterns)]
937 pub fn into_log_string(
938 self,
939 ) -> Option<(u32, String, Vec<u32>, MetricEventLoggerLogStringResponder)> {
940 if let MetricEventLoggerRequest::LogString {
941 metric_id,
942 string_value,
943 event_codes,
944 responder,
945 } = self
946 {
947 Some((metric_id, string_value, event_codes, responder))
948 } else {
949 None
950 }
951 }
952
953 #[allow(irrefutable_let_patterns)]
954 pub fn into_log_metric_events(
955 self,
956 ) -> Option<(Vec<MetricEvent>, MetricEventLoggerLogMetricEventsResponder)> {
957 if let MetricEventLoggerRequest::LogMetricEvents { events, responder } = self {
958 Some((events, responder))
959 } else {
960 None
961 }
962 }
963
964 pub fn method_name(&self) -> &'static str {
966 match *self {
967 MetricEventLoggerRequest::LogOccurrence { .. } => "log_occurrence",
968 MetricEventLoggerRequest::LogInteger { .. } => "log_integer",
969 MetricEventLoggerRequest::LogIntegerHistogram { .. } => "log_integer_histogram",
970 MetricEventLoggerRequest::LogString { .. } => "log_string",
971 MetricEventLoggerRequest::LogMetricEvents { .. } => "log_metric_events",
972 }
973 }
974}
975
976#[derive(Debug, Clone)]
977pub struct MetricEventLoggerControlHandle {
978 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
979}
980
981impl fidl::endpoints::ControlHandle for MetricEventLoggerControlHandle {
982 fn shutdown(&self) {
983 self.inner.shutdown()
984 }
985 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
986 self.inner.shutdown_with_epitaph(status)
987 }
988
989 fn is_closed(&self) -> bool {
990 self.inner.channel().is_closed()
991 }
992 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
993 self.inner.channel().on_closed()
994 }
995
996 #[cfg(target_os = "fuchsia")]
997 fn signal_peer(
998 &self,
999 clear_mask: zx::Signals,
1000 set_mask: zx::Signals,
1001 ) -> Result<(), zx_status::Status> {
1002 use fidl::Peered;
1003 self.inner.channel().signal_peer(clear_mask, set_mask)
1004 }
1005}
1006
1007impl MetricEventLoggerControlHandle {}
1008
1009#[must_use = "FIDL methods require a response to be sent"]
1010#[derive(Debug)]
1011pub struct MetricEventLoggerLogOccurrenceResponder {
1012 control_handle: std::mem::ManuallyDrop<MetricEventLoggerControlHandle>,
1013 tx_id: u32,
1014}
1015
1016impl std::ops::Drop for MetricEventLoggerLogOccurrenceResponder {
1020 fn drop(&mut self) {
1021 self.control_handle.shutdown();
1022 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1024 }
1025}
1026
1027impl fidl::endpoints::Responder for MetricEventLoggerLogOccurrenceResponder {
1028 type ControlHandle = MetricEventLoggerControlHandle;
1029
1030 fn control_handle(&self) -> &MetricEventLoggerControlHandle {
1031 &self.control_handle
1032 }
1033
1034 fn drop_without_shutdown(mut self) {
1035 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1037 std::mem::forget(self);
1039 }
1040}
1041
1042impl MetricEventLoggerLogOccurrenceResponder {
1043 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1047 let _result = self.send_raw(result);
1048 if _result.is_err() {
1049 self.control_handle.shutdown();
1050 }
1051 self.drop_without_shutdown();
1052 _result
1053 }
1054
1055 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1057 let _result = self.send_raw(result);
1058 self.drop_without_shutdown();
1059 _result
1060 }
1061
1062 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1063 self.control_handle
1064 .inner
1065 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
1066 result,
1067 self.tx_id,
1068 0x26308985ae2bb3ac,
1069 fidl::encoding::DynamicFlags::empty(),
1070 )
1071 }
1072}
1073
1074#[must_use = "FIDL methods require a response to be sent"]
1075#[derive(Debug)]
1076pub struct MetricEventLoggerLogIntegerResponder {
1077 control_handle: std::mem::ManuallyDrop<MetricEventLoggerControlHandle>,
1078 tx_id: u32,
1079}
1080
1081impl std::ops::Drop for MetricEventLoggerLogIntegerResponder {
1085 fn drop(&mut self) {
1086 self.control_handle.shutdown();
1087 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1089 }
1090}
1091
1092impl fidl::endpoints::Responder for MetricEventLoggerLogIntegerResponder {
1093 type ControlHandle = MetricEventLoggerControlHandle;
1094
1095 fn control_handle(&self) -> &MetricEventLoggerControlHandle {
1096 &self.control_handle
1097 }
1098
1099 fn drop_without_shutdown(mut self) {
1100 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1102 std::mem::forget(self);
1104 }
1105}
1106
1107impl MetricEventLoggerLogIntegerResponder {
1108 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1112 let _result = self.send_raw(result);
1113 if _result.is_err() {
1114 self.control_handle.shutdown();
1115 }
1116 self.drop_without_shutdown();
1117 _result
1118 }
1119
1120 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1122 let _result = self.send_raw(result);
1123 self.drop_without_shutdown();
1124 _result
1125 }
1126
1127 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1128 self.control_handle
1129 .inner
1130 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
1131 result,
1132 self.tx_id,
1133 0x5d453303a88bd552,
1134 fidl::encoding::DynamicFlags::empty(),
1135 )
1136 }
1137}
1138
1139#[must_use = "FIDL methods require a response to be sent"]
1140#[derive(Debug)]
1141pub struct MetricEventLoggerLogIntegerHistogramResponder {
1142 control_handle: std::mem::ManuallyDrop<MetricEventLoggerControlHandle>,
1143 tx_id: u32,
1144}
1145
1146impl std::ops::Drop for MetricEventLoggerLogIntegerHistogramResponder {
1150 fn drop(&mut self) {
1151 self.control_handle.shutdown();
1152 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1154 }
1155}
1156
1157impl fidl::endpoints::Responder for MetricEventLoggerLogIntegerHistogramResponder {
1158 type ControlHandle = MetricEventLoggerControlHandle;
1159
1160 fn control_handle(&self) -> &MetricEventLoggerControlHandle {
1161 &self.control_handle
1162 }
1163
1164 fn drop_without_shutdown(mut self) {
1165 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1167 std::mem::forget(self);
1169 }
1170}
1171
1172impl MetricEventLoggerLogIntegerHistogramResponder {
1173 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1177 let _result = self.send_raw(result);
1178 if _result.is_err() {
1179 self.control_handle.shutdown();
1180 }
1181 self.drop_without_shutdown();
1182 _result
1183 }
1184
1185 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1187 let _result = self.send_raw(result);
1188 self.drop_without_shutdown();
1189 _result
1190 }
1191
1192 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1193 self.control_handle
1194 .inner
1195 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
1196 result,
1197 self.tx_id,
1198 0x79ac8a6bc06a01c0,
1199 fidl::encoding::DynamicFlags::empty(),
1200 )
1201 }
1202}
1203
1204#[must_use = "FIDL methods require a response to be sent"]
1205#[derive(Debug)]
1206pub struct MetricEventLoggerLogStringResponder {
1207 control_handle: std::mem::ManuallyDrop<MetricEventLoggerControlHandle>,
1208 tx_id: u32,
1209}
1210
1211impl std::ops::Drop for MetricEventLoggerLogStringResponder {
1215 fn drop(&mut self) {
1216 self.control_handle.shutdown();
1217 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1219 }
1220}
1221
1222impl fidl::endpoints::Responder for MetricEventLoggerLogStringResponder {
1223 type ControlHandle = MetricEventLoggerControlHandle;
1224
1225 fn control_handle(&self) -> &MetricEventLoggerControlHandle {
1226 &self.control_handle
1227 }
1228
1229 fn drop_without_shutdown(mut self) {
1230 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1232 std::mem::forget(self);
1234 }
1235}
1236
1237impl MetricEventLoggerLogStringResponder {
1238 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1242 let _result = self.send_raw(result);
1243 if _result.is_err() {
1244 self.control_handle.shutdown();
1245 }
1246 self.drop_without_shutdown();
1247 _result
1248 }
1249
1250 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1252 let _result = self.send_raw(result);
1253 self.drop_without_shutdown();
1254 _result
1255 }
1256
1257 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1258 self.control_handle
1259 .inner
1260 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
1261 result,
1262 self.tx_id,
1263 0x1611efbdf6ac8300,
1264 fidl::encoding::DynamicFlags::empty(),
1265 )
1266 }
1267}
1268
1269#[must_use = "FIDL methods require a response to be sent"]
1270#[derive(Debug)]
1271pub struct MetricEventLoggerLogMetricEventsResponder {
1272 control_handle: std::mem::ManuallyDrop<MetricEventLoggerControlHandle>,
1273 tx_id: u32,
1274}
1275
1276impl std::ops::Drop for MetricEventLoggerLogMetricEventsResponder {
1280 fn drop(&mut self) {
1281 self.control_handle.shutdown();
1282 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1284 }
1285}
1286
1287impl fidl::endpoints::Responder for MetricEventLoggerLogMetricEventsResponder {
1288 type ControlHandle = MetricEventLoggerControlHandle;
1289
1290 fn control_handle(&self) -> &MetricEventLoggerControlHandle {
1291 &self.control_handle
1292 }
1293
1294 fn drop_without_shutdown(mut self) {
1295 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1297 std::mem::forget(self);
1299 }
1300}
1301
1302impl MetricEventLoggerLogMetricEventsResponder {
1303 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1307 let _result = self.send_raw(result);
1308 if _result.is_err() {
1309 self.control_handle.shutdown();
1310 }
1311 self.drop_without_shutdown();
1312 _result
1313 }
1314
1315 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1317 let _result = self.send_raw(result);
1318 self.drop_without_shutdown();
1319 _result
1320 }
1321
1322 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1323 self.control_handle
1324 .inner
1325 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
1326 result,
1327 self.tx_id,
1328 0x4d8c26bb74820c6b,
1329 fidl::encoding::DynamicFlags::empty(),
1330 )
1331 }
1332}
1333
1334#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1335pub struct MetricEventLoggerFactoryMarker;
1336
1337impl fidl::endpoints::ProtocolMarker for MetricEventLoggerFactoryMarker {
1338 type Proxy = MetricEventLoggerFactoryProxy;
1339 type RequestStream = MetricEventLoggerFactoryRequestStream;
1340 #[cfg(target_os = "fuchsia")]
1341 type SynchronousProxy = MetricEventLoggerFactorySynchronousProxy;
1342
1343 const DEBUG_NAME: &'static str = "fuchsia.metrics.MetricEventLoggerFactory";
1344}
1345impl fidl::endpoints::DiscoverableProtocolMarker for MetricEventLoggerFactoryMarker {}
1346pub type MetricEventLoggerFactoryCreateMetricEventLoggerResult = Result<(), Error>;
1347pub type MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsResult = Result<(), Error>;
1348
1349pub trait MetricEventLoggerFactoryProxyInterface: Send + Sync {
1350 type CreateMetricEventLoggerResponseFut: std::future::Future<
1351 Output = Result<MetricEventLoggerFactoryCreateMetricEventLoggerResult, fidl::Error>,
1352 > + Send;
1353 fn r#create_metric_event_logger(
1354 &self,
1355 project_spec: &ProjectSpec,
1356 logger: fidl::endpoints::ServerEnd<MetricEventLoggerMarker>,
1357 ) -> Self::CreateMetricEventLoggerResponseFut;
1358 type CreateMetricEventLoggerWithExperimentsResponseFut: std::future::Future<
1359 Output = Result<
1360 MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsResult,
1361 fidl::Error,
1362 >,
1363 > + Send;
1364 fn r#create_metric_event_logger_with_experiments(
1365 &self,
1366 project_spec: &ProjectSpec,
1367 experiment_ids: &[u32],
1368 logger: fidl::endpoints::ServerEnd<MetricEventLoggerMarker>,
1369 ) -> Self::CreateMetricEventLoggerWithExperimentsResponseFut;
1370}
1371#[derive(Debug)]
1372#[cfg(target_os = "fuchsia")]
1373pub struct MetricEventLoggerFactorySynchronousProxy {
1374 client: fidl::client::sync::Client,
1375}
1376
1377#[cfg(target_os = "fuchsia")]
1378impl fidl::endpoints::SynchronousProxy for MetricEventLoggerFactorySynchronousProxy {
1379 type Proxy = MetricEventLoggerFactoryProxy;
1380 type Protocol = MetricEventLoggerFactoryMarker;
1381
1382 fn from_channel(inner: fidl::Channel) -> Self {
1383 Self::new(inner)
1384 }
1385
1386 fn into_channel(self) -> fidl::Channel {
1387 self.client.into_channel()
1388 }
1389
1390 fn as_channel(&self) -> &fidl::Channel {
1391 self.client.as_channel()
1392 }
1393}
1394
1395#[cfg(target_os = "fuchsia")]
1396impl MetricEventLoggerFactorySynchronousProxy {
1397 pub fn new(channel: fidl::Channel) -> Self {
1398 let protocol_name =
1399 <MetricEventLoggerFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1400 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1401 }
1402
1403 pub fn into_channel(self) -> fidl::Channel {
1404 self.client.into_channel()
1405 }
1406
1407 pub fn wait_for_event(
1410 &self,
1411 deadline: zx::MonotonicInstant,
1412 ) -> Result<MetricEventLoggerFactoryEvent, fidl::Error> {
1413 MetricEventLoggerFactoryEvent::decode(self.client.wait_for_event(deadline)?)
1414 }
1415
1416 pub fn r#create_metric_event_logger(
1418 &self,
1419 mut project_spec: &ProjectSpec,
1420 mut logger: fidl::endpoints::ServerEnd<MetricEventLoggerMarker>,
1421 ___deadline: zx::MonotonicInstant,
1422 ) -> Result<MetricEventLoggerFactoryCreateMetricEventLoggerResult, fidl::Error> {
1423 let _response = self.client.send_query::<
1424 MetricEventLoggerFactoryCreateMetricEventLoggerRequest,
1425 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
1426 >(
1427 (project_spec, logger,),
1428 0xd6cf51cee5039fe,
1429 fidl::encoding::DynamicFlags::empty(),
1430 ___deadline,
1431 )?;
1432 Ok(_response.map(|x| x))
1433 }
1434
1435 pub fn r#create_metric_event_logger_with_experiments(
1444 &self,
1445 mut project_spec: &ProjectSpec,
1446 mut experiment_ids: &[u32],
1447 mut logger: fidl::endpoints::ServerEnd<MetricEventLoggerMarker>,
1448 ___deadline: zx::MonotonicInstant,
1449 ) -> Result<MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsResult, fidl::Error>
1450 {
1451 let _response = self.client.send_query::<
1452 MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsRequest,
1453 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
1454 >(
1455 (project_spec, experiment_ids, logger,),
1456 0x7f1f745ef7bf48fa,
1457 fidl::encoding::DynamicFlags::empty(),
1458 ___deadline,
1459 )?;
1460 Ok(_response.map(|x| x))
1461 }
1462}
1463
1464#[cfg(target_os = "fuchsia")]
1465impl From<MetricEventLoggerFactorySynchronousProxy> for zx::Handle {
1466 fn from(value: MetricEventLoggerFactorySynchronousProxy) -> Self {
1467 value.into_channel().into()
1468 }
1469}
1470
1471#[cfg(target_os = "fuchsia")]
1472impl From<fidl::Channel> for MetricEventLoggerFactorySynchronousProxy {
1473 fn from(value: fidl::Channel) -> Self {
1474 Self::new(value)
1475 }
1476}
1477
1478#[derive(Debug, Clone)]
1479pub struct MetricEventLoggerFactoryProxy {
1480 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1481}
1482
1483impl fidl::endpoints::Proxy for MetricEventLoggerFactoryProxy {
1484 type Protocol = MetricEventLoggerFactoryMarker;
1485
1486 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1487 Self::new(inner)
1488 }
1489
1490 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1491 self.client.into_channel().map_err(|client| Self { client })
1492 }
1493
1494 fn as_channel(&self) -> &::fidl::AsyncChannel {
1495 self.client.as_channel()
1496 }
1497}
1498
1499impl MetricEventLoggerFactoryProxy {
1500 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1502 let protocol_name =
1503 <MetricEventLoggerFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1504 Self { client: fidl::client::Client::new(channel, protocol_name) }
1505 }
1506
1507 pub fn take_event_stream(&self) -> MetricEventLoggerFactoryEventStream {
1513 MetricEventLoggerFactoryEventStream { event_receiver: self.client.take_event_receiver() }
1514 }
1515
1516 pub fn r#create_metric_event_logger(
1518 &self,
1519 mut project_spec: &ProjectSpec,
1520 mut logger: fidl::endpoints::ServerEnd<MetricEventLoggerMarker>,
1521 ) -> fidl::client::QueryResponseFut<
1522 MetricEventLoggerFactoryCreateMetricEventLoggerResult,
1523 fidl::encoding::DefaultFuchsiaResourceDialect,
1524 > {
1525 MetricEventLoggerFactoryProxyInterface::r#create_metric_event_logger(
1526 self,
1527 project_spec,
1528 logger,
1529 )
1530 }
1531
1532 pub fn r#create_metric_event_logger_with_experiments(
1541 &self,
1542 mut project_spec: &ProjectSpec,
1543 mut experiment_ids: &[u32],
1544 mut logger: fidl::endpoints::ServerEnd<MetricEventLoggerMarker>,
1545 ) -> fidl::client::QueryResponseFut<
1546 MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsResult,
1547 fidl::encoding::DefaultFuchsiaResourceDialect,
1548 > {
1549 MetricEventLoggerFactoryProxyInterface::r#create_metric_event_logger_with_experiments(
1550 self,
1551 project_spec,
1552 experiment_ids,
1553 logger,
1554 )
1555 }
1556}
1557
1558impl MetricEventLoggerFactoryProxyInterface for MetricEventLoggerFactoryProxy {
1559 type CreateMetricEventLoggerResponseFut = fidl::client::QueryResponseFut<
1560 MetricEventLoggerFactoryCreateMetricEventLoggerResult,
1561 fidl::encoding::DefaultFuchsiaResourceDialect,
1562 >;
1563 fn r#create_metric_event_logger(
1564 &self,
1565 mut project_spec: &ProjectSpec,
1566 mut logger: fidl::endpoints::ServerEnd<MetricEventLoggerMarker>,
1567 ) -> Self::CreateMetricEventLoggerResponseFut {
1568 fn _decode(
1569 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1570 ) -> Result<MetricEventLoggerFactoryCreateMetricEventLoggerResult, fidl::Error> {
1571 let _response = fidl::client::decode_transaction_body::<
1572 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
1573 fidl::encoding::DefaultFuchsiaResourceDialect,
1574 0xd6cf51cee5039fe,
1575 >(_buf?)?;
1576 Ok(_response.map(|x| x))
1577 }
1578 self.client.send_query_and_decode::<
1579 MetricEventLoggerFactoryCreateMetricEventLoggerRequest,
1580 MetricEventLoggerFactoryCreateMetricEventLoggerResult,
1581 >(
1582 (project_spec, logger,),
1583 0xd6cf51cee5039fe,
1584 fidl::encoding::DynamicFlags::empty(),
1585 _decode,
1586 )
1587 }
1588
1589 type CreateMetricEventLoggerWithExperimentsResponseFut = fidl::client::QueryResponseFut<
1590 MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsResult,
1591 fidl::encoding::DefaultFuchsiaResourceDialect,
1592 >;
1593 fn r#create_metric_event_logger_with_experiments(
1594 &self,
1595 mut project_spec: &ProjectSpec,
1596 mut experiment_ids: &[u32],
1597 mut logger: fidl::endpoints::ServerEnd<MetricEventLoggerMarker>,
1598 ) -> Self::CreateMetricEventLoggerWithExperimentsResponseFut {
1599 fn _decode(
1600 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1601 ) -> Result<MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsResult, fidl::Error>
1602 {
1603 let _response = fidl::client::decode_transaction_body::<
1604 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
1605 fidl::encoding::DefaultFuchsiaResourceDialect,
1606 0x7f1f745ef7bf48fa,
1607 >(_buf?)?;
1608 Ok(_response.map(|x| x))
1609 }
1610 self.client.send_query_and_decode::<
1611 MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsRequest,
1612 MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsResult,
1613 >(
1614 (project_spec, experiment_ids, logger,),
1615 0x7f1f745ef7bf48fa,
1616 fidl::encoding::DynamicFlags::empty(),
1617 _decode,
1618 )
1619 }
1620}
1621
1622pub struct MetricEventLoggerFactoryEventStream {
1623 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1624}
1625
1626impl std::marker::Unpin for MetricEventLoggerFactoryEventStream {}
1627
1628impl futures::stream::FusedStream for MetricEventLoggerFactoryEventStream {
1629 fn is_terminated(&self) -> bool {
1630 self.event_receiver.is_terminated()
1631 }
1632}
1633
1634impl futures::Stream for MetricEventLoggerFactoryEventStream {
1635 type Item = Result<MetricEventLoggerFactoryEvent, fidl::Error>;
1636
1637 fn poll_next(
1638 mut self: std::pin::Pin<&mut Self>,
1639 cx: &mut std::task::Context<'_>,
1640 ) -> std::task::Poll<Option<Self::Item>> {
1641 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1642 &mut self.event_receiver,
1643 cx
1644 )?) {
1645 Some(buf) => std::task::Poll::Ready(Some(MetricEventLoggerFactoryEvent::decode(buf))),
1646 None => std::task::Poll::Ready(None),
1647 }
1648 }
1649}
1650
1651#[derive(Debug)]
1652pub enum MetricEventLoggerFactoryEvent {}
1653
1654impl MetricEventLoggerFactoryEvent {
1655 fn decode(
1657 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1658 ) -> Result<MetricEventLoggerFactoryEvent, fidl::Error> {
1659 let (bytes, _handles) = buf.split_mut();
1660 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1661 debug_assert_eq!(tx_header.tx_id, 0);
1662 match tx_header.ordinal {
1663 _ => Err(fidl::Error::UnknownOrdinal {
1664 ordinal: tx_header.ordinal,
1665 protocol_name:
1666 <MetricEventLoggerFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1667 }),
1668 }
1669 }
1670}
1671
1672pub struct MetricEventLoggerFactoryRequestStream {
1674 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1675 is_terminated: bool,
1676}
1677
1678impl std::marker::Unpin for MetricEventLoggerFactoryRequestStream {}
1679
1680impl futures::stream::FusedStream for MetricEventLoggerFactoryRequestStream {
1681 fn is_terminated(&self) -> bool {
1682 self.is_terminated
1683 }
1684}
1685
1686impl fidl::endpoints::RequestStream for MetricEventLoggerFactoryRequestStream {
1687 type Protocol = MetricEventLoggerFactoryMarker;
1688 type ControlHandle = MetricEventLoggerFactoryControlHandle;
1689
1690 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1691 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1692 }
1693
1694 fn control_handle(&self) -> Self::ControlHandle {
1695 MetricEventLoggerFactoryControlHandle { inner: self.inner.clone() }
1696 }
1697
1698 fn into_inner(
1699 self,
1700 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1701 {
1702 (self.inner, self.is_terminated)
1703 }
1704
1705 fn from_inner(
1706 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1707 is_terminated: bool,
1708 ) -> Self {
1709 Self { inner, is_terminated }
1710 }
1711}
1712
1713impl futures::Stream for MetricEventLoggerFactoryRequestStream {
1714 type Item = Result<MetricEventLoggerFactoryRequest, fidl::Error>;
1715
1716 fn poll_next(
1717 mut self: std::pin::Pin<&mut Self>,
1718 cx: &mut std::task::Context<'_>,
1719 ) -> std::task::Poll<Option<Self::Item>> {
1720 let this = &mut *self;
1721 if this.inner.check_shutdown(cx) {
1722 this.is_terminated = true;
1723 return std::task::Poll::Ready(None);
1724 }
1725 if this.is_terminated {
1726 panic!("polled MetricEventLoggerFactoryRequestStream after completion");
1727 }
1728 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1729 |bytes, handles| {
1730 match this.inner.channel().read_etc(cx, bytes, handles) {
1731 std::task::Poll::Ready(Ok(())) => {}
1732 std::task::Poll::Pending => return std::task::Poll::Pending,
1733 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1734 this.is_terminated = true;
1735 return std::task::Poll::Ready(None);
1736 }
1737 std::task::Poll::Ready(Err(e)) => {
1738 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1739 e.into(),
1740 ))))
1741 }
1742 }
1743
1744 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1746
1747 std::task::Poll::Ready(Some(match header.ordinal {
1748 0xd6cf51cee5039fe => {
1749 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1750 let mut req = fidl::new_empty!(MetricEventLoggerFactoryCreateMetricEventLoggerRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1751 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MetricEventLoggerFactoryCreateMetricEventLoggerRequest>(&header, _body_bytes, handles, &mut req)?;
1752 let control_handle = MetricEventLoggerFactoryControlHandle {
1753 inner: this.inner.clone(),
1754 };
1755 Ok(MetricEventLoggerFactoryRequest::CreateMetricEventLogger {project_spec: req.project_spec,
1756logger: req.logger,
1757
1758 responder: MetricEventLoggerFactoryCreateMetricEventLoggerResponder {
1759 control_handle: std::mem::ManuallyDrop::new(control_handle),
1760 tx_id: header.tx_id,
1761 },
1762 })
1763 }
1764 0x7f1f745ef7bf48fa => {
1765 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1766 let mut req = fidl::new_empty!(MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1767 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsRequest>(&header, _body_bytes, handles, &mut req)?;
1768 let control_handle = MetricEventLoggerFactoryControlHandle {
1769 inner: this.inner.clone(),
1770 };
1771 Ok(MetricEventLoggerFactoryRequest::CreateMetricEventLoggerWithExperiments {project_spec: req.project_spec,
1772experiment_ids: req.experiment_ids,
1773logger: req.logger,
1774
1775 responder: MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsResponder {
1776 control_handle: std::mem::ManuallyDrop::new(control_handle),
1777 tx_id: header.tx_id,
1778 },
1779 })
1780 }
1781 _ => Err(fidl::Error::UnknownOrdinal {
1782 ordinal: header.ordinal,
1783 protocol_name: <MetricEventLoggerFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1784 }),
1785 }))
1786 },
1787 )
1788 }
1789}
1790
1791#[derive(Debug)]
1793pub enum MetricEventLoggerFactoryRequest {
1794 CreateMetricEventLogger {
1796 project_spec: ProjectSpec,
1797 logger: fidl::endpoints::ServerEnd<MetricEventLoggerMarker>,
1798 responder: MetricEventLoggerFactoryCreateMetricEventLoggerResponder,
1799 },
1800 CreateMetricEventLoggerWithExperiments {
1809 project_spec: ProjectSpec,
1810 experiment_ids: Vec<u32>,
1811 logger: fidl::endpoints::ServerEnd<MetricEventLoggerMarker>,
1812 responder: MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsResponder,
1813 },
1814}
1815
1816impl MetricEventLoggerFactoryRequest {
1817 #[allow(irrefutable_let_patterns)]
1818 pub fn into_create_metric_event_logger(
1819 self,
1820 ) -> Option<(
1821 ProjectSpec,
1822 fidl::endpoints::ServerEnd<MetricEventLoggerMarker>,
1823 MetricEventLoggerFactoryCreateMetricEventLoggerResponder,
1824 )> {
1825 if let MetricEventLoggerFactoryRequest::CreateMetricEventLogger {
1826 project_spec,
1827 logger,
1828 responder,
1829 } = self
1830 {
1831 Some((project_spec, logger, responder))
1832 } else {
1833 None
1834 }
1835 }
1836
1837 #[allow(irrefutable_let_patterns)]
1838 pub fn into_create_metric_event_logger_with_experiments(
1839 self,
1840 ) -> Option<(
1841 ProjectSpec,
1842 Vec<u32>,
1843 fidl::endpoints::ServerEnd<MetricEventLoggerMarker>,
1844 MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsResponder,
1845 )> {
1846 if let MetricEventLoggerFactoryRequest::CreateMetricEventLoggerWithExperiments {
1847 project_spec,
1848 experiment_ids,
1849 logger,
1850 responder,
1851 } = self
1852 {
1853 Some((project_spec, experiment_ids, logger, responder))
1854 } else {
1855 None
1856 }
1857 }
1858
1859 pub fn method_name(&self) -> &'static str {
1861 match *self {
1862 MetricEventLoggerFactoryRequest::CreateMetricEventLogger { .. } => {
1863 "create_metric_event_logger"
1864 }
1865 MetricEventLoggerFactoryRequest::CreateMetricEventLoggerWithExperiments { .. } => {
1866 "create_metric_event_logger_with_experiments"
1867 }
1868 }
1869 }
1870}
1871
1872#[derive(Debug, Clone)]
1873pub struct MetricEventLoggerFactoryControlHandle {
1874 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1875}
1876
1877impl fidl::endpoints::ControlHandle for MetricEventLoggerFactoryControlHandle {
1878 fn shutdown(&self) {
1879 self.inner.shutdown()
1880 }
1881 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1882 self.inner.shutdown_with_epitaph(status)
1883 }
1884
1885 fn is_closed(&self) -> bool {
1886 self.inner.channel().is_closed()
1887 }
1888 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1889 self.inner.channel().on_closed()
1890 }
1891
1892 #[cfg(target_os = "fuchsia")]
1893 fn signal_peer(
1894 &self,
1895 clear_mask: zx::Signals,
1896 set_mask: zx::Signals,
1897 ) -> Result<(), zx_status::Status> {
1898 use fidl::Peered;
1899 self.inner.channel().signal_peer(clear_mask, set_mask)
1900 }
1901}
1902
1903impl MetricEventLoggerFactoryControlHandle {}
1904
1905#[must_use = "FIDL methods require a response to be sent"]
1906#[derive(Debug)]
1907pub struct MetricEventLoggerFactoryCreateMetricEventLoggerResponder {
1908 control_handle: std::mem::ManuallyDrop<MetricEventLoggerFactoryControlHandle>,
1909 tx_id: u32,
1910}
1911
1912impl std::ops::Drop for MetricEventLoggerFactoryCreateMetricEventLoggerResponder {
1916 fn drop(&mut self) {
1917 self.control_handle.shutdown();
1918 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1920 }
1921}
1922
1923impl fidl::endpoints::Responder for MetricEventLoggerFactoryCreateMetricEventLoggerResponder {
1924 type ControlHandle = MetricEventLoggerFactoryControlHandle;
1925
1926 fn control_handle(&self) -> &MetricEventLoggerFactoryControlHandle {
1927 &self.control_handle
1928 }
1929
1930 fn drop_without_shutdown(mut self) {
1931 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1933 std::mem::forget(self);
1935 }
1936}
1937
1938impl MetricEventLoggerFactoryCreateMetricEventLoggerResponder {
1939 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1943 let _result = self.send_raw(result);
1944 if _result.is_err() {
1945 self.control_handle.shutdown();
1946 }
1947 self.drop_without_shutdown();
1948 _result
1949 }
1950
1951 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1953 let _result = self.send_raw(result);
1954 self.drop_without_shutdown();
1955 _result
1956 }
1957
1958 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1959 self.control_handle
1960 .inner
1961 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
1962 result,
1963 self.tx_id,
1964 0xd6cf51cee5039fe,
1965 fidl::encoding::DynamicFlags::empty(),
1966 )
1967 }
1968}
1969
1970#[must_use = "FIDL methods require a response to be sent"]
1971#[derive(Debug)]
1972pub struct MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsResponder {
1973 control_handle: std::mem::ManuallyDrop<MetricEventLoggerFactoryControlHandle>,
1974 tx_id: u32,
1975}
1976
1977impl std::ops::Drop for MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsResponder {
1981 fn drop(&mut self) {
1982 self.control_handle.shutdown();
1983 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1985 }
1986}
1987
1988impl fidl::endpoints::Responder
1989 for MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsResponder
1990{
1991 type ControlHandle = MetricEventLoggerFactoryControlHandle;
1992
1993 fn control_handle(&self) -> &MetricEventLoggerFactoryControlHandle {
1994 &self.control_handle
1995 }
1996
1997 fn drop_without_shutdown(mut self) {
1998 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2000 std::mem::forget(self);
2002 }
2003}
2004
2005impl MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsResponder {
2006 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2010 let _result = self.send_raw(result);
2011 if _result.is_err() {
2012 self.control_handle.shutdown();
2013 }
2014 self.drop_without_shutdown();
2015 _result
2016 }
2017
2018 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2020 let _result = self.send_raw(result);
2021 self.drop_without_shutdown();
2022 _result
2023 }
2024
2025 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2026 self.control_handle
2027 .inner
2028 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
2029 result,
2030 self.tx_id,
2031 0x7f1f745ef7bf48fa,
2032 fidl::encoding::DynamicFlags::empty(),
2033 )
2034 }
2035}
2036
2037mod internal {
2038 use super::*;
2039
2040 impl fidl::encoding::ResourceTypeMarker for MetricEventLoggerFactoryCreateMetricEventLoggerRequest {
2041 type Borrowed<'a> = &'a mut Self;
2042 fn take_or_borrow<'a>(
2043 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2044 ) -> Self::Borrowed<'a> {
2045 value
2046 }
2047 }
2048
2049 unsafe impl fidl::encoding::TypeMarker for MetricEventLoggerFactoryCreateMetricEventLoggerRequest {
2050 type Owned = Self;
2051
2052 #[inline(always)]
2053 fn inline_align(_context: fidl::encoding::Context) -> usize {
2054 8
2055 }
2056
2057 #[inline(always)]
2058 fn inline_size(_context: fidl::encoding::Context) -> usize {
2059 24
2060 }
2061 }
2062
2063 unsafe impl
2064 fidl::encoding::Encode<
2065 MetricEventLoggerFactoryCreateMetricEventLoggerRequest,
2066 fidl::encoding::DefaultFuchsiaResourceDialect,
2067 > for &mut MetricEventLoggerFactoryCreateMetricEventLoggerRequest
2068 {
2069 #[inline]
2070 unsafe fn encode(
2071 self,
2072 encoder: &mut fidl::encoding::Encoder<
2073 '_,
2074 fidl::encoding::DefaultFuchsiaResourceDialect,
2075 >,
2076 offset: usize,
2077 _depth: fidl::encoding::Depth,
2078 ) -> fidl::Result<()> {
2079 encoder.debug_check_bounds::<MetricEventLoggerFactoryCreateMetricEventLoggerRequest>(
2080 offset,
2081 );
2082 fidl::encoding::Encode::<MetricEventLoggerFactoryCreateMetricEventLoggerRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2084 (
2085 <ProjectSpec as fidl::encoding::ValueTypeMarker>::borrow(&self.project_spec),
2086 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MetricEventLoggerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.logger),
2087 ),
2088 encoder, offset, _depth
2089 )
2090 }
2091 }
2092 unsafe impl<
2093 T0: fidl::encoding::Encode<ProjectSpec, fidl::encoding::DefaultFuchsiaResourceDialect>,
2094 T1: fidl::encoding::Encode<
2095 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MetricEventLoggerMarker>>,
2096 fidl::encoding::DefaultFuchsiaResourceDialect,
2097 >,
2098 >
2099 fidl::encoding::Encode<
2100 MetricEventLoggerFactoryCreateMetricEventLoggerRequest,
2101 fidl::encoding::DefaultFuchsiaResourceDialect,
2102 > for (T0, T1)
2103 {
2104 #[inline]
2105 unsafe fn encode(
2106 self,
2107 encoder: &mut fidl::encoding::Encoder<
2108 '_,
2109 fidl::encoding::DefaultFuchsiaResourceDialect,
2110 >,
2111 offset: usize,
2112 depth: fidl::encoding::Depth,
2113 ) -> fidl::Result<()> {
2114 encoder.debug_check_bounds::<MetricEventLoggerFactoryCreateMetricEventLoggerRequest>(
2115 offset,
2116 );
2117 unsafe {
2120 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
2121 (ptr as *mut u64).write_unaligned(0);
2122 }
2123 self.0.encode(encoder, offset + 0, depth)?;
2125 self.1.encode(encoder, offset + 16, depth)?;
2126 Ok(())
2127 }
2128 }
2129
2130 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2131 for MetricEventLoggerFactoryCreateMetricEventLoggerRequest
2132 {
2133 #[inline(always)]
2134 fn new_empty() -> Self {
2135 Self {
2136 project_spec: fidl::new_empty!(
2137 ProjectSpec,
2138 fidl::encoding::DefaultFuchsiaResourceDialect
2139 ),
2140 logger: fidl::new_empty!(
2141 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MetricEventLoggerMarker>>,
2142 fidl::encoding::DefaultFuchsiaResourceDialect
2143 ),
2144 }
2145 }
2146
2147 #[inline]
2148 unsafe fn decode(
2149 &mut self,
2150 decoder: &mut fidl::encoding::Decoder<
2151 '_,
2152 fidl::encoding::DefaultFuchsiaResourceDialect,
2153 >,
2154 offset: usize,
2155 _depth: fidl::encoding::Depth,
2156 ) -> fidl::Result<()> {
2157 decoder.debug_check_bounds::<Self>(offset);
2158 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
2160 let padval = unsafe { (ptr as *const u64).read_unaligned() };
2161 let mask = 0xffffffff00000000u64;
2162 let maskedval = padval & mask;
2163 if maskedval != 0 {
2164 return Err(fidl::Error::NonZeroPadding {
2165 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
2166 });
2167 }
2168 fidl::decode!(
2169 ProjectSpec,
2170 fidl::encoding::DefaultFuchsiaResourceDialect,
2171 &mut self.project_spec,
2172 decoder,
2173 offset + 0,
2174 _depth
2175 )?;
2176 fidl::decode!(
2177 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MetricEventLoggerMarker>>,
2178 fidl::encoding::DefaultFuchsiaResourceDialect,
2179 &mut self.logger,
2180 decoder,
2181 offset + 16,
2182 _depth
2183 )?;
2184 Ok(())
2185 }
2186 }
2187
2188 impl fidl::encoding::ResourceTypeMarker
2189 for MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsRequest
2190 {
2191 type Borrowed<'a> = &'a mut Self;
2192 fn take_or_borrow<'a>(
2193 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2194 ) -> Self::Borrowed<'a> {
2195 value
2196 }
2197 }
2198
2199 unsafe impl fidl::encoding::TypeMarker
2200 for MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsRequest
2201 {
2202 type Owned = Self;
2203
2204 #[inline(always)]
2205 fn inline_align(_context: fidl::encoding::Context) -> usize {
2206 8
2207 }
2208
2209 #[inline(always)]
2210 fn inline_size(_context: fidl::encoding::Context) -> usize {
2211 40
2212 }
2213 }
2214
2215 unsafe impl
2216 fidl::encoding::Encode<
2217 MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsRequest,
2218 fidl::encoding::DefaultFuchsiaResourceDialect,
2219 > for &mut MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsRequest
2220 {
2221 #[inline]
2222 unsafe fn encode(
2223 self,
2224 encoder: &mut fidl::encoding::Encoder<
2225 '_,
2226 fidl::encoding::DefaultFuchsiaResourceDialect,
2227 >,
2228 offset: usize,
2229 _depth: fidl::encoding::Depth,
2230 ) -> fidl::Result<()> {
2231 encoder.debug_check_bounds::<MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsRequest>(offset);
2232 fidl::encoding::Encode::<MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2234 (
2235 <ProjectSpec as fidl::encoding::ValueTypeMarker>::borrow(&self.project_spec),
2236 <fidl::encoding::Vector<u32, 100> as fidl::encoding::ValueTypeMarker>::borrow(&self.experiment_ids),
2237 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MetricEventLoggerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.logger),
2238 ),
2239 encoder, offset, _depth
2240 )
2241 }
2242 }
2243 unsafe impl<
2244 T0: fidl::encoding::Encode<ProjectSpec, fidl::encoding::DefaultFuchsiaResourceDialect>,
2245 T1: fidl::encoding::Encode<
2246 fidl::encoding::Vector<u32, 100>,
2247 fidl::encoding::DefaultFuchsiaResourceDialect,
2248 >,
2249 T2: fidl::encoding::Encode<
2250 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MetricEventLoggerMarker>>,
2251 fidl::encoding::DefaultFuchsiaResourceDialect,
2252 >,
2253 >
2254 fidl::encoding::Encode<
2255 MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsRequest,
2256 fidl::encoding::DefaultFuchsiaResourceDialect,
2257 > for (T0, T1, T2)
2258 {
2259 #[inline]
2260 unsafe fn encode(
2261 self,
2262 encoder: &mut fidl::encoding::Encoder<
2263 '_,
2264 fidl::encoding::DefaultFuchsiaResourceDialect,
2265 >,
2266 offset: usize,
2267 depth: fidl::encoding::Depth,
2268 ) -> fidl::Result<()> {
2269 encoder.debug_check_bounds::<MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsRequest>(offset);
2270 unsafe {
2273 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
2274 (ptr as *mut u64).write_unaligned(0);
2275 }
2276 self.0.encode(encoder, offset + 0, depth)?;
2278 self.1.encode(encoder, offset + 16, depth)?;
2279 self.2.encode(encoder, offset + 32, depth)?;
2280 Ok(())
2281 }
2282 }
2283
2284 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2285 for MetricEventLoggerFactoryCreateMetricEventLoggerWithExperimentsRequest
2286 {
2287 #[inline(always)]
2288 fn new_empty() -> Self {
2289 Self {
2290 project_spec: fidl::new_empty!(
2291 ProjectSpec,
2292 fidl::encoding::DefaultFuchsiaResourceDialect
2293 ),
2294 experiment_ids: fidl::new_empty!(fidl::encoding::Vector<u32, 100>, fidl::encoding::DefaultFuchsiaResourceDialect),
2295 logger: fidl::new_empty!(
2296 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MetricEventLoggerMarker>>,
2297 fidl::encoding::DefaultFuchsiaResourceDialect
2298 ),
2299 }
2300 }
2301
2302 #[inline]
2303 unsafe fn decode(
2304 &mut self,
2305 decoder: &mut fidl::encoding::Decoder<
2306 '_,
2307 fidl::encoding::DefaultFuchsiaResourceDialect,
2308 >,
2309 offset: usize,
2310 _depth: fidl::encoding::Depth,
2311 ) -> fidl::Result<()> {
2312 decoder.debug_check_bounds::<Self>(offset);
2313 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
2315 let padval = unsafe { (ptr as *const u64).read_unaligned() };
2316 let mask = 0xffffffff00000000u64;
2317 let maskedval = padval & mask;
2318 if maskedval != 0 {
2319 return Err(fidl::Error::NonZeroPadding {
2320 padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
2321 });
2322 }
2323 fidl::decode!(
2324 ProjectSpec,
2325 fidl::encoding::DefaultFuchsiaResourceDialect,
2326 &mut self.project_spec,
2327 decoder,
2328 offset + 0,
2329 _depth
2330 )?;
2331 fidl::decode!(fidl::encoding::Vector<u32, 100>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.experiment_ids, decoder, offset + 16, _depth)?;
2332 fidl::decode!(
2333 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MetricEventLoggerMarker>>,
2334 fidl::encoding::DefaultFuchsiaResourceDialect,
2335 &mut self.logger,
2336 decoder,
2337 offset + 32,
2338 _depth
2339 )?;
2340 Ok(())
2341 }
2342 }
2343}