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_test_detect_factory_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct RealmFactoryCreateRealmRequest {
16 pub options: RealmOptions,
17 pub realm_server: fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
21 for RealmFactoryCreateRealmRequest
22{
23}
24
25#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
26pub struct RealmFactoryGetTriageDetectEventsResponse {
27 pub client_end: fidl::endpoints::ClientEnd<TriageDetectEventsMarker>,
28}
29
30impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
31 for RealmFactoryGetTriageDetectEventsResponse
32{
33}
34
35#[derive(Debug, Default, PartialEq)]
41pub struct RealmOptions {
42 pub program_config: Option<fidl::Vmo>,
48 pub triage_configs: Option<Vec<fidl::Vmo>>,
54 pub inspect_data: Option<Vec<fidl::Vmo>>,
58 #[doc(hidden)]
59 pub __source_breaking: fidl::marker::SourceBreaking,
60}
61
62impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for RealmOptions {}
63
64#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
65pub struct RealmFactoryMarker;
66
67impl fidl::endpoints::ProtocolMarker for RealmFactoryMarker {
68 type Proxy = RealmFactoryProxy;
69 type RequestStream = RealmFactoryRequestStream;
70 #[cfg(target_os = "fuchsia")]
71 type SynchronousProxy = RealmFactorySynchronousProxy;
72
73 const DEBUG_NAME: &'static str = "test.detect.factory.RealmFactory";
74}
75impl fidl::endpoints::DiscoverableProtocolMarker for RealmFactoryMarker {}
76pub type RealmFactoryCreateRealmResult = Result<(), fidl_fuchsia_testing_harness::OperationError>;
77
78pub trait RealmFactoryProxyInterface: Send + Sync {
79 type CreateRealmResponseFut: std::future::Future<Output = Result<RealmFactoryCreateRealmResult, fidl::Error>>
80 + Send;
81 fn r#create_realm(
82 &self,
83 options: RealmOptions,
84 realm_server: fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
85 ) -> Self::CreateRealmResponseFut;
86 type GetTriageDetectEventsResponseFut: std::future::Future<
87 Output = Result<fidl::endpoints::ClientEnd<TriageDetectEventsMarker>, fidl::Error>,
88 > + Send;
89 fn r#get_triage_detect_events(&self) -> Self::GetTriageDetectEventsResponseFut;
90}
91#[derive(Debug)]
92#[cfg(target_os = "fuchsia")]
93pub struct RealmFactorySynchronousProxy {
94 client: fidl::client::sync::Client,
95}
96
97#[cfg(target_os = "fuchsia")]
98impl fidl::endpoints::SynchronousProxy for RealmFactorySynchronousProxy {
99 type Proxy = RealmFactoryProxy;
100 type Protocol = RealmFactoryMarker;
101
102 fn from_channel(inner: fidl::Channel) -> Self {
103 Self::new(inner)
104 }
105
106 fn into_channel(self) -> fidl::Channel {
107 self.client.into_channel()
108 }
109
110 fn as_channel(&self) -> &fidl::Channel {
111 self.client.as_channel()
112 }
113}
114
115#[cfg(target_os = "fuchsia")]
116impl RealmFactorySynchronousProxy {
117 pub fn new(channel: fidl::Channel) -> Self {
118 let protocol_name = <RealmFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
119 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
120 }
121
122 pub fn into_channel(self) -> fidl::Channel {
123 self.client.into_channel()
124 }
125
126 pub fn wait_for_event(
129 &self,
130 deadline: zx::MonotonicInstant,
131 ) -> Result<RealmFactoryEvent, fidl::Error> {
132 RealmFactoryEvent::decode(self.client.wait_for_event(deadline)?)
133 }
134
135 pub fn r#create_realm(
139 &self,
140 mut options: RealmOptions,
141 mut realm_server: fidl::endpoints::ServerEnd<
142 fidl_fuchsia_testing_harness::RealmProxy_Marker,
143 >,
144 ___deadline: zx::MonotonicInstant,
145 ) -> Result<RealmFactoryCreateRealmResult, fidl::Error> {
146 let _response = self
147 .client
148 .send_query::<RealmFactoryCreateRealmRequest, fidl::encoding::FlexibleResultType<
149 fidl::encoding::EmptyStruct,
150 fidl_fuchsia_testing_harness::OperationError,
151 >>(
152 (&mut options, realm_server),
153 0x12d4b5c7c9d9801a,
154 fidl::encoding::DynamicFlags::FLEXIBLE,
155 ___deadline,
156 )?
157 .into_result::<RealmFactoryMarker>("create_realm")?;
158 Ok(_response.map(|x| x))
159 }
160
161 pub fn r#get_triage_detect_events(
167 &self,
168 ___deadline: zx::MonotonicInstant,
169 ) -> Result<fidl::endpoints::ClientEnd<TriageDetectEventsMarker>, fidl::Error> {
170 let _response = self
171 .client
172 .send_query::<fidl::encoding::EmptyPayload, RealmFactoryGetTriageDetectEventsResponse>(
173 (),
174 0x7be53256487c35fd,
175 fidl::encoding::DynamicFlags::empty(),
176 ___deadline,
177 )?;
178 Ok(_response.client_end)
179 }
180}
181
182#[cfg(target_os = "fuchsia")]
183impl From<RealmFactorySynchronousProxy> for zx::Handle {
184 fn from(value: RealmFactorySynchronousProxy) -> Self {
185 value.into_channel().into()
186 }
187}
188
189#[cfg(target_os = "fuchsia")]
190impl From<fidl::Channel> for RealmFactorySynchronousProxy {
191 fn from(value: fidl::Channel) -> Self {
192 Self::new(value)
193 }
194}
195
196#[derive(Debug, Clone)]
197pub struct RealmFactoryProxy {
198 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
199}
200
201impl fidl::endpoints::Proxy for RealmFactoryProxy {
202 type Protocol = RealmFactoryMarker;
203
204 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
205 Self::new(inner)
206 }
207
208 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
209 self.client.into_channel().map_err(|client| Self { client })
210 }
211
212 fn as_channel(&self) -> &::fidl::AsyncChannel {
213 self.client.as_channel()
214 }
215}
216
217impl RealmFactoryProxy {
218 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
220 let protocol_name = <RealmFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
221 Self { client: fidl::client::Client::new(channel, protocol_name) }
222 }
223
224 pub fn take_event_stream(&self) -> RealmFactoryEventStream {
230 RealmFactoryEventStream { event_receiver: self.client.take_event_receiver() }
231 }
232
233 pub fn r#create_realm(
237 &self,
238 mut options: RealmOptions,
239 mut realm_server: fidl::endpoints::ServerEnd<
240 fidl_fuchsia_testing_harness::RealmProxy_Marker,
241 >,
242 ) -> fidl::client::QueryResponseFut<
243 RealmFactoryCreateRealmResult,
244 fidl::encoding::DefaultFuchsiaResourceDialect,
245 > {
246 RealmFactoryProxyInterface::r#create_realm(self, options, realm_server)
247 }
248
249 pub fn r#get_triage_detect_events(
255 &self,
256 ) -> fidl::client::QueryResponseFut<
257 fidl::endpoints::ClientEnd<TriageDetectEventsMarker>,
258 fidl::encoding::DefaultFuchsiaResourceDialect,
259 > {
260 RealmFactoryProxyInterface::r#get_triage_detect_events(self)
261 }
262}
263
264impl RealmFactoryProxyInterface for RealmFactoryProxy {
265 type CreateRealmResponseFut = fidl::client::QueryResponseFut<
266 RealmFactoryCreateRealmResult,
267 fidl::encoding::DefaultFuchsiaResourceDialect,
268 >;
269 fn r#create_realm(
270 &self,
271 mut options: RealmOptions,
272 mut realm_server: fidl::endpoints::ServerEnd<
273 fidl_fuchsia_testing_harness::RealmProxy_Marker,
274 >,
275 ) -> Self::CreateRealmResponseFut {
276 fn _decode(
277 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
278 ) -> Result<RealmFactoryCreateRealmResult, fidl::Error> {
279 let _response = fidl::client::decode_transaction_body::<
280 fidl::encoding::FlexibleResultType<
281 fidl::encoding::EmptyStruct,
282 fidl_fuchsia_testing_harness::OperationError,
283 >,
284 fidl::encoding::DefaultFuchsiaResourceDialect,
285 0x12d4b5c7c9d9801a,
286 >(_buf?)?
287 .into_result::<RealmFactoryMarker>("create_realm")?;
288 Ok(_response.map(|x| x))
289 }
290 self.client
291 .send_query_and_decode::<RealmFactoryCreateRealmRequest, RealmFactoryCreateRealmResult>(
292 (&mut options, realm_server),
293 0x12d4b5c7c9d9801a,
294 fidl::encoding::DynamicFlags::FLEXIBLE,
295 _decode,
296 )
297 }
298
299 type GetTriageDetectEventsResponseFut = fidl::client::QueryResponseFut<
300 fidl::endpoints::ClientEnd<TriageDetectEventsMarker>,
301 fidl::encoding::DefaultFuchsiaResourceDialect,
302 >;
303 fn r#get_triage_detect_events(&self) -> Self::GetTriageDetectEventsResponseFut {
304 fn _decode(
305 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
306 ) -> Result<fidl::endpoints::ClientEnd<TriageDetectEventsMarker>, fidl::Error> {
307 let _response = fidl::client::decode_transaction_body::<
308 RealmFactoryGetTriageDetectEventsResponse,
309 fidl::encoding::DefaultFuchsiaResourceDialect,
310 0x7be53256487c35fd,
311 >(_buf?)?;
312 Ok(_response.client_end)
313 }
314 self.client.send_query_and_decode::<
315 fidl::encoding::EmptyPayload,
316 fidl::endpoints::ClientEnd<TriageDetectEventsMarker>,
317 >(
318 (),
319 0x7be53256487c35fd,
320 fidl::encoding::DynamicFlags::empty(),
321 _decode,
322 )
323 }
324}
325
326pub struct RealmFactoryEventStream {
327 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
328}
329
330impl std::marker::Unpin for RealmFactoryEventStream {}
331
332impl futures::stream::FusedStream for RealmFactoryEventStream {
333 fn is_terminated(&self) -> bool {
334 self.event_receiver.is_terminated()
335 }
336}
337
338impl futures::Stream for RealmFactoryEventStream {
339 type Item = Result<RealmFactoryEvent, fidl::Error>;
340
341 fn poll_next(
342 mut self: std::pin::Pin<&mut Self>,
343 cx: &mut std::task::Context<'_>,
344 ) -> std::task::Poll<Option<Self::Item>> {
345 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
346 &mut self.event_receiver,
347 cx
348 )?) {
349 Some(buf) => std::task::Poll::Ready(Some(RealmFactoryEvent::decode(buf))),
350 None => std::task::Poll::Ready(None),
351 }
352 }
353}
354
355#[derive(Debug)]
356pub enum RealmFactoryEvent {
357 #[non_exhaustive]
358 _UnknownEvent {
359 ordinal: u64,
361 },
362}
363
364impl RealmFactoryEvent {
365 fn decode(
367 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
368 ) -> Result<RealmFactoryEvent, fidl::Error> {
369 let (bytes, _handles) = buf.split_mut();
370 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
371 debug_assert_eq!(tx_header.tx_id, 0);
372 match tx_header.ordinal {
373 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
374 Ok(RealmFactoryEvent::_UnknownEvent { ordinal: tx_header.ordinal })
375 }
376 _ => Err(fidl::Error::UnknownOrdinal {
377 ordinal: tx_header.ordinal,
378 protocol_name: <RealmFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
379 }),
380 }
381 }
382}
383
384pub struct RealmFactoryRequestStream {
386 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
387 is_terminated: bool,
388}
389
390impl std::marker::Unpin for RealmFactoryRequestStream {}
391
392impl futures::stream::FusedStream for RealmFactoryRequestStream {
393 fn is_terminated(&self) -> bool {
394 self.is_terminated
395 }
396}
397
398impl fidl::endpoints::RequestStream for RealmFactoryRequestStream {
399 type Protocol = RealmFactoryMarker;
400 type ControlHandle = RealmFactoryControlHandle;
401
402 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
403 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
404 }
405
406 fn control_handle(&self) -> Self::ControlHandle {
407 RealmFactoryControlHandle { inner: self.inner.clone() }
408 }
409
410 fn into_inner(
411 self,
412 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
413 {
414 (self.inner, self.is_terminated)
415 }
416
417 fn from_inner(
418 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
419 is_terminated: bool,
420 ) -> Self {
421 Self { inner, is_terminated }
422 }
423}
424
425impl futures::Stream for RealmFactoryRequestStream {
426 type Item = Result<RealmFactoryRequest, fidl::Error>;
427
428 fn poll_next(
429 mut self: std::pin::Pin<&mut Self>,
430 cx: &mut std::task::Context<'_>,
431 ) -> std::task::Poll<Option<Self::Item>> {
432 let this = &mut *self;
433 if this.inner.check_shutdown(cx) {
434 this.is_terminated = true;
435 return std::task::Poll::Ready(None);
436 }
437 if this.is_terminated {
438 panic!("polled RealmFactoryRequestStream after completion");
439 }
440 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
441 |bytes, handles| {
442 match this.inner.channel().read_etc(cx, bytes, handles) {
443 std::task::Poll::Ready(Ok(())) => {}
444 std::task::Poll::Pending => return std::task::Poll::Pending,
445 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
446 this.is_terminated = true;
447 return std::task::Poll::Ready(None);
448 }
449 std::task::Poll::Ready(Err(e)) => {
450 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
451 e.into(),
452 ))))
453 }
454 }
455
456 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
458
459 std::task::Poll::Ready(Some(match header.ordinal {
460 0x12d4b5c7c9d9801a => {
461 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
462 let mut req = fidl::new_empty!(
463 RealmFactoryCreateRealmRequest,
464 fidl::encoding::DefaultFuchsiaResourceDialect
465 );
466 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmFactoryCreateRealmRequest>(&header, _body_bytes, handles, &mut req)?;
467 let control_handle =
468 RealmFactoryControlHandle { inner: this.inner.clone() };
469 Ok(RealmFactoryRequest::CreateRealm {
470 options: req.options,
471 realm_server: req.realm_server,
472
473 responder: RealmFactoryCreateRealmResponder {
474 control_handle: std::mem::ManuallyDrop::new(control_handle),
475 tx_id: header.tx_id,
476 },
477 })
478 }
479 0x7be53256487c35fd => {
480 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
481 let mut req = fidl::new_empty!(
482 fidl::encoding::EmptyPayload,
483 fidl::encoding::DefaultFuchsiaResourceDialect
484 );
485 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
486 let control_handle =
487 RealmFactoryControlHandle { inner: this.inner.clone() };
488 Ok(RealmFactoryRequest::GetTriageDetectEvents {
489 responder: RealmFactoryGetTriageDetectEventsResponder {
490 control_handle: std::mem::ManuallyDrop::new(control_handle),
491 tx_id: header.tx_id,
492 },
493 })
494 }
495 _ if header.tx_id == 0
496 && header
497 .dynamic_flags()
498 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
499 {
500 Ok(RealmFactoryRequest::_UnknownMethod {
501 ordinal: header.ordinal,
502 control_handle: RealmFactoryControlHandle { inner: this.inner.clone() },
503 method_type: fidl::MethodType::OneWay,
504 })
505 }
506 _ if header
507 .dynamic_flags()
508 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
509 {
510 this.inner.send_framework_err(
511 fidl::encoding::FrameworkErr::UnknownMethod,
512 header.tx_id,
513 header.ordinal,
514 header.dynamic_flags(),
515 (bytes, handles),
516 )?;
517 Ok(RealmFactoryRequest::_UnknownMethod {
518 ordinal: header.ordinal,
519 control_handle: RealmFactoryControlHandle { inner: this.inner.clone() },
520 method_type: fidl::MethodType::TwoWay,
521 })
522 }
523 _ => Err(fidl::Error::UnknownOrdinal {
524 ordinal: header.ordinal,
525 protocol_name:
526 <RealmFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
527 }),
528 }))
529 },
530 )
531 }
532}
533
534#[derive(Debug)]
555pub enum RealmFactoryRequest {
556 CreateRealm {
560 options: RealmOptions,
561 realm_server: fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
562 responder: RealmFactoryCreateRealmResponder,
563 },
564 GetTriageDetectEvents { responder: RealmFactoryGetTriageDetectEventsResponder },
570 #[non_exhaustive]
572 _UnknownMethod {
573 ordinal: u64,
575 control_handle: RealmFactoryControlHandle,
576 method_type: fidl::MethodType,
577 },
578}
579
580impl RealmFactoryRequest {
581 #[allow(irrefutable_let_patterns)]
582 pub fn into_create_realm(
583 self,
584 ) -> Option<(
585 RealmOptions,
586 fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
587 RealmFactoryCreateRealmResponder,
588 )> {
589 if let RealmFactoryRequest::CreateRealm { options, realm_server, responder } = self {
590 Some((options, realm_server, responder))
591 } else {
592 None
593 }
594 }
595
596 #[allow(irrefutable_let_patterns)]
597 pub fn into_get_triage_detect_events(
598 self,
599 ) -> Option<(RealmFactoryGetTriageDetectEventsResponder)> {
600 if let RealmFactoryRequest::GetTriageDetectEvents { responder } = self {
601 Some((responder))
602 } else {
603 None
604 }
605 }
606
607 pub fn method_name(&self) -> &'static str {
609 match *self {
610 RealmFactoryRequest::CreateRealm { .. } => "create_realm",
611 RealmFactoryRequest::GetTriageDetectEvents { .. } => "get_triage_detect_events",
612 RealmFactoryRequest::_UnknownMethod {
613 method_type: fidl::MethodType::OneWay, ..
614 } => "unknown one-way method",
615 RealmFactoryRequest::_UnknownMethod {
616 method_type: fidl::MethodType::TwoWay, ..
617 } => "unknown two-way method",
618 }
619 }
620}
621
622#[derive(Debug, Clone)]
623pub struct RealmFactoryControlHandle {
624 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
625}
626
627impl fidl::endpoints::ControlHandle for RealmFactoryControlHandle {
628 fn shutdown(&self) {
629 self.inner.shutdown()
630 }
631 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
632 self.inner.shutdown_with_epitaph(status)
633 }
634
635 fn is_closed(&self) -> bool {
636 self.inner.channel().is_closed()
637 }
638 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
639 self.inner.channel().on_closed()
640 }
641
642 #[cfg(target_os = "fuchsia")]
643 fn signal_peer(
644 &self,
645 clear_mask: zx::Signals,
646 set_mask: zx::Signals,
647 ) -> Result<(), zx_status::Status> {
648 use fidl::Peered;
649 self.inner.channel().signal_peer(clear_mask, set_mask)
650 }
651}
652
653impl RealmFactoryControlHandle {}
654
655#[must_use = "FIDL methods require a response to be sent"]
656#[derive(Debug)]
657pub struct RealmFactoryCreateRealmResponder {
658 control_handle: std::mem::ManuallyDrop<RealmFactoryControlHandle>,
659 tx_id: u32,
660}
661
662impl std::ops::Drop for RealmFactoryCreateRealmResponder {
666 fn drop(&mut self) {
667 self.control_handle.shutdown();
668 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
670 }
671}
672
673impl fidl::endpoints::Responder for RealmFactoryCreateRealmResponder {
674 type ControlHandle = RealmFactoryControlHandle;
675
676 fn control_handle(&self) -> &RealmFactoryControlHandle {
677 &self.control_handle
678 }
679
680 fn drop_without_shutdown(mut self) {
681 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
683 std::mem::forget(self);
685 }
686}
687
688impl RealmFactoryCreateRealmResponder {
689 pub fn send(
693 self,
694 mut result: Result<(), fidl_fuchsia_testing_harness::OperationError>,
695 ) -> Result<(), fidl::Error> {
696 let _result = self.send_raw(result);
697 if _result.is_err() {
698 self.control_handle.shutdown();
699 }
700 self.drop_without_shutdown();
701 _result
702 }
703
704 pub fn send_no_shutdown_on_err(
706 self,
707 mut result: Result<(), fidl_fuchsia_testing_harness::OperationError>,
708 ) -> Result<(), fidl::Error> {
709 let _result = self.send_raw(result);
710 self.drop_without_shutdown();
711 _result
712 }
713
714 fn send_raw(
715 &self,
716 mut result: Result<(), fidl_fuchsia_testing_harness::OperationError>,
717 ) -> Result<(), fidl::Error> {
718 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
719 fidl::encoding::EmptyStruct,
720 fidl_fuchsia_testing_harness::OperationError,
721 >>(
722 fidl::encoding::FlexibleResult::new(result),
723 self.tx_id,
724 0x12d4b5c7c9d9801a,
725 fidl::encoding::DynamicFlags::FLEXIBLE,
726 )
727 }
728}
729
730#[must_use = "FIDL methods require a response to be sent"]
731#[derive(Debug)]
732pub struct RealmFactoryGetTriageDetectEventsResponder {
733 control_handle: std::mem::ManuallyDrop<RealmFactoryControlHandle>,
734 tx_id: u32,
735}
736
737impl std::ops::Drop for RealmFactoryGetTriageDetectEventsResponder {
741 fn drop(&mut self) {
742 self.control_handle.shutdown();
743 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
745 }
746}
747
748impl fidl::endpoints::Responder for RealmFactoryGetTriageDetectEventsResponder {
749 type ControlHandle = RealmFactoryControlHandle;
750
751 fn control_handle(&self) -> &RealmFactoryControlHandle {
752 &self.control_handle
753 }
754
755 fn drop_without_shutdown(mut self) {
756 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
758 std::mem::forget(self);
760 }
761}
762
763impl RealmFactoryGetTriageDetectEventsResponder {
764 pub fn send(
768 self,
769 mut client_end: fidl::endpoints::ClientEnd<TriageDetectEventsMarker>,
770 ) -> Result<(), fidl::Error> {
771 let _result = self.send_raw(client_end);
772 if _result.is_err() {
773 self.control_handle.shutdown();
774 }
775 self.drop_without_shutdown();
776 _result
777 }
778
779 pub fn send_no_shutdown_on_err(
781 self,
782 mut client_end: fidl::endpoints::ClientEnd<TriageDetectEventsMarker>,
783 ) -> Result<(), fidl::Error> {
784 let _result = self.send_raw(client_end);
785 self.drop_without_shutdown();
786 _result
787 }
788
789 fn send_raw(
790 &self,
791 mut client_end: fidl::endpoints::ClientEnd<TriageDetectEventsMarker>,
792 ) -> Result<(), fidl::Error> {
793 self.control_handle.inner.send::<RealmFactoryGetTriageDetectEventsResponse>(
794 (client_end,),
795 self.tx_id,
796 0x7be53256487c35fd,
797 fidl::encoding::DynamicFlags::empty(),
798 )
799 }
800}
801
802#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
803pub struct TriageDetectEventsMarker;
804
805impl fidl::endpoints::ProtocolMarker for TriageDetectEventsMarker {
806 type Proxy = TriageDetectEventsProxy;
807 type RequestStream = TriageDetectEventsRequestStream;
808 #[cfg(target_os = "fuchsia")]
809 type SynchronousProxy = TriageDetectEventsSynchronousProxy;
810
811 const DEBUG_NAME: &'static str = "test.detect.factory.TriageDetectEvents";
812}
813impl fidl::endpoints::DiscoverableProtocolMarker for TriageDetectEventsMarker {}
814
815pub trait TriageDetectEventsProxyInterface: Send + Sync {}
816#[derive(Debug)]
817#[cfg(target_os = "fuchsia")]
818pub struct TriageDetectEventsSynchronousProxy {
819 client: fidl::client::sync::Client,
820}
821
822#[cfg(target_os = "fuchsia")]
823impl fidl::endpoints::SynchronousProxy for TriageDetectEventsSynchronousProxy {
824 type Proxy = TriageDetectEventsProxy;
825 type Protocol = TriageDetectEventsMarker;
826
827 fn from_channel(inner: fidl::Channel) -> Self {
828 Self::new(inner)
829 }
830
831 fn into_channel(self) -> fidl::Channel {
832 self.client.into_channel()
833 }
834
835 fn as_channel(&self) -> &fidl::Channel {
836 self.client.as_channel()
837 }
838}
839
840#[cfg(target_os = "fuchsia")]
841impl TriageDetectEventsSynchronousProxy {
842 pub fn new(channel: fidl::Channel) -> Self {
843 let protocol_name =
844 <TriageDetectEventsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
845 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
846 }
847
848 pub fn into_channel(self) -> fidl::Channel {
849 self.client.into_channel()
850 }
851
852 pub fn wait_for_event(
855 &self,
856 deadline: zx::MonotonicInstant,
857 ) -> Result<TriageDetectEventsEvent, fidl::Error> {
858 TriageDetectEventsEvent::decode(self.client.wait_for_event(deadline)?)
859 }
860}
861
862#[cfg(target_os = "fuchsia")]
863impl From<TriageDetectEventsSynchronousProxy> for zx::Handle {
864 fn from(value: TriageDetectEventsSynchronousProxy) -> Self {
865 value.into_channel().into()
866 }
867}
868
869#[cfg(target_os = "fuchsia")]
870impl From<fidl::Channel> for TriageDetectEventsSynchronousProxy {
871 fn from(value: fidl::Channel) -> Self {
872 Self::new(value)
873 }
874}
875
876#[derive(Debug, Clone)]
877pub struct TriageDetectEventsProxy {
878 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
879}
880
881impl fidl::endpoints::Proxy for TriageDetectEventsProxy {
882 type Protocol = TriageDetectEventsMarker;
883
884 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
885 Self::new(inner)
886 }
887
888 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
889 self.client.into_channel().map_err(|client| Self { client })
890 }
891
892 fn as_channel(&self) -> &::fidl::AsyncChannel {
893 self.client.as_channel()
894 }
895}
896
897impl TriageDetectEventsProxy {
898 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
900 let protocol_name =
901 <TriageDetectEventsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
902 Self { client: fidl::client::Client::new(channel, protocol_name) }
903 }
904
905 pub fn take_event_stream(&self) -> TriageDetectEventsEventStream {
911 TriageDetectEventsEventStream { event_receiver: self.client.take_event_receiver() }
912 }
913}
914
915impl TriageDetectEventsProxyInterface for TriageDetectEventsProxy {}
916
917pub struct TriageDetectEventsEventStream {
918 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
919}
920
921impl std::marker::Unpin for TriageDetectEventsEventStream {}
922
923impl futures::stream::FusedStream for TriageDetectEventsEventStream {
924 fn is_terminated(&self) -> bool {
925 self.event_receiver.is_terminated()
926 }
927}
928
929impl futures::Stream for TriageDetectEventsEventStream {
930 type Item = Result<TriageDetectEventsEvent, fidl::Error>;
931
932 fn poll_next(
933 mut self: std::pin::Pin<&mut Self>,
934 cx: &mut std::task::Context<'_>,
935 ) -> std::task::Poll<Option<Self::Item>> {
936 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
937 &mut self.event_receiver,
938 cx
939 )?) {
940 Some(buf) => std::task::Poll::Ready(Some(TriageDetectEventsEvent::decode(buf))),
941 None => std::task::Poll::Ready(None),
942 }
943 }
944}
945
946#[derive(Debug)]
947pub enum TriageDetectEventsEvent {
948 OnDone {},
949 OnBail {},
950 OnDiagnosticFetch {},
951 OnCrashReport {
952 crash_signature: String,
953 crash_program_name: String,
954 },
955 OnCrashReportingProductRegistration {
956 product_name: String,
957 program_name: String,
958 },
959 #[non_exhaustive]
960 _UnknownEvent {
961 ordinal: u64,
963 },
964}
965
966impl TriageDetectEventsEvent {
967 #[allow(irrefutable_let_patterns)]
968 pub fn into_on_done(self) -> Option<()> {
969 if let TriageDetectEventsEvent::OnDone {} = self {
970 Some(())
971 } else {
972 None
973 }
974 }
975 #[allow(irrefutable_let_patterns)]
976 pub fn into_on_bail(self) -> Option<()> {
977 if let TriageDetectEventsEvent::OnBail {} = self {
978 Some(())
979 } else {
980 None
981 }
982 }
983 #[allow(irrefutable_let_patterns)]
984 pub fn into_on_diagnostic_fetch(self) -> Option<()> {
985 if let TriageDetectEventsEvent::OnDiagnosticFetch {} = self {
986 Some(())
987 } else {
988 None
989 }
990 }
991 #[allow(irrefutable_let_patterns)]
992 pub fn into_on_crash_report(self) -> Option<(String, String)> {
993 if let TriageDetectEventsEvent::OnCrashReport { crash_signature, crash_program_name } = self
994 {
995 Some((crash_signature, crash_program_name))
996 } else {
997 None
998 }
999 }
1000 #[allow(irrefutable_let_patterns)]
1001 pub fn into_on_crash_reporting_product_registration(self) -> Option<(String, String)> {
1002 if let TriageDetectEventsEvent::OnCrashReportingProductRegistration {
1003 product_name,
1004 program_name,
1005 } = self
1006 {
1007 Some((product_name, program_name))
1008 } else {
1009 None
1010 }
1011 }
1012
1013 fn decode(
1015 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1016 ) -> Result<TriageDetectEventsEvent, fidl::Error> {
1017 let (bytes, _handles) = buf.split_mut();
1018 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1019 debug_assert_eq!(tx_header.tx_id, 0);
1020 match tx_header.ordinal {
1021 0x66b129b2110cfda9 => {
1022 let mut out = fidl::new_empty!(
1023 fidl::encoding::EmptyPayload,
1024 fidl::encoding::DefaultFuchsiaResourceDialect
1025 );
1026 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&tx_header, _body_bytes, _handles, &mut out)?;
1027 Ok((TriageDetectEventsEvent::OnDone {}))
1028 }
1029 0x353ae45fe8b3ba1f => {
1030 let mut out = fidl::new_empty!(
1031 fidl::encoding::EmptyPayload,
1032 fidl::encoding::DefaultFuchsiaResourceDialect
1033 );
1034 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&tx_header, _body_bytes, _handles, &mut out)?;
1035 Ok((TriageDetectEventsEvent::OnBail {}))
1036 }
1037 0x4143229dae6d22cd => {
1038 let mut out = fidl::new_empty!(
1039 fidl::encoding::EmptyPayload,
1040 fidl::encoding::DefaultFuchsiaResourceDialect
1041 );
1042 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&tx_header, _body_bytes, _handles, &mut out)?;
1043 Ok((TriageDetectEventsEvent::OnDiagnosticFetch {}))
1044 }
1045 0x5906712c264a59a0 => {
1046 let mut out = fidl::new_empty!(
1047 TriageDetectEventsOnCrashReportRequest,
1048 fidl::encoding::DefaultFuchsiaResourceDialect
1049 );
1050 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TriageDetectEventsOnCrashReportRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
1051 Ok((TriageDetectEventsEvent::OnCrashReport {
1052 crash_signature: out.crash_signature,
1053 crash_program_name: out.crash_program_name,
1054 }))
1055 }
1056 0x4646fa5654da3de9 => {
1057 let mut out = fidl::new_empty!(
1058 TriageDetectEventsOnCrashReportingProductRegistrationRequest,
1059 fidl::encoding::DefaultFuchsiaResourceDialect
1060 );
1061 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TriageDetectEventsOnCrashReportingProductRegistrationRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
1062 Ok((TriageDetectEventsEvent::OnCrashReportingProductRegistration {
1063 product_name: out.product_name,
1064 program_name: out.program_name,
1065 }))
1066 }
1067 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1068 Ok(TriageDetectEventsEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1069 }
1070 _ => Err(fidl::Error::UnknownOrdinal {
1071 ordinal: tx_header.ordinal,
1072 protocol_name:
1073 <TriageDetectEventsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1074 }),
1075 }
1076 }
1077}
1078
1079pub struct TriageDetectEventsRequestStream {
1081 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1082 is_terminated: bool,
1083}
1084
1085impl std::marker::Unpin for TriageDetectEventsRequestStream {}
1086
1087impl futures::stream::FusedStream for TriageDetectEventsRequestStream {
1088 fn is_terminated(&self) -> bool {
1089 self.is_terminated
1090 }
1091}
1092
1093impl fidl::endpoints::RequestStream for TriageDetectEventsRequestStream {
1094 type Protocol = TriageDetectEventsMarker;
1095 type ControlHandle = TriageDetectEventsControlHandle;
1096
1097 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1098 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1099 }
1100
1101 fn control_handle(&self) -> Self::ControlHandle {
1102 TriageDetectEventsControlHandle { inner: self.inner.clone() }
1103 }
1104
1105 fn into_inner(
1106 self,
1107 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1108 {
1109 (self.inner, self.is_terminated)
1110 }
1111
1112 fn from_inner(
1113 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1114 is_terminated: bool,
1115 ) -> Self {
1116 Self { inner, is_terminated }
1117 }
1118}
1119
1120impl futures::Stream for TriageDetectEventsRequestStream {
1121 type Item = Result<TriageDetectEventsRequest, fidl::Error>;
1122
1123 fn poll_next(
1124 mut self: std::pin::Pin<&mut Self>,
1125 cx: &mut std::task::Context<'_>,
1126 ) -> std::task::Poll<Option<Self::Item>> {
1127 let this = &mut *self;
1128 if this.inner.check_shutdown(cx) {
1129 this.is_terminated = true;
1130 return std::task::Poll::Ready(None);
1131 }
1132 if this.is_terminated {
1133 panic!("polled TriageDetectEventsRequestStream after completion");
1134 }
1135 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1136 |bytes, handles| {
1137 match this.inner.channel().read_etc(cx, bytes, handles) {
1138 std::task::Poll::Ready(Ok(())) => {}
1139 std::task::Poll::Pending => return std::task::Poll::Pending,
1140 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1141 this.is_terminated = true;
1142 return std::task::Poll::Ready(None);
1143 }
1144 std::task::Poll::Ready(Err(e)) => {
1145 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1146 e.into(),
1147 ))))
1148 }
1149 }
1150
1151 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1153
1154 std::task::Poll::Ready(Some(match header.ordinal {
1155 _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1156 Ok(TriageDetectEventsRequest::_UnknownMethod {
1157 ordinal: header.ordinal,
1158 control_handle: TriageDetectEventsControlHandle { inner: this.inner.clone() },
1159 method_type: fidl::MethodType::OneWay,
1160 })
1161 }
1162 _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1163 this.inner.send_framework_err(
1164 fidl::encoding::FrameworkErr::UnknownMethod,
1165 header.tx_id,
1166 header.ordinal,
1167 header.dynamic_flags(),
1168 (bytes, handles),
1169 )?;
1170 Ok(TriageDetectEventsRequest::_UnknownMethod {
1171 ordinal: header.ordinal,
1172 control_handle: TriageDetectEventsControlHandle { inner: this.inner.clone() },
1173 method_type: fidl::MethodType::TwoWay,
1174 })
1175 }
1176 _ => Err(fidl::Error::UnknownOrdinal {
1177 ordinal: header.ordinal,
1178 protocol_name: <TriageDetectEventsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1179 }),
1180 }))
1181 },
1182 )
1183 }
1184}
1185
1186#[derive(Debug)]
1188pub enum TriageDetectEventsRequest {
1189 #[non_exhaustive]
1191 _UnknownMethod {
1192 ordinal: u64,
1194 control_handle: TriageDetectEventsControlHandle,
1195 method_type: fidl::MethodType,
1196 },
1197}
1198
1199impl TriageDetectEventsRequest {
1200 pub fn method_name(&self) -> &'static str {
1202 match *self {
1203 TriageDetectEventsRequest::_UnknownMethod {
1204 method_type: fidl::MethodType::OneWay,
1205 ..
1206 } => "unknown one-way method",
1207 TriageDetectEventsRequest::_UnknownMethod {
1208 method_type: fidl::MethodType::TwoWay,
1209 ..
1210 } => "unknown two-way method",
1211 }
1212 }
1213}
1214
1215#[derive(Debug, Clone)]
1216pub struct TriageDetectEventsControlHandle {
1217 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1218}
1219
1220impl fidl::endpoints::ControlHandle for TriageDetectEventsControlHandle {
1221 fn shutdown(&self) {
1222 self.inner.shutdown()
1223 }
1224 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1225 self.inner.shutdown_with_epitaph(status)
1226 }
1227
1228 fn is_closed(&self) -> bool {
1229 self.inner.channel().is_closed()
1230 }
1231 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1232 self.inner.channel().on_closed()
1233 }
1234
1235 #[cfg(target_os = "fuchsia")]
1236 fn signal_peer(
1237 &self,
1238 clear_mask: zx::Signals,
1239 set_mask: zx::Signals,
1240 ) -> Result<(), zx_status::Status> {
1241 use fidl::Peered;
1242 self.inner.channel().signal_peer(clear_mask, set_mask)
1243 }
1244}
1245
1246impl TriageDetectEventsControlHandle {
1247 pub fn send_on_done(&self) -> Result<(), fidl::Error> {
1248 self.inner.send::<fidl::encoding::EmptyPayload>(
1249 (),
1250 0,
1251 0x66b129b2110cfda9,
1252 fidl::encoding::DynamicFlags::FLEXIBLE,
1253 )
1254 }
1255
1256 pub fn send_on_bail(&self) -> Result<(), fidl::Error> {
1257 self.inner.send::<fidl::encoding::EmptyPayload>(
1258 (),
1259 0,
1260 0x353ae45fe8b3ba1f,
1261 fidl::encoding::DynamicFlags::FLEXIBLE,
1262 )
1263 }
1264
1265 pub fn send_on_diagnostic_fetch(&self) -> Result<(), fidl::Error> {
1266 self.inner.send::<fidl::encoding::EmptyPayload>(
1267 (),
1268 0,
1269 0x4143229dae6d22cd,
1270 fidl::encoding::DynamicFlags::FLEXIBLE,
1271 )
1272 }
1273
1274 pub fn send_on_crash_report(
1275 &self,
1276 mut crash_signature: &str,
1277 mut crash_program_name: &str,
1278 ) -> Result<(), fidl::Error> {
1279 self.inner.send::<TriageDetectEventsOnCrashReportRequest>(
1280 (crash_signature, crash_program_name),
1281 0,
1282 0x5906712c264a59a0,
1283 fidl::encoding::DynamicFlags::FLEXIBLE,
1284 )
1285 }
1286
1287 pub fn send_on_crash_reporting_product_registration(
1288 &self,
1289 mut product_name: &str,
1290 mut program_name: &str,
1291 ) -> Result<(), fidl::Error> {
1292 self.inner.send::<TriageDetectEventsOnCrashReportingProductRegistrationRequest>(
1293 (product_name, program_name),
1294 0,
1295 0x4646fa5654da3de9,
1296 fidl::encoding::DynamicFlags::FLEXIBLE,
1297 )
1298 }
1299}
1300
1301mod internal {
1302 use super::*;
1303
1304 impl fidl::encoding::ResourceTypeMarker for RealmFactoryCreateRealmRequest {
1305 type Borrowed<'a> = &'a mut Self;
1306 fn take_or_borrow<'a>(
1307 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1308 ) -> Self::Borrowed<'a> {
1309 value
1310 }
1311 }
1312
1313 unsafe impl fidl::encoding::TypeMarker for RealmFactoryCreateRealmRequest {
1314 type Owned = Self;
1315
1316 #[inline(always)]
1317 fn inline_align(_context: fidl::encoding::Context) -> usize {
1318 8
1319 }
1320
1321 #[inline(always)]
1322 fn inline_size(_context: fidl::encoding::Context) -> usize {
1323 24
1324 }
1325 }
1326
1327 unsafe impl
1328 fidl::encoding::Encode<
1329 RealmFactoryCreateRealmRequest,
1330 fidl::encoding::DefaultFuchsiaResourceDialect,
1331 > for &mut RealmFactoryCreateRealmRequest
1332 {
1333 #[inline]
1334 unsafe fn encode(
1335 self,
1336 encoder: &mut fidl::encoding::Encoder<
1337 '_,
1338 fidl::encoding::DefaultFuchsiaResourceDialect,
1339 >,
1340 offset: usize,
1341 _depth: fidl::encoding::Depth,
1342 ) -> fidl::Result<()> {
1343 encoder.debug_check_bounds::<RealmFactoryCreateRealmRequest>(offset);
1344 fidl::encoding::Encode::<
1346 RealmFactoryCreateRealmRequest,
1347 fidl::encoding::DefaultFuchsiaResourceDialect,
1348 >::encode(
1349 (
1350 <RealmOptions as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1351 &mut self.options,
1352 ),
1353 <fidl::encoding::Endpoint<
1354 fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
1355 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1356 &mut self.realm_server,
1357 ),
1358 ),
1359 encoder,
1360 offset,
1361 _depth,
1362 )
1363 }
1364 }
1365 unsafe impl<
1366 T0: fidl::encoding::Encode<RealmOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
1367 T1: fidl::encoding::Encode<
1368 fidl::encoding::Endpoint<
1369 fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
1370 >,
1371 fidl::encoding::DefaultFuchsiaResourceDialect,
1372 >,
1373 >
1374 fidl::encoding::Encode<
1375 RealmFactoryCreateRealmRequest,
1376 fidl::encoding::DefaultFuchsiaResourceDialect,
1377 > for (T0, T1)
1378 {
1379 #[inline]
1380 unsafe fn encode(
1381 self,
1382 encoder: &mut fidl::encoding::Encoder<
1383 '_,
1384 fidl::encoding::DefaultFuchsiaResourceDialect,
1385 >,
1386 offset: usize,
1387 depth: fidl::encoding::Depth,
1388 ) -> fidl::Result<()> {
1389 encoder.debug_check_bounds::<RealmFactoryCreateRealmRequest>(offset);
1390 unsafe {
1393 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
1394 (ptr as *mut u64).write_unaligned(0);
1395 }
1396 self.0.encode(encoder, offset + 0, depth)?;
1398 self.1.encode(encoder, offset + 16, depth)?;
1399 Ok(())
1400 }
1401 }
1402
1403 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1404 for RealmFactoryCreateRealmRequest
1405 {
1406 #[inline(always)]
1407 fn new_empty() -> Self {
1408 Self {
1409 options: fidl::new_empty!(
1410 RealmOptions,
1411 fidl::encoding::DefaultFuchsiaResourceDialect
1412 ),
1413 realm_server: fidl::new_empty!(
1414 fidl::encoding::Endpoint<
1415 fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
1416 >,
1417 fidl::encoding::DefaultFuchsiaResourceDialect
1418 ),
1419 }
1420 }
1421
1422 #[inline]
1423 unsafe fn decode(
1424 &mut self,
1425 decoder: &mut fidl::encoding::Decoder<
1426 '_,
1427 fidl::encoding::DefaultFuchsiaResourceDialect,
1428 >,
1429 offset: usize,
1430 _depth: fidl::encoding::Depth,
1431 ) -> fidl::Result<()> {
1432 decoder.debug_check_bounds::<Self>(offset);
1433 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
1435 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1436 let mask = 0xffffffff00000000u64;
1437 let maskedval = padval & mask;
1438 if maskedval != 0 {
1439 return Err(fidl::Error::NonZeroPadding {
1440 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
1441 });
1442 }
1443 fidl::decode!(
1444 RealmOptions,
1445 fidl::encoding::DefaultFuchsiaResourceDialect,
1446 &mut self.options,
1447 decoder,
1448 offset + 0,
1449 _depth
1450 )?;
1451 fidl::decode!(
1452 fidl::encoding::Endpoint<
1453 fidl::endpoints::ServerEnd<fidl_fuchsia_testing_harness::RealmProxy_Marker>,
1454 >,
1455 fidl::encoding::DefaultFuchsiaResourceDialect,
1456 &mut self.realm_server,
1457 decoder,
1458 offset + 16,
1459 _depth
1460 )?;
1461 Ok(())
1462 }
1463 }
1464
1465 impl fidl::encoding::ResourceTypeMarker for RealmFactoryGetTriageDetectEventsResponse {
1466 type Borrowed<'a> = &'a mut Self;
1467 fn take_or_borrow<'a>(
1468 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1469 ) -> Self::Borrowed<'a> {
1470 value
1471 }
1472 }
1473
1474 unsafe impl fidl::encoding::TypeMarker for RealmFactoryGetTriageDetectEventsResponse {
1475 type Owned = Self;
1476
1477 #[inline(always)]
1478 fn inline_align(_context: fidl::encoding::Context) -> usize {
1479 4
1480 }
1481
1482 #[inline(always)]
1483 fn inline_size(_context: fidl::encoding::Context) -> usize {
1484 4
1485 }
1486 }
1487
1488 unsafe impl
1489 fidl::encoding::Encode<
1490 RealmFactoryGetTriageDetectEventsResponse,
1491 fidl::encoding::DefaultFuchsiaResourceDialect,
1492 > for &mut RealmFactoryGetTriageDetectEventsResponse
1493 {
1494 #[inline]
1495 unsafe fn encode(
1496 self,
1497 encoder: &mut fidl::encoding::Encoder<
1498 '_,
1499 fidl::encoding::DefaultFuchsiaResourceDialect,
1500 >,
1501 offset: usize,
1502 _depth: fidl::encoding::Depth,
1503 ) -> fidl::Result<()> {
1504 encoder.debug_check_bounds::<RealmFactoryGetTriageDetectEventsResponse>(offset);
1505 fidl::encoding::Encode::<RealmFactoryGetTriageDetectEventsResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1507 (
1508 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<TriageDetectEventsMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.client_end),
1509 ),
1510 encoder, offset, _depth
1511 )
1512 }
1513 }
1514 unsafe impl<
1515 T0: fidl::encoding::Encode<
1516 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<TriageDetectEventsMarker>>,
1517 fidl::encoding::DefaultFuchsiaResourceDialect,
1518 >,
1519 >
1520 fidl::encoding::Encode<
1521 RealmFactoryGetTriageDetectEventsResponse,
1522 fidl::encoding::DefaultFuchsiaResourceDialect,
1523 > for (T0,)
1524 {
1525 #[inline]
1526 unsafe fn encode(
1527 self,
1528 encoder: &mut fidl::encoding::Encoder<
1529 '_,
1530 fidl::encoding::DefaultFuchsiaResourceDialect,
1531 >,
1532 offset: usize,
1533 depth: fidl::encoding::Depth,
1534 ) -> fidl::Result<()> {
1535 encoder.debug_check_bounds::<RealmFactoryGetTriageDetectEventsResponse>(offset);
1536 self.0.encode(encoder, offset + 0, depth)?;
1540 Ok(())
1541 }
1542 }
1543
1544 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1545 for RealmFactoryGetTriageDetectEventsResponse
1546 {
1547 #[inline(always)]
1548 fn new_empty() -> Self {
1549 Self {
1550 client_end: fidl::new_empty!(
1551 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<TriageDetectEventsMarker>>,
1552 fidl::encoding::DefaultFuchsiaResourceDialect
1553 ),
1554 }
1555 }
1556
1557 #[inline]
1558 unsafe fn decode(
1559 &mut self,
1560 decoder: &mut fidl::encoding::Decoder<
1561 '_,
1562 fidl::encoding::DefaultFuchsiaResourceDialect,
1563 >,
1564 offset: usize,
1565 _depth: fidl::encoding::Depth,
1566 ) -> fidl::Result<()> {
1567 decoder.debug_check_bounds::<Self>(offset);
1568 fidl::decode!(
1570 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<TriageDetectEventsMarker>>,
1571 fidl::encoding::DefaultFuchsiaResourceDialect,
1572 &mut self.client_end,
1573 decoder,
1574 offset + 0,
1575 _depth
1576 )?;
1577 Ok(())
1578 }
1579 }
1580
1581 impl RealmOptions {
1582 #[inline(always)]
1583 fn max_ordinal_present(&self) -> u64 {
1584 if let Some(_) = self.inspect_data {
1585 return 3;
1586 }
1587 if let Some(_) = self.triage_configs {
1588 return 2;
1589 }
1590 if let Some(_) = self.program_config {
1591 return 1;
1592 }
1593 0
1594 }
1595 }
1596
1597 impl fidl::encoding::ResourceTypeMarker for RealmOptions {
1598 type Borrowed<'a> = &'a mut Self;
1599 fn take_or_borrow<'a>(
1600 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1601 ) -> Self::Borrowed<'a> {
1602 value
1603 }
1604 }
1605
1606 unsafe impl fidl::encoding::TypeMarker for RealmOptions {
1607 type Owned = Self;
1608
1609 #[inline(always)]
1610 fn inline_align(_context: fidl::encoding::Context) -> usize {
1611 8
1612 }
1613
1614 #[inline(always)]
1615 fn inline_size(_context: fidl::encoding::Context) -> usize {
1616 16
1617 }
1618 }
1619
1620 unsafe impl fidl::encoding::Encode<RealmOptions, fidl::encoding::DefaultFuchsiaResourceDialect>
1621 for &mut RealmOptions
1622 {
1623 unsafe fn encode(
1624 self,
1625 encoder: &mut fidl::encoding::Encoder<
1626 '_,
1627 fidl::encoding::DefaultFuchsiaResourceDialect,
1628 >,
1629 offset: usize,
1630 mut depth: fidl::encoding::Depth,
1631 ) -> fidl::Result<()> {
1632 encoder.debug_check_bounds::<RealmOptions>(offset);
1633 let max_ordinal: u64 = self.max_ordinal_present();
1635 encoder.write_num(max_ordinal, offset);
1636 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1637 if max_ordinal == 0 {
1639 return Ok(());
1640 }
1641 depth.increment()?;
1642 let envelope_size = 8;
1643 let bytes_len = max_ordinal as usize * envelope_size;
1644 #[allow(unused_variables)]
1645 let offset = encoder.out_of_line_offset(bytes_len);
1646 let mut _prev_end_offset: usize = 0;
1647 if 1 > max_ordinal {
1648 return Ok(());
1649 }
1650
1651 let cur_offset: usize = (1 - 1) * envelope_size;
1654
1655 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1657
1658 fidl::encoding::encode_in_envelope_optional::<
1663 fidl::encoding::HandleType<
1664 fidl::Vmo,
1665 { fidl::ObjectType::VMO.into_raw() },
1666 2147483648,
1667 >,
1668 fidl::encoding::DefaultFuchsiaResourceDialect,
1669 >(
1670 self.program_config.as_mut().map(
1671 <fidl::encoding::HandleType<
1672 fidl::Vmo,
1673 { fidl::ObjectType::VMO.into_raw() },
1674 2147483648,
1675 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1676 ),
1677 encoder,
1678 offset + cur_offset,
1679 depth,
1680 )?;
1681
1682 _prev_end_offset = cur_offset + envelope_size;
1683 if 2 > max_ordinal {
1684 return Ok(());
1685 }
1686
1687 let cur_offset: usize = (2 - 1) * envelope_size;
1690
1691 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1693
1694 fidl::encoding::encode_in_envelope_optional::<
1699 fidl::encoding::Vector<
1700 fidl::encoding::HandleType<
1701 fidl::Vmo,
1702 { fidl::ObjectType::VMO.into_raw() },
1703 2147483648,
1704 >,
1705 64,
1706 >,
1707 fidl::encoding::DefaultFuchsiaResourceDialect,
1708 >(
1709 self.triage_configs.as_mut().map(
1710 <fidl::encoding::Vector<
1711 fidl::encoding::HandleType<
1712 fidl::Vmo,
1713 { fidl::ObjectType::VMO.into_raw() },
1714 2147483648,
1715 >,
1716 64,
1717 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1718 ),
1719 encoder,
1720 offset + cur_offset,
1721 depth,
1722 )?;
1723
1724 _prev_end_offset = cur_offset + envelope_size;
1725 if 3 > max_ordinal {
1726 return Ok(());
1727 }
1728
1729 let cur_offset: usize = (3 - 1) * envelope_size;
1732
1733 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1735
1736 fidl::encoding::encode_in_envelope_optional::<
1741 fidl::encoding::Vector<
1742 fidl::encoding::HandleType<
1743 fidl::Vmo,
1744 { fidl::ObjectType::VMO.into_raw() },
1745 2147483648,
1746 >,
1747 64,
1748 >,
1749 fidl::encoding::DefaultFuchsiaResourceDialect,
1750 >(
1751 self.inspect_data.as_mut().map(
1752 <fidl::encoding::Vector<
1753 fidl::encoding::HandleType<
1754 fidl::Vmo,
1755 { fidl::ObjectType::VMO.into_raw() },
1756 2147483648,
1757 >,
1758 64,
1759 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1760 ),
1761 encoder,
1762 offset + cur_offset,
1763 depth,
1764 )?;
1765
1766 _prev_end_offset = cur_offset + envelope_size;
1767
1768 Ok(())
1769 }
1770 }
1771
1772 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for RealmOptions {
1773 #[inline(always)]
1774 fn new_empty() -> Self {
1775 Self::default()
1776 }
1777
1778 unsafe fn decode(
1779 &mut self,
1780 decoder: &mut fidl::encoding::Decoder<
1781 '_,
1782 fidl::encoding::DefaultFuchsiaResourceDialect,
1783 >,
1784 offset: usize,
1785 mut depth: fidl::encoding::Depth,
1786 ) -> fidl::Result<()> {
1787 decoder.debug_check_bounds::<Self>(offset);
1788 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1789 None => return Err(fidl::Error::NotNullable),
1790 Some(len) => len,
1791 };
1792 if len == 0 {
1794 return Ok(());
1795 };
1796 depth.increment()?;
1797 let envelope_size = 8;
1798 let bytes_len = len * envelope_size;
1799 let offset = decoder.out_of_line_offset(bytes_len)?;
1800 let mut _next_ordinal_to_read = 0;
1802 let mut next_offset = offset;
1803 let end_offset = offset + bytes_len;
1804 _next_ordinal_to_read += 1;
1805 if next_offset >= end_offset {
1806 return Ok(());
1807 }
1808
1809 while _next_ordinal_to_read < 1 {
1811 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1812 _next_ordinal_to_read += 1;
1813 next_offset += envelope_size;
1814 }
1815
1816 let next_out_of_line = decoder.next_out_of_line();
1817 let handles_before = decoder.remaining_handles();
1818 if let Some((inlined, num_bytes, num_handles)) =
1819 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1820 {
1821 let member_inline_size = <fidl::encoding::HandleType<
1822 fidl::Vmo,
1823 { fidl::ObjectType::VMO.into_raw() },
1824 2147483648,
1825 > as fidl::encoding::TypeMarker>::inline_size(
1826 decoder.context
1827 );
1828 if inlined != (member_inline_size <= 4) {
1829 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1830 }
1831 let inner_offset;
1832 let mut inner_depth = depth.clone();
1833 if inlined {
1834 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1835 inner_offset = next_offset;
1836 } else {
1837 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1838 inner_depth.increment()?;
1839 }
1840 let val_ref =
1841 self.program_config.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
1842 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
1843 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1844 {
1845 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1846 }
1847 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1848 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1849 }
1850 }
1851
1852 next_offset += envelope_size;
1853 _next_ordinal_to_read += 1;
1854 if next_offset >= end_offset {
1855 return Ok(());
1856 }
1857
1858 while _next_ordinal_to_read < 2 {
1860 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1861 _next_ordinal_to_read += 1;
1862 next_offset += envelope_size;
1863 }
1864
1865 let next_out_of_line = decoder.next_out_of_line();
1866 let handles_before = decoder.remaining_handles();
1867 if let Some((inlined, num_bytes, num_handles)) =
1868 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1869 {
1870 let member_inline_size = <fidl::encoding::Vector<
1871 fidl::encoding::HandleType<
1872 fidl::Vmo,
1873 { fidl::ObjectType::VMO.into_raw() },
1874 2147483648,
1875 >,
1876 64,
1877 > as fidl::encoding::TypeMarker>::inline_size(
1878 decoder.context
1879 );
1880 if inlined != (member_inline_size <= 4) {
1881 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1882 }
1883 let inner_offset;
1884 let mut inner_depth = depth.clone();
1885 if inlined {
1886 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1887 inner_offset = next_offset;
1888 } else {
1889 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1890 inner_depth.increment()?;
1891 }
1892 let val_ref = self.triage_configs.get_or_insert_with(|| {
1893 fidl::new_empty!(
1894 fidl::encoding::Vector<
1895 fidl::encoding::HandleType<
1896 fidl::Vmo,
1897 { fidl::ObjectType::VMO.into_raw() },
1898 2147483648,
1899 >,
1900 64,
1901 >,
1902 fidl::encoding::DefaultFuchsiaResourceDialect
1903 )
1904 });
1905 fidl::decode!(
1906 fidl::encoding::Vector<
1907 fidl::encoding::HandleType<
1908 fidl::Vmo,
1909 { fidl::ObjectType::VMO.into_raw() },
1910 2147483648,
1911 >,
1912 64,
1913 >,
1914 fidl::encoding::DefaultFuchsiaResourceDialect,
1915 val_ref,
1916 decoder,
1917 inner_offset,
1918 inner_depth
1919 )?;
1920 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1921 {
1922 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1923 }
1924 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1925 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1926 }
1927 }
1928
1929 next_offset += envelope_size;
1930 _next_ordinal_to_read += 1;
1931 if next_offset >= end_offset {
1932 return Ok(());
1933 }
1934
1935 while _next_ordinal_to_read < 3 {
1937 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1938 _next_ordinal_to_read += 1;
1939 next_offset += envelope_size;
1940 }
1941
1942 let next_out_of_line = decoder.next_out_of_line();
1943 let handles_before = decoder.remaining_handles();
1944 if let Some((inlined, num_bytes, num_handles)) =
1945 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1946 {
1947 let member_inline_size = <fidl::encoding::Vector<
1948 fidl::encoding::HandleType<
1949 fidl::Vmo,
1950 { fidl::ObjectType::VMO.into_raw() },
1951 2147483648,
1952 >,
1953 64,
1954 > as fidl::encoding::TypeMarker>::inline_size(
1955 decoder.context
1956 );
1957 if inlined != (member_inline_size <= 4) {
1958 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1959 }
1960 let inner_offset;
1961 let mut inner_depth = depth.clone();
1962 if inlined {
1963 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1964 inner_offset = next_offset;
1965 } else {
1966 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1967 inner_depth.increment()?;
1968 }
1969 let val_ref = self.inspect_data.get_or_insert_with(|| {
1970 fidl::new_empty!(
1971 fidl::encoding::Vector<
1972 fidl::encoding::HandleType<
1973 fidl::Vmo,
1974 { fidl::ObjectType::VMO.into_raw() },
1975 2147483648,
1976 >,
1977 64,
1978 >,
1979 fidl::encoding::DefaultFuchsiaResourceDialect
1980 )
1981 });
1982 fidl::decode!(
1983 fidl::encoding::Vector<
1984 fidl::encoding::HandleType<
1985 fidl::Vmo,
1986 { fidl::ObjectType::VMO.into_raw() },
1987 2147483648,
1988 >,
1989 64,
1990 >,
1991 fidl::encoding::DefaultFuchsiaResourceDialect,
1992 val_ref,
1993 decoder,
1994 inner_offset,
1995 inner_depth
1996 )?;
1997 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1998 {
1999 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2000 }
2001 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2002 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2003 }
2004 }
2005
2006 next_offset += envelope_size;
2007
2008 while next_offset < end_offset {
2010 _next_ordinal_to_read += 1;
2011 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2012 next_offset += envelope_size;
2013 }
2014
2015 Ok(())
2016 }
2017 }
2018}