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