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_tracing_provider_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
16pub struct ProviderConfig {
17 pub buffering_mode: fidl_fuchsia_tracing::BufferingMode,
18 pub buffer: fidl::Vmo,
20 pub fifo: fidl::Fifo,
25 pub categories: Vec<String>,
26}
27
28impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ProviderConfig {}
29
30#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
31pub struct ProviderInitializeRequest {
32 pub config: ProviderConfig,
33}
34
35impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ProviderInitializeRequest {}
36
37#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
38pub struct RegistryRegisterProviderRequest {
39 pub provider: fidl::endpoints::ClientEnd<ProviderMarker>,
40 pub pid: u64,
41 pub name: String,
42}
43
44impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
45 for RegistryRegisterProviderRequest
46{
47}
48
49#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
50pub struct RegistryRegisterProviderSynchronouslyRequest {
51 pub provider: fidl::endpoints::ClientEnd<ProviderMarker>,
52 pub pid: u64,
53 pub name: String,
54}
55
56impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
57 for RegistryRegisterProviderSynchronouslyRequest
58{
59}
60
61#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
62pub struct ProviderMarker;
63
64impl fidl::endpoints::ProtocolMarker for ProviderMarker {
65 type Proxy = ProviderProxy;
66 type RequestStream = ProviderRequestStream;
67 #[cfg(target_os = "fuchsia")]
68 type SynchronousProxy = ProviderSynchronousProxy;
69
70 const DEBUG_NAME: &'static str = "(anonymous) Provider";
71}
72
73pub trait ProviderProxyInterface: Send + Sync {
74 fn r#initialize(&self, config: ProviderConfig) -> Result<(), fidl::Error>;
75 fn r#start(&self, options: &StartOptions) -> Result<(), fidl::Error>;
76 fn r#stop(&self) -> Result<(), fidl::Error>;
77 fn r#terminate(&self) -> Result<(), fidl::Error>;
78 type GetKnownCategoriesResponseFut: std::future::Future<Output = Result<Vec<fidl_fuchsia_tracing::KnownCategory>, fidl::Error>>
79 + Send;
80 fn r#get_known_categories(&self) -> Self::GetKnownCategoriesResponseFut;
81}
82#[derive(Debug)]
83#[cfg(target_os = "fuchsia")]
84pub struct ProviderSynchronousProxy {
85 client: fidl::client::sync::Client,
86}
87
88#[cfg(target_os = "fuchsia")]
89impl fidl::endpoints::SynchronousProxy for ProviderSynchronousProxy {
90 type Proxy = ProviderProxy;
91 type Protocol = ProviderMarker;
92
93 fn from_channel(inner: fidl::Channel) -> Self {
94 Self::new(inner)
95 }
96
97 fn into_channel(self) -> fidl::Channel {
98 self.client.into_channel()
99 }
100
101 fn as_channel(&self) -> &fidl::Channel {
102 self.client.as_channel()
103 }
104}
105
106#[cfg(target_os = "fuchsia")]
107impl ProviderSynchronousProxy {
108 pub fn new(channel: fidl::Channel) -> Self {
109 let protocol_name = <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
110 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
111 }
112
113 pub fn into_channel(self) -> fidl::Channel {
114 self.client.into_channel()
115 }
116
117 pub fn wait_for_event(
120 &self,
121 deadline: zx::MonotonicInstant,
122 ) -> Result<ProviderEvent, fidl::Error> {
123 ProviderEvent::decode(self.client.wait_for_event(deadline)?)
124 }
125
126 pub fn r#initialize(&self, mut config: ProviderConfig) -> Result<(), fidl::Error> {
134 self.client.send::<ProviderInitializeRequest>(
135 (&mut config,),
136 0x9e31667d7b180f7,
137 fidl::encoding::DynamicFlags::empty(),
138 )
139 }
140
141 pub fn r#start(&self, mut options: &StartOptions) -> Result<(), fidl::Error> {
148 self.client.send::<ProviderStartRequest>(
149 (options,),
150 0x5bae2b60be66a815,
151 fidl::encoding::DynamicFlags::empty(),
152 )
153 }
154
155 pub fn r#stop(&self) -> Result<(), fidl::Error> {
164 self.client.send::<fidl::encoding::EmptyPayload>(
165 (),
166 0x133df8ebb1897df0,
167 fidl::encoding::DynamicFlags::empty(),
168 )
169 }
170
171 pub fn r#terminate(&self) -> Result<(), fidl::Error> {
178 self.client.send::<fidl::encoding::EmptyPayload>(
179 (),
180 0x6b5564032f2726b1,
181 fidl::encoding::DynamicFlags::empty(),
182 )
183 }
184
185 pub fn r#get_known_categories(
187 &self,
188 ___deadline: zx::MonotonicInstant,
189 ) -> Result<Vec<fidl_fuchsia_tracing::KnownCategory>, fidl::Error> {
190 let _response = self
191 .client
192 .send_query::<fidl::encoding::EmptyPayload, ProviderGetKnownCategoriesResponse>(
193 (),
194 0x5f5b0ad77af3f886,
195 fidl::encoding::DynamicFlags::empty(),
196 ___deadline,
197 )?;
198 Ok(_response.categories)
199 }
200}
201
202#[cfg(target_os = "fuchsia")]
203impl From<ProviderSynchronousProxy> for zx::Handle {
204 fn from(value: ProviderSynchronousProxy) -> Self {
205 value.into_channel().into()
206 }
207}
208
209#[cfg(target_os = "fuchsia")]
210impl From<fidl::Channel> for ProviderSynchronousProxy {
211 fn from(value: fidl::Channel) -> Self {
212 Self::new(value)
213 }
214}
215
216#[derive(Debug, Clone)]
217pub struct ProviderProxy {
218 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
219}
220
221impl fidl::endpoints::Proxy for ProviderProxy {
222 type Protocol = ProviderMarker;
223
224 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
225 Self::new(inner)
226 }
227
228 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
229 self.client.into_channel().map_err(|client| Self { client })
230 }
231
232 fn as_channel(&self) -> &::fidl::AsyncChannel {
233 self.client.as_channel()
234 }
235}
236
237impl ProviderProxy {
238 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
240 let protocol_name = <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
241 Self { client: fidl::client::Client::new(channel, protocol_name) }
242 }
243
244 pub fn take_event_stream(&self) -> ProviderEventStream {
250 ProviderEventStream { event_receiver: self.client.take_event_receiver() }
251 }
252
253 pub fn r#initialize(&self, mut config: ProviderConfig) -> Result<(), fidl::Error> {
261 ProviderProxyInterface::r#initialize(self, config)
262 }
263
264 pub fn r#start(&self, mut options: &StartOptions) -> Result<(), fidl::Error> {
271 ProviderProxyInterface::r#start(self, options)
272 }
273
274 pub fn r#stop(&self) -> Result<(), fidl::Error> {
283 ProviderProxyInterface::r#stop(self)
284 }
285
286 pub fn r#terminate(&self) -> Result<(), fidl::Error> {
293 ProviderProxyInterface::r#terminate(self)
294 }
295
296 pub fn r#get_known_categories(
298 &self,
299 ) -> fidl::client::QueryResponseFut<
300 Vec<fidl_fuchsia_tracing::KnownCategory>,
301 fidl::encoding::DefaultFuchsiaResourceDialect,
302 > {
303 ProviderProxyInterface::r#get_known_categories(self)
304 }
305}
306
307impl ProviderProxyInterface for ProviderProxy {
308 fn r#initialize(&self, mut config: ProviderConfig) -> Result<(), fidl::Error> {
309 self.client.send::<ProviderInitializeRequest>(
310 (&mut config,),
311 0x9e31667d7b180f7,
312 fidl::encoding::DynamicFlags::empty(),
313 )
314 }
315
316 fn r#start(&self, mut options: &StartOptions) -> Result<(), fidl::Error> {
317 self.client.send::<ProviderStartRequest>(
318 (options,),
319 0x5bae2b60be66a815,
320 fidl::encoding::DynamicFlags::empty(),
321 )
322 }
323
324 fn r#stop(&self) -> Result<(), fidl::Error> {
325 self.client.send::<fidl::encoding::EmptyPayload>(
326 (),
327 0x133df8ebb1897df0,
328 fidl::encoding::DynamicFlags::empty(),
329 )
330 }
331
332 fn r#terminate(&self) -> Result<(), fidl::Error> {
333 self.client.send::<fidl::encoding::EmptyPayload>(
334 (),
335 0x6b5564032f2726b1,
336 fidl::encoding::DynamicFlags::empty(),
337 )
338 }
339
340 type GetKnownCategoriesResponseFut = fidl::client::QueryResponseFut<
341 Vec<fidl_fuchsia_tracing::KnownCategory>,
342 fidl::encoding::DefaultFuchsiaResourceDialect,
343 >;
344 fn r#get_known_categories(&self) -> Self::GetKnownCategoriesResponseFut {
345 fn _decode(
346 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
347 ) -> Result<Vec<fidl_fuchsia_tracing::KnownCategory>, fidl::Error> {
348 let _response = fidl::client::decode_transaction_body::<
349 ProviderGetKnownCategoriesResponse,
350 fidl::encoding::DefaultFuchsiaResourceDialect,
351 0x5f5b0ad77af3f886,
352 >(_buf?)?;
353 Ok(_response.categories)
354 }
355 self.client.send_query_and_decode::<
356 fidl::encoding::EmptyPayload,
357 Vec<fidl_fuchsia_tracing::KnownCategory>,
358 >(
359 (),
360 0x5f5b0ad77af3f886,
361 fidl::encoding::DynamicFlags::empty(),
362 _decode,
363 )
364 }
365}
366
367pub struct ProviderEventStream {
368 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
369}
370
371impl std::marker::Unpin for ProviderEventStream {}
372
373impl futures::stream::FusedStream for ProviderEventStream {
374 fn is_terminated(&self) -> bool {
375 self.event_receiver.is_terminated()
376 }
377}
378
379impl futures::Stream for ProviderEventStream {
380 type Item = Result<ProviderEvent, fidl::Error>;
381
382 fn poll_next(
383 mut self: std::pin::Pin<&mut Self>,
384 cx: &mut std::task::Context<'_>,
385 ) -> std::task::Poll<Option<Self::Item>> {
386 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
387 &mut self.event_receiver,
388 cx
389 )?) {
390 Some(buf) => std::task::Poll::Ready(Some(ProviderEvent::decode(buf))),
391 None => std::task::Poll::Ready(None),
392 }
393 }
394}
395
396#[derive(Debug)]
397pub enum ProviderEvent {}
398
399impl ProviderEvent {
400 fn decode(
402 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
403 ) -> Result<ProviderEvent, fidl::Error> {
404 let (bytes, _handles) = buf.split_mut();
405 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
406 debug_assert_eq!(tx_header.tx_id, 0);
407 match tx_header.ordinal {
408 _ => Err(fidl::Error::UnknownOrdinal {
409 ordinal: tx_header.ordinal,
410 protocol_name: <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
411 }),
412 }
413 }
414}
415
416pub struct ProviderRequestStream {
418 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
419 is_terminated: bool,
420}
421
422impl std::marker::Unpin for ProviderRequestStream {}
423
424impl futures::stream::FusedStream for ProviderRequestStream {
425 fn is_terminated(&self) -> bool {
426 self.is_terminated
427 }
428}
429
430impl fidl::endpoints::RequestStream for ProviderRequestStream {
431 type Protocol = ProviderMarker;
432 type ControlHandle = ProviderControlHandle;
433
434 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
435 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
436 }
437
438 fn control_handle(&self) -> Self::ControlHandle {
439 ProviderControlHandle { inner: self.inner.clone() }
440 }
441
442 fn into_inner(
443 self,
444 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
445 {
446 (self.inner, self.is_terminated)
447 }
448
449 fn from_inner(
450 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
451 is_terminated: bool,
452 ) -> Self {
453 Self { inner, is_terminated }
454 }
455}
456
457impl futures::Stream for ProviderRequestStream {
458 type Item = Result<ProviderRequest, fidl::Error>;
459
460 fn poll_next(
461 mut self: std::pin::Pin<&mut Self>,
462 cx: &mut std::task::Context<'_>,
463 ) -> std::task::Poll<Option<Self::Item>> {
464 let this = &mut *self;
465 if this.inner.check_shutdown(cx) {
466 this.is_terminated = true;
467 return std::task::Poll::Ready(None);
468 }
469 if this.is_terminated {
470 panic!("polled ProviderRequestStream after completion");
471 }
472 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
473 |bytes, handles| {
474 match this.inner.channel().read_etc(cx, bytes, handles) {
475 std::task::Poll::Ready(Ok(())) => {}
476 std::task::Poll::Pending => return std::task::Poll::Pending,
477 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
478 this.is_terminated = true;
479 return std::task::Poll::Ready(None);
480 }
481 std::task::Poll::Ready(Err(e)) => {
482 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
483 e.into(),
484 ))))
485 }
486 }
487
488 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
490
491 std::task::Poll::Ready(Some(match header.ordinal {
492 0x9e31667d7b180f7 => {
493 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
494 let mut req = fidl::new_empty!(
495 ProviderInitializeRequest,
496 fidl::encoding::DefaultFuchsiaResourceDialect
497 );
498 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProviderInitializeRequest>(&header, _body_bytes, handles, &mut req)?;
499 let control_handle = ProviderControlHandle { inner: this.inner.clone() };
500 Ok(ProviderRequest::Initialize { config: req.config, control_handle })
501 }
502 0x5bae2b60be66a815 => {
503 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
504 let mut req = fidl::new_empty!(
505 ProviderStartRequest,
506 fidl::encoding::DefaultFuchsiaResourceDialect
507 );
508 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProviderStartRequest>(&header, _body_bytes, handles, &mut req)?;
509 let control_handle = ProviderControlHandle { inner: this.inner.clone() };
510 Ok(ProviderRequest::Start { options: req.options, control_handle })
511 }
512 0x133df8ebb1897df0 => {
513 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
514 let mut req = fidl::new_empty!(
515 fidl::encoding::EmptyPayload,
516 fidl::encoding::DefaultFuchsiaResourceDialect
517 );
518 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
519 let control_handle = ProviderControlHandle { inner: this.inner.clone() };
520 Ok(ProviderRequest::Stop { control_handle })
521 }
522 0x6b5564032f2726b1 => {
523 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
524 let mut req = fidl::new_empty!(
525 fidl::encoding::EmptyPayload,
526 fidl::encoding::DefaultFuchsiaResourceDialect
527 );
528 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
529 let control_handle = ProviderControlHandle { inner: this.inner.clone() };
530 Ok(ProviderRequest::Terminate { control_handle })
531 }
532 0x5f5b0ad77af3f886 => {
533 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
534 let mut req = fidl::new_empty!(
535 fidl::encoding::EmptyPayload,
536 fidl::encoding::DefaultFuchsiaResourceDialect
537 );
538 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
539 let control_handle = ProviderControlHandle { inner: this.inner.clone() };
540 Ok(ProviderRequest::GetKnownCategories {
541 responder: ProviderGetKnownCategoriesResponder {
542 control_handle: std::mem::ManuallyDrop::new(control_handle),
543 tx_id: header.tx_id,
544 },
545 })
546 }
547 _ => Err(fidl::Error::UnknownOrdinal {
548 ordinal: header.ordinal,
549 protocol_name:
550 <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
551 }),
552 }))
553 },
554 )
555 }
556}
557
558#[derive(Debug)]
564pub enum ProviderRequest {
565 Initialize { config: ProviderConfig, control_handle: ProviderControlHandle },
573 Start { options: StartOptions, control_handle: ProviderControlHandle },
580 Stop { control_handle: ProviderControlHandle },
589 Terminate { control_handle: ProviderControlHandle },
596 GetKnownCategories { responder: ProviderGetKnownCategoriesResponder },
598}
599
600impl ProviderRequest {
601 #[allow(irrefutable_let_patterns)]
602 pub fn into_initialize(self) -> Option<(ProviderConfig, ProviderControlHandle)> {
603 if let ProviderRequest::Initialize { config, control_handle } = self {
604 Some((config, control_handle))
605 } else {
606 None
607 }
608 }
609
610 #[allow(irrefutable_let_patterns)]
611 pub fn into_start(self) -> Option<(StartOptions, ProviderControlHandle)> {
612 if let ProviderRequest::Start { options, control_handle } = self {
613 Some((options, control_handle))
614 } else {
615 None
616 }
617 }
618
619 #[allow(irrefutable_let_patterns)]
620 pub fn into_stop(self) -> Option<(ProviderControlHandle)> {
621 if let ProviderRequest::Stop { control_handle } = self {
622 Some((control_handle))
623 } else {
624 None
625 }
626 }
627
628 #[allow(irrefutable_let_patterns)]
629 pub fn into_terminate(self) -> Option<(ProviderControlHandle)> {
630 if let ProviderRequest::Terminate { control_handle } = self {
631 Some((control_handle))
632 } else {
633 None
634 }
635 }
636
637 #[allow(irrefutable_let_patterns)]
638 pub fn into_get_known_categories(self) -> Option<(ProviderGetKnownCategoriesResponder)> {
639 if let ProviderRequest::GetKnownCategories { responder } = self {
640 Some((responder))
641 } else {
642 None
643 }
644 }
645
646 pub fn method_name(&self) -> &'static str {
648 match *self {
649 ProviderRequest::Initialize { .. } => "initialize",
650 ProviderRequest::Start { .. } => "start",
651 ProviderRequest::Stop { .. } => "stop",
652 ProviderRequest::Terminate { .. } => "terminate",
653 ProviderRequest::GetKnownCategories { .. } => "get_known_categories",
654 }
655 }
656}
657
658#[derive(Debug, Clone)]
659pub struct ProviderControlHandle {
660 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
661}
662
663impl fidl::endpoints::ControlHandle for ProviderControlHandle {
664 fn shutdown(&self) {
665 self.inner.shutdown()
666 }
667 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
668 self.inner.shutdown_with_epitaph(status)
669 }
670
671 fn is_closed(&self) -> bool {
672 self.inner.channel().is_closed()
673 }
674 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
675 self.inner.channel().on_closed()
676 }
677
678 #[cfg(target_os = "fuchsia")]
679 fn signal_peer(
680 &self,
681 clear_mask: zx::Signals,
682 set_mask: zx::Signals,
683 ) -> Result<(), zx_status::Status> {
684 use fidl::Peered;
685 self.inner.channel().signal_peer(clear_mask, set_mask)
686 }
687}
688
689impl ProviderControlHandle {}
690
691#[must_use = "FIDL methods require a response to be sent"]
692#[derive(Debug)]
693pub struct ProviderGetKnownCategoriesResponder {
694 control_handle: std::mem::ManuallyDrop<ProviderControlHandle>,
695 tx_id: u32,
696}
697
698impl std::ops::Drop for ProviderGetKnownCategoriesResponder {
702 fn drop(&mut self) {
703 self.control_handle.shutdown();
704 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
706 }
707}
708
709impl fidl::endpoints::Responder for ProviderGetKnownCategoriesResponder {
710 type ControlHandle = ProviderControlHandle;
711
712 fn control_handle(&self) -> &ProviderControlHandle {
713 &self.control_handle
714 }
715
716 fn drop_without_shutdown(mut self) {
717 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
719 std::mem::forget(self);
721 }
722}
723
724impl ProviderGetKnownCategoriesResponder {
725 pub fn send(
729 self,
730 mut categories: &[fidl_fuchsia_tracing::KnownCategory],
731 ) -> Result<(), fidl::Error> {
732 let _result = self.send_raw(categories);
733 if _result.is_err() {
734 self.control_handle.shutdown();
735 }
736 self.drop_without_shutdown();
737 _result
738 }
739
740 pub fn send_no_shutdown_on_err(
742 self,
743 mut categories: &[fidl_fuchsia_tracing::KnownCategory],
744 ) -> Result<(), fidl::Error> {
745 let _result = self.send_raw(categories);
746 self.drop_without_shutdown();
747 _result
748 }
749
750 fn send_raw(
751 &self,
752 mut categories: &[fidl_fuchsia_tracing::KnownCategory],
753 ) -> Result<(), fidl::Error> {
754 self.control_handle.inner.send::<ProviderGetKnownCategoriesResponse>(
755 (categories,),
756 self.tx_id,
757 0x5f5b0ad77af3f886,
758 fidl::encoding::DynamicFlags::empty(),
759 )
760 }
761}
762
763#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
764pub struct RegistryMarker;
765
766impl fidl::endpoints::ProtocolMarker for RegistryMarker {
767 type Proxy = RegistryProxy;
768 type RequestStream = RegistryRequestStream;
769 #[cfg(target_os = "fuchsia")]
770 type SynchronousProxy = RegistrySynchronousProxy;
771
772 const DEBUG_NAME: &'static str = "fuchsia.tracing.provider.Registry";
773}
774impl fidl::endpoints::DiscoverableProtocolMarker for RegistryMarker {}
775
776pub trait RegistryProxyInterface: Send + Sync {
777 fn r#register_provider(
778 &self,
779 provider: fidl::endpoints::ClientEnd<ProviderMarker>,
780 pid: u64,
781 name: &str,
782 ) -> Result<(), fidl::Error>;
783 type RegisterProviderSynchronouslyResponseFut: std::future::Future<Output = Result<(i32, bool), fidl::Error>>
784 + Send;
785 fn r#register_provider_synchronously(
786 &self,
787 provider: fidl::endpoints::ClientEnd<ProviderMarker>,
788 pid: u64,
789 name: &str,
790 ) -> Self::RegisterProviderSynchronouslyResponseFut;
791}
792#[derive(Debug)]
793#[cfg(target_os = "fuchsia")]
794pub struct RegistrySynchronousProxy {
795 client: fidl::client::sync::Client,
796}
797
798#[cfg(target_os = "fuchsia")]
799impl fidl::endpoints::SynchronousProxy for RegistrySynchronousProxy {
800 type Proxy = RegistryProxy;
801 type Protocol = RegistryMarker;
802
803 fn from_channel(inner: fidl::Channel) -> Self {
804 Self::new(inner)
805 }
806
807 fn into_channel(self) -> fidl::Channel {
808 self.client.into_channel()
809 }
810
811 fn as_channel(&self) -> &fidl::Channel {
812 self.client.as_channel()
813 }
814}
815
816#[cfg(target_os = "fuchsia")]
817impl RegistrySynchronousProxy {
818 pub fn new(channel: fidl::Channel) -> Self {
819 let protocol_name = <RegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
820 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
821 }
822
823 pub fn into_channel(self) -> fidl::Channel {
824 self.client.into_channel()
825 }
826
827 pub fn wait_for_event(
830 &self,
831 deadline: zx::MonotonicInstant,
832 ) -> Result<RegistryEvent, fidl::Error> {
833 RegistryEvent::decode(self.client.wait_for_event(deadline)?)
834 }
835
836 pub fn r#register_provider(
843 &self,
844 mut provider: fidl::endpoints::ClientEnd<ProviderMarker>,
845 mut pid: u64,
846 mut name: &str,
847 ) -> Result<(), fidl::Error> {
848 self.client.send::<RegistryRegisterProviderRequest>(
849 (provider, pid, name),
850 0x75bcae3dfa08479c,
851 fidl::encoding::DynamicFlags::empty(),
852 )
853 }
854
855 pub fn r#register_provider_synchronously(
865 &self,
866 mut provider: fidl::endpoints::ClientEnd<ProviderMarker>,
867 mut pid: u64,
868 mut name: &str,
869 ___deadline: zx::MonotonicInstant,
870 ) -> Result<(i32, bool), fidl::Error> {
871 let _response = self.client.send_query::<
872 RegistryRegisterProviderSynchronouslyRequest,
873 RegistryRegisterProviderSynchronouslyResponse,
874 >(
875 (provider, pid, name,),
876 0x4835ed419a808f16,
877 fidl::encoding::DynamicFlags::empty(),
878 ___deadline,
879 )?;
880 Ok((_response.s, _response.started))
881 }
882}
883
884#[cfg(target_os = "fuchsia")]
885impl From<RegistrySynchronousProxy> for zx::Handle {
886 fn from(value: RegistrySynchronousProxy) -> Self {
887 value.into_channel().into()
888 }
889}
890
891#[cfg(target_os = "fuchsia")]
892impl From<fidl::Channel> for RegistrySynchronousProxy {
893 fn from(value: fidl::Channel) -> Self {
894 Self::new(value)
895 }
896}
897
898#[derive(Debug, Clone)]
899pub struct RegistryProxy {
900 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
901}
902
903impl fidl::endpoints::Proxy for RegistryProxy {
904 type Protocol = RegistryMarker;
905
906 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
907 Self::new(inner)
908 }
909
910 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
911 self.client.into_channel().map_err(|client| Self { client })
912 }
913
914 fn as_channel(&self) -> &::fidl::AsyncChannel {
915 self.client.as_channel()
916 }
917}
918
919impl RegistryProxy {
920 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
922 let protocol_name = <RegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
923 Self { client: fidl::client::Client::new(channel, protocol_name) }
924 }
925
926 pub fn take_event_stream(&self) -> RegistryEventStream {
932 RegistryEventStream { event_receiver: self.client.take_event_receiver() }
933 }
934
935 pub fn r#register_provider(
942 &self,
943 mut provider: fidl::endpoints::ClientEnd<ProviderMarker>,
944 mut pid: u64,
945 mut name: &str,
946 ) -> Result<(), fidl::Error> {
947 RegistryProxyInterface::r#register_provider(self, provider, pid, name)
948 }
949
950 pub fn r#register_provider_synchronously(
960 &self,
961 mut provider: fidl::endpoints::ClientEnd<ProviderMarker>,
962 mut pid: u64,
963 mut name: &str,
964 ) -> fidl::client::QueryResponseFut<(i32, bool), fidl::encoding::DefaultFuchsiaResourceDialect>
965 {
966 RegistryProxyInterface::r#register_provider_synchronously(self, provider, pid, name)
967 }
968}
969
970impl RegistryProxyInterface for RegistryProxy {
971 fn r#register_provider(
972 &self,
973 mut provider: fidl::endpoints::ClientEnd<ProviderMarker>,
974 mut pid: u64,
975 mut name: &str,
976 ) -> Result<(), fidl::Error> {
977 self.client.send::<RegistryRegisterProviderRequest>(
978 (provider, pid, name),
979 0x75bcae3dfa08479c,
980 fidl::encoding::DynamicFlags::empty(),
981 )
982 }
983
984 type RegisterProviderSynchronouslyResponseFut =
985 fidl::client::QueryResponseFut<(i32, bool), fidl::encoding::DefaultFuchsiaResourceDialect>;
986 fn r#register_provider_synchronously(
987 &self,
988 mut provider: fidl::endpoints::ClientEnd<ProviderMarker>,
989 mut pid: u64,
990 mut name: &str,
991 ) -> Self::RegisterProviderSynchronouslyResponseFut {
992 fn _decode(
993 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
994 ) -> Result<(i32, bool), fidl::Error> {
995 let _response = fidl::client::decode_transaction_body::<
996 RegistryRegisterProviderSynchronouslyResponse,
997 fidl::encoding::DefaultFuchsiaResourceDialect,
998 0x4835ed419a808f16,
999 >(_buf?)?;
1000 Ok((_response.s, _response.started))
1001 }
1002 self.client
1003 .send_query_and_decode::<RegistryRegisterProviderSynchronouslyRequest, (i32, bool)>(
1004 (provider, pid, name),
1005 0x4835ed419a808f16,
1006 fidl::encoding::DynamicFlags::empty(),
1007 _decode,
1008 )
1009 }
1010}
1011
1012pub struct RegistryEventStream {
1013 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1014}
1015
1016impl std::marker::Unpin for RegistryEventStream {}
1017
1018impl futures::stream::FusedStream for RegistryEventStream {
1019 fn is_terminated(&self) -> bool {
1020 self.event_receiver.is_terminated()
1021 }
1022}
1023
1024impl futures::Stream for RegistryEventStream {
1025 type Item = Result<RegistryEvent, fidl::Error>;
1026
1027 fn poll_next(
1028 mut self: std::pin::Pin<&mut Self>,
1029 cx: &mut std::task::Context<'_>,
1030 ) -> std::task::Poll<Option<Self::Item>> {
1031 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1032 &mut self.event_receiver,
1033 cx
1034 )?) {
1035 Some(buf) => std::task::Poll::Ready(Some(RegistryEvent::decode(buf))),
1036 None => std::task::Poll::Ready(None),
1037 }
1038 }
1039}
1040
1041#[derive(Debug)]
1042pub enum RegistryEvent {}
1043
1044impl RegistryEvent {
1045 fn decode(
1047 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1048 ) -> Result<RegistryEvent, fidl::Error> {
1049 let (bytes, _handles) = buf.split_mut();
1050 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1051 debug_assert_eq!(tx_header.tx_id, 0);
1052 match tx_header.ordinal {
1053 _ => Err(fidl::Error::UnknownOrdinal {
1054 ordinal: tx_header.ordinal,
1055 protocol_name: <RegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1056 }),
1057 }
1058 }
1059}
1060
1061pub struct RegistryRequestStream {
1063 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1064 is_terminated: bool,
1065}
1066
1067impl std::marker::Unpin for RegistryRequestStream {}
1068
1069impl futures::stream::FusedStream for RegistryRequestStream {
1070 fn is_terminated(&self) -> bool {
1071 self.is_terminated
1072 }
1073}
1074
1075impl fidl::endpoints::RequestStream for RegistryRequestStream {
1076 type Protocol = RegistryMarker;
1077 type ControlHandle = RegistryControlHandle;
1078
1079 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1080 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1081 }
1082
1083 fn control_handle(&self) -> Self::ControlHandle {
1084 RegistryControlHandle { inner: self.inner.clone() }
1085 }
1086
1087 fn into_inner(
1088 self,
1089 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1090 {
1091 (self.inner, self.is_terminated)
1092 }
1093
1094 fn from_inner(
1095 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1096 is_terminated: bool,
1097 ) -> Self {
1098 Self { inner, is_terminated }
1099 }
1100}
1101
1102impl futures::Stream for RegistryRequestStream {
1103 type Item = Result<RegistryRequest, fidl::Error>;
1104
1105 fn poll_next(
1106 mut self: std::pin::Pin<&mut Self>,
1107 cx: &mut std::task::Context<'_>,
1108 ) -> std::task::Poll<Option<Self::Item>> {
1109 let this = &mut *self;
1110 if this.inner.check_shutdown(cx) {
1111 this.is_terminated = true;
1112 return std::task::Poll::Ready(None);
1113 }
1114 if this.is_terminated {
1115 panic!("polled RegistryRequestStream after completion");
1116 }
1117 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1118 |bytes, handles| {
1119 match this.inner.channel().read_etc(cx, bytes, handles) {
1120 std::task::Poll::Ready(Ok(())) => {}
1121 std::task::Poll::Pending => return std::task::Poll::Pending,
1122 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1123 this.is_terminated = true;
1124 return std::task::Poll::Ready(None);
1125 }
1126 std::task::Poll::Ready(Err(e)) => {
1127 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1128 e.into(),
1129 ))))
1130 }
1131 }
1132
1133 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1135
1136 std::task::Poll::Ready(Some(match header.ordinal {
1137 0x75bcae3dfa08479c => {
1138 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1139 let mut req = fidl::new_empty!(
1140 RegistryRegisterProviderRequest,
1141 fidl::encoding::DefaultFuchsiaResourceDialect
1142 );
1143 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RegistryRegisterProviderRequest>(&header, _body_bytes, handles, &mut req)?;
1144 let control_handle = RegistryControlHandle { inner: this.inner.clone() };
1145 Ok(RegistryRequest::RegisterProvider {
1146 provider: req.provider,
1147 pid: req.pid,
1148 name: req.name,
1149
1150 control_handle,
1151 })
1152 }
1153 0x4835ed419a808f16 => {
1154 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1155 let mut req = fidl::new_empty!(
1156 RegistryRegisterProviderSynchronouslyRequest,
1157 fidl::encoding::DefaultFuchsiaResourceDialect
1158 );
1159 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RegistryRegisterProviderSynchronouslyRequest>(&header, _body_bytes, handles, &mut req)?;
1160 let control_handle = RegistryControlHandle { inner: this.inner.clone() };
1161 Ok(RegistryRequest::RegisterProviderSynchronously {
1162 provider: req.provider,
1163 pid: req.pid,
1164 name: req.name,
1165
1166 responder: RegistryRegisterProviderSynchronouslyResponder {
1167 control_handle: std::mem::ManuallyDrop::new(control_handle),
1168 tx_id: header.tx_id,
1169 },
1170 })
1171 }
1172 _ => Err(fidl::Error::UnknownOrdinal {
1173 ordinal: header.ordinal,
1174 protocol_name:
1175 <RegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1176 }),
1177 }))
1178 },
1179 )
1180 }
1181}
1182
1183#[derive(Debug)]
1188pub enum RegistryRequest {
1189 RegisterProvider {
1196 provider: fidl::endpoints::ClientEnd<ProviderMarker>,
1197 pid: u64,
1198 name: String,
1199 control_handle: RegistryControlHandle,
1200 },
1201 RegisterProviderSynchronously {
1211 provider: fidl::endpoints::ClientEnd<ProviderMarker>,
1212 pid: u64,
1213 name: String,
1214 responder: RegistryRegisterProviderSynchronouslyResponder,
1215 },
1216}
1217
1218impl RegistryRequest {
1219 #[allow(irrefutable_let_patterns)]
1220 pub fn into_register_provider(
1221 self,
1222 ) -> Option<(fidl::endpoints::ClientEnd<ProviderMarker>, u64, String, RegistryControlHandle)>
1223 {
1224 if let RegistryRequest::RegisterProvider { provider, pid, name, control_handle } = self {
1225 Some((provider, pid, name, control_handle))
1226 } else {
1227 None
1228 }
1229 }
1230
1231 #[allow(irrefutable_let_patterns)]
1232 pub fn into_register_provider_synchronously(
1233 self,
1234 ) -> Option<(
1235 fidl::endpoints::ClientEnd<ProviderMarker>,
1236 u64,
1237 String,
1238 RegistryRegisterProviderSynchronouslyResponder,
1239 )> {
1240 if let RegistryRequest::RegisterProviderSynchronously { provider, pid, name, responder } =
1241 self
1242 {
1243 Some((provider, pid, name, responder))
1244 } else {
1245 None
1246 }
1247 }
1248
1249 pub fn method_name(&self) -> &'static str {
1251 match *self {
1252 RegistryRequest::RegisterProvider { .. } => "register_provider",
1253 RegistryRequest::RegisterProviderSynchronously { .. } => {
1254 "register_provider_synchronously"
1255 }
1256 }
1257 }
1258}
1259
1260#[derive(Debug, Clone)]
1261pub struct RegistryControlHandle {
1262 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1263}
1264
1265impl fidl::endpoints::ControlHandle for RegistryControlHandle {
1266 fn shutdown(&self) {
1267 self.inner.shutdown()
1268 }
1269 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1270 self.inner.shutdown_with_epitaph(status)
1271 }
1272
1273 fn is_closed(&self) -> bool {
1274 self.inner.channel().is_closed()
1275 }
1276 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1277 self.inner.channel().on_closed()
1278 }
1279
1280 #[cfg(target_os = "fuchsia")]
1281 fn signal_peer(
1282 &self,
1283 clear_mask: zx::Signals,
1284 set_mask: zx::Signals,
1285 ) -> Result<(), zx_status::Status> {
1286 use fidl::Peered;
1287 self.inner.channel().signal_peer(clear_mask, set_mask)
1288 }
1289}
1290
1291impl RegistryControlHandle {}
1292
1293#[must_use = "FIDL methods require a response to be sent"]
1294#[derive(Debug)]
1295pub struct RegistryRegisterProviderSynchronouslyResponder {
1296 control_handle: std::mem::ManuallyDrop<RegistryControlHandle>,
1297 tx_id: u32,
1298}
1299
1300impl std::ops::Drop for RegistryRegisterProviderSynchronouslyResponder {
1304 fn drop(&mut self) {
1305 self.control_handle.shutdown();
1306 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1308 }
1309}
1310
1311impl fidl::endpoints::Responder for RegistryRegisterProviderSynchronouslyResponder {
1312 type ControlHandle = RegistryControlHandle;
1313
1314 fn control_handle(&self) -> &RegistryControlHandle {
1315 &self.control_handle
1316 }
1317
1318 fn drop_without_shutdown(mut self) {
1319 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1321 std::mem::forget(self);
1323 }
1324}
1325
1326impl RegistryRegisterProviderSynchronouslyResponder {
1327 pub fn send(self, mut s: i32, mut started: bool) -> Result<(), fidl::Error> {
1331 let _result = self.send_raw(s, started);
1332 if _result.is_err() {
1333 self.control_handle.shutdown();
1334 }
1335 self.drop_without_shutdown();
1336 _result
1337 }
1338
1339 pub fn send_no_shutdown_on_err(self, mut s: i32, mut started: bool) -> Result<(), fidl::Error> {
1341 let _result = self.send_raw(s, started);
1342 self.drop_without_shutdown();
1343 _result
1344 }
1345
1346 fn send_raw(&self, mut s: i32, mut started: bool) -> Result<(), fidl::Error> {
1347 self.control_handle.inner.send::<RegistryRegisterProviderSynchronouslyResponse>(
1348 (s, started),
1349 self.tx_id,
1350 0x4835ed419a808f16,
1351 fidl::encoding::DynamicFlags::empty(),
1352 )
1353 }
1354}
1355
1356mod internal {
1357 use super::*;
1358
1359 impl fidl::encoding::ResourceTypeMarker for ProviderConfig {
1360 type Borrowed<'a> = &'a mut Self;
1361 fn take_or_borrow<'a>(
1362 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1363 ) -> Self::Borrowed<'a> {
1364 value
1365 }
1366 }
1367
1368 unsafe impl fidl::encoding::TypeMarker for ProviderConfig {
1369 type Owned = Self;
1370
1371 #[inline(always)]
1372 fn inline_align(_context: fidl::encoding::Context) -> usize {
1373 8
1374 }
1375
1376 #[inline(always)]
1377 fn inline_size(_context: fidl::encoding::Context) -> usize {
1378 32
1379 }
1380 }
1381
1382 unsafe impl
1383 fidl::encoding::Encode<ProviderConfig, fidl::encoding::DefaultFuchsiaResourceDialect>
1384 for &mut ProviderConfig
1385 {
1386 #[inline]
1387 unsafe fn encode(
1388 self,
1389 encoder: &mut fidl::encoding::Encoder<
1390 '_,
1391 fidl::encoding::DefaultFuchsiaResourceDialect,
1392 >,
1393 offset: usize,
1394 _depth: fidl::encoding::Depth,
1395 ) -> fidl::Result<()> {
1396 encoder.debug_check_bounds::<ProviderConfig>(offset);
1397 fidl::encoding::Encode::<ProviderConfig, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1399 (
1400 <fidl_fuchsia_tracing::BufferingMode as fidl::encoding::ValueTypeMarker>::borrow(&self.buffering_mode),
1401 <fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.buffer),
1402 <fidl::encoding::HandleType<fidl::Fifo, { fidl::ObjectType::FIFO.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.fifo),
1403 <fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 5000> as fidl::encoding::ValueTypeMarker>::borrow(&self.categories),
1404 ),
1405 encoder, offset, _depth
1406 )
1407 }
1408 }
1409 unsafe impl<
1410 T0: fidl::encoding::Encode<
1411 fidl_fuchsia_tracing::BufferingMode,
1412 fidl::encoding::DefaultFuchsiaResourceDialect,
1413 >,
1414 T1: fidl::encoding::Encode<
1415 fidl::encoding::HandleType<
1416 fidl::Vmo,
1417 { fidl::ObjectType::VMO.into_raw() },
1418 2147483648,
1419 >,
1420 fidl::encoding::DefaultFuchsiaResourceDialect,
1421 >,
1422 T2: fidl::encoding::Encode<
1423 fidl::encoding::HandleType<
1424 fidl::Fifo,
1425 { fidl::ObjectType::FIFO.into_raw() },
1426 2147483648,
1427 >,
1428 fidl::encoding::DefaultFuchsiaResourceDialect,
1429 >,
1430 T3: fidl::encoding::Encode<
1431 fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 5000>,
1432 fidl::encoding::DefaultFuchsiaResourceDialect,
1433 >,
1434 > fidl::encoding::Encode<ProviderConfig, fidl::encoding::DefaultFuchsiaResourceDialect>
1435 for (T0, T1, T2, T3)
1436 {
1437 #[inline]
1438 unsafe fn encode(
1439 self,
1440 encoder: &mut fidl::encoding::Encoder<
1441 '_,
1442 fidl::encoding::DefaultFuchsiaResourceDialect,
1443 >,
1444 offset: usize,
1445 depth: fidl::encoding::Depth,
1446 ) -> fidl::Result<()> {
1447 encoder.debug_check_bounds::<ProviderConfig>(offset);
1448 unsafe {
1451 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1452 (ptr as *mut u64).write_unaligned(0);
1453 }
1454 unsafe {
1455 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
1456 (ptr as *mut u64).write_unaligned(0);
1457 }
1458 self.0.encode(encoder, offset + 0, depth)?;
1460 self.1.encode(encoder, offset + 4, depth)?;
1461 self.2.encode(encoder, offset + 8, depth)?;
1462 self.3.encode(encoder, offset + 16, depth)?;
1463 Ok(())
1464 }
1465 }
1466
1467 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1468 for ProviderConfig
1469 {
1470 #[inline(always)]
1471 fn new_empty() -> Self {
1472 Self {
1473 buffering_mode: fidl::new_empty!(
1474 fidl_fuchsia_tracing::BufferingMode,
1475 fidl::encoding::DefaultFuchsiaResourceDialect
1476 ),
1477 buffer: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
1478 fifo: fidl::new_empty!(fidl::encoding::HandleType<fidl::Fifo, { fidl::ObjectType::FIFO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
1479 categories: fidl::new_empty!(
1480 fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 5000>,
1481 fidl::encoding::DefaultFuchsiaResourceDialect
1482 ),
1483 }
1484 }
1485
1486 #[inline]
1487 unsafe fn decode(
1488 &mut self,
1489 decoder: &mut fidl::encoding::Decoder<
1490 '_,
1491 fidl::encoding::DefaultFuchsiaResourceDialect,
1492 >,
1493 offset: usize,
1494 _depth: fidl::encoding::Depth,
1495 ) -> fidl::Result<()> {
1496 decoder.debug_check_bounds::<Self>(offset);
1497 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
1499 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1500 let mask = 0xffffff00u64;
1501 let maskedval = padval & mask;
1502 if maskedval != 0 {
1503 return Err(fidl::Error::NonZeroPadding {
1504 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1505 });
1506 }
1507 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
1508 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1509 let mask = 0xffffffff00000000u64;
1510 let maskedval = padval & mask;
1511 if maskedval != 0 {
1512 return Err(fidl::Error::NonZeroPadding {
1513 padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
1514 });
1515 }
1516 fidl::decode!(
1517 fidl_fuchsia_tracing::BufferingMode,
1518 fidl::encoding::DefaultFuchsiaResourceDialect,
1519 &mut self.buffering_mode,
1520 decoder,
1521 offset + 0,
1522 _depth
1523 )?;
1524 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.buffer, decoder, offset + 4, _depth)?;
1525 fidl::decode!(fidl::encoding::HandleType<fidl::Fifo, { fidl::ObjectType::FIFO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.fifo, decoder, offset + 8, _depth)?;
1526 fidl::decode!(
1527 fidl::encoding::Vector<fidl::encoding::BoundedString<100>, 5000>,
1528 fidl::encoding::DefaultFuchsiaResourceDialect,
1529 &mut self.categories,
1530 decoder,
1531 offset + 16,
1532 _depth
1533 )?;
1534 Ok(())
1535 }
1536 }
1537
1538 impl fidl::encoding::ResourceTypeMarker for ProviderInitializeRequest {
1539 type Borrowed<'a> = &'a mut Self;
1540 fn take_or_borrow<'a>(
1541 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1542 ) -> Self::Borrowed<'a> {
1543 value
1544 }
1545 }
1546
1547 unsafe impl fidl::encoding::TypeMarker for ProviderInitializeRequest {
1548 type Owned = Self;
1549
1550 #[inline(always)]
1551 fn inline_align(_context: fidl::encoding::Context) -> usize {
1552 8
1553 }
1554
1555 #[inline(always)]
1556 fn inline_size(_context: fidl::encoding::Context) -> usize {
1557 32
1558 }
1559 }
1560
1561 unsafe impl
1562 fidl::encoding::Encode<
1563 ProviderInitializeRequest,
1564 fidl::encoding::DefaultFuchsiaResourceDialect,
1565 > for &mut ProviderInitializeRequest
1566 {
1567 #[inline]
1568 unsafe fn encode(
1569 self,
1570 encoder: &mut fidl::encoding::Encoder<
1571 '_,
1572 fidl::encoding::DefaultFuchsiaResourceDialect,
1573 >,
1574 offset: usize,
1575 _depth: fidl::encoding::Depth,
1576 ) -> fidl::Result<()> {
1577 encoder.debug_check_bounds::<ProviderInitializeRequest>(offset);
1578 fidl::encoding::Encode::<
1580 ProviderInitializeRequest,
1581 fidl::encoding::DefaultFuchsiaResourceDialect,
1582 >::encode(
1583 (<ProviderConfig as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1584 &mut self.config,
1585 ),),
1586 encoder,
1587 offset,
1588 _depth,
1589 )
1590 }
1591 }
1592 unsafe impl<
1593 T0: fidl::encoding::Encode<ProviderConfig, fidl::encoding::DefaultFuchsiaResourceDialect>,
1594 >
1595 fidl::encoding::Encode<
1596 ProviderInitializeRequest,
1597 fidl::encoding::DefaultFuchsiaResourceDialect,
1598 > for (T0,)
1599 {
1600 #[inline]
1601 unsafe fn encode(
1602 self,
1603 encoder: &mut fidl::encoding::Encoder<
1604 '_,
1605 fidl::encoding::DefaultFuchsiaResourceDialect,
1606 >,
1607 offset: usize,
1608 depth: fidl::encoding::Depth,
1609 ) -> fidl::Result<()> {
1610 encoder.debug_check_bounds::<ProviderInitializeRequest>(offset);
1611 self.0.encode(encoder, offset + 0, depth)?;
1615 Ok(())
1616 }
1617 }
1618
1619 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1620 for ProviderInitializeRequest
1621 {
1622 #[inline(always)]
1623 fn new_empty() -> Self {
1624 Self {
1625 config: fidl::new_empty!(
1626 ProviderConfig,
1627 fidl::encoding::DefaultFuchsiaResourceDialect
1628 ),
1629 }
1630 }
1631
1632 #[inline]
1633 unsafe fn decode(
1634 &mut self,
1635 decoder: &mut fidl::encoding::Decoder<
1636 '_,
1637 fidl::encoding::DefaultFuchsiaResourceDialect,
1638 >,
1639 offset: usize,
1640 _depth: fidl::encoding::Depth,
1641 ) -> fidl::Result<()> {
1642 decoder.debug_check_bounds::<Self>(offset);
1643 fidl::decode!(
1645 ProviderConfig,
1646 fidl::encoding::DefaultFuchsiaResourceDialect,
1647 &mut self.config,
1648 decoder,
1649 offset + 0,
1650 _depth
1651 )?;
1652 Ok(())
1653 }
1654 }
1655
1656 impl fidl::encoding::ResourceTypeMarker for RegistryRegisterProviderRequest {
1657 type Borrowed<'a> = &'a mut Self;
1658 fn take_or_borrow<'a>(
1659 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1660 ) -> Self::Borrowed<'a> {
1661 value
1662 }
1663 }
1664
1665 unsafe impl fidl::encoding::TypeMarker for RegistryRegisterProviderRequest {
1666 type Owned = Self;
1667
1668 #[inline(always)]
1669 fn inline_align(_context: fidl::encoding::Context) -> usize {
1670 8
1671 }
1672
1673 #[inline(always)]
1674 fn inline_size(_context: fidl::encoding::Context) -> usize {
1675 32
1676 }
1677 }
1678
1679 unsafe impl
1680 fidl::encoding::Encode<
1681 RegistryRegisterProviderRequest,
1682 fidl::encoding::DefaultFuchsiaResourceDialect,
1683 > for &mut RegistryRegisterProviderRequest
1684 {
1685 #[inline]
1686 unsafe fn encode(
1687 self,
1688 encoder: &mut fidl::encoding::Encoder<
1689 '_,
1690 fidl::encoding::DefaultFuchsiaResourceDialect,
1691 >,
1692 offset: usize,
1693 _depth: fidl::encoding::Depth,
1694 ) -> fidl::Result<()> {
1695 encoder.debug_check_bounds::<RegistryRegisterProviderRequest>(offset);
1696 fidl::encoding::Encode::<RegistryRegisterProviderRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1698 (
1699 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ProviderMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.provider),
1700 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.pid),
1701 <fidl::encoding::BoundedString<100> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
1702 ),
1703 encoder, offset, _depth
1704 )
1705 }
1706 }
1707 unsafe impl<
1708 T0: fidl::encoding::Encode<
1709 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ProviderMarker>>,
1710 fidl::encoding::DefaultFuchsiaResourceDialect,
1711 >,
1712 T1: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
1713 T2: fidl::encoding::Encode<
1714 fidl::encoding::BoundedString<100>,
1715 fidl::encoding::DefaultFuchsiaResourceDialect,
1716 >,
1717 >
1718 fidl::encoding::Encode<
1719 RegistryRegisterProviderRequest,
1720 fidl::encoding::DefaultFuchsiaResourceDialect,
1721 > for (T0, T1, T2)
1722 {
1723 #[inline]
1724 unsafe fn encode(
1725 self,
1726 encoder: &mut fidl::encoding::Encoder<
1727 '_,
1728 fidl::encoding::DefaultFuchsiaResourceDialect,
1729 >,
1730 offset: usize,
1731 depth: fidl::encoding::Depth,
1732 ) -> fidl::Result<()> {
1733 encoder.debug_check_bounds::<RegistryRegisterProviderRequest>(offset);
1734 unsafe {
1737 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1738 (ptr as *mut u64).write_unaligned(0);
1739 }
1740 self.0.encode(encoder, offset + 0, depth)?;
1742 self.1.encode(encoder, offset + 8, depth)?;
1743 self.2.encode(encoder, offset + 16, depth)?;
1744 Ok(())
1745 }
1746 }
1747
1748 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1749 for RegistryRegisterProviderRequest
1750 {
1751 #[inline(always)]
1752 fn new_empty() -> Self {
1753 Self {
1754 provider: fidl::new_empty!(
1755 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ProviderMarker>>,
1756 fidl::encoding::DefaultFuchsiaResourceDialect
1757 ),
1758 pid: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
1759 name: fidl::new_empty!(
1760 fidl::encoding::BoundedString<100>,
1761 fidl::encoding::DefaultFuchsiaResourceDialect
1762 ),
1763 }
1764 }
1765
1766 #[inline]
1767 unsafe fn decode(
1768 &mut self,
1769 decoder: &mut fidl::encoding::Decoder<
1770 '_,
1771 fidl::encoding::DefaultFuchsiaResourceDialect,
1772 >,
1773 offset: usize,
1774 _depth: fidl::encoding::Depth,
1775 ) -> fidl::Result<()> {
1776 decoder.debug_check_bounds::<Self>(offset);
1777 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
1779 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1780 let mask = 0xffffffff00000000u64;
1781 let maskedval = padval & mask;
1782 if maskedval != 0 {
1783 return Err(fidl::Error::NonZeroPadding {
1784 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1785 });
1786 }
1787 fidl::decode!(
1788 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ProviderMarker>>,
1789 fidl::encoding::DefaultFuchsiaResourceDialect,
1790 &mut self.provider,
1791 decoder,
1792 offset + 0,
1793 _depth
1794 )?;
1795 fidl::decode!(
1796 u64,
1797 fidl::encoding::DefaultFuchsiaResourceDialect,
1798 &mut self.pid,
1799 decoder,
1800 offset + 8,
1801 _depth
1802 )?;
1803 fidl::decode!(
1804 fidl::encoding::BoundedString<100>,
1805 fidl::encoding::DefaultFuchsiaResourceDialect,
1806 &mut self.name,
1807 decoder,
1808 offset + 16,
1809 _depth
1810 )?;
1811 Ok(())
1812 }
1813 }
1814
1815 impl fidl::encoding::ResourceTypeMarker for RegistryRegisterProviderSynchronouslyRequest {
1816 type Borrowed<'a> = &'a mut Self;
1817 fn take_or_borrow<'a>(
1818 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1819 ) -> Self::Borrowed<'a> {
1820 value
1821 }
1822 }
1823
1824 unsafe impl fidl::encoding::TypeMarker for RegistryRegisterProviderSynchronouslyRequest {
1825 type Owned = Self;
1826
1827 #[inline(always)]
1828 fn inline_align(_context: fidl::encoding::Context) -> usize {
1829 8
1830 }
1831
1832 #[inline(always)]
1833 fn inline_size(_context: fidl::encoding::Context) -> usize {
1834 32
1835 }
1836 }
1837
1838 unsafe impl
1839 fidl::encoding::Encode<
1840 RegistryRegisterProviderSynchronouslyRequest,
1841 fidl::encoding::DefaultFuchsiaResourceDialect,
1842 > for &mut RegistryRegisterProviderSynchronouslyRequest
1843 {
1844 #[inline]
1845 unsafe fn encode(
1846 self,
1847 encoder: &mut fidl::encoding::Encoder<
1848 '_,
1849 fidl::encoding::DefaultFuchsiaResourceDialect,
1850 >,
1851 offset: usize,
1852 _depth: fidl::encoding::Depth,
1853 ) -> fidl::Result<()> {
1854 encoder.debug_check_bounds::<RegistryRegisterProviderSynchronouslyRequest>(offset);
1855 fidl::encoding::Encode::<RegistryRegisterProviderSynchronouslyRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1857 (
1858 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ProviderMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.provider),
1859 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.pid),
1860 <fidl::encoding::BoundedString<100> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
1861 ),
1862 encoder, offset, _depth
1863 )
1864 }
1865 }
1866 unsafe impl<
1867 T0: fidl::encoding::Encode<
1868 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ProviderMarker>>,
1869 fidl::encoding::DefaultFuchsiaResourceDialect,
1870 >,
1871 T1: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
1872 T2: fidl::encoding::Encode<
1873 fidl::encoding::BoundedString<100>,
1874 fidl::encoding::DefaultFuchsiaResourceDialect,
1875 >,
1876 >
1877 fidl::encoding::Encode<
1878 RegistryRegisterProviderSynchronouslyRequest,
1879 fidl::encoding::DefaultFuchsiaResourceDialect,
1880 > for (T0, T1, T2)
1881 {
1882 #[inline]
1883 unsafe fn encode(
1884 self,
1885 encoder: &mut fidl::encoding::Encoder<
1886 '_,
1887 fidl::encoding::DefaultFuchsiaResourceDialect,
1888 >,
1889 offset: usize,
1890 depth: fidl::encoding::Depth,
1891 ) -> fidl::Result<()> {
1892 encoder.debug_check_bounds::<RegistryRegisterProviderSynchronouslyRequest>(offset);
1893 unsafe {
1896 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1897 (ptr as *mut u64).write_unaligned(0);
1898 }
1899 self.0.encode(encoder, offset + 0, depth)?;
1901 self.1.encode(encoder, offset + 8, depth)?;
1902 self.2.encode(encoder, offset + 16, depth)?;
1903 Ok(())
1904 }
1905 }
1906
1907 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1908 for RegistryRegisterProviderSynchronouslyRequest
1909 {
1910 #[inline(always)]
1911 fn new_empty() -> Self {
1912 Self {
1913 provider: fidl::new_empty!(
1914 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ProviderMarker>>,
1915 fidl::encoding::DefaultFuchsiaResourceDialect
1916 ),
1917 pid: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
1918 name: fidl::new_empty!(
1919 fidl::encoding::BoundedString<100>,
1920 fidl::encoding::DefaultFuchsiaResourceDialect
1921 ),
1922 }
1923 }
1924
1925 #[inline]
1926 unsafe fn decode(
1927 &mut self,
1928 decoder: &mut fidl::encoding::Decoder<
1929 '_,
1930 fidl::encoding::DefaultFuchsiaResourceDialect,
1931 >,
1932 offset: usize,
1933 _depth: fidl::encoding::Depth,
1934 ) -> fidl::Result<()> {
1935 decoder.debug_check_bounds::<Self>(offset);
1936 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
1938 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1939 let mask = 0xffffffff00000000u64;
1940 let maskedval = padval & mask;
1941 if maskedval != 0 {
1942 return Err(fidl::Error::NonZeroPadding {
1943 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1944 });
1945 }
1946 fidl::decode!(
1947 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ProviderMarker>>,
1948 fidl::encoding::DefaultFuchsiaResourceDialect,
1949 &mut self.provider,
1950 decoder,
1951 offset + 0,
1952 _depth
1953 )?;
1954 fidl::decode!(
1955 u64,
1956 fidl::encoding::DefaultFuchsiaResourceDialect,
1957 &mut self.pid,
1958 decoder,
1959 offset + 8,
1960 _depth
1961 )?;
1962 fidl::decode!(
1963 fidl::encoding::BoundedString<100>,
1964 fidl::encoding::DefaultFuchsiaResourceDialect,
1965 &mut self.name,
1966 decoder,
1967 offset + 16,
1968 _depth
1969 )?;
1970 Ok(())
1971 }
1972 }
1973}