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_debugdata__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct PublisherPublishRequest {
16 pub data_sink: String,
17 pub data: fidl::Vmo,
18 pub vmo_token: fidl::EventPair,
19}
20
21impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for PublisherPublishRequest {}
22
23#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
24pub struct PublisherMarker;
25
26impl fidl::endpoints::ProtocolMarker for PublisherMarker {
27 type Proxy = PublisherProxy;
28 type RequestStream = PublisherRequestStream;
29 #[cfg(target_os = "fuchsia")]
30 type SynchronousProxy = PublisherSynchronousProxy;
31
32 const DEBUG_NAME: &'static str = "fuchsia.debugdata.Publisher";
33}
34impl fidl::endpoints::DiscoverableProtocolMarker for PublisherMarker {}
35
36pub trait PublisherProxyInterface: Send + Sync {
37 fn r#publish(
38 &self,
39 data_sink: &str,
40 data: fidl::Vmo,
41 vmo_token: fidl::EventPair,
42 ) -> Result<(), fidl::Error>;
43}
44#[derive(Debug)]
45#[cfg(target_os = "fuchsia")]
46pub struct PublisherSynchronousProxy {
47 client: fidl::client::sync::Client,
48}
49
50#[cfg(target_os = "fuchsia")]
51impl fidl::endpoints::SynchronousProxy for PublisherSynchronousProxy {
52 type Proxy = PublisherProxy;
53 type Protocol = PublisherMarker;
54
55 fn from_channel(inner: fidl::Channel) -> Self {
56 Self::new(inner)
57 }
58
59 fn into_channel(self) -> fidl::Channel {
60 self.client.into_channel()
61 }
62
63 fn as_channel(&self) -> &fidl::Channel {
64 self.client.as_channel()
65 }
66}
67
68#[cfg(target_os = "fuchsia")]
69impl PublisherSynchronousProxy {
70 pub fn new(channel: fidl::Channel) -> Self {
71 let protocol_name = <PublisherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
72 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
73 }
74
75 pub fn into_channel(self) -> fidl::Channel {
76 self.client.into_channel()
77 }
78
79 pub fn wait_for_event(
82 &self,
83 deadline: zx::MonotonicInstant,
84 ) -> Result<PublisherEvent, fidl::Error> {
85 PublisherEvent::decode(self.client.wait_for_event(deadline)?)
86 }
87
88 pub fn r#publish(
103 &self,
104 mut data_sink: &str,
105 mut data: fidl::Vmo,
106 mut vmo_token: fidl::EventPair,
107 ) -> Result<(), fidl::Error> {
108 self.client.send::<PublisherPublishRequest>(
109 (data_sink, data, vmo_token),
110 0xf52f8806121e066,
111 fidl::encoding::DynamicFlags::empty(),
112 )
113 }
114}
115
116#[cfg(target_os = "fuchsia")]
117impl From<PublisherSynchronousProxy> for zx::Handle {
118 fn from(value: PublisherSynchronousProxy) -> Self {
119 value.into_channel().into()
120 }
121}
122
123#[cfg(target_os = "fuchsia")]
124impl From<fidl::Channel> for PublisherSynchronousProxy {
125 fn from(value: fidl::Channel) -> Self {
126 Self::new(value)
127 }
128}
129
130#[cfg(target_os = "fuchsia")]
131impl fidl::endpoints::FromClient for PublisherSynchronousProxy {
132 type Protocol = PublisherMarker;
133
134 fn from_client(value: fidl::endpoints::ClientEnd<PublisherMarker>) -> Self {
135 Self::new(value.into_channel())
136 }
137}
138
139#[derive(Debug, Clone)]
140pub struct PublisherProxy {
141 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
142}
143
144impl fidl::endpoints::Proxy for PublisherProxy {
145 type Protocol = PublisherMarker;
146
147 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
148 Self::new(inner)
149 }
150
151 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
152 self.client.into_channel().map_err(|client| Self { client })
153 }
154
155 fn as_channel(&self) -> &::fidl::AsyncChannel {
156 self.client.as_channel()
157 }
158}
159
160impl PublisherProxy {
161 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
163 let protocol_name = <PublisherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
164 Self { client: fidl::client::Client::new(channel, protocol_name) }
165 }
166
167 pub fn take_event_stream(&self) -> PublisherEventStream {
173 PublisherEventStream { event_receiver: self.client.take_event_receiver() }
174 }
175
176 pub fn r#publish(
191 &self,
192 mut data_sink: &str,
193 mut data: fidl::Vmo,
194 mut vmo_token: fidl::EventPair,
195 ) -> Result<(), fidl::Error> {
196 PublisherProxyInterface::r#publish(self, data_sink, data, vmo_token)
197 }
198}
199
200impl PublisherProxyInterface for PublisherProxy {
201 fn r#publish(
202 &self,
203 mut data_sink: &str,
204 mut data: fidl::Vmo,
205 mut vmo_token: fidl::EventPair,
206 ) -> Result<(), fidl::Error> {
207 self.client.send::<PublisherPublishRequest>(
208 (data_sink, data, vmo_token),
209 0xf52f8806121e066,
210 fidl::encoding::DynamicFlags::empty(),
211 )
212 }
213}
214
215pub struct PublisherEventStream {
216 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
217}
218
219impl std::marker::Unpin for PublisherEventStream {}
220
221impl futures::stream::FusedStream for PublisherEventStream {
222 fn is_terminated(&self) -> bool {
223 self.event_receiver.is_terminated()
224 }
225}
226
227impl futures::Stream for PublisherEventStream {
228 type Item = Result<PublisherEvent, fidl::Error>;
229
230 fn poll_next(
231 mut self: std::pin::Pin<&mut Self>,
232 cx: &mut std::task::Context<'_>,
233 ) -> std::task::Poll<Option<Self::Item>> {
234 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
235 &mut self.event_receiver,
236 cx
237 )?) {
238 Some(buf) => std::task::Poll::Ready(Some(PublisherEvent::decode(buf))),
239 None => std::task::Poll::Ready(None),
240 }
241 }
242}
243
244#[derive(Debug)]
245pub enum PublisherEvent {}
246
247impl PublisherEvent {
248 fn decode(
250 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
251 ) -> Result<PublisherEvent, fidl::Error> {
252 let (bytes, _handles) = buf.split_mut();
253 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
254 debug_assert_eq!(tx_header.tx_id, 0);
255 match tx_header.ordinal {
256 _ => Err(fidl::Error::UnknownOrdinal {
257 ordinal: tx_header.ordinal,
258 protocol_name: <PublisherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
259 }),
260 }
261 }
262}
263
264pub struct PublisherRequestStream {
266 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
267 is_terminated: bool,
268}
269
270impl std::marker::Unpin for PublisherRequestStream {}
271
272impl futures::stream::FusedStream for PublisherRequestStream {
273 fn is_terminated(&self) -> bool {
274 self.is_terminated
275 }
276}
277
278impl fidl::endpoints::RequestStream for PublisherRequestStream {
279 type Protocol = PublisherMarker;
280 type ControlHandle = PublisherControlHandle;
281
282 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
283 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
284 }
285
286 fn control_handle(&self) -> Self::ControlHandle {
287 PublisherControlHandle { inner: self.inner.clone() }
288 }
289
290 fn into_inner(
291 self,
292 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
293 {
294 (self.inner, self.is_terminated)
295 }
296
297 fn from_inner(
298 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
299 is_terminated: bool,
300 ) -> Self {
301 Self { inner, is_terminated }
302 }
303}
304
305impl futures::Stream for PublisherRequestStream {
306 type Item = Result<PublisherRequest, fidl::Error>;
307
308 fn poll_next(
309 mut self: std::pin::Pin<&mut Self>,
310 cx: &mut std::task::Context<'_>,
311 ) -> std::task::Poll<Option<Self::Item>> {
312 let this = &mut *self;
313 if this.inner.check_shutdown(cx) {
314 this.is_terminated = true;
315 return std::task::Poll::Ready(None);
316 }
317 if this.is_terminated {
318 panic!("polled PublisherRequestStream after completion");
319 }
320 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
321 |bytes, handles| {
322 match this.inner.channel().read_etc(cx, bytes, handles) {
323 std::task::Poll::Ready(Ok(())) => {}
324 std::task::Poll::Pending => return std::task::Poll::Pending,
325 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
326 this.is_terminated = true;
327 return std::task::Poll::Ready(None);
328 }
329 std::task::Poll::Ready(Err(e)) => {
330 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
331 e.into(),
332 ))))
333 }
334 }
335
336 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
338
339 std::task::Poll::Ready(Some(match header.ordinal {
340 0xf52f8806121e066 => {
341 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
342 let mut req = fidl::new_empty!(
343 PublisherPublishRequest,
344 fidl::encoding::DefaultFuchsiaResourceDialect
345 );
346 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PublisherPublishRequest>(&header, _body_bytes, handles, &mut req)?;
347 let control_handle = PublisherControlHandle { inner: this.inner.clone() };
348 Ok(PublisherRequest::Publish {
349 data_sink: req.data_sink,
350 data: req.data,
351 vmo_token: req.vmo_token,
352
353 control_handle,
354 })
355 }
356 _ => Err(fidl::Error::UnknownOrdinal {
357 ordinal: header.ordinal,
358 protocol_name:
359 <PublisherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
360 }),
361 }))
362 },
363 )
364 }
365}
366
367#[derive(Debug)]
369pub enum PublisherRequest {
370 Publish {
385 data_sink: String,
386 data: fidl::Vmo,
387 vmo_token: fidl::EventPair,
388 control_handle: PublisherControlHandle,
389 },
390}
391
392impl PublisherRequest {
393 #[allow(irrefutable_let_patterns)]
394 pub fn into_publish(
395 self,
396 ) -> Option<(String, fidl::Vmo, fidl::EventPair, PublisherControlHandle)> {
397 if let PublisherRequest::Publish { data_sink, data, vmo_token, control_handle } = self {
398 Some((data_sink, data, vmo_token, control_handle))
399 } else {
400 None
401 }
402 }
403
404 pub fn method_name(&self) -> &'static str {
406 match *self {
407 PublisherRequest::Publish { .. } => "publish",
408 }
409 }
410}
411
412#[derive(Debug, Clone)]
413pub struct PublisherControlHandle {
414 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
415}
416
417impl fidl::endpoints::ControlHandle for PublisherControlHandle {
418 fn shutdown(&self) {
419 self.inner.shutdown()
420 }
421 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
422 self.inner.shutdown_with_epitaph(status)
423 }
424
425 fn is_closed(&self) -> bool {
426 self.inner.channel().is_closed()
427 }
428 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
429 self.inner.channel().on_closed()
430 }
431
432 #[cfg(target_os = "fuchsia")]
433 fn signal_peer(
434 &self,
435 clear_mask: zx::Signals,
436 set_mask: zx::Signals,
437 ) -> Result<(), zx_status::Status> {
438 use fidl::Peered;
439 self.inner.channel().signal_peer(clear_mask, set_mask)
440 }
441}
442
443impl PublisherControlHandle {}
444
445mod internal {
446 use super::*;
447
448 impl fidl::encoding::ResourceTypeMarker for PublisherPublishRequest {
449 type Borrowed<'a> = &'a mut Self;
450 fn take_or_borrow<'a>(
451 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
452 ) -> Self::Borrowed<'a> {
453 value
454 }
455 }
456
457 unsafe impl fidl::encoding::TypeMarker for PublisherPublishRequest {
458 type Owned = Self;
459
460 #[inline(always)]
461 fn inline_align(_context: fidl::encoding::Context) -> usize {
462 8
463 }
464
465 #[inline(always)]
466 fn inline_size(_context: fidl::encoding::Context) -> usize {
467 24
468 }
469 }
470
471 unsafe impl
472 fidl::encoding::Encode<
473 PublisherPublishRequest,
474 fidl::encoding::DefaultFuchsiaResourceDialect,
475 > for &mut PublisherPublishRequest
476 {
477 #[inline]
478 unsafe fn encode(
479 self,
480 encoder: &mut fidl::encoding::Encoder<
481 '_,
482 fidl::encoding::DefaultFuchsiaResourceDialect,
483 >,
484 offset: usize,
485 _depth: fidl::encoding::Depth,
486 ) -> fidl::Result<()> {
487 encoder.debug_check_bounds::<PublisherPublishRequest>(offset);
488 fidl::encoding::Encode::<
490 PublisherPublishRequest,
491 fidl::encoding::DefaultFuchsiaResourceDialect,
492 >::encode(
493 (
494 <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
495 &self.data_sink,
496 ),
497 <fidl::encoding::HandleType<
498 fidl::Vmo,
499 { fidl::ObjectType::VMO.into_raw() },
500 2147483648,
501 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
502 &mut self.data
503 ),
504 <fidl::encoding::HandleType<
505 fidl::EventPair,
506 { fidl::ObjectType::EVENTPAIR.into_raw() },
507 2147483648,
508 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
509 &mut self.vmo_token
510 ),
511 ),
512 encoder,
513 offset,
514 _depth,
515 )
516 }
517 }
518 unsafe impl<
519 T0: fidl::encoding::Encode<
520 fidl::encoding::BoundedString<255>,
521 fidl::encoding::DefaultFuchsiaResourceDialect,
522 >,
523 T1: fidl::encoding::Encode<
524 fidl::encoding::HandleType<
525 fidl::Vmo,
526 { fidl::ObjectType::VMO.into_raw() },
527 2147483648,
528 >,
529 fidl::encoding::DefaultFuchsiaResourceDialect,
530 >,
531 T2: fidl::encoding::Encode<
532 fidl::encoding::HandleType<
533 fidl::EventPair,
534 { fidl::ObjectType::EVENTPAIR.into_raw() },
535 2147483648,
536 >,
537 fidl::encoding::DefaultFuchsiaResourceDialect,
538 >,
539 >
540 fidl::encoding::Encode<
541 PublisherPublishRequest,
542 fidl::encoding::DefaultFuchsiaResourceDialect,
543 > for (T0, T1, T2)
544 {
545 #[inline]
546 unsafe fn encode(
547 self,
548 encoder: &mut fidl::encoding::Encoder<
549 '_,
550 fidl::encoding::DefaultFuchsiaResourceDialect,
551 >,
552 offset: usize,
553 depth: fidl::encoding::Depth,
554 ) -> fidl::Result<()> {
555 encoder.debug_check_bounds::<PublisherPublishRequest>(offset);
556 self.0.encode(encoder, offset + 0, depth)?;
560 self.1.encode(encoder, offset + 16, depth)?;
561 self.2.encode(encoder, offset + 20, depth)?;
562 Ok(())
563 }
564 }
565
566 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
567 for PublisherPublishRequest
568 {
569 #[inline(always)]
570 fn new_empty() -> Self {
571 Self {
572 data_sink: fidl::new_empty!(
573 fidl::encoding::BoundedString<255>,
574 fidl::encoding::DefaultFuchsiaResourceDialect
575 ),
576 data: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
577 vmo_token: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
578 }
579 }
580
581 #[inline]
582 unsafe fn decode(
583 &mut self,
584 decoder: &mut fidl::encoding::Decoder<
585 '_,
586 fidl::encoding::DefaultFuchsiaResourceDialect,
587 >,
588 offset: usize,
589 _depth: fidl::encoding::Depth,
590 ) -> fidl::Result<()> {
591 decoder.debug_check_bounds::<Self>(offset);
592 fidl::decode!(
594 fidl::encoding::BoundedString<255>,
595 fidl::encoding::DefaultFuchsiaResourceDialect,
596 &mut self.data_sink,
597 decoder,
598 offset + 0,
599 _depth
600 )?;
601 fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.data, decoder, offset + 16, _depth)?;
602 fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.vmo_token, decoder, offset + 20, _depth)?;
603 Ok(())
604 }
605 }
606}