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_controller_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct ProvisionerInitializeTracingRequest {
16 pub controller: fidl::endpoints::ServerEnd<SessionMarker>,
17 pub config: TraceConfig,
18 pub output: fidl::Socket,
19}
20
21impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
22 for ProvisionerInitializeTracingRequest
23{
24}
25
26#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
27pub struct ProvisionerMarker;
28
29impl fidl::endpoints::ProtocolMarker for ProvisionerMarker {
30 type Proxy = ProvisionerProxy;
31 type RequestStream = ProvisionerRequestStream;
32 #[cfg(target_os = "fuchsia")]
33 type SynchronousProxy = ProvisionerSynchronousProxy;
34
35 const DEBUG_NAME: &'static str = "fuchsia.tracing.controller.Provisioner";
36}
37impl fidl::endpoints::DiscoverableProtocolMarker for ProvisionerMarker {}
38
39pub trait ProvisionerProxyInterface: Send + Sync {
40 fn r#initialize_tracing(
41 &self,
42 controller: fidl::endpoints::ServerEnd<SessionMarker>,
43 config: &TraceConfig,
44 output: fidl::Socket,
45 ) -> Result<(), fidl::Error>;
46 type GetProvidersResponseFut: std::future::Future<Output = Result<Vec<ProviderInfo>, fidl::Error>>
47 + Send;
48 fn r#get_providers(&self) -> Self::GetProvidersResponseFut;
49 type GetKnownCategoriesResponseFut: std::future::Future<Output = Result<Vec<fidl_fuchsia_tracing::KnownCategory>, fidl::Error>>
50 + Send;
51 fn r#get_known_categories(&self) -> Self::GetKnownCategoriesResponseFut;
52}
53#[derive(Debug)]
54#[cfg(target_os = "fuchsia")]
55pub struct ProvisionerSynchronousProxy {
56 client: fidl::client::sync::Client,
57}
58
59#[cfg(target_os = "fuchsia")]
60impl fidl::endpoints::SynchronousProxy for ProvisionerSynchronousProxy {
61 type Proxy = ProvisionerProxy;
62 type Protocol = ProvisionerMarker;
63
64 fn from_channel(inner: fidl::Channel) -> Self {
65 Self::new(inner)
66 }
67
68 fn into_channel(self) -> fidl::Channel {
69 self.client.into_channel()
70 }
71
72 fn as_channel(&self) -> &fidl::Channel {
73 self.client.as_channel()
74 }
75}
76
77#[cfg(target_os = "fuchsia")]
78impl ProvisionerSynchronousProxy {
79 pub fn new(channel: fidl::Channel) -> Self {
80 let protocol_name = <ProvisionerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
81 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
82 }
83
84 pub fn into_channel(self) -> fidl::Channel {
85 self.client.into_channel()
86 }
87
88 pub fn wait_for_event(
91 &self,
92 deadline: zx::MonotonicInstant,
93 ) -> Result<ProvisionerEvent, fidl::Error> {
94 ProvisionerEvent::decode(self.client.wait_for_event(deadline)?)
95 }
96
97 pub fn r#initialize_tracing(
108 &self,
109 mut controller: fidl::endpoints::ServerEnd<SessionMarker>,
110 mut config: &TraceConfig,
111 mut output: fidl::Socket,
112 ) -> Result<(), fidl::Error> {
113 self.client.send::<ProvisionerInitializeTracingRequest>(
114 (controller, config, output),
115 0x3b046ed3a0684ab8,
116 fidl::encoding::DynamicFlags::FLEXIBLE,
117 )
118 }
119
120 pub fn r#get_providers(
122 &self,
123 ___deadline: zx::MonotonicInstant,
124 ) -> Result<Vec<ProviderInfo>, fidl::Error> {
125 let _response = self.client.send_query::<
126 fidl::encoding::EmptyPayload,
127 fidl::encoding::FlexibleType<ProvisionerGetProvidersResponse>,
128 >(
129 (),
130 0xc4d4f36edc50d43,
131 fidl::encoding::DynamicFlags::FLEXIBLE,
132 ___deadline,
133 )?
134 .into_result::<ProvisionerMarker>("get_providers")?;
135 Ok(_response.providers)
136 }
137
138 pub fn r#get_known_categories(
139 &self,
140 ___deadline: zx::MonotonicInstant,
141 ) -> Result<Vec<fidl_fuchsia_tracing::KnownCategory>, fidl::Error> {
142 let _response = self.client.send_query::<
143 fidl::encoding::EmptyPayload,
144 fidl::encoding::FlexibleType<ProvisionerGetKnownCategoriesResponse>,
145 >(
146 (),
147 0x41ef99397b945a4,
148 fidl::encoding::DynamicFlags::FLEXIBLE,
149 ___deadline,
150 )?
151 .into_result::<ProvisionerMarker>("get_known_categories")?;
152 Ok(_response.categories)
153 }
154}
155
156#[cfg(target_os = "fuchsia")]
157impl From<ProvisionerSynchronousProxy> for zx::Handle {
158 fn from(value: ProvisionerSynchronousProxy) -> Self {
159 value.into_channel().into()
160 }
161}
162
163#[cfg(target_os = "fuchsia")]
164impl From<fidl::Channel> for ProvisionerSynchronousProxy {
165 fn from(value: fidl::Channel) -> Self {
166 Self::new(value)
167 }
168}
169
170#[derive(Debug, Clone)]
171pub struct ProvisionerProxy {
172 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
173}
174
175impl fidl::endpoints::Proxy for ProvisionerProxy {
176 type Protocol = ProvisionerMarker;
177
178 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
179 Self::new(inner)
180 }
181
182 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
183 self.client.into_channel().map_err(|client| Self { client })
184 }
185
186 fn as_channel(&self) -> &::fidl::AsyncChannel {
187 self.client.as_channel()
188 }
189}
190
191impl ProvisionerProxy {
192 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
194 let protocol_name = <ProvisionerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
195 Self { client: fidl::client::Client::new(channel, protocol_name) }
196 }
197
198 pub fn take_event_stream(&self) -> ProvisionerEventStream {
204 ProvisionerEventStream { event_receiver: self.client.take_event_receiver() }
205 }
206
207 pub fn r#initialize_tracing(
218 &self,
219 mut controller: fidl::endpoints::ServerEnd<SessionMarker>,
220 mut config: &TraceConfig,
221 mut output: fidl::Socket,
222 ) -> Result<(), fidl::Error> {
223 ProvisionerProxyInterface::r#initialize_tracing(self, controller, config, output)
224 }
225
226 pub fn r#get_providers(
228 &self,
229 ) -> fidl::client::QueryResponseFut<
230 Vec<ProviderInfo>,
231 fidl::encoding::DefaultFuchsiaResourceDialect,
232 > {
233 ProvisionerProxyInterface::r#get_providers(self)
234 }
235
236 pub fn r#get_known_categories(
237 &self,
238 ) -> fidl::client::QueryResponseFut<
239 Vec<fidl_fuchsia_tracing::KnownCategory>,
240 fidl::encoding::DefaultFuchsiaResourceDialect,
241 > {
242 ProvisionerProxyInterface::r#get_known_categories(self)
243 }
244}
245
246impl ProvisionerProxyInterface for ProvisionerProxy {
247 fn r#initialize_tracing(
248 &self,
249 mut controller: fidl::endpoints::ServerEnd<SessionMarker>,
250 mut config: &TraceConfig,
251 mut output: fidl::Socket,
252 ) -> Result<(), fidl::Error> {
253 self.client.send::<ProvisionerInitializeTracingRequest>(
254 (controller, config, output),
255 0x3b046ed3a0684ab8,
256 fidl::encoding::DynamicFlags::FLEXIBLE,
257 )
258 }
259
260 type GetProvidersResponseFut = fidl::client::QueryResponseFut<
261 Vec<ProviderInfo>,
262 fidl::encoding::DefaultFuchsiaResourceDialect,
263 >;
264 fn r#get_providers(&self) -> Self::GetProvidersResponseFut {
265 fn _decode(
266 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
267 ) -> Result<Vec<ProviderInfo>, fidl::Error> {
268 let _response = fidl::client::decode_transaction_body::<
269 fidl::encoding::FlexibleType<ProvisionerGetProvidersResponse>,
270 fidl::encoding::DefaultFuchsiaResourceDialect,
271 0xc4d4f36edc50d43,
272 >(_buf?)?
273 .into_result::<ProvisionerMarker>("get_providers")?;
274 Ok(_response.providers)
275 }
276 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<ProviderInfo>>(
277 (),
278 0xc4d4f36edc50d43,
279 fidl::encoding::DynamicFlags::FLEXIBLE,
280 _decode,
281 )
282 }
283
284 type GetKnownCategoriesResponseFut = fidl::client::QueryResponseFut<
285 Vec<fidl_fuchsia_tracing::KnownCategory>,
286 fidl::encoding::DefaultFuchsiaResourceDialect,
287 >;
288 fn r#get_known_categories(&self) -> Self::GetKnownCategoriesResponseFut {
289 fn _decode(
290 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
291 ) -> Result<Vec<fidl_fuchsia_tracing::KnownCategory>, fidl::Error> {
292 let _response = fidl::client::decode_transaction_body::<
293 fidl::encoding::FlexibleType<ProvisionerGetKnownCategoriesResponse>,
294 fidl::encoding::DefaultFuchsiaResourceDialect,
295 0x41ef99397b945a4,
296 >(_buf?)?
297 .into_result::<ProvisionerMarker>("get_known_categories")?;
298 Ok(_response.categories)
299 }
300 self.client.send_query_and_decode::<
301 fidl::encoding::EmptyPayload,
302 Vec<fidl_fuchsia_tracing::KnownCategory>,
303 >(
304 (),
305 0x41ef99397b945a4,
306 fidl::encoding::DynamicFlags::FLEXIBLE,
307 _decode,
308 )
309 }
310}
311
312pub struct ProvisionerEventStream {
313 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
314}
315
316impl std::marker::Unpin for ProvisionerEventStream {}
317
318impl futures::stream::FusedStream for ProvisionerEventStream {
319 fn is_terminated(&self) -> bool {
320 self.event_receiver.is_terminated()
321 }
322}
323
324impl futures::Stream for ProvisionerEventStream {
325 type Item = Result<ProvisionerEvent, fidl::Error>;
326
327 fn poll_next(
328 mut self: std::pin::Pin<&mut Self>,
329 cx: &mut std::task::Context<'_>,
330 ) -> std::task::Poll<Option<Self::Item>> {
331 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
332 &mut self.event_receiver,
333 cx
334 )?) {
335 Some(buf) => std::task::Poll::Ready(Some(ProvisionerEvent::decode(buf))),
336 None => std::task::Poll::Ready(None),
337 }
338 }
339}
340
341#[derive(Debug)]
342pub enum ProvisionerEvent {
343 #[non_exhaustive]
344 _UnknownEvent {
345 ordinal: u64,
347 },
348}
349
350impl ProvisionerEvent {
351 fn decode(
353 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
354 ) -> Result<ProvisionerEvent, fidl::Error> {
355 let (bytes, _handles) = buf.split_mut();
356 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
357 debug_assert_eq!(tx_header.tx_id, 0);
358 match tx_header.ordinal {
359 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
360 Ok(ProvisionerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
361 }
362 _ => Err(fidl::Error::UnknownOrdinal {
363 ordinal: tx_header.ordinal,
364 protocol_name: <ProvisionerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
365 }),
366 }
367 }
368}
369
370pub struct ProvisionerRequestStream {
372 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
373 is_terminated: bool,
374}
375
376impl std::marker::Unpin for ProvisionerRequestStream {}
377
378impl futures::stream::FusedStream for ProvisionerRequestStream {
379 fn is_terminated(&self) -> bool {
380 self.is_terminated
381 }
382}
383
384impl fidl::endpoints::RequestStream for ProvisionerRequestStream {
385 type Protocol = ProvisionerMarker;
386 type ControlHandle = ProvisionerControlHandle;
387
388 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
389 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
390 }
391
392 fn control_handle(&self) -> Self::ControlHandle {
393 ProvisionerControlHandle { inner: self.inner.clone() }
394 }
395
396 fn into_inner(
397 self,
398 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
399 {
400 (self.inner, self.is_terminated)
401 }
402
403 fn from_inner(
404 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
405 is_terminated: bool,
406 ) -> Self {
407 Self { inner, is_terminated }
408 }
409}
410
411impl futures::Stream for ProvisionerRequestStream {
412 type Item = Result<ProvisionerRequest, fidl::Error>;
413
414 fn poll_next(
415 mut self: std::pin::Pin<&mut Self>,
416 cx: &mut std::task::Context<'_>,
417 ) -> std::task::Poll<Option<Self::Item>> {
418 let this = &mut *self;
419 if this.inner.check_shutdown(cx) {
420 this.is_terminated = true;
421 return std::task::Poll::Ready(None);
422 }
423 if this.is_terminated {
424 panic!("polled ProvisionerRequestStream after completion");
425 }
426 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
427 |bytes, handles| {
428 match this.inner.channel().read_etc(cx, bytes, handles) {
429 std::task::Poll::Ready(Ok(())) => {}
430 std::task::Poll::Pending => return std::task::Poll::Pending,
431 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
432 this.is_terminated = true;
433 return std::task::Poll::Ready(None);
434 }
435 std::task::Poll::Ready(Err(e)) => {
436 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
437 e.into(),
438 ))))
439 }
440 }
441
442 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
444
445 std::task::Poll::Ready(Some(match header.ordinal {
446 0x3b046ed3a0684ab8 => {
447 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
448 let mut req = fidl::new_empty!(
449 ProvisionerInitializeTracingRequest,
450 fidl::encoding::DefaultFuchsiaResourceDialect
451 );
452 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProvisionerInitializeTracingRequest>(&header, _body_bytes, handles, &mut req)?;
453 let control_handle = ProvisionerControlHandle { inner: this.inner.clone() };
454 Ok(ProvisionerRequest::InitializeTracing {
455 controller: req.controller,
456 config: req.config,
457 output: req.output,
458
459 control_handle,
460 })
461 }
462 0xc4d4f36edc50d43 => {
463 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
464 let mut req = fidl::new_empty!(
465 fidl::encoding::EmptyPayload,
466 fidl::encoding::DefaultFuchsiaResourceDialect
467 );
468 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
469 let control_handle = ProvisionerControlHandle { inner: this.inner.clone() };
470 Ok(ProvisionerRequest::GetProviders {
471 responder: ProvisionerGetProvidersResponder {
472 control_handle: std::mem::ManuallyDrop::new(control_handle),
473 tx_id: header.tx_id,
474 },
475 })
476 }
477 0x41ef99397b945a4 => {
478 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
479 let mut req = fidl::new_empty!(
480 fidl::encoding::EmptyPayload,
481 fidl::encoding::DefaultFuchsiaResourceDialect
482 );
483 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
484 let control_handle = ProvisionerControlHandle { inner: this.inner.clone() };
485 Ok(ProvisionerRequest::GetKnownCategories {
486 responder: ProvisionerGetKnownCategoriesResponder {
487 control_handle: std::mem::ManuallyDrop::new(control_handle),
488 tx_id: header.tx_id,
489 },
490 })
491 }
492 _ if header.tx_id == 0
493 && header
494 .dynamic_flags()
495 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
496 {
497 Ok(ProvisionerRequest::_UnknownMethod {
498 ordinal: header.ordinal,
499 control_handle: ProvisionerControlHandle { inner: this.inner.clone() },
500 method_type: fidl::MethodType::OneWay,
501 })
502 }
503 _ if header
504 .dynamic_flags()
505 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
506 {
507 this.inner.send_framework_err(
508 fidl::encoding::FrameworkErr::UnknownMethod,
509 header.tx_id,
510 header.ordinal,
511 header.dynamic_flags(),
512 (bytes, handles),
513 )?;
514 Ok(ProvisionerRequest::_UnknownMethod {
515 ordinal: header.ordinal,
516 control_handle: ProvisionerControlHandle { inner: this.inner.clone() },
517 method_type: fidl::MethodType::TwoWay,
518 })
519 }
520 _ => Err(fidl::Error::UnknownOrdinal {
521 ordinal: header.ordinal,
522 protocol_name:
523 <ProvisionerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
524 }),
525 }))
526 },
527 )
528 }
529}
530
531#[derive(Debug)]
539pub enum ProvisionerRequest {
540 InitializeTracing {
551 controller: fidl::endpoints::ServerEnd<SessionMarker>,
552 config: TraceConfig,
553 output: fidl::Socket,
554 control_handle: ProvisionerControlHandle,
555 },
556 GetProviders {
558 responder: ProvisionerGetProvidersResponder,
559 },
560 GetKnownCategories {
561 responder: ProvisionerGetKnownCategoriesResponder,
562 },
563 #[non_exhaustive]
565 _UnknownMethod {
566 ordinal: u64,
568 control_handle: ProvisionerControlHandle,
569 method_type: fidl::MethodType,
570 },
571}
572
573impl ProvisionerRequest {
574 #[allow(irrefutable_let_patterns)]
575 pub fn into_initialize_tracing(
576 self,
577 ) -> Option<(
578 fidl::endpoints::ServerEnd<SessionMarker>,
579 TraceConfig,
580 fidl::Socket,
581 ProvisionerControlHandle,
582 )> {
583 if let ProvisionerRequest::InitializeTracing {
584 controller,
585 config,
586 output,
587 control_handle,
588 } = self
589 {
590 Some((controller, config, output, control_handle))
591 } else {
592 None
593 }
594 }
595
596 #[allow(irrefutable_let_patterns)]
597 pub fn into_get_providers(self) -> Option<(ProvisionerGetProvidersResponder)> {
598 if let ProvisionerRequest::GetProviders { responder } = self {
599 Some((responder))
600 } else {
601 None
602 }
603 }
604
605 #[allow(irrefutable_let_patterns)]
606 pub fn into_get_known_categories(self) -> Option<(ProvisionerGetKnownCategoriesResponder)> {
607 if let ProvisionerRequest::GetKnownCategories { responder } = self {
608 Some((responder))
609 } else {
610 None
611 }
612 }
613
614 pub fn method_name(&self) -> &'static str {
616 match *self {
617 ProvisionerRequest::InitializeTracing { .. } => "initialize_tracing",
618 ProvisionerRequest::GetProviders { .. } => "get_providers",
619 ProvisionerRequest::GetKnownCategories { .. } => "get_known_categories",
620 ProvisionerRequest::_UnknownMethod {
621 method_type: fidl::MethodType::OneWay, ..
622 } => "unknown one-way method",
623 ProvisionerRequest::_UnknownMethod {
624 method_type: fidl::MethodType::TwoWay, ..
625 } => "unknown two-way method",
626 }
627 }
628}
629
630#[derive(Debug, Clone)]
631pub struct ProvisionerControlHandle {
632 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
633}
634
635impl fidl::endpoints::ControlHandle for ProvisionerControlHandle {
636 fn shutdown(&self) {
637 self.inner.shutdown()
638 }
639 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
640 self.inner.shutdown_with_epitaph(status)
641 }
642
643 fn is_closed(&self) -> bool {
644 self.inner.channel().is_closed()
645 }
646 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
647 self.inner.channel().on_closed()
648 }
649
650 #[cfg(target_os = "fuchsia")]
651 fn signal_peer(
652 &self,
653 clear_mask: zx::Signals,
654 set_mask: zx::Signals,
655 ) -> Result<(), zx_status::Status> {
656 use fidl::Peered;
657 self.inner.channel().signal_peer(clear_mask, set_mask)
658 }
659}
660
661impl ProvisionerControlHandle {}
662
663#[must_use = "FIDL methods require a response to be sent"]
664#[derive(Debug)]
665pub struct ProvisionerGetProvidersResponder {
666 control_handle: std::mem::ManuallyDrop<ProvisionerControlHandle>,
667 tx_id: u32,
668}
669
670impl std::ops::Drop for ProvisionerGetProvidersResponder {
674 fn drop(&mut self) {
675 self.control_handle.shutdown();
676 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
678 }
679}
680
681impl fidl::endpoints::Responder for ProvisionerGetProvidersResponder {
682 type ControlHandle = ProvisionerControlHandle;
683
684 fn control_handle(&self) -> &ProvisionerControlHandle {
685 &self.control_handle
686 }
687
688 fn drop_without_shutdown(mut self) {
689 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
691 std::mem::forget(self);
693 }
694}
695
696impl ProvisionerGetProvidersResponder {
697 pub fn send(self, mut providers: &[ProviderInfo]) -> Result<(), fidl::Error> {
701 let _result = self.send_raw(providers);
702 if _result.is_err() {
703 self.control_handle.shutdown();
704 }
705 self.drop_without_shutdown();
706 _result
707 }
708
709 pub fn send_no_shutdown_on_err(
711 self,
712 mut providers: &[ProviderInfo],
713 ) -> Result<(), fidl::Error> {
714 let _result = self.send_raw(providers);
715 self.drop_without_shutdown();
716 _result
717 }
718
719 fn send_raw(&self, mut providers: &[ProviderInfo]) -> Result<(), fidl::Error> {
720 self.control_handle
721 .inner
722 .send::<fidl::encoding::FlexibleType<ProvisionerGetProvidersResponse>>(
723 fidl::encoding::Flexible::new((providers,)),
724 self.tx_id,
725 0xc4d4f36edc50d43,
726 fidl::encoding::DynamicFlags::FLEXIBLE,
727 )
728 }
729}
730
731#[must_use = "FIDL methods require a response to be sent"]
732#[derive(Debug)]
733pub struct ProvisionerGetKnownCategoriesResponder {
734 control_handle: std::mem::ManuallyDrop<ProvisionerControlHandle>,
735 tx_id: u32,
736}
737
738impl std::ops::Drop for ProvisionerGetKnownCategoriesResponder {
742 fn drop(&mut self) {
743 self.control_handle.shutdown();
744 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
746 }
747}
748
749impl fidl::endpoints::Responder for ProvisionerGetKnownCategoriesResponder {
750 type ControlHandle = ProvisionerControlHandle;
751
752 fn control_handle(&self) -> &ProvisionerControlHandle {
753 &self.control_handle
754 }
755
756 fn drop_without_shutdown(mut self) {
757 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
759 std::mem::forget(self);
761 }
762}
763
764impl ProvisionerGetKnownCategoriesResponder {
765 pub fn send(
769 self,
770 mut categories: &[fidl_fuchsia_tracing::KnownCategory],
771 ) -> Result<(), fidl::Error> {
772 let _result = self.send_raw(categories);
773 if _result.is_err() {
774 self.control_handle.shutdown();
775 }
776 self.drop_without_shutdown();
777 _result
778 }
779
780 pub fn send_no_shutdown_on_err(
782 self,
783 mut categories: &[fidl_fuchsia_tracing::KnownCategory],
784 ) -> Result<(), fidl::Error> {
785 let _result = self.send_raw(categories);
786 self.drop_without_shutdown();
787 _result
788 }
789
790 fn send_raw(
791 &self,
792 mut categories: &[fidl_fuchsia_tracing::KnownCategory],
793 ) -> Result<(), fidl::Error> {
794 self.control_handle
795 .inner
796 .send::<fidl::encoding::FlexibleType<ProvisionerGetKnownCategoriesResponse>>(
797 fidl::encoding::Flexible::new((categories,)),
798 self.tx_id,
799 0x41ef99397b945a4,
800 fidl::encoding::DynamicFlags::FLEXIBLE,
801 )
802 }
803}
804
805#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
806pub struct SessionMarker;
807
808impl fidl::endpoints::ProtocolMarker for SessionMarker {
809 type Proxy = SessionProxy;
810 type RequestStream = SessionRequestStream;
811 #[cfg(target_os = "fuchsia")]
812 type SynchronousProxy = SessionSynchronousProxy;
813
814 const DEBUG_NAME: &'static str = "(anonymous) Session";
815}
816pub type SessionStartTracingResult = Result<(), StartError>;
817pub type SessionStopTracingResult = Result<StopResult, StopError>;
818
819pub trait SessionProxyInterface: Send + Sync {
820 type StartTracingResponseFut: std::future::Future<Output = Result<SessionStartTracingResult, fidl::Error>>
821 + Send;
822 fn r#start_tracing(&self, payload: &StartOptions) -> Self::StartTracingResponseFut;
823 type StopTracingResponseFut: std::future::Future<Output = Result<SessionStopTracingResult, fidl::Error>>
824 + Send;
825 fn r#stop_tracing(&self, payload: &StopOptions) -> Self::StopTracingResponseFut;
826 type WatchAlertResponseFut: std::future::Future<Output = Result<String, fidl::Error>> + Send;
827 fn r#watch_alert(&self) -> Self::WatchAlertResponseFut;
828}
829#[derive(Debug)]
830#[cfg(target_os = "fuchsia")]
831pub struct SessionSynchronousProxy {
832 client: fidl::client::sync::Client,
833}
834
835#[cfg(target_os = "fuchsia")]
836impl fidl::endpoints::SynchronousProxy for SessionSynchronousProxy {
837 type Proxy = SessionProxy;
838 type Protocol = SessionMarker;
839
840 fn from_channel(inner: fidl::Channel) -> Self {
841 Self::new(inner)
842 }
843
844 fn into_channel(self) -> fidl::Channel {
845 self.client.into_channel()
846 }
847
848 fn as_channel(&self) -> &fidl::Channel {
849 self.client.as_channel()
850 }
851}
852
853#[cfg(target_os = "fuchsia")]
854impl SessionSynchronousProxy {
855 pub fn new(channel: fidl::Channel) -> Self {
856 let protocol_name = <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
857 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
858 }
859
860 pub fn into_channel(self) -> fidl::Channel {
861 self.client.into_channel()
862 }
863
864 pub fn wait_for_event(
867 &self,
868 deadline: zx::MonotonicInstant,
869 ) -> Result<SessionEvent, fidl::Error> {
870 SessionEvent::decode(self.client.wait_for_event(deadline)?)
871 }
872
873 pub fn r#start_tracing(
885 &self,
886 mut payload: &StartOptions,
887 ___deadline: zx::MonotonicInstant,
888 ) -> Result<SessionStartTracingResult, fidl::Error> {
889 let _response = self.client.send_query::<
890 StartOptions,
891 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, StartError>,
892 >(
893 payload,
894 0xde9b6ccbe936631,
895 fidl::encoding::DynamicFlags::FLEXIBLE,
896 ___deadline,
897 )?
898 .into_result::<SessionMarker>("start_tracing")?;
899 Ok(_response.map(|x| x))
900 }
901
902 pub fn r#stop_tracing(
908 &self,
909 mut payload: &StopOptions,
910 ___deadline: zx::MonotonicInstant,
911 ) -> Result<SessionStopTracingResult, fidl::Error> {
912 let _response = self
913 .client
914 .send_query::<StopOptions, fidl::encoding::FlexibleResultType<StopResult, StopError>>(
915 payload,
916 0x50fefc9b3ff9b03a,
917 fidl::encoding::DynamicFlags::FLEXIBLE,
918 ___deadline,
919 )?
920 .into_result::<SessionMarker>("stop_tracing")?;
921 Ok(_response.map(|x| x))
922 }
923
924 pub fn r#watch_alert(&self, ___deadline: zx::MonotonicInstant) -> Result<String, fidl::Error> {
933 let _response = self.client.send_query::<
934 fidl::encoding::EmptyPayload,
935 fidl::encoding::FlexibleType<SessionWatchAlertResponse>,
936 >(
937 (),
938 0x1f1c080716d92276,
939 fidl::encoding::DynamicFlags::FLEXIBLE,
940 ___deadline,
941 )?
942 .into_result::<SessionMarker>("watch_alert")?;
943 Ok(_response.alert_name)
944 }
945}
946
947#[cfg(target_os = "fuchsia")]
948impl From<SessionSynchronousProxy> for zx::Handle {
949 fn from(value: SessionSynchronousProxy) -> Self {
950 value.into_channel().into()
951 }
952}
953
954#[cfg(target_os = "fuchsia")]
955impl From<fidl::Channel> for SessionSynchronousProxy {
956 fn from(value: fidl::Channel) -> Self {
957 Self::new(value)
958 }
959}
960
961#[derive(Debug, Clone)]
962pub struct SessionProxy {
963 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
964}
965
966impl fidl::endpoints::Proxy for SessionProxy {
967 type Protocol = SessionMarker;
968
969 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
970 Self::new(inner)
971 }
972
973 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
974 self.client.into_channel().map_err(|client| Self { client })
975 }
976
977 fn as_channel(&self) -> &::fidl::AsyncChannel {
978 self.client.as_channel()
979 }
980}
981
982impl SessionProxy {
983 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
985 let protocol_name = <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
986 Self { client: fidl::client::Client::new(channel, protocol_name) }
987 }
988
989 pub fn take_event_stream(&self) -> SessionEventStream {
995 SessionEventStream { event_receiver: self.client.take_event_receiver() }
996 }
997
998 pub fn r#start_tracing(
1010 &self,
1011 mut payload: &StartOptions,
1012 ) -> fidl::client::QueryResponseFut<
1013 SessionStartTracingResult,
1014 fidl::encoding::DefaultFuchsiaResourceDialect,
1015 > {
1016 SessionProxyInterface::r#start_tracing(self, payload)
1017 }
1018
1019 pub fn r#stop_tracing(
1025 &self,
1026 mut payload: &StopOptions,
1027 ) -> fidl::client::QueryResponseFut<
1028 SessionStopTracingResult,
1029 fidl::encoding::DefaultFuchsiaResourceDialect,
1030 > {
1031 SessionProxyInterface::r#stop_tracing(self, payload)
1032 }
1033
1034 pub fn r#watch_alert(
1043 &self,
1044 ) -> fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect> {
1045 SessionProxyInterface::r#watch_alert(self)
1046 }
1047}
1048
1049impl SessionProxyInterface for SessionProxy {
1050 type StartTracingResponseFut = fidl::client::QueryResponseFut<
1051 SessionStartTracingResult,
1052 fidl::encoding::DefaultFuchsiaResourceDialect,
1053 >;
1054 fn r#start_tracing(&self, mut payload: &StartOptions) -> Self::StartTracingResponseFut {
1055 fn _decode(
1056 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1057 ) -> Result<SessionStartTracingResult, fidl::Error> {
1058 let _response = fidl::client::decode_transaction_body::<
1059 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, StartError>,
1060 fidl::encoding::DefaultFuchsiaResourceDialect,
1061 0xde9b6ccbe936631,
1062 >(_buf?)?
1063 .into_result::<SessionMarker>("start_tracing")?;
1064 Ok(_response.map(|x| x))
1065 }
1066 self.client.send_query_and_decode::<StartOptions, SessionStartTracingResult>(
1067 payload,
1068 0xde9b6ccbe936631,
1069 fidl::encoding::DynamicFlags::FLEXIBLE,
1070 _decode,
1071 )
1072 }
1073
1074 type StopTracingResponseFut = fidl::client::QueryResponseFut<
1075 SessionStopTracingResult,
1076 fidl::encoding::DefaultFuchsiaResourceDialect,
1077 >;
1078 fn r#stop_tracing(&self, mut payload: &StopOptions) -> Self::StopTracingResponseFut {
1079 fn _decode(
1080 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1081 ) -> Result<SessionStopTracingResult, fidl::Error> {
1082 let _response = fidl::client::decode_transaction_body::<
1083 fidl::encoding::FlexibleResultType<StopResult, StopError>,
1084 fidl::encoding::DefaultFuchsiaResourceDialect,
1085 0x50fefc9b3ff9b03a,
1086 >(_buf?)?
1087 .into_result::<SessionMarker>("stop_tracing")?;
1088 Ok(_response.map(|x| x))
1089 }
1090 self.client.send_query_and_decode::<StopOptions, SessionStopTracingResult>(
1091 payload,
1092 0x50fefc9b3ff9b03a,
1093 fidl::encoding::DynamicFlags::FLEXIBLE,
1094 _decode,
1095 )
1096 }
1097
1098 type WatchAlertResponseFut =
1099 fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect>;
1100 fn r#watch_alert(&self) -> Self::WatchAlertResponseFut {
1101 fn _decode(
1102 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1103 ) -> Result<String, fidl::Error> {
1104 let _response = fidl::client::decode_transaction_body::<
1105 fidl::encoding::FlexibleType<SessionWatchAlertResponse>,
1106 fidl::encoding::DefaultFuchsiaResourceDialect,
1107 0x1f1c080716d92276,
1108 >(_buf?)?
1109 .into_result::<SessionMarker>("watch_alert")?;
1110 Ok(_response.alert_name)
1111 }
1112 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, String>(
1113 (),
1114 0x1f1c080716d92276,
1115 fidl::encoding::DynamicFlags::FLEXIBLE,
1116 _decode,
1117 )
1118 }
1119}
1120
1121pub struct SessionEventStream {
1122 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1123}
1124
1125impl std::marker::Unpin for SessionEventStream {}
1126
1127impl futures::stream::FusedStream for SessionEventStream {
1128 fn is_terminated(&self) -> bool {
1129 self.event_receiver.is_terminated()
1130 }
1131}
1132
1133impl futures::Stream for SessionEventStream {
1134 type Item = Result<SessionEvent, fidl::Error>;
1135
1136 fn poll_next(
1137 mut self: std::pin::Pin<&mut Self>,
1138 cx: &mut std::task::Context<'_>,
1139 ) -> std::task::Poll<Option<Self::Item>> {
1140 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1141 &mut self.event_receiver,
1142 cx
1143 )?) {
1144 Some(buf) => std::task::Poll::Ready(Some(SessionEvent::decode(buf))),
1145 None => std::task::Poll::Ready(None),
1146 }
1147 }
1148}
1149
1150#[derive(Debug)]
1151pub enum SessionEvent {
1152 OnSessionStateChange {
1153 state: SessionState,
1154 },
1155 #[non_exhaustive]
1156 _UnknownEvent {
1157 ordinal: u64,
1159 },
1160}
1161
1162impl SessionEvent {
1163 #[allow(irrefutable_let_patterns)]
1164 pub fn into_on_session_state_change(self) -> Option<SessionState> {
1165 if let SessionEvent::OnSessionStateChange { state } = self {
1166 Some((state))
1167 } else {
1168 None
1169 }
1170 }
1171
1172 fn decode(
1174 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1175 ) -> Result<SessionEvent, fidl::Error> {
1176 let (bytes, _handles) = buf.split_mut();
1177 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1178 debug_assert_eq!(tx_header.tx_id, 0);
1179 match tx_header.ordinal {
1180 0x7ab1640718b971cd => {
1181 let mut out = fidl::new_empty!(
1182 SessionOnSessionStateChangeRequest,
1183 fidl::encoding::DefaultFuchsiaResourceDialect
1184 );
1185 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionOnSessionStateChangeRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
1186 Ok((SessionEvent::OnSessionStateChange { state: out.state }))
1187 }
1188 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1189 Ok(SessionEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1190 }
1191 _ => Err(fidl::Error::UnknownOrdinal {
1192 ordinal: tx_header.ordinal,
1193 protocol_name: <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1194 }),
1195 }
1196 }
1197}
1198
1199pub struct SessionRequestStream {
1201 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1202 is_terminated: bool,
1203}
1204
1205impl std::marker::Unpin for SessionRequestStream {}
1206
1207impl futures::stream::FusedStream for SessionRequestStream {
1208 fn is_terminated(&self) -> bool {
1209 self.is_terminated
1210 }
1211}
1212
1213impl fidl::endpoints::RequestStream for SessionRequestStream {
1214 type Protocol = SessionMarker;
1215 type ControlHandle = SessionControlHandle;
1216
1217 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1218 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1219 }
1220
1221 fn control_handle(&self) -> Self::ControlHandle {
1222 SessionControlHandle { inner: self.inner.clone() }
1223 }
1224
1225 fn into_inner(
1226 self,
1227 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1228 {
1229 (self.inner, self.is_terminated)
1230 }
1231
1232 fn from_inner(
1233 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1234 is_terminated: bool,
1235 ) -> Self {
1236 Self { inner, is_terminated }
1237 }
1238}
1239
1240impl futures::Stream for SessionRequestStream {
1241 type Item = Result<SessionRequest, fidl::Error>;
1242
1243 fn poll_next(
1244 mut self: std::pin::Pin<&mut Self>,
1245 cx: &mut std::task::Context<'_>,
1246 ) -> std::task::Poll<Option<Self::Item>> {
1247 let this = &mut *self;
1248 if this.inner.check_shutdown(cx) {
1249 this.is_terminated = true;
1250 return std::task::Poll::Ready(None);
1251 }
1252 if this.is_terminated {
1253 panic!("polled SessionRequestStream after completion");
1254 }
1255 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1256 |bytes, handles| {
1257 match this.inner.channel().read_etc(cx, bytes, handles) {
1258 std::task::Poll::Ready(Ok(())) => {}
1259 std::task::Poll::Pending => return std::task::Poll::Pending,
1260 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1261 this.is_terminated = true;
1262 return std::task::Poll::Ready(None);
1263 }
1264 std::task::Poll::Ready(Err(e)) => {
1265 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1266 e.into(),
1267 ))))
1268 }
1269 }
1270
1271 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1273
1274 std::task::Poll::Ready(Some(match header.ordinal {
1275 0xde9b6ccbe936631 => {
1276 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1277 let mut req = fidl::new_empty!(
1278 StartOptions,
1279 fidl::encoding::DefaultFuchsiaResourceDialect
1280 );
1281 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StartOptions>(&header, _body_bytes, handles, &mut req)?;
1282 let control_handle = SessionControlHandle { inner: this.inner.clone() };
1283 Ok(SessionRequest::StartTracing {
1284 payload: req,
1285 responder: SessionStartTracingResponder {
1286 control_handle: std::mem::ManuallyDrop::new(control_handle),
1287 tx_id: header.tx_id,
1288 },
1289 })
1290 }
1291 0x50fefc9b3ff9b03a => {
1292 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1293 let mut req = fidl::new_empty!(
1294 StopOptions,
1295 fidl::encoding::DefaultFuchsiaResourceDialect
1296 );
1297 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StopOptions>(&header, _body_bytes, handles, &mut req)?;
1298 let control_handle = SessionControlHandle { inner: this.inner.clone() };
1299 Ok(SessionRequest::StopTracing {
1300 payload: req,
1301 responder: SessionStopTracingResponder {
1302 control_handle: std::mem::ManuallyDrop::new(control_handle),
1303 tx_id: header.tx_id,
1304 },
1305 })
1306 }
1307 0x1f1c080716d92276 => {
1308 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1309 let mut req = fidl::new_empty!(
1310 fidl::encoding::EmptyPayload,
1311 fidl::encoding::DefaultFuchsiaResourceDialect
1312 );
1313 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1314 let control_handle = SessionControlHandle { inner: this.inner.clone() };
1315 Ok(SessionRequest::WatchAlert {
1316 responder: SessionWatchAlertResponder {
1317 control_handle: std::mem::ManuallyDrop::new(control_handle),
1318 tx_id: header.tx_id,
1319 },
1320 })
1321 }
1322 _ if header.tx_id == 0
1323 && header
1324 .dynamic_flags()
1325 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1326 {
1327 Ok(SessionRequest::_UnknownMethod {
1328 ordinal: header.ordinal,
1329 control_handle: SessionControlHandle { inner: this.inner.clone() },
1330 method_type: fidl::MethodType::OneWay,
1331 })
1332 }
1333 _ if header
1334 .dynamic_flags()
1335 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1336 {
1337 this.inner.send_framework_err(
1338 fidl::encoding::FrameworkErr::UnknownMethod,
1339 header.tx_id,
1340 header.ordinal,
1341 header.dynamic_flags(),
1342 (bytes, handles),
1343 )?;
1344 Ok(SessionRequest::_UnknownMethod {
1345 ordinal: header.ordinal,
1346 control_handle: SessionControlHandle { inner: this.inner.clone() },
1347 method_type: fidl::MethodType::TwoWay,
1348 })
1349 }
1350 _ => Err(fidl::Error::UnknownOrdinal {
1351 ordinal: header.ordinal,
1352 protocol_name:
1353 <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1354 }),
1355 }))
1356 },
1357 )
1358 }
1359}
1360
1361#[derive(Debug)]
1377pub enum SessionRequest {
1378 StartTracing { payload: StartOptions, responder: SessionStartTracingResponder },
1390 StopTracing { payload: StopOptions, responder: SessionStopTracingResponder },
1396 WatchAlert { responder: SessionWatchAlertResponder },
1405 #[non_exhaustive]
1407 _UnknownMethod {
1408 ordinal: u64,
1410 control_handle: SessionControlHandle,
1411 method_type: fidl::MethodType,
1412 },
1413}
1414
1415impl SessionRequest {
1416 #[allow(irrefutable_let_patterns)]
1417 pub fn into_start_tracing(self) -> Option<(StartOptions, SessionStartTracingResponder)> {
1418 if let SessionRequest::StartTracing { payload, responder } = self {
1419 Some((payload, responder))
1420 } else {
1421 None
1422 }
1423 }
1424
1425 #[allow(irrefutable_let_patterns)]
1426 pub fn into_stop_tracing(self) -> Option<(StopOptions, SessionStopTracingResponder)> {
1427 if let SessionRequest::StopTracing { payload, responder } = self {
1428 Some((payload, responder))
1429 } else {
1430 None
1431 }
1432 }
1433
1434 #[allow(irrefutable_let_patterns)]
1435 pub fn into_watch_alert(self) -> Option<(SessionWatchAlertResponder)> {
1436 if let SessionRequest::WatchAlert { responder } = self {
1437 Some((responder))
1438 } else {
1439 None
1440 }
1441 }
1442
1443 pub fn method_name(&self) -> &'static str {
1445 match *self {
1446 SessionRequest::StartTracing { .. } => "start_tracing",
1447 SessionRequest::StopTracing { .. } => "stop_tracing",
1448 SessionRequest::WatchAlert { .. } => "watch_alert",
1449 SessionRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
1450 "unknown one-way method"
1451 }
1452 SessionRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
1453 "unknown two-way method"
1454 }
1455 }
1456 }
1457}
1458
1459#[derive(Debug, Clone)]
1460pub struct SessionControlHandle {
1461 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1462}
1463
1464impl fidl::endpoints::ControlHandle for SessionControlHandle {
1465 fn shutdown(&self) {
1466 self.inner.shutdown()
1467 }
1468 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1469 self.inner.shutdown_with_epitaph(status)
1470 }
1471
1472 fn is_closed(&self) -> bool {
1473 self.inner.channel().is_closed()
1474 }
1475 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1476 self.inner.channel().on_closed()
1477 }
1478
1479 #[cfg(target_os = "fuchsia")]
1480 fn signal_peer(
1481 &self,
1482 clear_mask: zx::Signals,
1483 set_mask: zx::Signals,
1484 ) -> Result<(), zx_status::Status> {
1485 use fidl::Peered;
1486 self.inner.channel().signal_peer(clear_mask, set_mask)
1487 }
1488}
1489
1490impl SessionControlHandle {
1491 pub fn send_on_session_state_change(&self, mut state: SessionState) -> Result<(), fidl::Error> {
1492 self.inner.send::<SessionOnSessionStateChangeRequest>(
1493 (state,),
1494 0,
1495 0x7ab1640718b971cd,
1496 fidl::encoding::DynamicFlags::FLEXIBLE,
1497 )
1498 }
1499}
1500
1501#[must_use = "FIDL methods require a response to be sent"]
1502#[derive(Debug)]
1503pub struct SessionStartTracingResponder {
1504 control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
1505 tx_id: u32,
1506}
1507
1508impl std::ops::Drop for SessionStartTracingResponder {
1512 fn drop(&mut self) {
1513 self.control_handle.shutdown();
1514 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1516 }
1517}
1518
1519impl fidl::endpoints::Responder for SessionStartTracingResponder {
1520 type ControlHandle = SessionControlHandle;
1521
1522 fn control_handle(&self) -> &SessionControlHandle {
1523 &self.control_handle
1524 }
1525
1526 fn drop_without_shutdown(mut self) {
1527 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1529 std::mem::forget(self);
1531 }
1532}
1533
1534impl SessionStartTracingResponder {
1535 pub fn send(self, mut result: Result<(), StartError>) -> Result<(), fidl::Error> {
1539 let _result = self.send_raw(result);
1540 if _result.is_err() {
1541 self.control_handle.shutdown();
1542 }
1543 self.drop_without_shutdown();
1544 _result
1545 }
1546
1547 pub fn send_no_shutdown_on_err(
1549 self,
1550 mut result: Result<(), StartError>,
1551 ) -> Result<(), fidl::Error> {
1552 let _result = self.send_raw(result);
1553 self.drop_without_shutdown();
1554 _result
1555 }
1556
1557 fn send_raw(&self, mut result: Result<(), StartError>) -> Result<(), fidl::Error> {
1558 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1559 fidl::encoding::EmptyStruct,
1560 StartError,
1561 >>(
1562 fidl::encoding::FlexibleResult::new(result),
1563 self.tx_id,
1564 0xde9b6ccbe936631,
1565 fidl::encoding::DynamicFlags::FLEXIBLE,
1566 )
1567 }
1568}
1569
1570#[must_use = "FIDL methods require a response to be sent"]
1571#[derive(Debug)]
1572pub struct SessionStopTracingResponder {
1573 control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
1574 tx_id: u32,
1575}
1576
1577impl std::ops::Drop for SessionStopTracingResponder {
1581 fn drop(&mut self) {
1582 self.control_handle.shutdown();
1583 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1585 }
1586}
1587
1588impl fidl::endpoints::Responder for SessionStopTracingResponder {
1589 type ControlHandle = SessionControlHandle;
1590
1591 fn control_handle(&self) -> &SessionControlHandle {
1592 &self.control_handle
1593 }
1594
1595 fn drop_without_shutdown(mut self) {
1596 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1598 std::mem::forget(self);
1600 }
1601}
1602
1603impl SessionStopTracingResponder {
1604 pub fn send(self, mut result: Result<&StopResult, StopError>) -> Result<(), fidl::Error> {
1608 let _result = self.send_raw(result);
1609 if _result.is_err() {
1610 self.control_handle.shutdown();
1611 }
1612 self.drop_without_shutdown();
1613 _result
1614 }
1615
1616 pub fn send_no_shutdown_on_err(
1618 self,
1619 mut result: Result<&StopResult, StopError>,
1620 ) -> Result<(), fidl::Error> {
1621 let _result = self.send_raw(result);
1622 self.drop_without_shutdown();
1623 _result
1624 }
1625
1626 fn send_raw(&self, mut result: Result<&StopResult, StopError>) -> Result<(), fidl::Error> {
1627 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<StopResult, StopError>>(
1628 fidl::encoding::FlexibleResult::new(result),
1629 self.tx_id,
1630 0x50fefc9b3ff9b03a,
1631 fidl::encoding::DynamicFlags::FLEXIBLE,
1632 )
1633 }
1634}
1635
1636#[must_use = "FIDL methods require a response to be sent"]
1637#[derive(Debug)]
1638pub struct SessionWatchAlertResponder {
1639 control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
1640 tx_id: u32,
1641}
1642
1643impl std::ops::Drop for SessionWatchAlertResponder {
1647 fn drop(&mut self) {
1648 self.control_handle.shutdown();
1649 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1651 }
1652}
1653
1654impl fidl::endpoints::Responder for SessionWatchAlertResponder {
1655 type ControlHandle = SessionControlHandle;
1656
1657 fn control_handle(&self) -> &SessionControlHandle {
1658 &self.control_handle
1659 }
1660
1661 fn drop_without_shutdown(mut self) {
1662 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1664 std::mem::forget(self);
1666 }
1667}
1668
1669impl SessionWatchAlertResponder {
1670 pub fn send(self, mut alert_name: &str) -> Result<(), fidl::Error> {
1674 let _result = self.send_raw(alert_name);
1675 if _result.is_err() {
1676 self.control_handle.shutdown();
1677 }
1678 self.drop_without_shutdown();
1679 _result
1680 }
1681
1682 pub fn send_no_shutdown_on_err(self, mut alert_name: &str) -> Result<(), fidl::Error> {
1684 let _result = self.send_raw(alert_name);
1685 self.drop_without_shutdown();
1686 _result
1687 }
1688
1689 fn send_raw(&self, mut alert_name: &str) -> Result<(), fidl::Error> {
1690 self.control_handle.inner.send::<fidl::encoding::FlexibleType<SessionWatchAlertResponse>>(
1691 fidl::encoding::Flexible::new((alert_name,)),
1692 self.tx_id,
1693 0x1f1c080716d92276,
1694 fidl::encoding::DynamicFlags::FLEXIBLE,
1695 )
1696 }
1697}
1698
1699mod internal {
1700 use super::*;
1701
1702 impl fidl::encoding::ResourceTypeMarker for ProvisionerInitializeTracingRequest {
1703 type Borrowed<'a> = &'a mut Self;
1704 fn take_or_borrow<'a>(
1705 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1706 ) -> Self::Borrowed<'a> {
1707 value
1708 }
1709 }
1710
1711 unsafe impl fidl::encoding::TypeMarker for ProvisionerInitializeTracingRequest {
1712 type Owned = Self;
1713
1714 #[inline(always)]
1715 fn inline_align(_context: fidl::encoding::Context) -> usize {
1716 8
1717 }
1718
1719 #[inline(always)]
1720 fn inline_size(_context: fidl::encoding::Context) -> usize {
1721 32
1722 }
1723 }
1724
1725 unsafe impl
1726 fidl::encoding::Encode<
1727 ProvisionerInitializeTracingRequest,
1728 fidl::encoding::DefaultFuchsiaResourceDialect,
1729 > for &mut ProvisionerInitializeTracingRequest
1730 {
1731 #[inline]
1732 unsafe fn encode(
1733 self,
1734 encoder: &mut fidl::encoding::Encoder<
1735 '_,
1736 fidl::encoding::DefaultFuchsiaResourceDialect,
1737 >,
1738 offset: usize,
1739 _depth: fidl::encoding::Depth,
1740 ) -> fidl::Result<()> {
1741 encoder.debug_check_bounds::<ProvisionerInitializeTracingRequest>(offset);
1742 fidl::encoding::Encode::<ProvisionerInitializeTracingRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1744 (
1745 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.controller),
1746 <TraceConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.config),
1747 <fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 16392> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.output),
1748 ),
1749 encoder, offset, _depth
1750 )
1751 }
1752 }
1753 unsafe impl<
1754 T0: fidl::encoding::Encode<
1755 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>>,
1756 fidl::encoding::DefaultFuchsiaResourceDialect,
1757 >,
1758 T1: fidl::encoding::Encode<TraceConfig, fidl::encoding::DefaultFuchsiaResourceDialect>,
1759 T2: fidl::encoding::Encode<
1760 fidl::encoding::HandleType<
1761 fidl::Socket,
1762 { fidl::ObjectType::SOCKET.into_raw() },
1763 16392,
1764 >,
1765 fidl::encoding::DefaultFuchsiaResourceDialect,
1766 >,
1767 >
1768 fidl::encoding::Encode<
1769 ProvisionerInitializeTracingRequest,
1770 fidl::encoding::DefaultFuchsiaResourceDialect,
1771 > for (T0, T1, T2)
1772 {
1773 #[inline]
1774 unsafe fn encode(
1775 self,
1776 encoder: &mut fidl::encoding::Encoder<
1777 '_,
1778 fidl::encoding::DefaultFuchsiaResourceDialect,
1779 >,
1780 offset: usize,
1781 depth: fidl::encoding::Depth,
1782 ) -> fidl::Result<()> {
1783 encoder.debug_check_bounds::<ProvisionerInitializeTracingRequest>(offset);
1784 unsafe {
1787 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1788 (ptr as *mut u64).write_unaligned(0);
1789 }
1790 unsafe {
1791 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
1792 (ptr as *mut u64).write_unaligned(0);
1793 }
1794 self.0.encode(encoder, offset + 0, depth)?;
1796 self.1.encode(encoder, offset + 8, depth)?;
1797 self.2.encode(encoder, offset + 24, depth)?;
1798 Ok(())
1799 }
1800 }
1801
1802 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1803 for ProvisionerInitializeTracingRequest
1804 {
1805 #[inline(always)]
1806 fn new_empty() -> Self {
1807 Self {
1808 controller: fidl::new_empty!(
1809 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>>,
1810 fidl::encoding::DefaultFuchsiaResourceDialect
1811 ),
1812 config: fidl::new_empty!(
1813 TraceConfig,
1814 fidl::encoding::DefaultFuchsiaResourceDialect
1815 ),
1816 output: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 16392>, fidl::encoding::DefaultFuchsiaResourceDialect),
1817 }
1818 }
1819
1820 #[inline]
1821 unsafe fn decode(
1822 &mut self,
1823 decoder: &mut fidl::encoding::Decoder<
1824 '_,
1825 fidl::encoding::DefaultFuchsiaResourceDialect,
1826 >,
1827 offset: usize,
1828 _depth: fidl::encoding::Depth,
1829 ) -> fidl::Result<()> {
1830 decoder.debug_check_bounds::<Self>(offset);
1831 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
1833 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1834 let mask = 0xffffffff00000000u64;
1835 let maskedval = padval & mask;
1836 if maskedval != 0 {
1837 return Err(fidl::Error::NonZeroPadding {
1838 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1839 });
1840 }
1841 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
1842 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1843 let mask = 0xffffffff00000000u64;
1844 let maskedval = padval & mask;
1845 if maskedval != 0 {
1846 return Err(fidl::Error::NonZeroPadding {
1847 padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
1848 });
1849 }
1850 fidl::decode!(
1851 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>>,
1852 fidl::encoding::DefaultFuchsiaResourceDialect,
1853 &mut self.controller,
1854 decoder,
1855 offset + 0,
1856 _depth
1857 )?;
1858 fidl::decode!(
1859 TraceConfig,
1860 fidl::encoding::DefaultFuchsiaResourceDialect,
1861 &mut self.config,
1862 decoder,
1863 offset + 8,
1864 _depth
1865 )?;
1866 fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 16392>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.output, decoder, offset + 24, _depth)?;
1867 Ok(())
1868 }
1869 }
1870}