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, Eq, Hash, Ord, PartialEq, PartialOrd)]
27pub struct SessionManagerEndTraceSessionRequest {
28 pub task_id: u64,
29 pub output: fidl::Socket,
30}
31
32impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
33 for SessionManagerEndTraceSessionRequest
34{
35}
36
37#[derive(Debug, PartialEq)]
38pub struct SessionManagerStartTraceSessionRequest {
39 pub config: TraceConfig,
40 pub options: TraceOptions,
41}
42
43impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
44 for SessionManagerStartTraceSessionRequest
45{
46}
47
48#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
49pub struct ProvisionerMarker;
50
51impl fidl::endpoints::ProtocolMarker for ProvisionerMarker {
52 type Proxy = ProvisionerProxy;
53 type RequestStream = ProvisionerRequestStream;
54 #[cfg(target_os = "fuchsia")]
55 type SynchronousProxy = ProvisionerSynchronousProxy;
56
57 const DEBUG_NAME: &'static str = "fuchsia.tracing.controller.Provisioner";
58}
59impl fidl::endpoints::DiscoverableProtocolMarker for ProvisionerMarker {}
60
61pub trait ProvisionerProxyInterface: Send + Sync {
62 fn r#initialize_tracing(
63 &self,
64 controller: fidl::endpoints::ServerEnd<SessionMarker>,
65 config: &TraceConfig,
66 output: fidl::Socket,
67 ) -> Result<(), fidl::Error>;
68 type GetProvidersResponseFut: std::future::Future<Output = Result<Vec<ProviderInfo>, fidl::Error>>
69 + Send;
70 fn r#get_providers(&self) -> Self::GetProvidersResponseFut;
71 type GetKnownCategoriesResponseFut: std::future::Future<Output = Result<Vec<fidl_fuchsia_tracing::KnownCategory>, fidl::Error>>
72 + Send;
73 fn r#get_known_categories(&self) -> Self::GetKnownCategoriesResponseFut;
74}
75#[derive(Debug)]
76#[cfg(target_os = "fuchsia")]
77pub struct ProvisionerSynchronousProxy {
78 client: fidl::client::sync::Client,
79}
80
81#[cfg(target_os = "fuchsia")]
82impl fidl::endpoints::SynchronousProxy for ProvisionerSynchronousProxy {
83 type Proxy = ProvisionerProxy;
84 type Protocol = ProvisionerMarker;
85
86 fn from_channel(inner: fidl::Channel) -> Self {
87 Self::new(inner)
88 }
89
90 fn into_channel(self) -> fidl::Channel {
91 self.client.into_channel()
92 }
93
94 fn as_channel(&self) -> &fidl::Channel {
95 self.client.as_channel()
96 }
97}
98
99#[cfg(target_os = "fuchsia")]
100impl ProvisionerSynchronousProxy {
101 pub fn new(channel: fidl::Channel) -> Self {
102 let protocol_name = <ProvisionerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
103 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
104 }
105
106 pub fn into_channel(self) -> fidl::Channel {
107 self.client.into_channel()
108 }
109
110 pub fn wait_for_event(
113 &self,
114 deadline: zx::MonotonicInstant,
115 ) -> Result<ProvisionerEvent, fidl::Error> {
116 ProvisionerEvent::decode(self.client.wait_for_event(deadline)?)
117 }
118
119 pub fn r#initialize_tracing(
130 &self,
131 mut controller: fidl::endpoints::ServerEnd<SessionMarker>,
132 mut config: &TraceConfig,
133 mut output: fidl::Socket,
134 ) -> Result<(), fidl::Error> {
135 self.client.send::<ProvisionerInitializeTracingRequest>(
136 (controller, config, output),
137 0x3b046ed3a0684ab8,
138 fidl::encoding::DynamicFlags::FLEXIBLE,
139 )
140 }
141
142 pub fn r#get_providers(
144 &self,
145 ___deadline: zx::MonotonicInstant,
146 ) -> Result<Vec<ProviderInfo>, fidl::Error> {
147 let _response = self.client.send_query::<
148 fidl::encoding::EmptyPayload,
149 fidl::encoding::FlexibleType<ProvisionerGetProvidersResponse>,
150 >(
151 (),
152 0xc4d4f36edc50d43,
153 fidl::encoding::DynamicFlags::FLEXIBLE,
154 ___deadline,
155 )?
156 .into_result::<ProvisionerMarker>("get_providers")?;
157 Ok(_response.providers)
158 }
159
160 pub fn r#get_known_categories(
161 &self,
162 ___deadline: zx::MonotonicInstant,
163 ) -> Result<Vec<fidl_fuchsia_tracing::KnownCategory>, fidl::Error> {
164 let _response = self.client.send_query::<
165 fidl::encoding::EmptyPayload,
166 fidl::encoding::FlexibleType<ProvisionerGetKnownCategoriesResponse>,
167 >(
168 (),
169 0x41ef99397b945a4,
170 fidl::encoding::DynamicFlags::FLEXIBLE,
171 ___deadline,
172 )?
173 .into_result::<ProvisionerMarker>("get_known_categories")?;
174 Ok(_response.categories)
175 }
176}
177
178#[cfg(target_os = "fuchsia")]
179impl From<ProvisionerSynchronousProxy> for zx::Handle {
180 fn from(value: ProvisionerSynchronousProxy) -> Self {
181 value.into_channel().into()
182 }
183}
184
185#[cfg(target_os = "fuchsia")]
186impl From<fidl::Channel> for ProvisionerSynchronousProxy {
187 fn from(value: fidl::Channel) -> Self {
188 Self::new(value)
189 }
190}
191
192#[cfg(target_os = "fuchsia")]
193impl fidl::endpoints::FromClient for ProvisionerSynchronousProxy {
194 type Protocol = ProvisionerMarker;
195
196 fn from_client(value: fidl::endpoints::ClientEnd<ProvisionerMarker>) -> Self {
197 Self::new(value.into_channel())
198 }
199}
200
201#[derive(Debug, Clone)]
202pub struct ProvisionerProxy {
203 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
204}
205
206impl fidl::endpoints::Proxy for ProvisionerProxy {
207 type Protocol = ProvisionerMarker;
208
209 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
210 Self::new(inner)
211 }
212
213 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
214 self.client.into_channel().map_err(|client| Self { client })
215 }
216
217 fn as_channel(&self) -> &::fidl::AsyncChannel {
218 self.client.as_channel()
219 }
220}
221
222impl ProvisionerProxy {
223 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
225 let protocol_name = <ProvisionerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
226 Self { client: fidl::client::Client::new(channel, protocol_name) }
227 }
228
229 pub fn take_event_stream(&self) -> ProvisionerEventStream {
235 ProvisionerEventStream { event_receiver: self.client.take_event_receiver() }
236 }
237
238 pub fn r#initialize_tracing(
249 &self,
250 mut controller: fidl::endpoints::ServerEnd<SessionMarker>,
251 mut config: &TraceConfig,
252 mut output: fidl::Socket,
253 ) -> Result<(), fidl::Error> {
254 ProvisionerProxyInterface::r#initialize_tracing(self, controller, config, output)
255 }
256
257 pub fn r#get_providers(
259 &self,
260 ) -> fidl::client::QueryResponseFut<
261 Vec<ProviderInfo>,
262 fidl::encoding::DefaultFuchsiaResourceDialect,
263 > {
264 ProvisionerProxyInterface::r#get_providers(self)
265 }
266
267 pub fn r#get_known_categories(
268 &self,
269 ) -> fidl::client::QueryResponseFut<
270 Vec<fidl_fuchsia_tracing::KnownCategory>,
271 fidl::encoding::DefaultFuchsiaResourceDialect,
272 > {
273 ProvisionerProxyInterface::r#get_known_categories(self)
274 }
275}
276
277impl ProvisionerProxyInterface for ProvisionerProxy {
278 fn r#initialize_tracing(
279 &self,
280 mut controller: fidl::endpoints::ServerEnd<SessionMarker>,
281 mut config: &TraceConfig,
282 mut output: fidl::Socket,
283 ) -> Result<(), fidl::Error> {
284 self.client.send::<ProvisionerInitializeTracingRequest>(
285 (controller, config, output),
286 0x3b046ed3a0684ab8,
287 fidl::encoding::DynamicFlags::FLEXIBLE,
288 )
289 }
290
291 type GetProvidersResponseFut = fidl::client::QueryResponseFut<
292 Vec<ProviderInfo>,
293 fidl::encoding::DefaultFuchsiaResourceDialect,
294 >;
295 fn r#get_providers(&self) -> Self::GetProvidersResponseFut {
296 fn _decode(
297 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
298 ) -> Result<Vec<ProviderInfo>, fidl::Error> {
299 let _response = fidl::client::decode_transaction_body::<
300 fidl::encoding::FlexibleType<ProvisionerGetProvidersResponse>,
301 fidl::encoding::DefaultFuchsiaResourceDialect,
302 0xc4d4f36edc50d43,
303 >(_buf?)?
304 .into_result::<ProvisionerMarker>("get_providers")?;
305 Ok(_response.providers)
306 }
307 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<ProviderInfo>>(
308 (),
309 0xc4d4f36edc50d43,
310 fidl::encoding::DynamicFlags::FLEXIBLE,
311 _decode,
312 )
313 }
314
315 type GetKnownCategoriesResponseFut = fidl::client::QueryResponseFut<
316 Vec<fidl_fuchsia_tracing::KnownCategory>,
317 fidl::encoding::DefaultFuchsiaResourceDialect,
318 >;
319 fn r#get_known_categories(&self) -> Self::GetKnownCategoriesResponseFut {
320 fn _decode(
321 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
322 ) -> Result<Vec<fidl_fuchsia_tracing::KnownCategory>, fidl::Error> {
323 let _response = fidl::client::decode_transaction_body::<
324 fidl::encoding::FlexibleType<ProvisionerGetKnownCategoriesResponse>,
325 fidl::encoding::DefaultFuchsiaResourceDialect,
326 0x41ef99397b945a4,
327 >(_buf?)?
328 .into_result::<ProvisionerMarker>("get_known_categories")?;
329 Ok(_response.categories)
330 }
331 self.client.send_query_and_decode::<
332 fidl::encoding::EmptyPayload,
333 Vec<fidl_fuchsia_tracing::KnownCategory>,
334 >(
335 (),
336 0x41ef99397b945a4,
337 fidl::encoding::DynamicFlags::FLEXIBLE,
338 _decode,
339 )
340 }
341}
342
343pub struct ProvisionerEventStream {
344 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
345}
346
347impl std::marker::Unpin for ProvisionerEventStream {}
348
349impl futures::stream::FusedStream for ProvisionerEventStream {
350 fn is_terminated(&self) -> bool {
351 self.event_receiver.is_terminated()
352 }
353}
354
355impl futures::Stream for ProvisionerEventStream {
356 type Item = Result<ProvisionerEvent, fidl::Error>;
357
358 fn poll_next(
359 mut self: std::pin::Pin<&mut Self>,
360 cx: &mut std::task::Context<'_>,
361 ) -> std::task::Poll<Option<Self::Item>> {
362 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
363 &mut self.event_receiver,
364 cx
365 )?) {
366 Some(buf) => std::task::Poll::Ready(Some(ProvisionerEvent::decode(buf))),
367 None => std::task::Poll::Ready(None),
368 }
369 }
370}
371
372#[derive(Debug)]
373pub enum ProvisionerEvent {
374 #[non_exhaustive]
375 _UnknownEvent {
376 ordinal: u64,
378 },
379}
380
381impl ProvisionerEvent {
382 fn decode(
384 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
385 ) -> Result<ProvisionerEvent, fidl::Error> {
386 let (bytes, _handles) = buf.split_mut();
387 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
388 debug_assert_eq!(tx_header.tx_id, 0);
389 match tx_header.ordinal {
390 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
391 Ok(ProvisionerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
392 }
393 _ => Err(fidl::Error::UnknownOrdinal {
394 ordinal: tx_header.ordinal,
395 protocol_name: <ProvisionerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
396 }),
397 }
398 }
399}
400
401pub struct ProvisionerRequestStream {
403 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
404 is_terminated: bool,
405}
406
407impl std::marker::Unpin for ProvisionerRequestStream {}
408
409impl futures::stream::FusedStream for ProvisionerRequestStream {
410 fn is_terminated(&self) -> bool {
411 self.is_terminated
412 }
413}
414
415impl fidl::endpoints::RequestStream for ProvisionerRequestStream {
416 type Protocol = ProvisionerMarker;
417 type ControlHandle = ProvisionerControlHandle;
418
419 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
420 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
421 }
422
423 fn control_handle(&self) -> Self::ControlHandle {
424 ProvisionerControlHandle { inner: self.inner.clone() }
425 }
426
427 fn into_inner(
428 self,
429 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
430 {
431 (self.inner, self.is_terminated)
432 }
433
434 fn from_inner(
435 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
436 is_terminated: bool,
437 ) -> Self {
438 Self { inner, is_terminated }
439 }
440}
441
442impl futures::Stream for ProvisionerRequestStream {
443 type Item = Result<ProvisionerRequest, fidl::Error>;
444
445 fn poll_next(
446 mut self: std::pin::Pin<&mut Self>,
447 cx: &mut std::task::Context<'_>,
448 ) -> std::task::Poll<Option<Self::Item>> {
449 let this = &mut *self;
450 if this.inner.check_shutdown(cx) {
451 this.is_terminated = true;
452 return std::task::Poll::Ready(None);
453 }
454 if this.is_terminated {
455 panic!("polled ProvisionerRequestStream after completion");
456 }
457 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
458 |bytes, handles| {
459 match this.inner.channel().read_etc(cx, bytes, handles) {
460 std::task::Poll::Ready(Ok(())) => {}
461 std::task::Poll::Pending => return std::task::Poll::Pending,
462 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
463 this.is_terminated = true;
464 return std::task::Poll::Ready(None);
465 }
466 std::task::Poll::Ready(Err(e)) => {
467 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
468 e.into(),
469 ))));
470 }
471 }
472
473 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
475
476 std::task::Poll::Ready(Some(match header.ordinal {
477 0x3b046ed3a0684ab8 => {
478 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
479 let mut req = fidl::new_empty!(
480 ProvisionerInitializeTracingRequest,
481 fidl::encoding::DefaultFuchsiaResourceDialect
482 );
483 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProvisionerInitializeTracingRequest>(&header, _body_bytes, handles, &mut req)?;
484 let control_handle = ProvisionerControlHandle { inner: this.inner.clone() };
485 Ok(ProvisionerRequest::InitializeTracing {
486 controller: req.controller,
487 config: req.config,
488 output: req.output,
489
490 control_handle,
491 })
492 }
493 0xc4d4f36edc50d43 => {
494 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
495 let mut req = fidl::new_empty!(
496 fidl::encoding::EmptyPayload,
497 fidl::encoding::DefaultFuchsiaResourceDialect
498 );
499 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
500 let control_handle = ProvisionerControlHandle { inner: this.inner.clone() };
501 Ok(ProvisionerRequest::GetProviders {
502 responder: ProvisionerGetProvidersResponder {
503 control_handle: std::mem::ManuallyDrop::new(control_handle),
504 tx_id: header.tx_id,
505 },
506 })
507 }
508 0x41ef99397b945a4 => {
509 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
510 let mut req = fidl::new_empty!(
511 fidl::encoding::EmptyPayload,
512 fidl::encoding::DefaultFuchsiaResourceDialect
513 );
514 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
515 let control_handle = ProvisionerControlHandle { inner: this.inner.clone() };
516 Ok(ProvisionerRequest::GetKnownCategories {
517 responder: ProvisionerGetKnownCategoriesResponder {
518 control_handle: std::mem::ManuallyDrop::new(control_handle),
519 tx_id: header.tx_id,
520 },
521 })
522 }
523 _ if header.tx_id == 0
524 && header
525 .dynamic_flags()
526 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
527 {
528 Ok(ProvisionerRequest::_UnknownMethod {
529 ordinal: header.ordinal,
530 control_handle: ProvisionerControlHandle { inner: this.inner.clone() },
531 method_type: fidl::MethodType::OneWay,
532 })
533 }
534 _ if header
535 .dynamic_flags()
536 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
537 {
538 this.inner.send_framework_err(
539 fidl::encoding::FrameworkErr::UnknownMethod,
540 header.tx_id,
541 header.ordinal,
542 header.dynamic_flags(),
543 (bytes, handles),
544 )?;
545 Ok(ProvisionerRequest::_UnknownMethod {
546 ordinal: header.ordinal,
547 control_handle: ProvisionerControlHandle { inner: this.inner.clone() },
548 method_type: fidl::MethodType::TwoWay,
549 })
550 }
551 _ => Err(fidl::Error::UnknownOrdinal {
552 ordinal: header.ordinal,
553 protocol_name:
554 <ProvisionerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
555 }),
556 }))
557 },
558 )
559 }
560}
561
562#[derive(Debug)]
570pub enum ProvisionerRequest {
571 InitializeTracing {
582 controller: fidl::endpoints::ServerEnd<SessionMarker>,
583 config: TraceConfig,
584 output: fidl::Socket,
585 control_handle: ProvisionerControlHandle,
586 },
587 GetProviders {
589 responder: ProvisionerGetProvidersResponder,
590 },
591 GetKnownCategories {
592 responder: ProvisionerGetKnownCategoriesResponder,
593 },
594 #[non_exhaustive]
596 _UnknownMethod {
597 ordinal: u64,
599 control_handle: ProvisionerControlHandle,
600 method_type: fidl::MethodType,
601 },
602}
603
604impl ProvisionerRequest {
605 #[allow(irrefutable_let_patterns)]
606 pub fn into_initialize_tracing(
607 self,
608 ) -> Option<(
609 fidl::endpoints::ServerEnd<SessionMarker>,
610 TraceConfig,
611 fidl::Socket,
612 ProvisionerControlHandle,
613 )> {
614 if let ProvisionerRequest::InitializeTracing {
615 controller,
616 config,
617 output,
618 control_handle,
619 } = self
620 {
621 Some((controller, config, output, control_handle))
622 } else {
623 None
624 }
625 }
626
627 #[allow(irrefutable_let_patterns)]
628 pub fn into_get_providers(self) -> Option<(ProvisionerGetProvidersResponder)> {
629 if let ProvisionerRequest::GetProviders { responder } = self {
630 Some((responder))
631 } else {
632 None
633 }
634 }
635
636 #[allow(irrefutable_let_patterns)]
637 pub fn into_get_known_categories(self) -> Option<(ProvisionerGetKnownCategoriesResponder)> {
638 if let ProvisionerRequest::GetKnownCategories { responder } = self {
639 Some((responder))
640 } else {
641 None
642 }
643 }
644
645 pub fn method_name(&self) -> &'static str {
647 match *self {
648 ProvisionerRequest::InitializeTracing { .. } => "initialize_tracing",
649 ProvisionerRequest::GetProviders { .. } => "get_providers",
650 ProvisionerRequest::GetKnownCategories { .. } => "get_known_categories",
651 ProvisionerRequest::_UnknownMethod {
652 method_type: fidl::MethodType::OneWay, ..
653 } => "unknown one-way method",
654 ProvisionerRequest::_UnknownMethod {
655 method_type: fidl::MethodType::TwoWay, ..
656 } => "unknown two-way method",
657 }
658 }
659}
660
661#[derive(Debug, Clone)]
662pub struct ProvisionerControlHandle {
663 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
664}
665
666impl fidl::endpoints::ControlHandle for ProvisionerControlHandle {
667 fn shutdown(&self) {
668 self.inner.shutdown()
669 }
670 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
671 self.inner.shutdown_with_epitaph(status)
672 }
673
674 fn is_closed(&self) -> bool {
675 self.inner.channel().is_closed()
676 }
677 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
678 self.inner.channel().on_closed()
679 }
680
681 #[cfg(target_os = "fuchsia")]
682 fn signal_peer(
683 &self,
684 clear_mask: zx::Signals,
685 set_mask: zx::Signals,
686 ) -> Result<(), zx_status::Status> {
687 use fidl::Peered;
688 self.inner.channel().signal_peer(clear_mask, set_mask)
689 }
690}
691
692impl ProvisionerControlHandle {}
693
694#[must_use = "FIDL methods require a response to be sent"]
695#[derive(Debug)]
696pub struct ProvisionerGetProvidersResponder {
697 control_handle: std::mem::ManuallyDrop<ProvisionerControlHandle>,
698 tx_id: u32,
699}
700
701impl std::ops::Drop for ProvisionerGetProvidersResponder {
705 fn drop(&mut self) {
706 self.control_handle.shutdown();
707 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
709 }
710}
711
712impl fidl::endpoints::Responder for ProvisionerGetProvidersResponder {
713 type ControlHandle = ProvisionerControlHandle;
714
715 fn control_handle(&self) -> &ProvisionerControlHandle {
716 &self.control_handle
717 }
718
719 fn drop_without_shutdown(mut self) {
720 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
722 std::mem::forget(self);
724 }
725}
726
727impl ProvisionerGetProvidersResponder {
728 pub fn send(self, mut providers: &[ProviderInfo]) -> Result<(), fidl::Error> {
732 let _result = self.send_raw(providers);
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 providers: &[ProviderInfo],
744 ) -> Result<(), fidl::Error> {
745 let _result = self.send_raw(providers);
746 self.drop_without_shutdown();
747 _result
748 }
749
750 fn send_raw(&self, mut providers: &[ProviderInfo]) -> Result<(), fidl::Error> {
751 self.control_handle
752 .inner
753 .send::<fidl::encoding::FlexibleType<ProvisionerGetProvidersResponse>>(
754 fidl::encoding::Flexible::new((providers,)),
755 self.tx_id,
756 0xc4d4f36edc50d43,
757 fidl::encoding::DynamicFlags::FLEXIBLE,
758 )
759 }
760}
761
762#[must_use = "FIDL methods require a response to be sent"]
763#[derive(Debug)]
764pub struct ProvisionerGetKnownCategoriesResponder {
765 control_handle: std::mem::ManuallyDrop<ProvisionerControlHandle>,
766 tx_id: u32,
767}
768
769impl std::ops::Drop for ProvisionerGetKnownCategoriesResponder {
773 fn drop(&mut self) {
774 self.control_handle.shutdown();
775 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
777 }
778}
779
780impl fidl::endpoints::Responder for ProvisionerGetKnownCategoriesResponder {
781 type ControlHandle = ProvisionerControlHandle;
782
783 fn control_handle(&self) -> &ProvisionerControlHandle {
784 &self.control_handle
785 }
786
787 fn drop_without_shutdown(mut self) {
788 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
790 std::mem::forget(self);
792 }
793}
794
795impl ProvisionerGetKnownCategoriesResponder {
796 pub fn send(
800 self,
801 mut categories: &[fidl_fuchsia_tracing::KnownCategory],
802 ) -> Result<(), fidl::Error> {
803 let _result = self.send_raw(categories);
804 if _result.is_err() {
805 self.control_handle.shutdown();
806 }
807 self.drop_without_shutdown();
808 _result
809 }
810
811 pub fn send_no_shutdown_on_err(
813 self,
814 mut categories: &[fidl_fuchsia_tracing::KnownCategory],
815 ) -> Result<(), fidl::Error> {
816 let _result = self.send_raw(categories);
817 self.drop_without_shutdown();
818 _result
819 }
820
821 fn send_raw(
822 &self,
823 mut categories: &[fidl_fuchsia_tracing::KnownCategory],
824 ) -> Result<(), fidl::Error> {
825 self.control_handle
826 .inner
827 .send::<fidl::encoding::FlexibleType<ProvisionerGetKnownCategoriesResponse>>(
828 fidl::encoding::Flexible::new((categories,)),
829 self.tx_id,
830 0x41ef99397b945a4,
831 fidl::encoding::DynamicFlags::FLEXIBLE,
832 )
833 }
834}
835
836#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
837pub struct SessionMarker;
838
839impl fidl::endpoints::ProtocolMarker for SessionMarker {
840 type Proxy = SessionProxy;
841 type RequestStream = SessionRequestStream;
842 #[cfg(target_os = "fuchsia")]
843 type SynchronousProxy = SessionSynchronousProxy;
844
845 const DEBUG_NAME: &'static str = "(anonymous) Session";
846}
847pub type SessionStartTracingResult = Result<(), StartError>;
848pub type SessionStopTracingResult = Result<StopResult, StopError>;
849
850pub trait SessionProxyInterface: Send + Sync {
851 type StartTracingResponseFut: std::future::Future<Output = Result<SessionStartTracingResult, fidl::Error>>
852 + Send;
853 fn r#start_tracing(&self, payload: &StartOptions) -> Self::StartTracingResponseFut;
854 type StopTracingResponseFut: std::future::Future<Output = Result<SessionStopTracingResult, fidl::Error>>
855 + Send;
856 fn r#stop_tracing(&self, payload: &StopOptions) -> Self::StopTracingResponseFut;
857 type WatchAlertResponseFut: std::future::Future<Output = Result<String, fidl::Error>> + Send;
858 fn r#watch_alert(&self) -> Self::WatchAlertResponseFut;
859}
860#[derive(Debug)]
861#[cfg(target_os = "fuchsia")]
862pub struct SessionSynchronousProxy {
863 client: fidl::client::sync::Client,
864}
865
866#[cfg(target_os = "fuchsia")]
867impl fidl::endpoints::SynchronousProxy for SessionSynchronousProxy {
868 type Proxy = SessionProxy;
869 type Protocol = SessionMarker;
870
871 fn from_channel(inner: fidl::Channel) -> Self {
872 Self::new(inner)
873 }
874
875 fn into_channel(self) -> fidl::Channel {
876 self.client.into_channel()
877 }
878
879 fn as_channel(&self) -> &fidl::Channel {
880 self.client.as_channel()
881 }
882}
883
884#[cfg(target_os = "fuchsia")]
885impl SessionSynchronousProxy {
886 pub fn new(channel: fidl::Channel) -> Self {
887 let protocol_name = <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
888 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
889 }
890
891 pub fn into_channel(self) -> fidl::Channel {
892 self.client.into_channel()
893 }
894
895 pub fn wait_for_event(
898 &self,
899 deadline: zx::MonotonicInstant,
900 ) -> Result<SessionEvent, fidl::Error> {
901 SessionEvent::decode(self.client.wait_for_event(deadline)?)
902 }
903
904 pub fn r#start_tracing(
916 &self,
917 mut payload: &StartOptions,
918 ___deadline: zx::MonotonicInstant,
919 ) -> Result<SessionStartTracingResult, fidl::Error> {
920 let _response = self.client.send_query::<
921 StartOptions,
922 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, StartError>,
923 >(
924 payload,
925 0xde9b6ccbe936631,
926 fidl::encoding::DynamicFlags::FLEXIBLE,
927 ___deadline,
928 )?
929 .into_result::<SessionMarker>("start_tracing")?;
930 Ok(_response.map(|x| x))
931 }
932
933 pub fn r#stop_tracing(
939 &self,
940 mut payload: &StopOptions,
941 ___deadline: zx::MonotonicInstant,
942 ) -> Result<SessionStopTracingResult, fidl::Error> {
943 let _response = self
944 .client
945 .send_query::<StopOptions, fidl::encoding::FlexibleResultType<StopResult, StopError>>(
946 payload,
947 0x50fefc9b3ff9b03a,
948 fidl::encoding::DynamicFlags::FLEXIBLE,
949 ___deadline,
950 )?
951 .into_result::<SessionMarker>("stop_tracing")?;
952 Ok(_response.map(|x| x))
953 }
954
955 pub fn r#watch_alert(&self, ___deadline: zx::MonotonicInstant) -> Result<String, fidl::Error> {
964 let _response = self.client.send_query::<
965 fidl::encoding::EmptyPayload,
966 fidl::encoding::FlexibleType<SessionWatchAlertResponse>,
967 >(
968 (),
969 0x1f1c080716d92276,
970 fidl::encoding::DynamicFlags::FLEXIBLE,
971 ___deadline,
972 )?
973 .into_result::<SessionMarker>("watch_alert")?;
974 Ok(_response.alert_name)
975 }
976}
977
978#[cfg(target_os = "fuchsia")]
979impl From<SessionSynchronousProxy> for zx::Handle {
980 fn from(value: SessionSynchronousProxy) -> Self {
981 value.into_channel().into()
982 }
983}
984
985#[cfg(target_os = "fuchsia")]
986impl From<fidl::Channel> for SessionSynchronousProxy {
987 fn from(value: fidl::Channel) -> Self {
988 Self::new(value)
989 }
990}
991
992#[cfg(target_os = "fuchsia")]
993impl fidl::endpoints::FromClient for SessionSynchronousProxy {
994 type Protocol = SessionMarker;
995
996 fn from_client(value: fidl::endpoints::ClientEnd<SessionMarker>) -> Self {
997 Self::new(value.into_channel())
998 }
999}
1000
1001#[derive(Debug, Clone)]
1002pub struct SessionProxy {
1003 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1004}
1005
1006impl fidl::endpoints::Proxy for SessionProxy {
1007 type Protocol = SessionMarker;
1008
1009 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1010 Self::new(inner)
1011 }
1012
1013 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1014 self.client.into_channel().map_err(|client| Self { client })
1015 }
1016
1017 fn as_channel(&self) -> &::fidl::AsyncChannel {
1018 self.client.as_channel()
1019 }
1020}
1021
1022impl SessionProxy {
1023 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1025 let protocol_name = <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1026 Self { client: fidl::client::Client::new(channel, protocol_name) }
1027 }
1028
1029 pub fn take_event_stream(&self) -> SessionEventStream {
1035 SessionEventStream { event_receiver: self.client.take_event_receiver() }
1036 }
1037
1038 pub fn r#start_tracing(
1050 &self,
1051 mut payload: &StartOptions,
1052 ) -> fidl::client::QueryResponseFut<
1053 SessionStartTracingResult,
1054 fidl::encoding::DefaultFuchsiaResourceDialect,
1055 > {
1056 SessionProxyInterface::r#start_tracing(self, payload)
1057 }
1058
1059 pub fn r#stop_tracing(
1065 &self,
1066 mut payload: &StopOptions,
1067 ) -> fidl::client::QueryResponseFut<
1068 SessionStopTracingResult,
1069 fidl::encoding::DefaultFuchsiaResourceDialect,
1070 > {
1071 SessionProxyInterface::r#stop_tracing(self, payload)
1072 }
1073
1074 pub fn r#watch_alert(
1083 &self,
1084 ) -> fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect> {
1085 SessionProxyInterface::r#watch_alert(self)
1086 }
1087}
1088
1089impl SessionProxyInterface for SessionProxy {
1090 type StartTracingResponseFut = fidl::client::QueryResponseFut<
1091 SessionStartTracingResult,
1092 fidl::encoding::DefaultFuchsiaResourceDialect,
1093 >;
1094 fn r#start_tracing(&self, mut payload: &StartOptions) -> Self::StartTracingResponseFut {
1095 fn _decode(
1096 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1097 ) -> Result<SessionStartTracingResult, fidl::Error> {
1098 let _response = fidl::client::decode_transaction_body::<
1099 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, StartError>,
1100 fidl::encoding::DefaultFuchsiaResourceDialect,
1101 0xde9b6ccbe936631,
1102 >(_buf?)?
1103 .into_result::<SessionMarker>("start_tracing")?;
1104 Ok(_response.map(|x| x))
1105 }
1106 self.client.send_query_and_decode::<StartOptions, SessionStartTracingResult>(
1107 payload,
1108 0xde9b6ccbe936631,
1109 fidl::encoding::DynamicFlags::FLEXIBLE,
1110 _decode,
1111 )
1112 }
1113
1114 type StopTracingResponseFut = fidl::client::QueryResponseFut<
1115 SessionStopTracingResult,
1116 fidl::encoding::DefaultFuchsiaResourceDialect,
1117 >;
1118 fn r#stop_tracing(&self, mut payload: &StopOptions) -> Self::StopTracingResponseFut {
1119 fn _decode(
1120 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1121 ) -> Result<SessionStopTracingResult, fidl::Error> {
1122 let _response = fidl::client::decode_transaction_body::<
1123 fidl::encoding::FlexibleResultType<StopResult, StopError>,
1124 fidl::encoding::DefaultFuchsiaResourceDialect,
1125 0x50fefc9b3ff9b03a,
1126 >(_buf?)?
1127 .into_result::<SessionMarker>("stop_tracing")?;
1128 Ok(_response.map(|x| x))
1129 }
1130 self.client.send_query_and_decode::<StopOptions, SessionStopTracingResult>(
1131 payload,
1132 0x50fefc9b3ff9b03a,
1133 fidl::encoding::DynamicFlags::FLEXIBLE,
1134 _decode,
1135 )
1136 }
1137
1138 type WatchAlertResponseFut =
1139 fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect>;
1140 fn r#watch_alert(&self) -> Self::WatchAlertResponseFut {
1141 fn _decode(
1142 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1143 ) -> Result<String, fidl::Error> {
1144 let _response = fidl::client::decode_transaction_body::<
1145 fidl::encoding::FlexibleType<SessionWatchAlertResponse>,
1146 fidl::encoding::DefaultFuchsiaResourceDialect,
1147 0x1f1c080716d92276,
1148 >(_buf?)?
1149 .into_result::<SessionMarker>("watch_alert")?;
1150 Ok(_response.alert_name)
1151 }
1152 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, String>(
1153 (),
1154 0x1f1c080716d92276,
1155 fidl::encoding::DynamicFlags::FLEXIBLE,
1156 _decode,
1157 )
1158 }
1159}
1160
1161pub struct SessionEventStream {
1162 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1163}
1164
1165impl std::marker::Unpin for SessionEventStream {}
1166
1167impl futures::stream::FusedStream for SessionEventStream {
1168 fn is_terminated(&self) -> bool {
1169 self.event_receiver.is_terminated()
1170 }
1171}
1172
1173impl futures::Stream for SessionEventStream {
1174 type Item = Result<SessionEvent, fidl::Error>;
1175
1176 fn poll_next(
1177 mut self: std::pin::Pin<&mut Self>,
1178 cx: &mut std::task::Context<'_>,
1179 ) -> std::task::Poll<Option<Self::Item>> {
1180 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1181 &mut self.event_receiver,
1182 cx
1183 )?) {
1184 Some(buf) => std::task::Poll::Ready(Some(SessionEvent::decode(buf))),
1185 None => std::task::Poll::Ready(None),
1186 }
1187 }
1188}
1189
1190#[derive(Debug)]
1191pub enum SessionEvent {
1192 OnSessionStateChange {
1193 state: SessionState,
1194 },
1195 #[non_exhaustive]
1196 _UnknownEvent {
1197 ordinal: u64,
1199 },
1200}
1201
1202impl SessionEvent {
1203 #[allow(irrefutable_let_patterns)]
1204 pub fn into_on_session_state_change(self) -> Option<SessionState> {
1205 if let SessionEvent::OnSessionStateChange { state } = self { Some((state)) } else { None }
1206 }
1207
1208 fn decode(
1210 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1211 ) -> Result<SessionEvent, fidl::Error> {
1212 let (bytes, _handles) = buf.split_mut();
1213 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1214 debug_assert_eq!(tx_header.tx_id, 0);
1215 match tx_header.ordinal {
1216 0x7ab1640718b971cd => {
1217 let mut out = fidl::new_empty!(
1218 SessionOnSessionStateChangeRequest,
1219 fidl::encoding::DefaultFuchsiaResourceDialect
1220 );
1221 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionOnSessionStateChangeRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
1222 Ok((SessionEvent::OnSessionStateChange { state: out.state }))
1223 }
1224 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1225 Ok(SessionEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1226 }
1227 _ => Err(fidl::Error::UnknownOrdinal {
1228 ordinal: tx_header.ordinal,
1229 protocol_name: <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1230 }),
1231 }
1232 }
1233}
1234
1235pub struct SessionRequestStream {
1237 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1238 is_terminated: bool,
1239}
1240
1241impl std::marker::Unpin for SessionRequestStream {}
1242
1243impl futures::stream::FusedStream for SessionRequestStream {
1244 fn is_terminated(&self) -> bool {
1245 self.is_terminated
1246 }
1247}
1248
1249impl fidl::endpoints::RequestStream for SessionRequestStream {
1250 type Protocol = SessionMarker;
1251 type ControlHandle = SessionControlHandle;
1252
1253 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1254 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1255 }
1256
1257 fn control_handle(&self) -> Self::ControlHandle {
1258 SessionControlHandle { inner: self.inner.clone() }
1259 }
1260
1261 fn into_inner(
1262 self,
1263 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1264 {
1265 (self.inner, self.is_terminated)
1266 }
1267
1268 fn from_inner(
1269 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1270 is_terminated: bool,
1271 ) -> Self {
1272 Self { inner, is_terminated }
1273 }
1274}
1275
1276impl futures::Stream for SessionRequestStream {
1277 type Item = Result<SessionRequest, fidl::Error>;
1278
1279 fn poll_next(
1280 mut self: std::pin::Pin<&mut Self>,
1281 cx: &mut std::task::Context<'_>,
1282 ) -> std::task::Poll<Option<Self::Item>> {
1283 let this = &mut *self;
1284 if this.inner.check_shutdown(cx) {
1285 this.is_terminated = true;
1286 return std::task::Poll::Ready(None);
1287 }
1288 if this.is_terminated {
1289 panic!("polled SessionRequestStream after completion");
1290 }
1291 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1292 |bytes, handles| {
1293 match this.inner.channel().read_etc(cx, bytes, handles) {
1294 std::task::Poll::Ready(Ok(())) => {}
1295 std::task::Poll::Pending => return std::task::Poll::Pending,
1296 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1297 this.is_terminated = true;
1298 return std::task::Poll::Ready(None);
1299 }
1300 std::task::Poll::Ready(Err(e)) => {
1301 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1302 e.into(),
1303 ))));
1304 }
1305 }
1306
1307 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1309
1310 std::task::Poll::Ready(Some(match header.ordinal {
1311 0xde9b6ccbe936631 => {
1312 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1313 let mut req = fidl::new_empty!(
1314 StartOptions,
1315 fidl::encoding::DefaultFuchsiaResourceDialect
1316 );
1317 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StartOptions>(&header, _body_bytes, handles, &mut req)?;
1318 let control_handle = SessionControlHandle { inner: this.inner.clone() };
1319 Ok(SessionRequest::StartTracing {
1320 payload: req,
1321 responder: SessionStartTracingResponder {
1322 control_handle: std::mem::ManuallyDrop::new(control_handle),
1323 tx_id: header.tx_id,
1324 },
1325 })
1326 }
1327 0x50fefc9b3ff9b03a => {
1328 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1329 let mut req = fidl::new_empty!(
1330 StopOptions,
1331 fidl::encoding::DefaultFuchsiaResourceDialect
1332 );
1333 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StopOptions>(&header, _body_bytes, handles, &mut req)?;
1334 let control_handle = SessionControlHandle { inner: this.inner.clone() };
1335 Ok(SessionRequest::StopTracing {
1336 payload: req,
1337 responder: SessionStopTracingResponder {
1338 control_handle: std::mem::ManuallyDrop::new(control_handle),
1339 tx_id: header.tx_id,
1340 },
1341 })
1342 }
1343 0x1f1c080716d92276 => {
1344 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1345 let mut req = fidl::new_empty!(
1346 fidl::encoding::EmptyPayload,
1347 fidl::encoding::DefaultFuchsiaResourceDialect
1348 );
1349 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1350 let control_handle = SessionControlHandle { inner: this.inner.clone() };
1351 Ok(SessionRequest::WatchAlert {
1352 responder: SessionWatchAlertResponder {
1353 control_handle: std::mem::ManuallyDrop::new(control_handle),
1354 tx_id: header.tx_id,
1355 },
1356 })
1357 }
1358 _ if header.tx_id == 0
1359 && header
1360 .dynamic_flags()
1361 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1362 {
1363 Ok(SessionRequest::_UnknownMethod {
1364 ordinal: header.ordinal,
1365 control_handle: SessionControlHandle { inner: this.inner.clone() },
1366 method_type: fidl::MethodType::OneWay,
1367 })
1368 }
1369 _ if header
1370 .dynamic_flags()
1371 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1372 {
1373 this.inner.send_framework_err(
1374 fidl::encoding::FrameworkErr::UnknownMethod,
1375 header.tx_id,
1376 header.ordinal,
1377 header.dynamic_flags(),
1378 (bytes, handles),
1379 )?;
1380 Ok(SessionRequest::_UnknownMethod {
1381 ordinal: header.ordinal,
1382 control_handle: SessionControlHandle { inner: this.inner.clone() },
1383 method_type: fidl::MethodType::TwoWay,
1384 })
1385 }
1386 _ => Err(fidl::Error::UnknownOrdinal {
1387 ordinal: header.ordinal,
1388 protocol_name:
1389 <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1390 }),
1391 }))
1392 },
1393 )
1394 }
1395}
1396
1397#[derive(Debug)]
1413pub enum SessionRequest {
1414 StartTracing { payload: StartOptions, responder: SessionStartTracingResponder },
1426 StopTracing { payload: StopOptions, responder: SessionStopTracingResponder },
1432 WatchAlert { responder: SessionWatchAlertResponder },
1441 #[non_exhaustive]
1443 _UnknownMethod {
1444 ordinal: u64,
1446 control_handle: SessionControlHandle,
1447 method_type: fidl::MethodType,
1448 },
1449}
1450
1451impl SessionRequest {
1452 #[allow(irrefutable_let_patterns)]
1453 pub fn into_start_tracing(self) -> Option<(StartOptions, SessionStartTracingResponder)> {
1454 if let SessionRequest::StartTracing { payload, responder } = self {
1455 Some((payload, responder))
1456 } else {
1457 None
1458 }
1459 }
1460
1461 #[allow(irrefutable_let_patterns)]
1462 pub fn into_stop_tracing(self) -> Option<(StopOptions, SessionStopTracingResponder)> {
1463 if let SessionRequest::StopTracing { payload, responder } = self {
1464 Some((payload, responder))
1465 } else {
1466 None
1467 }
1468 }
1469
1470 #[allow(irrefutable_let_patterns)]
1471 pub fn into_watch_alert(self) -> Option<(SessionWatchAlertResponder)> {
1472 if let SessionRequest::WatchAlert { responder } = self { Some((responder)) } else { None }
1473 }
1474
1475 pub fn method_name(&self) -> &'static str {
1477 match *self {
1478 SessionRequest::StartTracing { .. } => "start_tracing",
1479 SessionRequest::StopTracing { .. } => "stop_tracing",
1480 SessionRequest::WatchAlert { .. } => "watch_alert",
1481 SessionRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
1482 "unknown one-way method"
1483 }
1484 SessionRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
1485 "unknown two-way method"
1486 }
1487 }
1488 }
1489}
1490
1491#[derive(Debug, Clone)]
1492pub struct SessionControlHandle {
1493 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1494}
1495
1496impl fidl::endpoints::ControlHandle for SessionControlHandle {
1497 fn shutdown(&self) {
1498 self.inner.shutdown()
1499 }
1500 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1501 self.inner.shutdown_with_epitaph(status)
1502 }
1503
1504 fn is_closed(&self) -> bool {
1505 self.inner.channel().is_closed()
1506 }
1507 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1508 self.inner.channel().on_closed()
1509 }
1510
1511 #[cfg(target_os = "fuchsia")]
1512 fn signal_peer(
1513 &self,
1514 clear_mask: zx::Signals,
1515 set_mask: zx::Signals,
1516 ) -> Result<(), zx_status::Status> {
1517 use fidl::Peered;
1518 self.inner.channel().signal_peer(clear_mask, set_mask)
1519 }
1520}
1521
1522impl SessionControlHandle {
1523 pub fn send_on_session_state_change(&self, mut state: SessionState) -> Result<(), fidl::Error> {
1524 self.inner.send::<SessionOnSessionStateChangeRequest>(
1525 (state,),
1526 0,
1527 0x7ab1640718b971cd,
1528 fidl::encoding::DynamicFlags::FLEXIBLE,
1529 )
1530 }
1531}
1532
1533#[must_use = "FIDL methods require a response to be sent"]
1534#[derive(Debug)]
1535pub struct SessionStartTracingResponder {
1536 control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
1537 tx_id: u32,
1538}
1539
1540impl std::ops::Drop for SessionStartTracingResponder {
1544 fn drop(&mut self) {
1545 self.control_handle.shutdown();
1546 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1548 }
1549}
1550
1551impl fidl::endpoints::Responder for SessionStartTracingResponder {
1552 type ControlHandle = SessionControlHandle;
1553
1554 fn control_handle(&self) -> &SessionControlHandle {
1555 &self.control_handle
1556 }
1557
1558 fn drop_without_shutdown(mut self) {
1559 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1561 std::mem::forget(self);
1563 }
1564}
1565
1566impl SessionStartTracingResponder {
1567 pub fn send(self, mut result: Result<(), StartError>) -> Result<(), fidl::Error> {
1571 let _result = self.send_raw(result);
1572 if _result.is_err() {
1573 self.control_handle.shutdown();
1574 }
1575 self.drop_without_shutdown();
1576 _result
1577 }
1578
1579 pub fn send_no_shutdown_on_err(
1581 self,
1582 mut result: Result<(), StartError>,
1583 ) -> Result<(), fidl::Error> {
1584 let _result = self.send_raw(result);
1585 self.drop_without_shutdown();
1586 _result
1587 }
1588
1589 fn send_raw(&self, mut result: Result<(), StartError>) -> Result<(), fidl::Error> {
1590 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1591 fidl::encoding::EmptyStruct,
1592 StartError,
1593 >>(
1594 fidl::encoding::FlexibleResult::new(result),
1595 self.tx_id,
1596 0xde9b6ccbe936631,
1597 fidl::encoding::DynamicFlags::FLEXIBLE,
1598 )
1599 }
1600}
1601
1602#[must_use = "FIDL methods require a response to be sent"]
1603#[derive(Debug)]
1604pub struct SessionStopTracingResponder {
1605 control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
1606 tx_id: u32,
1607}
1608
1609impl std::ops::Drop for SessionStopTracingResponder {
1613 fn drop(&mut self) {
1614 self.control_handle.shutdown();
1615 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1617 }
1618}
1619
1620impl fidl::endpoints::Responder for SessionStopTracingResponder {
1621 type ControlHandle = SessionControlHandle;
1622
1623 fn control_handle(&self) -> &SessionControlHandle {
1624 &self.control_handle
1625 }
1626
1627 fn drop_without_shutdown(mut self) {
1628 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1630 std::mem::forget(self);
1632 }
1633}
1634
1635impl SessionStopTracingResponder {
1636 pub fn send(self, mut result: Result<&StopResult, StopError>) -> Result<(), fidl::Error> {
1640 let _result = self.send_raw(result);
1641 if _result.is_err() {
1642 self.control_handle.shutdown();
1643 }
1644 self.drop_without_shutdown();
1645 _result
1646 }
1647
1648 pub fn send_no_shutdown_on_err(
1650 self,
1651 mut result: Result<&StopResult, StopError>,
1652 ) -> Result<(), fidl::Error> {
1653 let _result = self.send_raw(result);
1654 self.drop_without_shutdown();
1655 _result
1656 }
1657
1658 fn send_raw(&self, mut result: Result<&StopResult, StopError>) -> Result<(), fidl::Error> {
1659 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<StopResult, StopError>>(
1660 fidl::encoding::FlexibleResult::new(result),
1661 self.tx_id,
1662 0x50fefc9b3ff9b03a,
1663 fidl::encoding::DynamicFlags::FLEXIBLE,
1664 )
1665 }
1666}
1667
1668#[must_use = "FIDL methods require a response to be sent"]
1669#[derive(Debug)]
1670pub struct SessionWatchAlertResponder {
1671 control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
1672 tx_id: u32,
1673}
1674
1675impl std::ops::Drop for SessionWatchAlertResponder {
1679 fn drop(&mut self) {
1680 self.control_handle.shutdown();
1681 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1683 }
1684}
1685
1686impl fidl::endpoints::Responder for SessionWatchAlertResponder {
1687 type ControlHandle = SessionControlHandle;
1688
1689 fn control_handle(&self) -> &SessionControlHandle {
1690 &self.control_handle
1691 }
1692
1693 fn drop_without_shutdown(mut self) {
1694 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1696 std::mem::forget(self);
1698 }
1699}
1700
1701impl SessionWatchAlertResponder {
1702 pub fn send(self, mut alert_name: &str) -> Result<(), fidl::Error> {
1706 let _result = self.send_raw(alert_name);
1707 if _result.is_err() {
1708 self.control_handle.shutdown();
1709 }
1710 self.drop_without_shutdown();
1711 _result
1712 }
1713
1714 pub fn send_no_shutdown_on_err(self, mut alert_name: &str) -> Result<(), fidl::Error> {
1716 let _result = self.send_raw(alert_name);
1717 self.drop_without_shutdown();
1718 _result
1719 }
1720
1721 fn send_raw(&self, mut alert_name: &str) -> Result<(), fidl::Error> {
1722 self.control_handle.inner.send::<fidl::encoding::FlexibleType<SessionWatchAlertResponse>>(
1723 fidl::encoding::Flexible::new((alert_name,)),
1724 self.tx_id,
1725 0x1f1c080716d92276,
1726 fidl::encoding::DynamicFlags::FLEXIBLE,
1727 )
1728 }
1729}
1730
1731#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1732pub struct SessionManagerMarker;
1733
1734impl fidl::endpoints::ProtocolMarker for SessionManagerMarker {
1735 type Proxy = SessionManagerProxy;
1736 type RequestStream = SessionManagerRequestStream;
1737 #[cfg(target_os = "fuchsia")]
1738 type SynchronousProxy = SessionManagerSynchronousProxy;
1739
1740 const DEBUG_NAME: &'static str = "fuchsia.tracing.controller.SessionManager";
1741}
1742impl fidl::endpoints::DiscoverableProtocolMarker for SessionManagerMarker {}
1743pub type SessionManagerStartTraceSessionResult = Result<u64, RecordingError>;
1744pub type SessionManagerEndTraceSessionResult = Result<(TraceOptions, StopResult), RecordingError>;
1745pub type SessionManagerStatusResult = Result<TraceStatus, RecordingError>;
1746
1747pub trait SessionManagerProxyInterface: Send + Sync {
1748 type GetProvidersResponseFut: std::future::Future<Output = Result<Vec<ProviderInfo>, fidl::Error>>
1749 + Send;
1750 fn r#get_providers(&self) -> Self::GetProvidersResponseFut;
1751 type GetKnownCategoriesResponseFut: std::future::Future<Output = Result<Vec<fidl_fuchsia_tracing::KnownCategory>, fidl::Error>>
1752 + Send;
1753 fn r#get_known_categories(&self) -> Self::GetKnownCategoriesResponseFut;
1754 type StartTraceSessionResponseFut: std::future::Future<Output = Result<SessionManagerStartTraceSessionResult, fidl::Error>>
1755 + Send;
1756 fn r#start_trace_session(
1757 &self,
1758 config: &TraceConfig,
1759 options: &TraceOptions,
1760 ) -> Self::StartTraceSessionResponseFut;
1761 type EndTraceSessionResponseFut: std::future::Future<Output = Result<SessionManagerEndTraceSessionResult, fidl::Error>>
1762 + Send;
1763 fn r#end_trace_session(
1764 &self,
1765 task_id: u64,
1766 output: fidl::Socket,
1767 ) -> Self::EndTraceSessionResponseFut;
1768 type StatusResponseFut: std::future::Future<Output = Result<SessionManagerStatusResult, fidl::Error>>
1769 + Send;
1770 fn r#status(&self) -> Self::StatusResponseFut;
1771}
1772#[derive(Debug)]
1773#[cfg(target_os = "fuchsia")]
1774pub struct SessionManagerSynchronousProxy {
1775 client: fidl::client::sync::Client,
1776}
1777
1778#[cfg(target_os = "fuchsia")]
1779impl fidl::endpoints::SynchronousProxy for SessionManagerSynchronousProxy {
1780 type Proxy = SessionManagerProxy;
1781 type Protocol = SessionManagerMarker;
1782
1783 fn from_channel(inner: fidl::Channel) -> Self {
1784 Self::new(inner)
1785 }
1786
1787 fn into_channel(self) -> fidl::Channel {
1788 self.client.into_channel()
1789 }
1790
1791 fn as_channel(&self) -> &fidl::Channel {
1792 self.client.as_channel()
1793 }
1794}
1795
1796#[cfg(target_os = "fuchsia")]
1797impl SessionManagerSynchronousProxy {
1798 pub fn new(channel: fidl::Channel) -> Self {
1799 let protocol_name = <SessionManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1800 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1801 }
1802
1803 pub fn into_channel(self) -> fidl::Channel {
1804 self.client.into_channel()
1805 }
1806
1807 pub fn wait_for_event(
1810 &self,
1811 deadline: zx::MonotonicInstant,
1812 ) -> Result<SessionManagerEvent, fidl::Error> {
1813 SessionManagerEvent::decode(self.client.wait_for_event(deadline)?)
1814 }
1815
1816 pub fn r#get_providers(
1818 &self,
1819 ___deadline: zx::MonotonicInstant,
1820 ) -> Result<Vec<ProviderInfo>, fidl::Error> {
1821 let _response = self.client.send_query::<
1822 fidl::encoding::EmptyPayload,
1823 fidl::encoding::FlexibleType<SessionManagerGetProvidersResponse>,
1824 >(
1825 (),
1826 0x61bd49c4eb1fa03,
1827 fidl::encoding::DynamicFlags::FLEXIBLE,
1828 ___deadline,
1829 )?
1830 .into_result::<SessionManagerMarker>("get_providers")?;
1831 Ok(_response.providers)
1832 }
1833
1834 pub fn r#get_known_categories(
1836 &self,
1837 ___deadline: zx::MonotonicInstant,
1838 ) -> Result<Vec<fidl_fuchsia_tracing::KnownCategory>, fidl::Error> {
1839 let _response = self.client.send_query::<
1840 fidl::encoding::EmptyPayload,
1841 fidl::encoding::FlexibleType<SessionManagerGetKnownCategoriesResponse>,
1842 >(
1843 (),
1844 0x6f0abdb5401788b2,
1845 fidl::encoding::DynamicFlags::FLEXIBLE,
1846 ___deadline,
1847 )?
1848 .into_result::<SessionManagerMarker>("get_known_categories")?;
1849 Ok(_response.categories)
1850 }
1851
1852 pub fn r#start_trace_session(
1854 &self,
1855 mut config: &TraceConfig,
1856 mut options: &TraceOptions,
1857 ___deadline: zx::MonotonicInstant,
1858 ) -> Result<SessionManagerStartTraceSessionResult, fidl::Error> {
1859 let _response = self.client.send_query::<
1860 SessionManagerStartTraceSessionRequest,
1861 fidl::encoding::FlexibleResultType<SessionManagerStartTraceSessionResponse, RecordingError>,
1862 >(
1863 (config, options,),
1864 0x54c39e0c173c0162,
1865 fidl::encoding::DynamicFlags::FLEXIBLE,
1866 ___deadline,
1867 )?
1868 .into_result::<SessionManagerMarker>("start_trace_session")?;
1869 Ok(_response.map(|x| x.task_id))
1870 }
1871
1872 pub fn r#end_trace_session(
1877 &self,
1878 mut task_id: u64,
1879 mut output: fidl::Socket,
1880 ___deadline: zx::MonotonicInstant,
1881 ) -> Result<SessionManagerEndTraceSessionResult, fidl::Error> {
1882 let _response = self
1883 .client
1884 .send_query::<SessionManagerEndTraceSessionRequest, fidl::encoding::FlexibleResultType<
1885 SessionManagerEndTraceSessionResponse,
1886 RecordingError,
1887 >>(
1888 (task_id, output),
1889 0x72d6ca80a0787577,
1890 fidl::encoding::DynamicFlags::FLEXIBLE,
1891 ___deadline,
1892 )?
1893 .into_result::<SessionManagerMarker>("end_trace_session")?;
1894 Ok(_response.map(|x| (x.options, x.result)))
1895 }
1896
1897 pub fn r#status(
1899 &self,
1900 ___deadline: zx::MonotonicInstant,
1901 ) -> Result<SessionManagerStatusResult, fidl::Error> {
1902 let _response = self.client.send_query::<
1903 fidl::encoding::EmptyPayload,
1904 fidl::encoding::FlexibleResultType<TraceStatus, RecordingError>,
1905 >(
1906 (),
1907 0x2ebc198b7af59063,
1908 fidl::encoding::DynamicFlags::FLEXIBLE,
1909 ___deadline,
1910 )?
1911 .into_result::<SessionManagerMarker>("status")?;
1912 Ok(_response.map(|x| x))
1913 }
1914}
1915
1916#[cfg(target_os = "fuchsia")]
1917impl From<SessionManagerSynchronousProxy> for zx::Handle {
1918 fn from(value: SessionManagerSynchronousProxy) -> Self {
1919 value.into_channel().into()
1920 }
1921}
1922
1923#[cfg(target_os = "fuchsia")]
1924impl From<fidl::Channel> for SessionManagerSynchronousProxy {
1925 fn from(value: fidl::Channel) -> Self {
1926 Self::new(value)
1927 }
1928}
1929
1930#[cfg(target_os = "fuchsia")]
1931impl fidl::endpoints::FromClient for SessionManagerSynchronousProxy {
1932 type Protocol = SessionManagerMarker;
1933
1934 fn from_client(value: fidl::endpoints::ClientEnd<SessionManagerMarker>) -> Self {
1935 Self::new(value.into_channel())
1936 }
1937}
1938
1939#[derive(Debug, Clone)]
1940pub struct SessionManagerProxy {
1941 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1942}
1943
1944impl fidl::endpoints::Proxy for SessionManagerProxy {
1945 type Protocol = SessionManagerMarker;
1946
1947 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1948 Self::new(inner)
1949 }
1950
1951 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1952 self.client.into_channel().map_err(|client| Self { client })
1953 }
1954
1955 fn as_channel(&self) -> &::fidl::AsyncChannel {
1956 self.client.as_channel()
1957 }
1958}
1959
1960impl SessionManagerProxy {
1961 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1963 let protocol_name = <SessionManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1964 Self { client: fidl::client::Client::new(channel, protocol_name) }
1965 }
1966
1967 pub fn take_event_stream(&self) -> SessionManagerEventStream {
1973 SessionManagerEventStream { event_receiver: self.client.take_event_receiver() }
1974 }
1975
1976 pub fn r#get_providers(
1978 &self,
1979 ) -> fidl::client::QueryResponseFut<
1980 Vec<ProviderInfo>,
1981 fidl::encoding::DefaultFuchsiaResourceDialect,
1982 > {
1983 SessionManagerProxyInterface::r#get_providers(self)
1984 }
1985
1986 pub fn r#get_known_categories(
1988 &self,
1989 ) -> fidl::client::QueryResponseFut<
1990 Vec<fidl_fuchsia_tracing::KnownCategory>,
1991 fidl::encoding::DefaultFuchsiaResourceDialect,
1992 > {
1993 SessionManagerProxyInterface::r#get_known_categories(self)
1994 }
1995
1996 pub fn r#start_trace_session(
1998 &self,
1999 mut config: &TraceConfig,
2000 mut options: &TraceOptions,
2001 ) -> fidl::client::QueryResponseFut<
2002 SessionManagerStartTraceSessionResult,
2003 fidl::encoding::DefaultFuchsiaResourceDialect,
2004 > {
2005 SessionManagerProxyInterface::r#start_trace_session(self, config, options)
2006 }
2007
2008 pub fn r#end_trace_session(
2013 &self,
2014 mut task_id: u64,
2015 mut output: fidl::Socket,
2016 ) -> fidl::client::QueryResponseFut<
2017 SessionManagerEndTraceSessionResult,
2018 fidl::encoding::DefaultFuchsiaResourceDialect,
2019 > {
2020 SessionManagerProxyInterface::r#end_trace_session(self, task_id, output)
2021 }
2022
2023 pub fn r#status(
2025 &self,
2026 ) -> fidl::client::QueryResponseFut<
2027 SessionManagerStatusResult,
2028 fidl::encoding::DefaultFuchsiaResourceDialect,
2029 > {
2030 SessionManagerProxyInterface::r#status(self)
2031 }
2032}
2033
2034impl SessionManagerProxyInterface for SessionManagerProxy {
2035 type GetProvidersResponseFut = fidl::client::QueryResponseFut<
2036 Vec<ProviderInfo>,
2037 fidl::encoding::DefaultFuchsiaResourceDialect,
2038 >;
2039 fn r#get_providers(&self) -> Self::GetProvidersResponseFut {
2040 fn _decode(
2041 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2042 ) -> Result<Vec<ProviderInfo>, fidl::Error> {
2043 let _response = fidl::client::decode_transaction_body::<
2044 fidl::encoding::FlexibleType<SessionManagerGetProvidersResponse>,
2045 fidl::encoding::DefaultFuchsiaResourceDialect,
2046 0x61bd49c4eb1fa03,
2047 >(_buf?)?
2048 .into_result::<SessionManagerMarker>("get_providers")?;
2049 Ok(_response.providers)
2050 }
2051 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<ProviderInfo>>(
2052 (),
2053 0x61bd49c4eb1fa03,
2054 fidl::encoding::DynamicFlags::FLEXIBLE,
2055 _decode,
2056 )
2057 }
2058
2059 type GetKnownCategoriesResponseFut = fidl::client::QueryResponseFut<
2060 Vec<fidl_fuchsia_tracing::KnownCategory>,
2061 fidl::encoding::DefaultFuchsiaResourceDialect,
2062 >;
2063 fn r#get_known_categories(&self) -> Self::GetKnownCategoriesResponseFut {
2064 fn _decode(
2065 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2066 ) -> Result<Vec<fidl_fuchsia_tracing::KnownCategory>, fidl::Error> {
2067 let _response = fidl::client::decode_transaction_body::<
2068 fidl::encoding::FlexibleType<SessionManagerGetKnownCategoriesResponse>,
2069 fidl::encoding::DefaultFuchsiaResourceDialect,
2070 0x6f0abdb5401788b2,
2071 >(_buf?)?
2072 .into_result::<SessionManagerMarker>("get_known_categories")?;
2073 Ok(_response.categories)
2074 }
2075 self.client.send_query_and_decode::<
2076 fidl::encoding::EmptyPayload,
2077 Vec<fidl_fuchsia_tracing::KnownCategory>,
2078 >(
2079 (),
2080 0x6f0abdb5401788b2,
2081 fidl::encoding::DynamicFlags::FLEXIBLE,
2082 _decode,
2083 )
2084 }
2085
2086 type StartTraceSessionResponseFut = fidl::client::QueryResponseFut<
2087 SessionManagerStartTraceSessionResult,
2088 fidl::encoding::DefaultFuchsiaResourceDialect,
2089 >;
2090 fn r#start_trace_session(
2091 &self,
2092 mut config: &TraceConfig,
2093 mut options: &TraceOptions,
2094 ) -> Self::StartTraceSessionResponseFut {
2095 fn _decode(
2096 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2097 ) -> Result<SessionManagerStartTraceSessionResult, fidl::Error> {
2098 let _response = fidl::client::decode_transaction_body::<
2099 fidl::encoding::FlexibleResultType<
2100 SessionManagerStartTraceSessionResponse,
2101 RecordingError,
2102 >,
2103 fidl::encoding::DefaultFuchsiaResourceDialect,
2104 0x54c39e0c173c0162,
2105 >(_buf?)?
2106 .into_result::<SessionManagerMarker>("start_trace_session")?;
2107 Ok(_response.map(|x| x.task_id))
2108 }
2109 self.client.send_query_and_decode::<
2110 SessionManagerStartTraceSessionRequest,
2111 SessionManagerStartTraceSessionResult,
2112 >(
2113 (config, options,),
2114 0x54c39e0c173c0162,
2115 fidl::encoding::DynamicFlags::FLEXIBLE,
2116 _decode,
2117 )
2118 }
2119
2120 type EndTraceSessionResponseFut = fidl::client::QueryResponseFut<
2121 SessionManagerEndTraceSessionResult,
2122 fidl::encoding::DefaultFuchsiaResourceDialect,
2123 >;
2124 fn r#end_trace_session(
2125 &self,
2126 mut task_id: u64,
2127 mut output: fidl::Socket,
2128 ) -> Self::EndTraceSessionResponseFut {
2129 fn _decode(
2130 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2131 ) -> Result<SessionManagerEndTraceSessionResult, fidl::Error> {
2132 let _response = fidl::client::decode_transaction_body::<
2133 fidl::encoding::FlexibleResultType<
2134 SessionManagerEndTraceSessionResponse,
2135 RecordingError,
2136 >,
2137 fidl::encoding::DefaultFuchsiaResourceDialect,
2138 0x72d6ca80a0787577,
2139 >(_buf?)?
2140 .into_result::<SessionManagerMarker>("end_trace_session")?;
2141 Ok(_response.map(|x| (x.options, x.result)))
2142 }
2143 self.client.send_query_and_decode::<
2144 SessionManagerEndTraceSessionRequest,
2145 SessionManagerEndTraceSessionResult,
2146 >(
2147 (task_id, output,),
2148 0x72d6ca80a0787577,
2149 fidl::encoding::DynamicFlags::FLEXIBLE,
2150 _decode,
2151 )
2152 }
2153
2154 type StatusResponseFut = fidl::client::QueryResponseFut<
2155 SessionManagerStatusResult,
2156 fidl::encoding::DefaultFuchsiaResourceDialect,
2157 >;
2158 fn r#status(&self) -> Self::StatusResponseFut {
2159 fn _decode(
2160 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2161 ) -> Result<SessionManagerStatusResult, fidl::Error> {
2162 let _response = fidl::client::decode_transaction_body::<
2163 fidl::encoding::FlexibleResultType<TraceStatus, RecordingError>,
2164 fidl::encoding::DefaultFuchsiaResourceDialect,
2165 0x2ebc198b7af59063,
2166 >(_buf?)?
2167 .into_result::<SessionManagerMarker>("status")?;
2168 Ok(_response.map(|x| x))
2169 }
2170 self.client
2171 .send_query_and_decode::<fidl::encoding::EmptyPayload, SessionManagerStatusResult>(
2172 (),
2173 0x2ebc198b7af59063,
2174 fidl::encoding::DynamicFlags::FLEXIBLE,
2175 _decode,
2176 )
2177 }
2178}
2179
2180pub struct SessionManagerEventStream {
2181 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2182}
2183
2184impl std::marker::Unpin for SessionManagerEventStream {}
2185
2186impl futures::stream::FusedStream for SessionManagerEventStream {
2187 fn is_terminated(&self) -> bool {
2188 self.event_receiver.is_terminated()
2189 }
2190}
2191
2192impl futures::Stream for SessionManagerEventStream {
2193 type Item = Result<SessionManagerEvent, fidl::Error>;
2194
2195 fn poll_next(
2196 mut self: std::pin::Pin<&mut Self>,
2197 cx: &mut std::task::Context<'_>,
2198 ) -> std::task::Poll<Option<Self::Item>> {
2199 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2200 &mut self.event_receiver,
2201 cx
2202 )?) {
2203 Some(buf) => std::task::Poll::Ready(Some(SessionManagerEvent::decode(buf))),
2204 None => std::task::Poll::Ready(None),
2205 }
2206 }
2207}
2208
2209#[derive(Debug)]
2210pub enum SessionManagerEvent {
2211 #[non_exhaustive]
2212 _UnknownEvent {
2213 ordinal: u64,
2215 },
2216}
2217
2218impl SessionManagerEvent {
2219 fn decode(
2221 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2222 ) -> Result<SessionManagerEvent, fidl::Error> {
2223 let (bytes, _handles) = buf.split_mut();
2224 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2225 debug_assert_eq!(tx_header.tx_id, 0);
2226 match tx_header.ordinal {
2227 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2228 Ok(SessionManagerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
2229 }
2230 _ => Err(fidl::Error::UnknownOrdinal {
2231 ordinal: tx_header.ordinal,
2232 protocol_name:
2233 <SessionManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2234 }),
2235 }
2236 }
2237}
2238
2239pub struct SessionManagerRequestStream {
2241 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2242 is_terminated: bool,
2243}
2244
2245impl std::marker::Unpin for SessionManagerRequestStream {}
2246
2247impl futures::stream::FusedStream for SessionManagerRequestStream {
2248 fn is_terminated(&self) -> bool {
2249 self.is_terminated
2250 }
2251}
2252
2253impl fidl::endpoints::RequestStream for SessionManagerRequestStream {
2254 type Protocol = SessionManagerMarker;
2255 type ControlHandle = SessionManagerControlHandle;
2256
2257 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2258 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2259 }
2260
2261 fn control_handle(&self) -> Self::ControlHandle {
2262 SessionManagerControlHandle { inner: self.inner.clone() }
2263 }
2264
2265 fn into_inner(
2266 self,
2267 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2268 {
2269 (self.inner, self.is_terminated)
2270 }
2271
2272 fn from_inner(
2273 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2274 is_terminated: bool,
2275 ) -> Self {
2276 Self { inner, is_terminated }
2277 }
2278}
2279
2280impl futures::Stream for SessionManagerRequestStream {
2281 type Item = Result<SessionManagerRequest, fidl::Error>;
2282
2283 fn poll_next(
2284 mut self: std::pin::Pin<&mut Self>,
2285 cx: &mut std::task::Context<'_>,
2286 ) -> std::task::Poll<Option<Self::Item>> {
2287 let this = &mut *self;
2288 if this.inner.check_shutdown(cx) {
2289 this.is_terminated = true;
2290 return std::task::Poll::Ready(None);
2291 }
2292 if this.is_terminated {
2293 panic!("polled SessionManagerRequestStream after completion");
2294 }
2295 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2296 |bytes, handles| {
2297 match this.inner.channel().read_etc(cx, bytes, handles) {
2298 std::task::Poll::Ready(Ok(())) => {}
2299 std::task::Poll::Pending => return std::task::Poll::Pending,
2300 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2301 this.is_terminated = true;
2302 return std::task::Poll::Ready(None);
2303 }
2304 std::task::Poll::Ready(Err(e)) => {
2305 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2306 e.into(),
2307 ))));
2308 }
2309 }
2310
2311 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2313
2314 std::task::Poll::Ready(Some(match header.ordinal {
2315 0x61bd49c4eb1fa03 => {
2316 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2317 let mut req = fidl::new_empty!(
2318 fidl::encoding::EmptyPayload,
2319 fidl::encoding::DefaultFuchsiaResourceDialect
2320 );
2321 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2322 let control_handle =
2323 SessionManagerControlHandle { inner: this.inner.clone() };
2324 Ok(SessionManagerRequest::GetProviders {
2325 responder: SessionManagerGetProvidersResponder {
2326 control_handle: std::mem::ManuallyDrop::new(control_handle),
2327 tx_id: header.tx_id,
2328 },
2329 })
2330 }
2331 0x6f0abdb5401788b2 => {
2332 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2333 let mut req = fidl::new_empty!(
2334 fidl::encoding::EmptyPayload,
2335 fidl::encoding::DefaultFuchsiaResourceDialect
2336 );
2337 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2338 let control_handle =
2339 SessionManagerControlHandle { inner: this.inner.clone() };
2340 Ok(SessionManagerRequest::GetKnownCategories {
2341 responder: SessionManagerGetKnownCategoriesResponder {
2342 control_handle: std::mem::ManuallyDrop::new(control_handle),
2343 tx_id: header.tx_id,
2344 },
2345 })
2346 }
2347 0x54c39e0c173c0162 => {
2348 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2349 let mut req = fidl::new_empty!(
2350 SessionManagerStartTraceSessionRequest,
2351 fidl::encoding::DefaultFuchsiaResourceDialect
2352 );
2353 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionManagerStartTraceSessionRequest>(&header, _body_bytes, handles, &mut req)?;
2354 let control_handle =
2355 SessionManagerControlHandle { inner: this.inner.clone() };
2356 Ok(SessionManagerRequest::StartTraceSession {
2357 config: req.config,
2358 options: req.options,
2359
2360 responder: SessionManagerStartTraceSessionResponder {
2361 control_handle: std::mem::ManuallyDrop::new(control_handle),
2362 tx_id: header.tx_id,
2363 },
2364 })
2365 }
2366 0x72d6ca80a0787577 => {
2367 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2368 let mut req = fidl::new_empty!(
2369 SessionManagerEndTraceSessionRequest,
2370 fidl::encoding::DefaultFuchsiaResourceDialect
2371 );
2372 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionManagerEndTraceSessionRequest>(&header, _body_bytes, handles, &mut req)?;
2373 let control_handle =
2374 SessionManagerControlHandle { inner: this.inner.clone() };
2375 Ok(SessionManagerRequest::EndTraceSession {
2376 task_id: req.task_id,
2377 output: req.output,
2378
2379 responder: SessionManagerEndTraceSessionResponder {
2380 control_handle: std::mem::ManuallyDrop::new(control_handle),
2381 tx_id: header.tx_id,
2382 },
2383 })
2384 }
2385 0x2ebc198b7af59063 => {
2386 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2387 let mut req = fidl::new_empty!(
2388 fidl::encoding::EmptyPayload,
2389 fidl::encoding::DefaultFuchsiaResourceDialect
2390 );
2391 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2392 let control_handle =
2393 SessionManagerControlHandle { inner: this.inner.clone() };
2394 Ok(SessionManagerRequest::Status {
2395 responder: SessionManagerStatusResponder {
2396 control_handle: std::mem::ManuallyDrop::new(control_handle),
2397 tx_id: header.tx_id,
2398 },
2399 })
2400 }
2401 _ if header.tx_id == 0
2402 && header
2403 .dynamic_flags()
2404 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2405 {
2406 Ok(SessionManagerRequest::_UnknownMethod {
2407 ordinal: header.ordinal,
2408 control_handle: SessionManagerControlHandle {
2409 inner: this.inner.clone(),
2410 },
2411 method_type: fidl::MethodType::OneWay,
2412 })
2413 }
2414 _ if header
2415 .dynamic_flags()
2416 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2417 {
2418 this.inner.send_framework_err(
2419 fidl::encoding::FrameworkErr::UnknownMethod,
2420 header.tx_id,
2421 header.ordinal,
2422 header.dynamic_flags(),
2423 (bytes, handles),
2424 )?;
2425 Ok(SessionManagerRequest::_UnknownMethod {
2426 ordinal: header.ordinal,
2427 control_handle: SessionManagerControlHandle {
2428 inner: this.inner.clone(),
2429 },
2430 method_type: fidl::MethodType::TwoWay,
2431 })
2432 }
2433 _ => Err(fidl::Error::UnknownOrdinal {
2434 ordinal: header.ordinal,
2435 protocol_name:
2436 <SessionManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2437 }),
2438 }))
2439 },
2440 )
2441 }
2442}
2443
2444#[derive(Debug)]
2445pub enum SessionManagerRequest {
2446 GetProviders { responder: SessionManagerGetProvidersResponder },
2448 GetKnownCategories { responder: SessionManagerGetKnownCategoriesResponder },
2450 StartTraceSession {
2452 config: TraceConfig,
2453 options: TraceOptions,
2454 responder: SessionManagerStartTraceSessionResponder,
2455 },
2456 EndTraceSession {
2461 task_id: u64,
2462 output: fidl::Socket,
2463 responder: SessionManagerEndTraceSessionResponder,
2464 },
2465 Status { responder: SessionManagerStatusResponder },
2467 #[non_exhaustive]
2469 _UnknownMethod {
2470 ordinal: u64,
2472 control_handle: SessionManagerControlHandle,
2473 method_type: fidl::MethodType,
2474 },
2475}
2476
2477impl SessionManagerRequest {
2478 #[allow(irrefutable_let_patterns)]
2479 pub fn into_get_providers(self) -> Option<(SessionManagerGetProvidersResponder)> {
2480 if let SessionManagerRequest::GetProviders { responder } = self {
2481 Some((responder))
2482 } else {
2483 None
2484 }
2485 }
2486
2487 #[allow(irrefutable_let_patterns)]
2488 pub fn into_get_known_categories(self) -> Option<(SessionManagerGetKnownCategoriesResponder)> {
2489 if let SessionManagerRequest::GetKnownCategories { responder } = self {
2490 Some((responder))
2491 } else {
2492 None
2493 }
2494 }
2495
2496 #[allow(irrefutable_let_patterns)]
2497 pub fn into_start_trace_session(
2498 self,
2499 ) -> Option<(TraceConfig, TraceOptions, SessionManagerStartTraceSessionResponder)> {
2500 if let SessionManagerRequest::StartTraceSession { config, options, responder } = self {
2501 Some((config, options, responder))
2502 } else {
2503 None
2504 }
2505 }
2506
2507 #[allow(irrefutable_let_patterns)]
2508 pub fn into_end_trace_session(
2509 self,
2510 ) -> Option<(u64, fidl::Socket, SessionManagerEndTraceSessionResponder)> {
2511 if let SessionManagerRequest::EndTraceSession { task_id, output, responder } = self {
2512 Some((task_id, output, responder))
2513 } else {
2514 None
2515 }
2516 }
2517
2518 #[allow(irrefutable_let_patterns)]
2519 pub fn into_status(self) -> Option<(SessionManagerStatusResponder)> {
2520 if let SessionManagerRequest::Status { responder } = self {
2521 Some((responder))
2522 } else {
2523 None
2524 }
2525 }
2526
2527 pub fn method_name(&self) -> &'static str {
2529 match *self {
2530 SessionManagerRequest::GetProviders { .. } => "get_providers",
2531 SessionManagerRequest::GetKnownCategories { .. } => "get_known_categories",
2532 SessionManagerRequest::StartTraceSession { .. } => "start_trace_session",
2533 SessionManagerRequest::EndTraceSession { .. } => "end_trace_session",
2534 SessionManagerRequest::Status { .. } => "status",
2535 SessionManagerRequest::_UnknownMethod {
2536 method_type: fidl::MethodType::OneWay, ..
2537 } => "unknown one-way method",
2538 SessionManagerRequest::_UnknownMethod {
2539 method_type: fidl::MethodType::TwoWay, ..
2540 } => "unknown two-way method",
2541 }
2542 }
2543}
2544
2545#[derive(Debug, Clone)]
2546pub struct SessionManagerControlHandle {
2547 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2548}
2549
2550impl fidl::endpoints::ControlHandle for SessionManagerControlHandle {
2551 fn shutdown(&self) {
2552 self.inner.shutdown()
2553 }
2554 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2555 self.inner.shutdown_with_epitaph(status)
2556 }
2557
2558 fn is_closed(&self) -> bool {
2559 self.inner.channel().is_closed()
2560 }
2561 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2562 self.inner.channel().on_closed()
2563 }
2564
2565 #[cfg(target_os = "fuchsia")]
2566 fn signal_peer(
2567 &self,
2568 clear_mask: zx::Signals,
2569 set_mask: zx::Signals,
2570 ) -> Result<(), zx_status::Status> {
2571 use fidl::Peered;
2572 self.inner.channel().signal_peer(clear_mask, set_mask)
2573 }
2574}
2575
2576impl SessionManagerControlHandle {}
2577
2578#[must_use = "FIDL methods require a response to be sent"]
2579#[derive(Debug)]
2580pub struct SessionManagerGetProvidersResponder {
2581 control_handle: std::mem::ManuallyDrop<SessionManagerControlHandle>,
2582 tx_id: u32,
2583}
2584
2585impl std::ops::Drop for SessionManagerGetProvidersResponder {
2589 fn drop(&mut self) {
2590 self.control_handle.shutdown();
2591 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2593 }
2594}
2595
2596impl fidl::endpoints::Responder for SessionManagerGetProvidersResponder {
2597 type ControlHandle = SessionManagerControlHandle;
2598
2599 fn control_handle(&self) -> &SessionManagerControlHandle {
2600 &self.control_handle
2601 }
2602
2603 fn drop_without_shutdown(mut self) {
2604 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2606 std::mem::forget(self);
2608 }
2609}
2610
2611impl SessionManagerGetProvidersResponder {
2612 pub fn send(self, mut providers: &[ProviderInfo]) -> Result<(), fidl::Error> {
2616 let _result = self.send_raw(providers);
2617 if _result.is_err() {
2618 self.control_handle.shutdown();
2619 }
2620 self.drop_without_shutdown();
2621 _result
2622 }
2623
2624 pub fn send_no_shutdown_on_err(
2626 self,
2627 mut providers: &[ProviderInfo],
2628 ) -> Result<(), fidl::Error> {
2629 let _result = self.send_raw(providers);
2630 self.drop_without_shutdown();
2631 _result
2632 }
2633
2634 fn send_raw(&self, mut providers: &[ProviderInfo]) -> Result<(), fidl::Error> {
2635 self.control_handle
2636 .inner
2637 .send::<fidl::encoding::FlexibleType<SessionManagerGetProvidersResponse>>(
2638 fidl::encoding::Flexible::new((providers,)),
2639 self.tx_id,
2640 0x61bd49c4eb1fa03,
2641 fidl::encoding::DynamicFlags::FLEXIBLE,
2642 )
2643 }
2644}
2645
2646#[must_use = "FIDL methods require a response to be sent"]
2647#[derive(Debug)]
2648pub struct SessionManagerGetKnownCategoriesResponder {
2649 control_handle: std::mem::ManuallyDrop<SessionManagerControlHandle>,
2650 tx_id: u32,
2651}
2652
2653impl std::ops::Drop for SessionManagerGetKnownCategoriesResponder {
2657 fn drop(&mut self) {
2658 self.control_handle.shutdown();
2659 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2661 }
2662}
2663
2664impl fidl::endpoints::Responder for SessionManagerGetKnownCategoriesResponder {
2665 type ControlHandle = SessionManagerControlHandle;
2666
2667 fn control_handle(&self) -> &SessionManagerControlHandle {
2668 &self.control_handle
2669 }
2670
2671 fn drop_without_shutdown(mut self) {
2672 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2674 std::mem::forget(self);
2676 }
2677}
2678
2679impl SessionManagerGetKnownCategoriesResponder {
2680 pub fn send(
2684 self,
2685 mut categories: &[fidl_fuchsia_tracing::KnownCategory],
2686 ) -> Result<(), fidl::Error> {
2687 let _result = self.send_raw(categories);
2688 if _result.is_err() {
2689 self.control_handle.shutdown();
2690 }
2691 self.drop_without_shutdown();
2692 _result
2693 }
2694
2695 pub fn send_no_shutdown_on_err(
2697 self,
2698 mut categories: &[fidl_fuchsia_tracing::KnownCategory],
2699 ) -> Result<(), fidl::Error> {
2700 let _result = self.send_raw(categories);
2701 self.drop_without_shutdown();
2702 _result
2703 }
2704
2705 fn send_raw(
2706 &self,
2707 mut categories: &[fidl_fuchsia_tracing::KnownCategory],
2708 ) -> Result<(), fidl::Error> {
2709 self.control_handle.inner.send::<fidl::encoding::FlexibleType<
2710 SessionManagerGetKnownCategoriesResponse,
2711 >>(
2712 fidl::encoding::Flexible::new((categories,)),
2713 self.tx_id,
2714 0x6f0abdb5401788b2,
2715 fidl::encoding::DynamicFlags::FLEXIBLE,
2716 )
2717 }
2718}
2719
2720#[must_use = "FIDL methods require a response to be sent"]
2721#[derive(Debug)]
2722pub struct SessionManagerStartTraceSessionResponder {
2723 control_handle: std::mem::ManuallyDrop<SessionManagerControlHandle>,
2724 tx_id: u32,
2725}
2726
2727impl std::ops::Drop for SessionManagerStartTraceSessionResponder {
2731 fn drop(&mut self) {
2732 self.control_handle.shutdown();
2733 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2735 }
2736}
2737
2738impl fidl::endpoints::Responder for SessionManagerStartTraceSessionResponder {
2739 type ControlHandle = SessionManagerControlHandle;
2740
2741 fn control_handle(&self) -> &SessionManagerControlHandle {
2742 &self.control_handle
2743 }
2744
2745 fn drop_without_shutdown(mut self) {
2746 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2748 std::mem::forget(self);
2750 }
2751}
2752
2753impl SessionManagerStartTraceSessionResponder {
2754 pub fn send(self, mut result: Result<u64, RecordingError>) -> Result<(), fidl::Error> {
2758 let _result = self.send_raw(result);
2759 if _result.is_err() {
2760 self.control_handle.shutdown();
2761 }
2762 self.drop_without_shutdown();
2763 _result
2764 }
2765
2766 pub fn send_no_shutdown_on_err(
2768 self,
2769 mut result: Result<u64, RecordingError>,
2770 ) -> Result<(), fidl::Error> {
2771 let _result = self.send_raw(result);
2772 self.drop_without_shutdown();
2773 _result
2774 }
2775
2776 fn send_raw(&self, mut result: Result<u64, RecordingError>) -> Result<(), fidl::Error> {
2777 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2778 SessionManagerStartTraceSessionResponse,
2779 RecordingError,
2780 >>(
2781 fidl::encoding::FlexibleResult::new(result.map(|task_id| (task_id,))),
2782 self.tx_id,
2783 0x54c39e0c173c0162,
2784 fidl::encoding::DynamicFlags::FLEXIBLE,
2785 )
2786 }
2787}
2788
2789#[must_use = "FIDL methods require a response to be sent"]
2790#[derive(Debug)]
2791pub struct SessionManagerEndTraceSessionResponder {
2792 control_handle: std::mem::ManuallyDrop<SessionManagerControlHandle>,
2793 tx_id: u32,
2794}
2795
2796impl std::ops::Drop for SessionManagerEndTraceSessionResponder {
2800 fn drop(&mut self) {
2801 self.control_handle.shutdown();
2802 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2804 }
2805}
2806
2807impl fidl::endpoints::Responder for SessionManagerEndTraceSessionResponder {
2808 type ControlHandle = SessionManagerControlHandle;
2809
2810 fn control_handle(&self) -> &SessionManagerControlHandle {
2811 &self.control_handle
2812 }
2813
2814 fn drop_without_shutdown(mut self) {
2815 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2817 std::mem::forget(self);
2819 }
2820}
2821
2822impl SessionManagerEndTraceSessionResponder {
2823 pub fn send(
2827 self,
2828 mut result: Result<(&TraceOptions, &StopResult), RecordingError>,
2829 ) -> Result<(), fidl::Error> {
2830 let _result = self.send_raw(result);
2831 if _result.is_err() {
2832 self.control_handle.shutdown();
2833 }
2834 self.drop_without_shutdown();
2835 _result
2836 }
2837
2838 pub fn send_no_shutdown_on_err(
2840 self,
2841 mut result: Result<(&TraceOptions, &StopResult), RecordingError>,
2842 ) -> Result<(), fidl::Error> {
2843 let _result = self.send_raw(result);
2844 self.drop_without_shutdown();
2845 _result
2846 }
2847
2848 fn send_raw(
2849 &self,
2850 mut result: Result<(&TraceOptions, &StopResult), RecordingError>,
2851 ) -> Result<(), fidl::Error> {
2852 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2853 SessionManagerEndTraceSessionResponse,
2854 RecordingError,
2855 >>(
2856 fidl::encoding::FlexibleResult::new(result),
2857 self.tx_id,
2858 0x72d6ca80a0787577,
2859 fidl::encoding::DynamicFlags::FLEXIBLE,
2860 )
2861 }
2862}
2863
2864#[must_use = "FIDL methods require a response to be sent"]
2865#[derive(Debug)]
2866pub struct SessionManagerStatusResponder {
2867 control_handle: std::mem::ManuallyDrop<SessionManagerControlHandle>,
2868 tx_id: u32,
2869}
2870
2871impl std::ops::Drop for SessionManagerStatusResponder {
2875 fn drop(&mut self) {
2876 self.control_handle.shutdown();
2877 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2879 }
2880}
2881
2882impl fidl::endpoints::Responder for SessionManagerStatusResponder {
2883 type ControlHandle = SessionManagerControlHandle;
2884
2885 fn control_handle(&self) -> &SessionManagerControlHandle {
2886 &self.control_handle
2887 }
2888
2889 fn drop_without_shutdown(mut self) {
2890 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2892 std::mem::forget(self);
2894 }
2895}
2896
2897impl SessionManagerStatusResponder {
2898 pub fn send(self, mut result: Result<&TraceStatus, RecordingError>) -> Result<(), fidl::Error> {
2902 let _result = self.send_raw(result);
2903 if _result.is_err() {
2904 self.control_handle.shutdown();
2905 }
2906 self.drop_without_shutdown();
2907 _result
2908 }
2909
2910 pub fn send_no_shutdown_on_err(
2912 self,
2913 mut result: Result<&TraceStatus, RecordingError>,
2914 ) -> Result<(), fidl::Error> {
2915 let _result = self.send_raw(result);
2916 self.drop_without_shutdown();
2917 _result
2918 }
2919
2920 fn send_raw(
2921 &self,
2922 mut result: Result<&TraceStatus, RecordingError>,
2923 ) -> Result<(), fidl::Error> {
2924 self.control_handle
2925 .inner
2926 .send::<fidl::encoding::FlexibleResultType<TraceStatus, RecordingError>>(
2927 fidl::encoding::FlexibleResult::new(result),
2928 self.tx_id,
2929 0x2ebc198b7af59063,
2930 fidl::encoding::DynamicFlags::FLEXIBLE,
2931 )
2932 }
2933}
2934
2935mod internal {
2936 use super::*;
2937
2938 impl fidl::encoding::ResourceTypeMarker for ProvisionerInitializeTracingRequest {
2939 type Borrowed<'a> = &'a mut Self;
2940 fn take_or_borrow<'a>(
2941 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2942 ) -> Self::Borrowed<'a> {
2943 value
2944 }
2945 }
2946
2947 unsafe impl fidl::encoding::TypeMarker for ProvisionerInitializeTracingRequest {
2948 type Owned = Self;
2949
2950 #[inline(always)]
2951 fn inline_align(_context: fidl::encoding::Context) -> usize {
2952 8
2953 }
2954
2955 #[inline(always)]
2956 fn inline_size(_context: fidl::encoding::Context) -> usize {
2957 32
2958 }
2959 }
2960
2961 unsafe impl
2962 fidl::encoding::Encode<
2963 ProvisionerInitializeTracingRequest,
2964 fidl::encoding::DefaultFuchsiaResourceDialect,
2965 > for &mut ProvisionerInitializeTracingRequest
2966 {
2967 #[inline]
2968 unsafe fn encode(
2969 self,
2970 encoder: &mut fidl::encoding::Encoder<
2971 '_,
2972 fidl::encoding::DefaultFuchsiaResourceDialect,
2973 >,
2974 offset: usize,
2975 _depth: fidl::encoding::Depth,
2976 ) -> fidl::Result<()> {
2977 encoder.debug_check_bounds::<ProvisionerInitializeTracingRequest>(offset);
2978 fidl::encoding::Encode::<ProvisionerInitializeTracingRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2980 (
2981 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.controller),
2982 <TraceConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.config),
2983 <fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 16392> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.output),
2984 ),
2985 encoder, offset, _depth
2986 )
2987 }
2988 }
2989 unsafe impl<
2990 T0: fidl::encoding::Encode<
2991 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>>,
2992 fidl::encoding::DefaultFuchsiaResourceDialect,
2993 >,
2994 T1: fidl::encoding::Encode<TraceConfig, fidl::encoding::DefaultFuchsiaResourceDialect>,
2995 T2: fidl::encoding::Encode<
2996 fidl::encoding::HandleType<
2997 fidl::Socket,
2998 { fidl::ObjectType::SOCKET.into_raw() },
2999 16392,
3000 >,
3001 fidl::encoding::DefaultFuchsiaResourceDialect,
3002 >,
3003 >
3004 fidl::encoding::Encode<
3005 ProvisionerInitializeTracingRequest,
3006 fidl::encoding::DefaultFuchsiaResourceDialect,
3007 > for (T0, T1, T2)
3008 {
3009 #[inline]
3010 unsafe fn encode(
3011 self,
3012 encoder: &mut fidl::encoding::Encoder<
3013 '_,
3014 fidl::encoding::DefaultFuchsiaResourceDialect,
3015 >,
3016 offset: usize,
3017 depth: fidl::encoding::Depth,
3018 ) -> fidl::Result<()> {
3019 encoder.debug_check_bounds::<ProvisionerInitializeTracingRequest>(offset);
3020 unsafe {
3023 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
3024 (ptr as *mut u64).write_unaligned(0);
3025 }
3026 unsafe {
3027 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
3028 (ptr as *mut u64).write_unaligned(0);
3029 }
3030 self.0.encode(encoder, offset + 0, depth)?;
3032 self.1.encode(encoder, offset + 8, depth)?;
3033 self.2.encode(encoder, offset + 24, depth)?;
3034 Ok(())
3035 }
3036 }
3037
3038 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3039 for ProvisionerInitializeTracingRequest
3040 {
3041 #[inline(always)]
3042 fn new_empty() -> Self {
3043 Self {
3044 controller: fidl::new_empty!(
3045 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>>,
3046 fidl::encoding::DefaultFuchsiaResourceDialect
3047 ),
3048 config: fidl::new_empty!(
3049 TraceConfig,
3050 fidl::encoding::DefaultFuchsiaResourceDialect
3051 ),
3052 output: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 16392>, fidl::encoding::DefaultFuchsiaResourceDialect),
3053 }
3054 }
3055
3056 #[inline]
3057 unsafe fn decode(
3058 &mut self,
3059 decoder: &mut fidl::encoding::Decoder<
3060 '_,
3061 fidl::encoding::DefaultFuchsiaResourceDialect,
3062 >,
3063 offset: usize,
3064 _depth: fidl::encoding::Depth,
3065 ) -> fidl::Result<()> {
3066 decoder.debug_check_bounds::<Self>(offset);
3067 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
3069 let padval = unsafe { (ptr as *const u64).read_unaligned() };
3070 let mask = 0xffffffff00000000u64;
3071 let maskedval = padval & mask;
3072 if maskedval != 0 {
3073 return Err(fidl::Error::NonZeroPadding {
3074 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
3075 });
3076 }
3077 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
3078 let padval = unsafe { (ptr as *const u64).read_unaligned() };
3079 let mask = 0xffffffff00000000u64;
3080 let maskedval = padval & mask;
3081 if maskedval != 0 {
3082 return Err(fidl::Error::NonZeroPadding {
3083 padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
3084 });
3085 }
3086 fidl::decode!(
3087 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>>,
3088 fidl::encoding::DefaultFuchsiaResourceDialect,
3089 &mut self.controller,
3090 decoder,
3091 offset + 0,
3092 _depth
3093 )?;
3094 fidl::decode!(
3095 TraceConfig,
3096 fidl::encoding::DefaultFuchsiaResourceDialect,
3097 &mut self.config,
3098 decoder,
3099 offset + 8,
3100 _depth
3101 )?;
3102 fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 16392>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.output, decoder, offset + 24, _depth)?;
3103 Ok(())
3104 }
3105 }
3106
3107 impl fidl::encoding::ResourceTypeMarker for SessionManagerEndTraceSessionRequest {
3108 type Borrowed<'a> = &'a mut Self;
3109 fn take_or_borrow<'a>(
3110 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3111 ) -> Self::Borrowed<'a> {
3112 value
3113 }
3114 }
3115
3116 unsafe impl fidl::encoding::TypeMarker for SessionManagerEndTraceSessionRequest {
3117 type Owned = Self;
3118
3119 #[inline(always)]
3120 fn inline_align(_context: fidl::encoding::Context) -> usize {
3121 8
3122 }
3123
3124 #[inline(always)]
3125 fn inline_size(_context: fidl::encoding::Context) -> usize {
3126 16
3127 }
3128 }
3129
3130 unsafe impl
3131 fidl::encoding::Encode<
3132 SessionManagerEndTraceSessionRequest,
3133 fidl::encoding::DefaultFuchsiaResourceDialect,
3134 > for &mut SessionManagerEndTraceSessionRequest
3135 {
3136 #[inline]
3137 unsafe fn encode(
3138 self,
3139 encoder: &mut fidl::encoding::Encoder<
3140 '_,
3141 fidl::encoding::DefaultFuchsiaResourceDialect,
3142 >,
3143 offset: usize,
3144 _depth: fidl::encoding::Depth,
3145 ) -> fidl::Result<()> {
3146 encoder.debug_check_bounds::<SessionManagerEndTraceSessionRequest>(offset);
3147 fidl::encoding::Encode::<
3149 SessionManagerEndTraceSessionRequest,
3150 fidl::encoding::DefaultFuchsiaResourceDialect,
3151 >::encode(
3152 (
3153 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.task_id),
3154 <fidl::encoding::HandleType<
3155 fidl::Socket,
3156 { fidl::ObjectType::SOCKET.into_raw() },
3157 16394,
3158 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3159 &mut self.output
3160 ),
3161 ),
3162 encoder,
3163 offset,
3164 _depth,
3165 )
3166 }
3167 }
3168 unsafe impl<
3169 T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
3170 T1: fidl::encoding::Encode<
3171 fidl::encoding::HandleType<
3172 fidl::Socket,
3173 { fidl::ObjectType::SOCKET.into_raw() },
3174 16394,
3175 >,
3176 fidl::encoding::DefaultFuchsiaResourceDialect,
3177 >,
3178 >
3179 fidl::encoding::Encode<
3180 SessionManagerEndTraceSessionRequest,
3181 fidl::encoding::DefaultFuchsiaResourceDialect,
3182 > for (T0, T1)
3183 {
3184 #[inline]
3185 unsafe fn encode(
3186 self,
3187 encoder: &mut fidl::encoding::Encoder<
3188 '_,
3189 fidl::encoding::DefaultFuchsiaResourceDialect,
3190 >,
3191 offset: usize,
3192 depth: fidl::encoding::Depth,
3193 ) -> fidl::Result<()> {
3194 encoder.debug_check_bounds::<SessionManagerEndTraceSessionRequest>(offset);
3195 unsafe {
3198 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
3199 (ptr as *mut u64).write_unaligned(0);
3200 }
3201 self.0.encode(encoder, offset + 0, depth)?;
3203 self.1.encode(encoder, offset + 8, depth)?;
3204 Ok(())
3205 }
3206 }
3207
3208 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3209 for SessionManagerEndTraceSessionRequest
3210 {
3211 #[inline(always)]
3212 fn new_empty() -> Self {
3213 Self {
3214 task_id: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
3215 output: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 16394>, fidl::encoding::DefaultFuchsiaResourceDialect),
3216 }
3217 }
3218
3219 #[inline]
3220 unsafe fn decode(
3221 &mut self,
3222 decoder: &mut fidl::encoding::Decoder<
3223 '_,
3224 fidl::encoding::DefaultFuchsiaResourceDialect,
3225 >,
3226 offset: usize,
3227 _depth: fidl::encoding::Depth,
3228 ) -> fidl::Result<()> {
3229 decoder.debug_check_bounds::<Self>(offset);
3230 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
3232 let padval = unsafe { (ptr as *const u64).read_unaligned() };
3233 let mask = 0xffffffff00000000u64;
3234 let maskedval = padval & mask;
3235 if maskedval != 0 {
3236 return Err(fidl::Error::NonZeroPadding {
3237 padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
3238 });
3239 }
3240 fidl::decode!(
3241 u64,
3242 fidl::encoding::DefaultFuchsiaResourceDialect,
3243 &mut self.task_id,
3244 decoder,
3245 offset + 0,
3246 _depth
3247 )?;
3248 fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 16394>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.output, decoder, offset + 8, _depth)?;
3249 Ok(())
3250 }
3251 }
3252
3253 impl fidl::encoding::ResourceTypeMarker for SessionManagerStartTraceSessionRequest {
3254 type Borrowed<'a> = &'a mut Self;
3255 fn take_or_borrow<'a>(
3256 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3257 ) -> Self::Borrowed<'a> {
3258 value
3259 }
3260 }
3261
3262 unsafe impl fidl::encoding::TypeMarker for SessionManagerStartTraceSessionRequest {
3263 type Owned = Self;
3264
3265 #[inline(always)]
3266 fn inline_align(_context: fidl::encoding::Context) -> usize {
3267 8
3268 }
3269
3270 #[inline(always)]
3271 fn inline_size(_context: fidl::encoding::Context) -> usize {
3272 32
3273 }
3274 }
3275
3276 unsafe impl
3277 fidl::encoding::Encode<
3278 SessionManagerStartTraceSessionRequest,
3279 fidl::encoding::DefaultFuchsiaResourceDialect,
3280 > for &mut SessionManagerStartTraceSessionRequest
3281 {
3282 #[inline]
3283 unsafe fn encode(
3284 self,
3285 encoder: &mut fidl::encoding::Encoder<
3286 '_,
3287 fidl::encoding::DefaultFuchsiaResourceDialect,
3288 >,
3289 offset: usize,
3290 _depth: fidl::encoding::Depth,
3291 ) -> fidl::Result<()> {
3292 encoder.debug_check_bounds::<SessionManagerStartTraceSessionRequest>(offset);
3293 fidl::encoding::Encode::<
3295 SessionManagerStartTraceSessionRequest,
3296 fidl::encoding::DefaultFuchsiaResourceDialect,
3297 >::encode(
3298 (
3299 <TraceConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.config),
3300 <TraceOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
3301 ),
3302 encoder,
3303 offset,
3304 _depth,
3305 )
3306 }
3307 }
3308 unsafe impl<
3309 T0: fidl::encoding::Encode<TraceConfig, fidl::encoding::DefaultFuchsiaResourceDialect>,
3310 T1: fidl::encoding::Encode<TraceOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
3311 >
3312 fidl::encoding::Encode<
3313 SessionManagerStartTraceSessionRequest,
3314 fidl::encoding::DefaultFuchsiaResourceDialect,
3315 > for (T0, T1)
3316 {
3317 #[inline]
3318 unsafe fn encode(
3319 self,
3320 encoder: &mut fidl::encoding::Encoder<
3321 '_,
3322 fidl::encoding::DefaultFuchsiaResourceDialect,
3323 >,
3324 offset: usize,
3325 depth: fidl::encoding::Depth,
3326 ) -> fidl::Result<()> {
3327 encoder.debug_check_bounds::<SessionManagerStartTraceSessionRequest>(offset);
3328 self.0.encode(encoder, offset + 0, depth)?;
3332 self.1.encode(encoder, offset + 16, depth)?;
3333 Ok(())
3334 }
3335 }
3336
3337 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3338 for SessionManagerStartTraceSessionRequest
3339 {
3340 #[inline(always)]
3341 fn new_empty() -> Self {
3342 Self {
3343 config: fidl::new_empty!(
3344 TraceConfig,
3345 fidl::encoding::DefaultFuchsiaResourceDialect
3346 ),
3347 options: fidl::new_empty!(
3348 TraceOptions,
3349 fidl::encoding::DefaultFuchsiaResourceDialect
3350 ),
3351 }
3352 }
3353
3354 #[inline]
3355 unsafe fn decode(
3356 &mut self,
3357 decoder: &mut fidl::encoding::Decoder<
3358 '_,
3359 fidl::encoding::DefaultFuchsiaResourceDialect,
3360 >,
3361 offset: usize,
3362 _depth: fidl::encoding::Depth,
3363 ) -> fidl::Result<()> {
3364 decoder.debug_check_bounds::<Self>(offset);
3365 fidl::decode!(
3367 TraceConfig,
3368 fidl::encoding::DefaultFuchsiaResourceDialect,
3369 &mut self.config,
3370 decoder,
3371 offset + 0,
3372 _depth
3373 )?;
3374 fidl::decode!(
3375 TraceOptions,
3376 fidl::encoding::DefaultFuchsiaResourceDialect,
3377 &mut self.options,
3378 decoder,
3379 offset + 16,
3380 _depth
3381 )?;
3382 Ok(())
3383 }
3384 }
3385}