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 _};
10use futures::future::{self, MaybeDone, TryFutureExt};
11use zx_status;
12
13pub const MAX_STRING_SIZE: u64 = 30;
14
15#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
16pub struct PackageServerGetUrlResponse {
17 pub url: String,
18}
19
20impl fidl::Persistable for PackageServerGetUrlResponse {}
21
22#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
23pub struct PackageServer_Marker;
24
25impl fidl::endpoints::ProtocolMarker for PackageServer_Marker {
26 type Proxy = PackageServer_Proxy;
27 type RequestStream = PackageServer_RequestStream;
28 #[cfg(target_os = "fuchsia")]
29 type SynchronousProxy = PackageServer_SynchronousProxy;
30
31 const DEBUG_NAME: &'static str = "test.security.pkg.PackageServer";
32}
33impl fidl::endpoints::DiscoverableProtocolMarker for PackageServer_Marker {}
34
35pub trait PackageServer_ProxyInterface: Send + Sync {
36 type GetUrlResponseFut: std::future::Future<Output = Result<String, fidl::Error>> + Send;
37 fn r#get_url(&self) -> Self::GetUrlResponseFut;
38}
39#[derive(Debug)]
40#[cfg(target_os = "fuchsia")]
41pub struct PackageServer_SynchronousProxy {
42 client: fidl::client::sync::Client,
43}
44
45#[cfg(target_os = "fuchsia")]
46impl fidl::endpoints::SynchronousProxy for PackageServer_SynchronousProxy {
47 type Proxy = PackageServer_Proxy;
48 type Protocol = PackageServer_Marker;
49
50 fn from_channel(inner: fidl::Channel) -> Self {
51 Self::new(inner)
52 }
53
54 fn into_channel(self) -> fidl::Channel {
55 self.client.into_channel()
56 }
57
58 fn as_channel(&self) -> &fidl::Channel {
59 self.client.as_channel()
60 }
61}
62
63#[cfg(target_os = "fuchsia")]
64impl PackageServer_SynchronousProxy {
65 pub fn new(channel: fidl::Channel) -> Self {
66 let protocol_name = <PackageServer_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
67 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
68 }
69
70 pub fn into_channel(self) -> fidl::Channel {
71 self.client.into_channel()
72 }
73
74 pub fn wait_for_event(
77 &self,
78 deadline: zx::MonotonicInstant,
79 ) -> Result<PackageServer_Event, fidl::Error> {
80 PackageServer_Event::decode(self.client.wait_for_event(deadline)?)
81 }
82
83 pub fn r#get_url(&self, ___deadline: zx::MonotonicInstant) -> Result<String, fidl::Error> {
85 let _response =
86 self.client.send_query::<fidl::encoding::EmptyPayload, PackageServerGetUrlResponse>(
87 (),
88 0x5dc4c0f9c1a8125,
89 fidl::encoding::DynamicFlags::empty(),
90 ___deadline,
91 )?;
92 Ok(_response.url)
93 }
94}
95
96#[derive(Debug, Clone)]
97pub struct PackageServer_Proxy {
98 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
99}
100
101impl fidl::endpoints::Proxy for PackageServer_Proxy {
102 type Protocol = PackageServer_Marker;
103
104 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
105 Self::new(inner)
106 }
107
108 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
109 self.client.into_channel().map_err(|client| Self { client })
110 }
111
112 fn as_channel(&self) -> &::fidl::AsyncChannel {
113 self.client.as_channel()
114 }
115}
116
117impl PackageServer_Proxy {
118 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
120 let protocol_name = <PackageServer_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
121 Self { client: fidl::client::Client::new(channel, protocol_name) }
122 }
123
124 pub fn take_event_stream(&self) -> PackageServer_EventStream {
130 PackageServer_EventStream { event_receiver: self.client.take_event_receiver() }
131 }
132
133 pub fn r#get_url(
135 &self,
136 ) -> fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect> {
137 PackageServer_ProxyInterface::r#get_url(self)
138 }
139}
140
141impl PackageServer_ProxyInterface for PackageServer_Proxy {
142 type GetUrlResponseFut =
143 fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect>;
144 fn r#get_url(&self) -> Self::GetUrlResponseFut {
145 fn _decode(
146 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
147 ) -> Result<String, fidl::Error> {
148 let _response = fidl::client::decode_transaction_body::<
149 PackageServerGetUrlResponse,
150 fidl::encoding::DefaultFuchsiaResourceDialect,
151 0x5dc4c0f9c1a8125,
152 >(_buf?)?;
153 Ok(_response.url)
154 }
155 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, String>(
156 (),
157 0x5dc4c0f9c1a8125,
158 fidl::encoding::DynamicFlags::empty(),
159 _decode,
160 )
161 }
162}
163
164pub struct PackageServer_EventStream {
165 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
166}
167
168impl std::marker::Unpin for PackageServer_EventStream {}
169
170impl futures::stream::FusedStream for PackageServer_EventStream {
171 fn is_terminated(&self) -> bool {
172 self.event_receiver.is_terminated()
173 }
174}
175
176impl futures::Stream for PackageServer_EventStream {
177 type Item = Result<PackageServer_Event, fidl::Error>;
178
179 fn poll_next(
180 mut self: std::pin::Pin<&mut Self>,
181 cx: &mut std::task::Context<'_>,
182 ) -> std::task::Poll<Option<Self::Item>> {
183 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
184 &mut self.event_receiver,
185 cx
186 )?) {
187 Some(buf) => std::task::Poll::Ready(Some(PackageServer_Event::decode(buf))),
188 None => std::task::Poll::Ready(None),
189 }
190 }
191}
192
193#[derive(Debug)]
194pub enum PackageServer_Event {}
195
196impl PackageServer_Event {
197 fn decode(
199 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
200 ) -> Result<PackageServer_Event, fidl::Error> {
201 let (bytes, _handles) = buf.split_mut();
202 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
203 debug_assert_eq!(tx_header.tx_id, 0);
204 match tx_header.ordinal {
205 _ => Err(fidl::Error::UnknownOrdinal {
206 ordinal: tx_header.ordinal,
207 protocol_name:
208 <PackageServer_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
209 }),
210 }
211 }
212}
213
214pub struct PackageServer_RequestStream {
216 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
217 is_terminated: bool,
218}
219
220impl std::marker::Unpin for PackageServer_RequestStream {}
221
222impl futures::stream::FusedStream for PackageServer_RequestStream {
223 fn is_terminated(&self) -> bool {
224 self.is_terminated
225 }
226}
227
228impl fidl::endpoints::RequestStream for PackageServer_RequestStream {
229 type Protocol = PackageServer_Marker;
230 type ControlHandle = PackageServer_ControlHandle;
231
232 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
233 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
234 }
235
236 fn control_handle(&self) -> Self::ControlHandle {
237 PackageServer_ControlHandle { inner: self.inner.clone() }
238 }
239
240 fn into_inner(
241 self,
242 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
243 {
244 (self.inner, self.is_terminated)
245 }
246
247 fn from_inner(
248 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
249 is_terminated: bool,
250 ) -> Self {
251 Self { inner, is_terminated }
252 }
253}
254
255impl futures::Stream for PackageServer_RequestStream {
256 type Item = Result<PackageServer_Request, fidl::Error>;
257
258 fn poll_next(
259 mut self: std::pin::Pin<&mut Self>,
260 cx: &mut std::task::Context<'_>,
261 ) -> std::task::Poll<Option<Self::Item>> {
262 let this = &mut *self;
263 if this.inner.check_shutdown(cx) {
264 this.is_terminated = true;
265 return std::task::Poll::Ready(None);
266 }
267 if this.is_terminated {
268 panic!("polled PackageServer_RequestStream after completion");
269 }
270 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
271 |bytes, handles| {
272 match this.inner.channel().read_etc(cx, bytes, handles) {
273 std::task::Poll::Ready(Ok(())) => {}
274 std::task::Poll::Pending => return std::task::Poll::Pending,
275 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
276 this.is_terminated = true;
277 return std::task::Poll::Ready(None);
278 }
279 std::task::Poll::Ready(Err(e)) => {
280 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
281 e.into(),
282 ))))
283 }
284 }
285
286 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
288
289 std::task::Poll::Ready(Some(match header.ordinal {
290 0x5dc4c0f9c1a8125 => {
291 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
292 let mut req = fidl::new_empty!(
293 fidl::encoding::EmptyPayload,
294 fidl::encoding::DefaultFuchsiaResourceDialect
295 );
296 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
297 let control_handle =
298 PackageServer_ControlHandle { inner: this.inner.clone() };
299 Ok(PackageServer_Request::GetUrl {
300 responder: PackageServer_GetUrlResponder {
301 control_handle: std::mem::ManuallyDrop::new(control_handle),
302 tx_id: header.tx_id,
303 },
304 })
305 }
306 _ => Err(fidl::Error::UnknownOrdinal {
307 ordinal: header.ordinal,
308 protocol_name:
309 <PackageServer_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
310 }),
311 }))
312 },
313 )
314 }
315}
316
317#[derive(Debug)]
319pub enum PackageServer_Request {
320 GetUrl { responder: PackageServer_GetUrlResponder },
322}
323
324impl PackageServer_Request {
325 #[allow(irrefutable_let_patterns)]
326 pub fn into_get_url(self) -> Option<(PackageServer_GetUrlResponder)> {
327 if let PackageServer_Request::GetUrl { responder } = self {
328 Some((responder))
329 } else {
330 None
331 }
332 }
333
334 pub fn method_name(&self) -> &'static str {
336 match *self {
337 PackageServer_Request::GetUrl { .. } => "get_url",
338 }
339 }
340}
341
342#[derive(Debug, Clone)]
343pub struct PackageServer_ControlHandle {
344 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
345}
346
347impl fidl::endpoints::ControlHandle for PackageServer_ControlHandle {
348 fn shutdown(&self) {
349 self.inner.shutdown()
350 }
351 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
352 self.inner.shutdown_with_epitaph(status)
353 }
354
355 fn is_closed(&self) -> bool {
356 self.inner.channel().is_closed()
357 }
358 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
359 self.inner.channel().on_closed()
360 }
361
362 #[cfg(target_os = "fuchsia")]
363 fn signal_peer(
364 &self,
365 clear_mask: zx::Signals,
366 set_mask: zx::Signals,
367 ) -> Result<(), zx_status::Status> {
368 use fidl::Peered;
369 self.inner.channel().signal_peer(clear_mask, set_mask)
370 }
371}
372
373impl PackageServer_ControlHandle {}
374
375#[must_use = "FIDL methods require a response to be sent"]
376#[derive(Debug)]
377pub struct PackageServer_GetUrlResponder {
378 control_handle: std::mem::ManuallyDrop<PackageServer_ControlHandle>,
379 tx_id: u32,
380}
381
382impl std::ops::Drop for PackageServer_GetUrlResponder {
386 fn drop(&mut self) {
387 self.control_handle.shutdown();
388 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
390 }
391}
392
393impl fidl::endpoints::Responder for PackageServer_GetUrlResponder {
394 type ControlHandle = PackageServer_ControlHandle;
395
396 fn control_handle(&self) -> &PackageServer_ControlHandle {
397 &self.control_handle
398 }
399
400 fn drop_without_shutdown(mut self) {
401 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
403 std::mem::forget(self);
405 }
406}
407
408impl PackageServer_GetUrlResponder {
409 pub fn send(self, mut url: &str) -> Result<(), fidl::Error> {
413 let _result = self.send_raw(url);
414 if _result.is_err() {
415 self.control_handle.shutdown();
416 }
417 self.drop_without_shutdown();
418 _result
419 }
420
421 pub fn send_no_shutdown_on_err(self, mut url: &str) -> Result<(), fidl::Error> {
423 let _result = self.send_raw(url);
424 self.drop_without_shutdown();
425 _result
426 }
427
428 fn send_raw(&self, mut url: &str) -> Result<(), fidl::Error> {
429 self.control_handle.inner.send::<PackageServerGetUrlResponse>(
430 (url,),
431 self.tx_id,
432 0x5dc4c0f9c1a8125,
433 fidl::encoding::DynamicFlags::empty(),
434 )
435 }
436}
437
438mod internal {
439 use super::*;
440
441 impl fidl::encoding::ValueTypeMarker for PackageServerGetUrlResponse {
442 type Borrowed<'a> = &'a Self;
443 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
444 value
445 }
446 }
447
448 unsafe impl fidl::encoding::TypeMarker for PackageServerGetUrlResponse {
449 type Owned = Self;
450
451 #[inline(always)]
452 fn inline_align(_context: fidl::encoding::Context) -> usize {
453 8
454 }
455
456 #[inline(always)]
457 fn inline_size(_context: fidl::encoding::Context) -> usize {
458 16
459 }
460 }
461
462 unsafe impl<D: fidl::encoding::ResourceDialect>
463 fidl::encoding::Encode<PackageServerGetUrlResponse, D> for &PackageServerGetUrlResponse
464 {
465 #[inline]
466 unsafe fn encode(
467 self,
468 encoder: &mut fidl::encoding::Encoder<'_, D>,
469 offset: usize,
470 _depth: fidl::encoding::Depth,
471 ) -> fidl::Result<()> {
472 encoder.debug_check_bounds::<PackageServerGetUrlResponse>(offset);
473 fidl::encoding::Encode::<PackageServerGetUrlResponse, D>::encode(
475 (<fidl::encoding::BoundedString<30> as fidl::encoding::ValueTypeMarker>::borrow(
476 &self.url,
477 ),),
478 encoder,
479 offset,
480 _depth,
481 )
482 }
483 }
484 unsafe impl<
485 D: fidl::encoding::ResourceDialect,
486 T0: fidl::encoding::Encode<fidl::encoding::BoundedString<30>, D>,
487 > fidl::encoding::Encode<PackageServerGetUrlResponse, D> for (T0,)
488 {
489 #[inline]
490 unsafe fn encode(
491 self,
492 encoder: &mut fidl::encoding::Encoder<'_, D>,
493 offset: usize,
494 depth: fidl::encoding::Depth,
495 ) -> fidl::Result<()> {
496 encoder.debug_check_bounds::<PackageServerGetUrlResponse>(offset);
497 self.0.encode(encoder, offset + 0, depth)?;
501 Ok(())
502 }
503 }
504
505 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
506 for PackageServerGetUrlResponse
507 {
508 #[inline(always)]
509 fn new_empty() -> Self {
510 Self { url: fidl::new_empty!(fidl::encoding::BoundedString<30>, D) }
511 }
512
513 #[inline]
514 unsafe fn decode(
515 &mut self,
516 decoder: &mut fidl::encoding::Decoder<'_, D>,
517 offset: usize,
518 _depth: fidl::encoding::Depth,
519 ) -> fidl::Result<()> {
520 decoder.debug_check_bounds::<Self>(offset);
521 fidl::decode!(
523 fidl::encoding::BoundedString<30>,
524 D,
525 &mut self.url,
526 decoder,
527 offset + 0,
528 _depth
529 )?;
530 Ok(())
531 }
532 }
533}