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_test_runner_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct LibraryLoaderCacheBuilderCreateRequest {
16 pub lib_directory: fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
17 pub cache: fidl::endpoints::ServerEnd<LibraryLoaderCacheMarker>,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
21 for LibraryLoaderCacheBuilderCreateRequest
22{
23}
24
25#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
26pub struct LibraryLoaderCacheServeRequest {
27 pub loader: fidl::endpoints::ServerEnd<fidl_fuchsia_ldsvc::LoaderMarker>,
28}
29
30impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
31 for LibraryLoaderCacheServeRequest
32{
33}
34
35#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
36pub struct LibraryLoaderCacheMarker;
37
38impl fidl::endpoints::ProtocolMarker for LibraryLoaderCacheMarker {
39 type Proxy = LibraryLoaderCacheProxy;
40 type RequestStream = LibraryLoaderCacheRequestStream;
41 #[cfg(target_os = "fuchsia")]
42 type SynchronousProxy = LibraryLoaderCacheSynchronousProxy;
43
44 const DEBUG_NAME: &'static str = "(anonymous) LibraryLoaderCache";
45}
46
47pub trait LibraryLoaderCacheProxyInterface: Send + Sync {
48 fn r#serve(
49 &self,
50 loader: fidl::endpoints::ServerEnd<fidl_fuchsia_ldsvc::LoaderMarker>,
51 ) -> Result<(), fidl::Error>;
52}
53#[derive(Debug)]
54#[cfg(target_os = "fuchsia")]
55pub struct LibraryLoaderCacheSynchronousProxy {
56 client: fidl::client::sync::Client,
57}
58
59#[cfg(target_os = "fuchsia")]
60impl fidl::endpoints::SynchronousProxy for LibraryLoaderCacheSynchronousProxy {
61 type Proxy = LibraryLoaderCacheProxy;
62 type Protocol = LibraryLoaderCacheMarker;
63
64 fn from_channel(inner: fidl::Channel) -> Self {
65 Self::new(inner)
66 }
67
68 fn into_channel(self) -> fidl::Channel {
69 self.client.into_channel()
70 }
71
72 fn as_channel(&self) -> &fidl::Channel {
73 self.client.as_channel()
74 }
75}
76
77#[cfg(target_os = "fuchsia")]
78impl LibraryLoaderCacheSynchronousProxy {
79 pub fn new(channel: fidl::Channel) -> Self {
80 let protocol_name =
81 <LibraryLoaderCacheMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
82 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
83 }
84
85 pub fn into_channel(self) -> fidl::Channel {
86 self.client.into_channel()
87 }
88
89 pub fn wait_for_event(
92 &self,
93 deadline: zx::MonotonicInstant,
94 ) -> Result<LibraryLoaderCacheEvent, fidl::Error> {
95 LibraryLoaderCacheEvent::decode(self.client.wait_for_event(deadline)?)
96 }
97
98 pub fn r#serve(
100 &self,
101 mut loader: fidl::endpoints::ServerEnd<fidl_fuchsia_ldsvc::LoaderMarker>,
102 ) -> Result<(), fidl::Error> {
103 self.client.send::<LibraryLoaderCacheServeRequest>(
104 (loader,),
105 0x1940439126b02e8f,
106 fidl::encoding::DynamicFlags::empty(),
107 )
108 }
109}
110
111#[cfg(target_os = "fuchsia")]
112impl From<LibraryLoaderCacheSynchronousProxy> for zx::Handle {
113 fn from(value: LibraryLoaderCacheSynchronousProxy) -> Self {
114 value.into_channel().into()
115 }
116}
117
118#[cfg(target_os = "fuchsia")]
119impl From<fidl::Channel> for LibraryLoaderCacheSynchronousProxy {
120 fn from(value: fidl::Channel) -> Self {
121 Self::new(value)
122 }
123}
124
125#[derive(Debug, Clone)]
126pub struct LibraryLoaderCacheProxy {
127 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
128}
129
130impl fidl::endpoints::Proxy for LibraryLoaderCacheProxy {
131 type Protocol = LibraryLoaderCacheMarker;
132
133 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
134 Self::new(inner)
135 }
136
137 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
138 self.client.into_channel().map_err(|client| Self { client })
139 }
140
141 fn as_channel(&self) -> &::fidl::AsyncChannel {
142 self.client.as_channel()
143 }
144}
145
146impl LibraryLoaderCacheProxy {
147 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
149 let protocol_name =
150 <LibraryLoaderCacheMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
151 Self { client: fidl::client::Client::new(channel, protocol_name) }
152 }
153
154 pub fn take_event_stream(&self) -> LibraryLoaderCacheEventStream {
160 LibraryLoaderCacheEventStream { event_receiver: self.client.take_event_receiver() }
161 }
162
163 pub fn r#serve(
165 &self,
166 mut loader: fidl::endpoints::ServerEnd<fidl_fuchsia_ldsvc::LoaderMarker>,
167 ) -> Result<(), fidl::Error> {
168 LibraryLoaderCacheProxyInterface::r#serve(self, loader)
169 }
170}
171
172impl LibraryLoaderCacheProxyInterface for LibraryLoaderCacheProxy {
173 fn r#serve(
174 &self,
175 mut loader: fidl::endpoints::ServerEnd<fidl_fuchsia_ldsvc::LoaderMarker>,
176 ) -> Result<(), fidl::Error> {
177 self.client.send::<LibraryLoaderCacheServeRequest>(
178 (loader,),
179 0x1940439126b02e8f,
180 fidl::encoding::DynamicFlags::empty(),
181 )
182 }
183}
184
185pub struct LibraryLoaderCacheEventStream {
186 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
187}
188
189impl std::marker::Unpin for LibraryLoaderCacheEventStream {}
190
191impl futures::stream::FusedStream for LibraryLoaderCacheEventStream {
192 fn is_terminated(&self) -> bool {
193 self.event_receiver.is_terminated()
194 }
195}
196
197impl futures::Stream for LibraryLoaderCacheEventStream {
198 type Item = Result<LibraryLoaderCacheEvent, fidl::Error>;
199
200 fn poll_next(
201 mut self: std::pin::Pin<&mut Self>,
202 cx: &mut std::task::Context<'_>,
203 ) -> std::task::Poll<Option<Self::Item>> {
204 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
205 &mut self.event_receiver,
206 cx
207 )?) {
208 Some(buf) => std::task::Poll::Ready(Some(LibraryLoaderCacheEvent::decode(buf))),
209 None => std::task::Poll::Ready(None),
210 }
211 }
212}
213
214#[derive(Debug)]
215pub enum LibraryLoaderCacheEvent {}
216
217impl LibraryLoaderCacheEvent {
218 fn decode(
220 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
221 ) -> Result<LibraryLoaderCacheEvent, fidl::Error> {
222 let (bytes, _handles) = buf.split_mut();
223 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
224 debug_assert_eq!(tx_header.tx_id, 0);
225 match tx_header.ordinal {
226 _ => Err(fidl::Error::UnknownOrdinal {
227 ordinal: tx_header.ordinal,
228 protocol_name:
229 <LibraryLoaderCacheMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
230 }),
231 }
232 }
233}
234
235pub struct LibraryLoaderCacheRequestStream {
237 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
238 is_terminated: bool,
239}
240
241impl std::marker::Unpin for LibraryLoaderCacheRequestStream {}
242
243impl futures::stream::FusedStream for LibraryLoaderCacheRequestStream {
244 fn is_terminated(&self) -> bool {
245 self.is_terminated
246 }
247}
248
249impl fidl::endpoints::RequestStream for LibraryLoaderCacheRequestStream {
250 type Protocol = LibraryLoaderCacheMarker;
251 type ControlHandle = LibraryLoaderCacheControlHandle;
252
253 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
254 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
255 }
256
257 fn control_handle(&self) -> Self::ControlHandle {
258 LibraryLoaderCacheControlHandle { inner: self.inner.clone() }
259 }
260
261 fn into_inner(
262 self,
263 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
264 {
265 (self.inner, self.is_terminated)
266 }
267
268 fn from_inner(
269 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
270 is_terminated: bool,
271 ) -> Self {
272 Self { inner, is_terminated }
273 }
274}
275
276impl futures::Stream for LibraryLoaderCacheRequestStream {
277 type Item = Result<LibraryLoaderCacheRequest, fidl::Error>;
278
279 fn poll_next(
280 mut self: std::pin::Pin<&mut Self>,
281 cx: &mut std::task::Context<'_>,
282 ) -> std::task::Poll<Option<Self::Item>> {
283 let this = &mut *self;
284 if this.inner.check_shutdown(cx) {
285 this.is_terminated = true;
286 return std::task::Poll::Ready(None);
287 }
288 if this.is_terminated {
289 panic!("polled LibraryLoaderCacheRequestStream after completion");
290 }
291 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
292 |bytes, handles| {
293 match this.inner.channel().read_etc(cx, bytes, handles) {
294 std::task::Poll::Ready(Ok(())) => {}
295 std::task::Poll::Pending => return std::task::Poll::Pending,
296 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
297 this.is_terminated = true;
298 return std::task::Poll::Ready(None);
299 }
300 std::task::Poll::Ready(Err(e)) => {
301 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
302 e.into(),
303 ))))
304 }
305 }
306
307 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
309
310 std::task::Poll::Ready(Some(match header.ordinal {
311 0x1940439126b02e8f => {
312 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
313 let mut req = fidl::new_empty!(LibraryLoaderCacheServeRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
314 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LibraryLoaderCacheServeRequest>(&header, _body_bytes, handles, &mut req)?;
315 let control_handle = LibraryLoaderCacheControlHandle {
316 inner: this.inner.clone(),
317 };
318 Ok(LibraryLoaderCacheRequest::Serve {loader: req.loader,
319
320 control_handle,
321 })
322 }
323 _ => Err(fidl::Error::UnknownOrdinal {
324 ordinal: header.ordinal,
325 protocol_name: <LibraryLoaderCacheMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
326 }),
327 }))
328 },
329 )
330 }
331}
332
333#[derive(Debug)]
335pub enum LibraryLoaderCacheRequest {
336 Serve {
338 loader: fidl::endpoints::ServerEnd<fidl_fuchsia_ldsvc::LoaderMarker>,
339 control_handle: LibraryLoaderCacheControlHandle,
340 },
341}
342
343impl LibraryLoaderCacheRequest {
344 #[allow(irrefutable_let_patterns)]
345 pub fn into_serve(
346 self,
347 ) -> Option<(
348 fidl::endpoints::ServerEnd<fidl_fuchsia_ldsvc::LoaderMarker>,
349 LibraryLoaderCacheControlHandle,
350 )> {
351 if let LibraryLoaderCacheRequest::Serve { loader, control_handle } = self {
352 Some((loader, control_handle))
353 } else {
354 None
355 }
356 }
357
358 pub fn method_name(&self) -> &'static str {
360 match *self {
361 LibraryLoaderCacheRequest::Serve { .. } => "serve",
362 }
363 }
364}
365
366#[derive(Debug, Clone)]
367pub struct LibraryLoaderCacheControlHandle {
368 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
369}
370
371impl fidl::endpoints::ControlHandle for LibraryLoaderCacheControlHandle {
372 fn shutdown(&self) {
373 self.inner.shutdown()
374 }
375 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
376 self.inner.shutdown_with_epitaph(status)
377 }
378
379 fn is_closed(&self) -> bool {
380 self.inner.channel().is_closed()
381 }
382 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
383 self.inner.channel().on_closed()
384 }
385
386 #[cfg(target_os = "fuchsia")]
387 fn signal_peer(
388 &self,
389 clear_mask: zx::Signals,
390 set_mask: zx::Signals,
391 ) -> Result<(), zx_status::Status> {
392 use fidl::Peered;
393 self.inner.channel().signal_peer(clear_mask, set_mask)
394 }
395}
396
397impl LibraryLoaderCacheControlHandle {}
398
399#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
400pub struct LibraryLoaderCacheBuilderMarker;
401
402impl fidl::endpoints::ProtocolMarker for LibraryLoaderCacheBuilderMarker {
403 type Proxy = LibraryLoaderCacheBuilderProxy;
404 type RequestStream = LibraryLoaderCacheBuilderRequestStream;
405 #[cfg(target_os = "fuchsia")]
406 type SynchronousProxy = LibraryLoaderCacheBuilderSynchronousProxy;
407
408 const DEBUG_NAME: &'static str = "fuchsia.test.runner.LibraryLoaderCacheBuilder";
409}
410impl fidl::endpoints::DiscoverableProtocolMarker for LibraryLoaderCacheBuilderMarker {}
411
412pub trait LibraryLoaderCacheBuilderProxyInterface: Send + Sync {
413 fn r#create(
414 &self,
415 lib_directory: fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
416 cache: fidl::endpoints::ServerEnd<LibraryLoaderCacheMarker>,
417 ) -> Result<(), fidl::Error>;
418}
419#[derive(Debug)]
420#[cfg(target_os = "fuchsia")]
421pub struct LibraryLoaderCacheBuilderSynchronousProxy {
422 client: fidl::client::sync::Client,
423}
424
425#[cfg(target_os = "fuchsia")]
426impl fidl::endpoints::SynchronousProxy for LibraryLoaderCacheBuilderSynchronousProxy {
427 type Proxy = LibraryLoaderCacheBuilderProxy;
428 type Protocol = LibraryLoaderCacheBuilderMarker;
429
430 fn from_channel(inner: fidl::Channel) -> Self {
431 Self::new(inner)
432 }
433
434 fn into_channel(self) -> fidl::Channel {
435 self.client.into_channel()
436 }
437
438 fn as_channel(&self) -> &fidl::Channel {
439 self.client.as_channel()
440 }
441}
442
443#[cfg(target_os = "fuchsia")]
444impl LibraryLoaderCacheBuilderSynchronousProxy {
445 pub fn new(channel: fidl::Channel) -> Self {
446 let protocol_name =
447 <LibraryLoaderCacheBuilderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
448 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
449 }
450
451 pub fn into_channel(self) -> fidl::Channel {
452 self.client.into_channel()
453 }
454
455 pub fn wait_for_event(
458 &self,
459 deadline: zx::MonotonicInstant,
460 ) -> Result<LibraryLoaderCacheBuilderEvent, fidl::Error> {
461 LibraryLoaderCacheBuilderEvent::decode(self.client.wait_for_event(deadline)?)
462 }
463
464 pub fn r#create(
469 &self,
470 mut lib_directory: fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
471 mut cache: fidl::endpoints::ServerEnd<LibraryLoaderCacheMarker>,
472 ) -> Result<(), fidl::Error> {
473 self.client.send::<LibraryLoaderCacheBuilderCreateRequest>(
474 (lib_directory, cache),
475 0x5f1be6b603264b0c,
476 fidl::encoding::DynamicFlags::empty(),
477 )
478 }
479}
480
481#[cfg(target_os = "fuchsia")]
482impl From<LibraryLoaderCacheBuilderSynchronousProxy> for zx::Handle {
483 fn from(value: LibraryLoaderCacheBuilderSynchronousProxy) -> Self {
484 value.into_channel().into()
485 }
486}
487
488#[cfg(target_os = "fuchsia")]
489impl From<fidl::Channel> for LibraryLoaderCacheBuilderSynchronousProxy {
490 fn from(value: fidl::Channel) -> Self {
491 Self::new(value)
492 }
493}
494
495#[derive(Debug, Clone)]
496pub struct LibraryLoaderCacheBuilderProxy {
497 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
498}
499
500impl fidl::endpoints::Proxy for LibraryLoaderCacheBuilderProxy {
501 type Protocol = LibraryLoaderCacheBuilderMarker;
502
503 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
504 Self::new(inner)
505 }
506
507 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
508 self.client.into_channel().map_err(|client| Self { client })
509 }
510
511 fn as_channel(&self) -> &::fidl::AsyncChannel {
512 self.client.as_channel()
513 }
514}
515
516impl LibraryLoaderCacheBuilderProxy {
517 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
519 let protocol_name =
520 <LibraryLoaderCacheBuilderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
521 Self { client: fidl::client::Client::new(channel, protocol_name) }
522 }
523
524 pub fn take_event_stream(&self) -> LibraryLoaderCacheBuilderEventStream {
530 LibraryLoaderCacheBuilderEventStream { event_receiver: self.client.take_event_receiver() }
531 }
532
533 pub fn r#create(
538 &self,
539 mut lib_directory: fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
540 mut cache: fidl::endpoints::ServerEnd<LibraryLoaderCacheMarker>,
541 ) -> Result<(), fidl::Error> {
542 LibraryLoaderCacheBuilderProxyInterface::r#create(self, lib_directory, cache)
543 }
544}
545
546impl LibraryLoaderCacheBuilderProxyInterface for LibraryLoaderCacheBuilderProxy {
547 fn r#create(
548 &self,
549 mut lib_directory: fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
550 mut cache: fidl::endpoints::ServerEnd<LibraryLoaderCacheMarker>,
551 ) -> Result<(), fidl::Error> {
552 self.client.send::<LibraryLoaderCacheBuilderCreateRequest>(
553 (lib_directory, cache),
554 0x5f1be6b603264b0c,
555 fidl::encoding::DynamicFlags::empty(),
556 )
557 }
558}
559
560pub struct LibraryLoaderCacheBuilderEventStream {
561 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
562}
563
564impl std::marker::Unpin for LibraryLoaderCacheBuilderEventStream {}
565
566impl futures::stream::FusedStream for LibraryLoaderCacheBuilderEventStream {
567 fn is_terminated(&self) -> bool {
568 self.event_receiver.is_terminated()
569 }
570}
571
572impl futures::Stream for LibraryLoaderCacheBuilderEventStream {
573 type Item = Result<LibraryLoaderCacheBuilderEvent, fidl::Error>;
574
575 fn poll_next(
576 mut self: std::pin::Pin<&mut Self>,
577 cx: &mut std::task::Context<'_>,
578 ) -> std::task::Poll<Option<Self::Item>> {
579 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
580 &mut self.event_receiver,
581 cx
582 )?) {
583 Some(buf) => std::task::Poll::Ready(Some(LibraryLoaderCacheBuilderEvent::decode(buf))),
584 None => std::task::Poll::Ready(None),
585 }
586 }
587}
588
589#[derive(Debug)]
590pub enum LibraryLoaderCacheBuilderEvent {}
591
592impl LibraryLoaderCacheBuilderEvent {
593 fn decode(
595 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
596 ) -> Result<LibraryLoaderCacheBuilderEvent, fidl::Error> {
597 let (bytes, _handles) = buf.split_mut();
598 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
599 debug_assert_eq!(tx_header.tx_id, 0);
600 match tx_header.ordinal {
601 _ => Err(fidl::Error::UnknownOrdinal {
602 ordinal: tx_header.ordinal,
603 protocol_name:
604 <LibraryLoaderCacheBuilderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
605 }),
606 }
607 }
608}
609
610pub struct LibraryLoaderCacheBuilderRequestStream {
612 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
613 is_terminated: bool,
614}
615
616impl std::marker::Unpin for LibraryLoaderCacheBuilderRequestStream {}
617
618impl futures::stream::FusedStream for LibraryLoaderCacheBuilderRequestStream {
619 fn is_terminated(&self) -> bool {
620 self.is_terminated
621 }
622}
623
624impl fidl::endpoints::RequestStream for LibraryLoaderCacheBuilderRequestStream {
625 type Protocol = LibraryLoaderCacheBuilderMarker;
626 type ControlHandle = LibraryLoaderCacheBuilderControlHandle;
627
628 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
629 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
630 }
631
632 fn control_handle(&self) -> Self::ControlHandle {
633 LibraryLoaderCacheBuilderControlHandle { inner: self.inner.clone() }
634 }
635
636 fn into_inner(
637 self,
638 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
639 {
640 (self.inner, self.is_terminated)
641 }
642
643 fn from_inner(
644 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
645 is_terminated: bool,
646 ) -> Self {
647 Self { inner, is_terminated }
648 }
649}
650
651impl futures::Stream for LibraryLoaderCacheBuilderRequestStream {
652 type Item = Result<LibraryLoaderCacheBuilderRequest, fidl::Error>;
653
654 fn poll_next(
655 mut self: std::pin::Pin<&mut Self>,
656 cx: &mut std::task::Context<'_>,
657 ) -> std::task::Poll<Option<Self::Item>> {
658 let this = &mut *self;
659 if this.inner.check_shutdown(cx) {
660 this.is_terminated = true;
661 return std::task::Poll::Ready(None);
662 }
663 if this.is_terminated {
664 panic!("polled LibraryLoaderCacheBuilderRequestStream after completion");
665 }
666 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
667 |bytes, handles| {
668 match this.inner.channel().read_etc(cx, bytes, handles) {
669 std::task::Poll::Ready(Ok(())) => {}
670 std::task::Poll::Pending => return std::task::Poll::Pending,
671 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
672 this.is_terminated = true;
673 return std::task::Poll::Ready(None);
674 }
675 std::task::Poll::Ready(Err(e)) => {
676 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
677 e.into(),
678 ))))
679 }
680 }
681
682 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
684
685 std::task::Poll::Ready(Some(match header.ordinal {
686 0x5f1be6b603264b0c => {
687 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
688 let mut req = fidl::new_empty!(LibraryLoaderCacheBuilderCreateRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
689 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LibraryLoaderCacheBuilderCreateRequest>(&header, _body_bytes, handles, &mut req)?;
690 let control_handle = LibraryLoaderCacheBuilderControlHandle {
691 inner: this.inner.clone(),
692 };
693 Ok(LibraryLoaderCacheBuilderRequest::Create {lib_directory: req.lib_directory,
694cache: req.cache,
695
696 control_handle,
697 })
698 }
699 _ => Err(fidl::Error::UnknownOrdinal {
700 ordinal: header.ordinal,
701 protocol_name: <LibraryLoaderCacheBuilderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
702 }),
703 }))
704 },
705 )
706 }
707}
708
709#[derive(Debug)]
713pub enum LibraryLoaderCacheBuilderRequest {
714 Create {
719 lib_directory: fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
720 cache: fidl::endpoints::ServerEnd<LibraryLoaderCacheMarker>,
721 control_handle: LibraryLoaderCacheBuilderControlHandle,
722 },
723}
724
725impl LibraryLoaderCacheBuilderRequest {
726 #[allow(irrefutable_let_patterns)]
727 pub fn into_create(
728 self,
729 ) -> Option<(
730 fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
731 fidl::endpoints::ServerEnd<LibraryLoaderCacheMarker>,
732 LibraryLoaderCacheBuilderControlHandle,
733 )> {
734 if let LibraryLoaderCacheBuilderRequest::Create { lib_directory, cache, control_handle } =
735 self
736 {
737 Some((lib_directory, cache, control_handle))
738 } else {
739 None
740 }
741 }
742
743 pub fn method_name(&self) -> &'static str {
745 match *self {
746 LibraryLoaderCacheBuilderRequest::Create { .. } => "create",
747 }
748 }
749}
750
751#[derive(Debug, Clone)]
752pub struct LibraryLoaderCacheBuilderControlHandle {
753 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
754}
755
756impl fidl::endpoints::ControlHandle for LibraryLoaderCacheBuilderControlHandle {
757 fn shutdown(&self) {
758 self.inner.shutdown()
759 }
760 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
761 self.inner.shutdown_with_epitaph(status)
762 }
763
764 fn is_closed(&self) -> bool {
765 self.inner.channel().is_closed()
766 }
767 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
768 self.inner.channel().on_closed()
769 }
770
771 #[cfg(target_os = "fuchsia")]
772 fn signal_peer(
773 &self,
774 clear_mask: zx::Signals,
775 set_mask: zx::Signals,
776 ) -> Result<(), zx_status::Status> {
777 use fidl::Peered;
778 self.inner.channel().signal_peer(clear_mask, set_mask)
779 }
780}
781
782impl LibraryLoaderCacheBuilderControlHandle {}
783
784mod internal {
785 use super::*;
786
787 impl fidl::encoding::ResourceTypeMarker for LibraryLoaderCacheBuilderCreateRequest {
788 type Borrowed<'a> = &'a mut Self;
789 fn take_or_borrow<'a>(
790 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
791 ) -> Self::Borrowed<'a> {
792 value
793 }
794 }
795
796 unsafe impl fidl::encoding::TypeMarker for LibraryLoaderCacheBuilderCreateRequest {
797 type Owned = Self;
798
799 #[inline(always)]
800 fn inline_align(_context: fidl::encoding::Context) -> usize {
801 4
802 }
803
804 #[inline(always)]
805 fn inline_size(_context: fidl::encoding::Context) -> usize {
806 8
807 }
808 }
809
810 unsafe impl
811 fidl::encoding::Encode<
812 LibraryLoaderCacheBuilderCreateRequest,
813 fidl::encoding::DefaultFuchsiaResourceDialect,
814 > for &mut LibraryLoaderCacheBuilderCreateRequest
815 {
816 #[inline]
817 unsafe fn encode(
818 self,
819 encoder: &mut fidl::encoding::Encoder<
820 '_,
821 fidl::encoding::DefaultFuchsiaResourceDialect,
822 >,
823 offset: usize,
824 _depth: fidl::encoding::Depth,
825 ) -> fidl::Result<()> {
826 encoder.debug_check_bounds::<LibraryLoaderCacheBuilderCreateRequest>(offset);
827 fidl::encoding::Encode::<LibraryLoaderCacheBuilderCreateRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
829 (
830 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.lib_directory),
831 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<LibraryLoaderCacheMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.cache),
832 ),
833 encoder, offset, _depth
834 )
835 }
836 }
837 unsafe impl<
838 T0: fidl::encoding::Encode<
839 fidl::encoding::Endpoint<
840 fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
841 >,
842 fidl::encoding::DefaultFuchsiaResourceDialect,
843 >,
844 T1: fidl::encoding::Encode<
845 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<LibraryLoaderCacheMarker>>,
846 fidl::encoding::DefaultFuchsiaResourceDialect,
847 >,
848 >
849 fidl::encoding::Encode<
850 LibraryLoaderCacheBuilderCreateRequest,
851 fidl::encoding::DefaultFuchsiaResourceDialect,
852 > for (T0, T1)
853 {
854 #[inline]
855 unsafe fn encode(
856 self,
857 encoder: &mut fidl::encoding::Encoder<
858 '_,
859 fidl::encoding::DefaultFuchsiaResourceDialect,
860 >,
861 offset: usize,
862 depth: fidl::encoding::Depth,
863 ) -> fidl::Result<()> {
864 encoder.debug_check_bounds::<LibraryLoaderCacheBuilderCreateRequest>(offset);
865 self.0.encode(encoder, offset + 0, depth)?;
869 self.1.encode(encoder, offset + 4, depth)?;
870 Ok(())
871 }
872 }
873
874 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
875 for LibraryLoaderCacheBuilderCreateRequest
876 {
877 #[inline(always)]
878 fn new_empty() -> Self {
879 Self {
880 lib_directory: fidl::new_empty!(
881 fidl::encoding::Endpoint<
882 fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
883 >,
884 fidl::encoding::DefaultFuchsiaResourceDialect
885 ),
886 cache: fidl::new_empty!(
887 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<LibraryLoaderCacheMarker>>,
888 fidl::encoding::DefaultFuchsiaResourceDialect
889 ),
890 }
891 }
892
893 #[inline]
894 unsafe fn decode(
895 &mut self,
896 decoder: &mut fidl::encoding::Decoder<
897 '_,
898 fidl::encoding::DefaultFuchsiaResourceDialect,
899 >,
900 offset: usize,
901 _depth: fidl::encoding::Depth,
902 ) -> fidl::Result<()> {
903 decoder.debug_check_bounds::<Self>(offset);
904 fidl::decode!(
906 fidl::encoding::Endpoint<
907 fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
908 >,
909 fidl::encoding::DefaultFuchsiaResourceDialect,
910 &mut self.lib_directory,
911 decoder,
912 offset + 0,
913 _depth
914 )?;
915 fidl::decode!(
916 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<LibraryLoaderCacheMarker>>,
917 fidl::encoding::DefaultFuchsiaResourceDialect,
918 &mut self.cache,
919 decoder,
920 offset + 4,
921 _depth
922 )?;
923 Ok(())
924 }
925 }
926
927 impl fidl::encoding::ResourceTypeMarker for LibraryLoaderCacheServeRequest {
928 type Borrowed<'a> = &'a mut Self;
929 fn take_or_borrow<'a>(
930 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
931 ) -> Self::Borrowed<'a> {
932 value
933 }
934 }
935
936 unsafe impl fidl::encoding::TypeMarker for LibraryLoaderCacheServeRequest {
937 type Owned = Self;
938
939 #[inline(always)]
940 fn inline_align(_context: fidl::encoding::Context) -> usize {
941 4
942 }
943
944 #[inline(always)]
945 fn inline_size(_context: fidl::encoding::Context) -> usize {
946 4
947 }
948 }
949
950 unsafe impl
951 fidl::encoding::Encode<
952 LibraryLoaderCacheServeRequest,
953 fidl::encoding::DefaultFuchsiaResourceDialect,
954 > for &mut LibraryLoaderCacheServeRequest
955 {
956 #[inline]
957 unsafe fn encode(
958 self,
959 encoder: &mut fidl::encoding::Encoder<
960 '_,
961 fidl::encoding::DefaultFuchsiaResourceDialect,
962 >,
963 offset: usize,
964 _depth: fidl::encoding::Depth,
965 ) -> fidl::Result<()> {
966 encoder.debug_check_bounds::<LibraryLoaderCacheServeRequest>(offset);
967 fidl::encoding::Encode::<
969 LibraryLoaderCacheServeRequest,
970 fidl::encoding::DefaultFuchsiaResourceDialect,
971 >::encode(
972 (<fidl::encoding::Endpoint<
973 fidl::endpoints::ServerEnd<fidl_fuchsia_ldsvc::LoaderMarker>,
974 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
975 &mut self.loader
976 ),),
977 encoder,
978 offset,
979 _depth,
980 )
981 }
982 }
983 unsafe impl<
984 T0: fidl::encoding::Encode<
985 fidl::encoding::Endpoint<
986 fidl::endpoints::ServerEnd<fidl_fuchsia_ldsvc::LoaderMarker>,
987 >,
988 fidl::encoding::DefaultFuchsiaResourceDialect,
989 >,
990 >
991 fidl::encoding::Encode<
992 LibraryLoaderCacheServeRequest,
993 fidl::encoding::DefaultFuchsiaResourceDialect,
994 > for (T0,)
995 {
996 #[inline]
997 unsafe fn encode(
998 self,
999 encoder: &mut fidl::encoding::Encoder<
1000 '_,
1001 fidl::encoding::DefaultFuchsiaResourceDialect,
1002 >,
1003 offset: usize,
1004 depth: fidl::encoding::Depth,
1005 ) -> fidl::Result<()> {
1006 encoder.debug_check_bounds::<LibraryLoaderCacheServeRequest>(offset);
1007 self.0.encode(encoder, offset + 0, depth)?;
1011 Ok(())
1012 }
1013 }
1014
1015 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1016 for LibraryLoaderCacheServeRequest
1017 {
1018 #[inline(always)]
1019 fn new_empty() -> Self {
1020 Self {
1021 loader: fidl::new_empty!(
1022 fidl::encoding::Endpoint<
1023 fidl::endpoints::ServerEnd<fidl_fuchsia_ldsvc::LoaderMarker>,
1024 >,
1025 fidl::encoding::DefaultFuchsiaResourceDialect
1026 ),
1027 }
1028 }
1029
1030 #[inline]
1031 unsafe fn decode(
1032 &mut self,
1033 decoder: &mut fidl::encoding::Decoder<
1034 '_,
1035 fidl::encoding::DefaultFuchsiaResourceDialect,
1036 >,
1037 offset: usize,
1038 _depth: fidl::encoding::Depth,
1039 ) -> fidl::Result<()> {
1040 decoder.debug_check_bounds::<Self>(offset);
1041 fidl::decode!(
1043 fidl::encoding::Endpoint<
1044 fidl::endpoints::ServerEnd<fidl_fuchsia_ldsvc::LoaderMarker>,
1045 >,
1046 fidl::encoding::DefaultFuchsiaResourceDialect,
1047 &mut self.loader,
1048 decoder,
1049 offset + 0,
1050 _depth
1051 )?;
1052 Ok(())
1053 }
1054 }
1055}