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_wayland__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct ServerConnectRequest {
16 pub channel: fidl::Channel,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ServerConnectRequest {}
20
21#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
22pub struct Server_Marker;
23
24impl fidl::endpoints::ProtocolMarker for Server_Marker {
25 type Proxy = Server_Proxy;
26 type RequestStream = Server_RequestStream;
27 #[cfg(target_os = "fuchsia")]
28 type SynchronousProxy = Server_SynchronousProxy;
29
30 const DEBUG_NAME: &'static str = "fuchsia.wayland.Server";
31}
32impl fidl::endpoints::DiscoverableProtocolMarker for Server_Marker {}
33
34pub trait Server_ProxyInterface: Send + Sync {
35 fn r#connect(&self, channel: fidl::Channel) -> Result<(), fidl::Error>;
36}
37#[derive(Debug)]
38#[cfg(target_os = "fuchsia")]
39pub struct Server_SynchronousProxy {
40 client: fidl::client::sync::Client,
41}
42
43#[cfg(target_os = "fuchsia")]
44impl fidl::endpoints::SynchronousProxy for Server_SynchronousProxy {
45 type Proxy = Server_Proxy;
46 type Protocol = Server_Marker;
47
48 fn from_channel(inner: fidl::Channel) -> Self {
49 Self::new(inner)
50 }
51
52 fn into_channel(self) -> fidl::Channel {
53 self.client.into_channel()
54 }
55
56 fn as_channel(&self) -> &fidl::Channel {
57 self.client.as_channel()
58 }
59}
60
61#[cfg(target_os = "fuchsia")]
62impl Server_SynchronousProxy {
63 pub fn new(channel: fidl::Channel) -> Self {
64 let protocol_name = <Server_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
65 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
66 }
67
68 pub fn into_channel(self) -> fidl::Channel {
69 self.client.into_channel()
70 }
71
72 pub fn wait_for_event(
75 &self,
76 deadline: zx::MonotonicInstant,
77 ) -> Result<Server_Event, fidl::Error> {
78 Server_Event::decode(self.client.wait_for_event(deadline)?)
79 }
80
81 pub fn r#connect(&self, mut channel: fidl::Channel) -> Result<(), fidl::Error> {
89 self.client.send::<ServerConnectRequest>(
90 (channel,),
91 0x52a3b4417b29e9e7,
92 fidl::encoding::DynamicFlags::empty(),
93 )
94 }
95}
96
97#[cfg(target_os = "fuchsia")]
98impl From<Server_SynchronousProxy> for zx::Handle {
99 fn from(value: Server_SynchronousProxy) -> Self {
100 value.into_channel().into()
101 }
102}
103
104#[cfg(target_os = "fuchsia")]
105impl From<fidl::Channel> for Server_SynchronousProxy {
106 fn from(value: fidl::Channel) -> Self {
107 Self::new(value)
108 }
109}
110
111#[cfg(target_os = "fuchsia")]
112impl fidl::endpoints::FromClient for Server_SynchronousProxy {
113 type Protocol = Server_Marker;
114
115 fn from_client(value: fidl::endpoints::ClientEnd<Server_Marker>) -> Self {
116 Self::new(value.into_channel())
117 }
118}
119
120#[derive(Debug, Clone)]
121pub struct Server_Proxy {
122 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
123}
124
125impl fidl::endpoints::Proxy for Server_Proxy {
126 type Protocol = Server_Marker;
127
128 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
129 Self::new(inner)
130 }
131
132 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
133 self.client.into_channel().map_err(|client| Self { client })
134 }
135
136 fn as_channel(&self) -> &::fidl::AsyncChannel {
137 self.client.as_channel()
138 }
139}
140
141impl Server_Proxy {
142 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
144 let protocol_name = <Server_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
145 Self { client: fidl::client::Client::new(channel, protocol_name) }
146 }
147
148 pub fn take_event_stream(&self) -> Server_EventStream {
154 Server_EventStream { event_receiver: self.client.take_event_receiver() }
155 }
156
157 pub fn r#connect(&self, mut channel: fidl::Channel) -> Result<(), fidl::Error> {
165 Server_ProxyInterface::r#connect(self, channel)
166 }
167}
168
169impl Server_ProxyInterface for Server_Proxy {
170 fn r#connect(&self, mut channel: fidl::Channel) -> Result<(), fidl::Error> {
171 self.client.send::<ServerConnectRequest>(
172 (channel,),
173 0x52a3b4417b29e9e7,
174 fidl::encoding::DynamicFlags::empty(),
175 )
176 }
177}
178
179pub struct Server_EventStream {
180 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
181}
182
183impl std::marker::Unpin for Server_EventStream {}
184
185impl futures::stream::FusedStream for Server_EventStream {
186 fn is_terminated(&self) -> bool {
187 self.event_receiver.is_terminated()
188 }
189}
190
191impl futures::Stream for Server_EventStream {
192 type Item = Result<Server_Event, fidl::Error>;
193
194 fn poll_next(
195 mut self: std::pin::Pin<&mut Self>,
196 cx: &mut std::task::Context<'_>,
197 ) -> std::task::Poll<Option<Self::Item>> {
198 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
199 &mut self.event_receiver,
200 cx
201 )?) {
202 Some(buf) => std::task::Poll::Ready(Some(Server_Event::decode(buf))),
203 None => std::task::Poll::Ready(None),
204 }
205 }
206}
207
208#[derive(Debug)]
209pub enum Server_Event {}
210
211impl Server_Event {
212 fn decode(
214 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
215 ) -> Result<Server_Event, fidl::Error> {
216 let (bytes, _handles) = buf.split_mut();
217 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
218 debug_assert_eq!(tx_header.tx_id, 0);
219 match tx_header.ordinal {
220 _ => Err(fidl::Error::UnknownOrdinal {
221 ordinal: tx_header.ordinal,
222 protocol_name: <Server_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
223 }),
224 }
225 }
226}
227
228pub struct Server_RequestStream {
230 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
231 is_terminated: bool,
232}
233
234impl std::marker::Unpin for Server_RequestStream {}
235
236impl futures::stream::FusedStream for Server_RequestStream {
237 fn is_terminated(&self) -> bool {
238 self.is_terminated
239 }
240}
241
242impl fidl::endpoints::RequestStream for Server_RequestStream {
243 type Protocol = Server_Marker;
244 type ControlHandle = Server_ControlHandle;
245
246 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
247 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
248 }
249
250 fn control_handle(&self) -> Self::ControlHandle {
251 Server_ControlHandle { inner: self.inner.clone() }
252 }
253
254 fn into_inner(
255 self,
256 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
257 {
258 (self.inner, self.is_terminated)
259 }
260
261 fn from_inner(
262 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
263 is_terminated: bool,
264 ) -> Self {
265 Self { inner, is_terminated }
266 }
267}
268
269impl futures::Stream for Server_RequestStream {
270 type Item = Result<Server_Request, fidl::Error>;
271
272 fn poll_next(
273 mut self: std::pin::Pin<&mut Self>,
274 cx: &mut std::task::Context<'_>,
275 ) -> std::task::Poll<Option<Self::Item>> {
276 let this = &mut *self;
277 if this.inner.check_shutdown(cx) {
278 this.is_terminated = true;
279 return std::task::Poll::Ready(None);
280 }
281 if this.is_terminated {
282 panic!("polled Server_RequestStream after completion");
283 }
284 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
285 |bytes, handles| {
286 match this.inner.channel().read_etc(cx, bytes, handles) {
287 std::task::Poll::Ready(Ok(())) => {}
288 std::task::Poll::Pending => return std::task::Poll::Pending,
289 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
290 this.is_terminated = true;
291 return std::task::Poll::Ready(None);
292 }
293 std::task::Poll::Ready(Err(e)) => {
294 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
295 e.into(),
296 ))))
297 }
298 }
299
300 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
302
303 std::task::Poll::Ready(Some(match header.ordinal {
304 0x52a3b4417b29e9e7 => {
305 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
306 let mut req = fidl::new_empty!(
307 ServerConnectRequest,
308 fidl::encoding::DefaultFuchsiaResourceDialect
309 );
310 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ServerConnectRequest>(&header, _body_bytes, handles, &mut req)?;
311 let control_handle = Server_ControlHandle { inner: this.inner.clone() };
312 Ok(Server_Request::Connect { channel: req.channel, control_handle })
313 }
314 _ => Err(fidl::Error::UnknownOrdinal {
315 ordinal: header.ordinal,
316 protocol_name:
317 <Server_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
318 }),
319 }))
320 },
321 )
322 }
323}
324
325#[derive(Debug)]
345pub enum Server_Request {
346 Connect { channel: fidl::Channel, control_handle: Server_ControlHandle },
354}
355
356impl Server_Request {
357 #[allow(irrefutable_let_patterns)]
358 pub fn into_connect(self) -> Option<(fidl::Channel, Server_ControlHandle)> {
359 if let Server_Request::Connect { channel, control_handle } = self {
360 Some((channel, control_handle))
361 } else {
362 None
363 }
364 }
365
366 pub fn method_name(&self) -> &'static str {
368 match *self {
369 Server_Request::Connect { .. } => "connect",
370 }
371 }
372}
373
374#[derive(Debug, Clone)]
375pub struct Server_ControlHandle {
376 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
377}
378
379impl fidl::endpoints::ControlHandle for Server_ControlHandle {
380 fn shutdown(&self) {
381 self.inner.shutdown()
382 }
383 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
384 self.inner.shutdown_with_epitaph(status)
385 }
386
387 fn is_closed(&self) -> bool {
388 self.inner.channel().is_closed()
389 }
390 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
391 self.inner.channel().on_closed()
392 }
393
394 #[cfg(target_os = "fuchsia")]
395 fn signal_peer(
396 &self,
397 clear_mask: zx::Signals,
398 set_mask: zx::Signals,
399 ) -> Result<(), zx_status::Status> {
400 use fidl::Peered;
401 self.inner.channel().signal_peer(clear_mask, set_mask)
402 }
403}
404
405impl Server_ControlHandle {}
406
407mod internal {
408 use super::*;
409
410 impl fidl::encoding::ResourceTypeMarker for ServerConnectRequest {
411 type Borrowed<'a> = &'a mut Self;
412 fn take_or_borrow<'a>(
413 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
414 ) -> Self::Borrowed<'a> {
415 value
416 }
417 }
418
419 unsafe impl fidl::encoding::TypeMarker for ServerConnectRequest {
420 type Owned = Self;
421
422 #[inline(always)]
423 fn inline_align(_context: fidl::encoding::Context) -> usize {
424 4
425 }
426
427 #[inline(always)]
428 fn inline_size(_context: fidl::encoding::Context) -> usize {
429 4
430 }
431 }
432
433 unsafe impl
434 fidl::encoding::Encode<ServerConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
435 for &mut ServerConnectRequest
436 {
437 #[inline]
438 unsafe fn encode(
439 self,
440 encoder: &mut fidl::encoding::Encoder<
441 '_,
442 fidl::encoding::DefaultFuchsiaResourceDialect,
443 >,
444 offset: usize,
445 _depth: fidl::encoding::Depth,
446 ) -> fidl::Result<()> {
447 encoder.debug_check_bounds::<ServerConnectRequest>(offset);
448 fidl::encoding::Encode::<
450 ServerConnectRequest,
451 fidl::encoding::DefaultFuchsiaResourceDialect,
452 >::encode(
453 (<fidl::encoding::HandleType<
454 fidl::Channel,
455 { fidl::ObjectType::CHANNEL.into_raw() },
456 2147483648,
457 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
458 &mut self.channel
459 ),),
460 encoder,
461 offset,
462 _depth,
463 )
464 }
465 }
466 unsafe impl<
467 T0: fidl::encoding::Encode<
468 fidl::encoding::HandleType<
469 fidl::Channel,
470 { fidl::ObjectType::CHANNEL.into_raw() },
471 2147483648,
472 >,
473 fidl::encoding::DefaultFuchsiaResourceDialect,
474 >,
475 >
476 fidl::encoding::Encode<ServerConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
477 for (T0,)
478 {
479 #[inline]
480 unsafe fn encode(
481 self,
482 encoder: &mut fidl::encoding::Encoder<
483 '_,
484 fidl::encoding::DefaultFuchsiaResourceDialect,
485 >,
486 offset: usize,
487 depth: fidl::encoding::Depth,
488 ) -> fidl::Result<()> {
489 encoder.debug_check_bounds::<ServerConnectRequest>(offset);
490 self.0.encode(encoder, offset + 0, depth)?;
494 Ok(())
495 }
496 }
497
498 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
499 for ServerConnectRequest
500 {
501 #[inline(always)]
502 fn new_empty() -> Self {
503 Self {
504 channel: fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
505 }
506 }
507
508 #[inline]
509 unsafe fn decode(
510 &mut self,
511 decoder: &mut fidl::encoding::Decoder<
512 '_,
513 fidl::encoding::DefaultFuchsiaResourceDialect,
514 >,
515 offset: usize,
516 _depth: fidl::encoding::Depth,
517 ) -> fidl::Result<()> {
518 decoder.debug_check_bounds::<Self>(offset);
519 fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.channel, decoder, offset + 0, _depth)?;
521 Ok(())
522 }
523 }
524}