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_fonts_experimental_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct ProviderListTypefacesRequest {
16 pub request: ListTypefacesRequest,
17 pub iterator: fidl::endpoints::ServerEnd<ListTypefacesIteratorMarker>,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
21 for ProviderListTypefacesRequest
22{
23}
24
25#[derive(Debug, PartialEq)]
26pub struct ProviderGetTypefaceByIdResponse {
27 pub response: fidl_fuchsia_fonts::TypefaceResponse,
28}
29
30impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
31 for ProviderGetTypefaceByIdResponse
32{
33}
34
35#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
36pub struct ListTypefacesIteratorMarker;
37
38impl fidl::endpoints::ProtocolMarker for ListTypefacesIteratorMarker {
39 type Proxy = ListTypefacesIteratorProxy;
40 type RequestStream = ListTypefacesIteratorRequestStream;
41 #[cfg(target_os = "fuchsia")]
42 type SynchronousProxy = ListTypefacesIteratorSynchronousProxy;
43
44 const DEBUG_NAME: &'static str = "(anonymous) ListTypefacesIterator";
45}
46
47pub trait ListTypefacesIteratorProxyInterface: Send + Sync {
48 type GetNextResponseFut: std::future::Future<Output = Result<TypefaceInfoResponse, fidl::Error>>
49 + Send;
50 fn r#get_next(&self) -> Self::GetNextResponseFut;
51}
52#[derive(Debug)]
53#[cfg(target_os = "fuchsia")]
54pub struct ListTypefacesIteratorSynchronousProxy {
55 client: fidl::client::sync::Client,
56}
57
58#[cfg(target_os = "fuchsia")]
59impl fidl::endpoints::SynchronousProxy for ListTypefacesIteratorSynchronousProxy {
60 type Proxy = ListTypefacesIteratorProxy;
61 type Protocol = ListTypefacesIteratorMarker;
62
63 fn from_channel(inner: fidl::Channel) -> Self {
64 Self::new(inner)
65 }
66
67 fn into_channel(self) -> fidl::Channel {
68 self.client.into_channel()
69 }
70
71 fn as_channel(&self) -> &fidl::Channel {
72 self.client.as_channel()
73 }
74}
75
76#[cfg(target_os = "fuchsia")]
77impl ListTypefacesIteratorSynchronousProxy {
78 pub fn new(channel: fidl::Channel) -> Self {
79 let protocol_name =
80 <ListTypefacesIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
81 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
82 }
83
84 pub fn into_channel(self) -> fidl::Channel {
85 self.client.into_channel()
86 }
87
88 pub fn wait_for_event(
91 &self,
92 deadline: zx::MonotonicInstant,
93 ) -> Result<ListTypefacesIteratorEvent, fidl::Error> {
94 ListTypefacesIteratorEvent::decode(self.client.wait_for_event(deadline)?)
95 }
96
97 pub fn r#get_next(
101 &self,
102 ___deadline: zx::MonotonicInstant,
103 ) -> Result<TypefaceInfoResponse, fidl::Error> {
104 let _response = self
105 .client
106 .send_query::<fidl::encoding::EmptyPayload, ListTypefacesIteratorGetNextResponse>(
107 (),
108 0x6592495ffe922cec,
109 fidl::encoding::DynamicFlags::empty(),
110 ___deadline,
111 )?;
112 Ok(_response.response)
113 }
114}
115
116#[cfg(target_os = "fuchsia")]
117impl From<ListTypefacesIteratorSynchronousProxy> for zx::Handle {
118 fn from(value: ListTypefacesIteratorSynchronousProxy) -> Self {
119 value.into_channel().into()
120 }
121}
122
123#[cfg(target_os = "fuchsia")]
124impl From<fidl::Channel> for ListTypefacesIteratorSynchronousProxy {
125 fn from(value: fidl::Channel) -> Self {
126 Self::new(value)
127 }
128}
129
130#[derive(Debug, Clone)]
131pub struct ListTypefacesIteratorProxy {
132 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
133}
134
135impl fidl::endpoints::Proxy for ListTypefacesIteratorProxy {
136 type Protocol = ListTypefacesIteratorMarker;
137
138 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
139 Self::new(inner)
140 }
141
142 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
143 self.client.into_channel().map_err(|client| Self { client })
144 }
145
146 fn as_channel(&self) -> &::fidl::AsyncChannel {
147 self.client.as_channel()
148 }
149}
150
151impl ListTypefacesIteratorProxy {
152 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
154 let protocol_name =
155 <ListTypefacesIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
156 Self { client: fidl::client::Client::new(channel, protocol_name) }
157 }
158
159 pub fn take_event_stream(&self) -> ListTypefacesIteratorEventStream {
165 ListTypefacesIteratorEventStream { event_receiver: self.client.take_event_receiver() }
166 }
167
168 pub fn r#get_next(
172 &self,
173 ) -> fidl::client::QueryResponseFut<
174 TypefaceInfoResponse,
175 fidl::encoding::DefaultFuchsiaResourceDialect,
176 > {
177 ListTypefacesIteratorProxyInterface::r#get_next(self)
178 }
179}
180
181impl ListTypefacesIteratorProxyInterface for ListTypefacesIteratorProxy {
182 type GetNextResponseFut = fidl::client::QueryResponseFut<
183 TypefaceInfoResponse,
184 fidl::encoding::DefaultFuchsiaResourceDialect,
185 >;
186 fn r#get_next(&self) -> Self::GetNextResponseFut {
187 fn _decode(
188 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
189 ) -> Result<TypefaceInfoResponse, fidl::Error> {
190 let _response = fidl::client::decode_transaction_body::<
191 ListTypefacesIteratorGetNextResponse,
192 fidl::encoding::DefaultFuchsiaResourceDialect,
193 0x6592495ffe922cec,
194 >(_buf?)?;
195 Ok(_response.response)
196 }
197 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, TypefaceInfoResponse>(
198 (),
199 0x6592495ffe922cec,
200 fidl::encoding::DynamicFlags::empty(),
201 _decode,
202 )
203 }
204}
205
206pub struct ListTypefacesIteratorEventStream {
207 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
208}
209
210impl std::marker::Unpin for ListTypefacesIteratorEventStream {}
211
212impl futures::stream::FusedStream for ListTypefacesIteratorEventStream {
213 fn is_terminated(&self) -> bool {
214 self.event_receiver.is_terminated()
215 }
216}
217
218impl futures::Stream for ListTypefacesIteratorEventStream {
219 type Item = Result<ListTypefacesIteratorEvent, fidl::Error>;
220
221 fn poll_next(
222 mut self: std::pin::Pin<&mut Self>,
223 cx: &mut std::task::Context<'_>,
224 ) -> std::task::Poll<Option<Self::Item>> {
225 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
226 &mut self.event_receiver,
227 cx
228 )?) {
229 Some(buf) => std::task::Poll::Ready(Some(ListTypefacesIteratorEvent::decode(buf))),
230 None => std::task::Poll::Ready(None),
231 }
232 }
233}
234
235#[derive(Debug)]
236pub enum ListTypefacesIteratorEvent {}
237
238impl ListTypefacesIteratorEvent {
239 fn decode(
241 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
242 ) -> Result<ListTypefacesIteratorEvent, fidl::Error> {
243 let (bytes, _handles) = buf.split_mut();
244 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
245 debug_assert_eq!(tx_header.tx_id, 0);
246 match tx_header.ordinal {
247 _ => Err(fidl::Error::UnknownOrdinal {
248 ordinal: tx_header.ordinal,
249 protocol_name:
250 <ListTypefacesIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
251 }),
252 }
253 }
254}
255
256pub struct ListTypefacesIteratorRequestStream {
258 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
259 is_terminated: bool,
260}
261
262impl std::marker::Unpin for ListTypefacesIteratorRequestStream {}
263
264impl futures::stream::FusedStream for ListTypefacesIteratorRequestStream {
265 fn is_terminated(&self) -> bool {
266 self.is_terminated
267 }
268}
269
270impl fidl::endpoints::RequestStream for ListTypefacesIteratorRequestStream {
271 type Protocol = ListTypefacesIteratorMarker;
272 type ControlHandle = ListTypefacesIteratorControlHandle;
273
274 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
275 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
276 }
277
278 fn control_handle(&self) -> Self::ControlHandle {
279 ListTypefacesIteratorControlHandle { inner: self.inner.clone() }
280 }
281
282 fn into_inner(
283 self,
284 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
285 {
286 (self.inner, self.is_terminated)
287 }
288
289 fn from_inner(
290 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
291 is_terminated: bool,
292 ) -> Self {
293 Self { inner, is_terminated }
294 }
295}
296
297impl futures::Stream for ListTypefacesIteratorRequestStream {
298 type Item = Result<ListTypefacesIteratorRequest, fidl::Error>;
299
300 fn poll_next(
301 mut self: std::pin::Pin<&mut Self>,
302 cx: &mut std::task::Context<'_>,
303 ) -> std::task::Poll<Option<Self::Item>> {
304 let this = &mut *self;
305 if this.inner.check_shutdown(cx) {
306 this.is_terminated = true;
307 return std::task::Poll::Ready(None);
308 }
309 if this.is_terminated {
310 panic!("polled ListTypefacesIteratorRequestStream after completion");
311 }
312 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
313 |bytes, handles| {
314 match this.inner.channel().read_etc(cx, bytes, handles) {
315 std::task::Poll::Ready(Ok(())) => {}
316 std::task::Poll::Pending => return std::task::Poll::Pending,
317 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
318 this.is_terminated = true;
319 return std::task::Poll::Ready(None);
320 }
321 std::task::Poll::Ready(Err(e)) => {
322 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
323 e.into(),
324 ))))
325 }
326 }
327
328 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
330
331 std::task::Poll::Ready(Some(match header.ordinal {
332 0x6592495ffe922cec => {
333 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
334 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
335 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
336 let control_handle = ListTypefacesIteratorControlHandle {
337 inner: this.inner.clone(),
338 };
339 Ok(ListTypefacesIteratorRequest::GetNext {
340 responder: ListTypefacesIteratorGetNextResponder {
341 control_handle: std::mem::ManuallyDrop::new(control_handle),
342 tx_id: header.tx_id,
343 },
344 })
345 }
346 _ => Err(fidl::Error::UnknownOrdinal {
347 ordinal: header.ordinal,
348 protocol_name: <ListTypefacesIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
349 }),
350 }))
351 },
352 )
353 }
354}
355
356#[derive(Debug)]
357pub enum ListTypefacesIteratorRequest {
358 GetNext { responder: ListTypefacesIteratorGetNextResponder },
362}
363
364impl ListTypefacesIteratorRequest {
365 #[allow(irrefutable_let_patterns)]
366 pub fn into_get_next(self) -> Option<(ListTypefacesIteratorGetNextResponder)> {
367 if let ListTypefacesIteratorRequest::GetNext { responder } = self {
368 Some((responder))
369 } else {
370 None
371 }
372 }
373
374 pub fn method_name(&self) -> &'static str {
376 match *self {
377 ListTypefacesIteratorRequest::GetNext { .. } => "get_next",
378 }
379 }
380}
381
382#[derive(Debug, Clone)]
383pub struct ListTypefacesIteratorControlHandle {
384 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
385}
386
387impl fidl::endpoints::ControlHandle for ListTypefacesIteratorControlHandle {
388 fn shutdown(&self) {
389 self.inner.shutdown()
390 }
391 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
392 self.inner.shutdown_with_epitaph(status)
393 }
394
395 fn is_closed(&self) -> bool {
396 self.inner.channel().is_closed()
397 }
398 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
399 self.inner.channel().on_closed()
400 }
401
402 #[cfg(target_os = "fuchsia")]
403 fn signal_peer(
404 &self,
405 clear_mask: zx::Signals,
406 set_mask: zx::Signals,
407 ) -> Result<(), zx_status::Status> {
408 use fidl::Peered;
409 self.inner.channel().signal_peer(clear_mask, set_mask)
410 }
411}
412
413impl ListTypefacesIteratorControlHandle {}
414
415#[must_use = "FIDL methods require a response to be sent"]
416#[derive(Debug)]
417pub struct ListTypefacesIteratorGetNextResponder {
418 control_handle: std::mem::ManuallyDrop<ListTypefacesIteratorControlHandle>,
419 tx_id: u32,
420}
421
422impl std::ops::Drop for ListTypefacesIteratorGetNextResponder {
426 fn drop(&mut self) {
427 self.control_handle.shutdown();
428 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
430 }
431}
432
433impl fidl::endpoints::Responder for ListTypefacesIteratorGetNextResponder {
434 type ControlHandle = ListTypefacesIteratorControlHandle;
435
436 fn control_handle(&self) -> &ListTypefacesIteratorControlHandle {
437 &self.control_handle
438 }
439
440 fn drop_without_shutdown(mut self) {
441 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
443 std::mem::forget(self);
445 }
446}
447
448impl ListTypefacesIteratorGetNextResponder {
449 pub fn send(self, mut response: &TypefaceInfoResponse) -> Result<(), fidl::Error> {
453 let _result = self.send_raw(response);
454 if _result.is_err() {
455 self.control_handle.shutdown();
456 }
457 self.drop_without_shutdown();
458 _result
459 }
460
461 pub fn send_no_shutdown_on_err(
463 self,
464 mut response: &TypefaceInfoResponse,
465 ) -> Result<(), fidl::Error> {
466 let _result = self.send_raw(response);
467 self.drop_without_shutdown();
468 _result
469 }
470
471 fn send_raw(&self, mut response: &TypefaceInfoResponse) -> Result<(), fidl::Error> {
472 self.control_handle.inner.send::<ListTypefacesIteratorGetNextResponse>(
473 (response,),
474 self.tx_id,
475 0x6592495ffe922cec,
476 fidl::encoding::DynamicFlags::empty(),
477 )
478 }
479}
480
481#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
482pub struct ProviderMarker;
483
484impl fidl::endpoints::ProtocolMarker for ProviderMarker {
485 type Proxy = ProviderProxy;
486 type RequestStream = ProviderRequestStream;
487 #[cfg(target_os = "fuchsia")]
488 type SynchronousProxy = ProviderSynchronousProxy;
489
490 const DEBUG_NAME: &'static str = "fuchsia.fonts.experimental.Provider";
491}
492impl fidl::endpoints::DiscoverableProtocolMarker for ProviderMarker {}
493pub type ProviderGetTypefaceByIdResult = Result<fidl_fuchsia_fonts::TypefaceResponse, Error>;
494pub type ProviderListTypefacesResult = Result<(), Error>;
495pub type ProviderGetTypefacesByFamilyResult = Result<TypefaceInfoResponse, Error>;
496
497pub trait ProviderProxyInterface: Send + Sync {
498 type GetTypefaceByIdResponseFut: std::future::Future<Output = Result<ProviderGetTypefaceByIdResult, fidl::Error>>
499 + Send;
500 fn r#get_typeface_by_id(&self, id: u32) -> Self::GetTypefaceByIdResponseFut;
501 type ListTypefacesResponseFut: std::future::Future<Output = Result<ProviderListTypefacesResult, fidl::Error>>
502 + Send;
503 fn r#list_typefaces(
504 &self,
505 request: &ListTypefacesRequest,
506 iterator: fidl::endpoints::ServerEnd<ListTypefacesIteratorMarker>,
507 ) -> Self::ListTypefacesResponseFut;
508 type GetTypefacesByFamilyResponseFut: std::future::Future<Output = Result<ProviderGetTypefacesByFamilyResult, fidl::Error>>
509 + Send;
510 fn r#get_typefaces_by_family(
511 &self,
512 family: &fidl_fuchsia_fonts::FamilyName,
513 ) -> Self::GetTypefacesByFamilyResponseFut;
514}
515#[derive(Debug)]
516#[cfg(target_os = "fuchsia")]
517pub struct ProviderSynchronousProxy {
518 client: fidl::client::sync::Client,
519}
520
521#[cfg(target_os = "fuchsia")]
522impl fidl::endpoints::SynchronousProxy for ProviderSynchronousProxy {
523 type Proxy = ProviderProxy;
524 type Protocol = ProviderMarker;
525
526 fn from_channel(inner: fidl::Channel) -> Self {
527 Self::new(inner)
528 }
529
530 fn into_channel(self) -> fidl::Channel {
531 self.client.into_channel()
532 }
533
534 fn as_channel(&self) -> &fidl::Channel {
535 self.client.as_channel()
536 }
537}
538
539#[cfg(target_os = "fuchsia")]
540impl ProviderSynchronousProxy {
541 pub fn new(channel: fidl::Channel) -> Self {
542 let protocol_name = <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
543 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
544 }
545
546 pub fn into_channel(self) -> fidl::Channel {
547 self.client.into_channel()
548 }
549
550 pub fn wait_for_event(
553 &self,
554 deadline: zx::MonotonicInstant,
555 ) -> Result<ProviderEvent, fidl::Error> {
556 ProviderEvent::decode(self.client.wait_for_event(deadline)?)
557 }
558
559 pub fn r#get_typeface_by_id(
570 &self,
571 mut id: u32,
572 ___deadline: zx::MonotonicInstant,
573 ) -> Result<ProviderGetTypefaceByIdResult, fidl::Error> {
574 let _response = self.client.send_query::<
575 ProviderGetTypefaceByIdRequest,
576 fidl::encoding::ResultType<ProviderGetTypefaceByIdResponse, Error>,
577 >(
578 (id,),
579 0x695e0babbf6c7f2c,
580 fidl::encoding::DynamicFlags::empty(),
581 ___deadline,
582 )?;
583 Ok(_response.map(|x| x.response))
584 }
585
586 pub fn r#list_typefaces(
592 &self,
593 mut request: &ListTypefacesRequest,
594 mut iterator: fidl::endpoints::ServerEnd<ListTypefacesIteratorMarker>,
595 ___deadline: zx::MonotonicInstant,
596 ) -> Result<ProviderListTypefacesResult, fidl::Error> {
597 let _response = self.client.send_query::<
598 ProviderListTypefacesRequest,
599 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
600 >(
601 (request, iterator,),
602 0x5245158a60e08325,
603 fidl::encoding::DynamicFlags::empty(),
604 ___deadline,
605 )?;
606 Ok(_response.map(|x| x))
607 }
608
609 pub fn r#get_typefaces_by_family(
620 &self,
621 mut family: &fidl_fuchsia_fonts::FamilyName,
622 ___deadline: zx::MonotonicInstant,
623 ) -> Result<ProviderGetTypefacesByFamilyResult, fidl::Error> {
624 let _response = self.client.send_query::<
625 ProviderGetTypefacesByFamilyRequest,
626 fidl::encoding::ResultType<ProviderGetTypefacesByFamilyResponse, Error>,
627 >(
628 (family,),
629 0x64450c13bc304356,
630 fidl::encoding::DynamicFlags::empty(),
631 ___deadline,
632 )?;
633 Ok(_response.map(|x| x.response))
634 }
635}
636
637#[cfg(target_os = "fuchsia")]
638impl From<ProviderSynchronousProxy> for zx::Handle {
639 fn from(value: ProviderSynchronousProxy) -> Self {
640 value.into_channel().into()
641 }
642}
643
644#[cfg(target_os = "fuchsia")]
645impl From<fidl::Channel> for ProviderSynchronousProxy {
646 fn from(value: fidl::Channel) -> Self {
647 Self::new(value)
648 }
649}
650
651#[derive(Debug, Clone)]
652pub struct ProviderProxy {
653 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
654}
655
656impl fidl::endpoints::Proxy for ProviderProxy {
657 type Protocol = ProviderMarker;
658
659 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
660 Self::new(inner)
661 }
662
663 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
664 self.client.into_channel().map_err(|client| Self { client })
665 }
666
667 fn as_channel(&self) -> &::fidl::AsyncChannel {
668 self.client.as_channel()
669 }
670}
671
672impl ProviderProxy {
673 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
675 let protocol_name = <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
676 Self { client: fidl::client::Client::new(channel, protocol_name) }
677 }
678
679 pub fn take_event_stream(&self) -> ProviderEventStream {
685 ProviderEventStream { event_receiver: self.client.take_event_receiver() }
686 }
687
688 pub fn r#get_typeface_by_id(
699 &self,
700 mut id: u32,
701 ) -> fidl::client::QueryResponseFut<
702 ProviderGetTypefaceByIdResult,
703 fidl::encoding::DefaultFuchsiaResourceDialect,
704 > {
705 ProviderProxyInterface::r#get_typeface_by_id(self, id)
706 }
707
708 pub fn r#list_typefaces(
714 &self,
715 mut request: &ListTypefacesRequest,
716 mut iterator: fidl::endpoints::ServerEnd<ListTypefacesIteratorMarker>,
717 ) -> fidl::client::QueryResponseFut<
718 ProviderListTypefacesResult,
719 fidl::encoding::DefaultFuchsiaResourceDialect,
720 > {
721 ProviderProxyInterface::r#list_typefaces(self, request, iterator)
722 }
723
724 pub fn r#get_typefaces_by_family(
735 &self,
736 mut family: &fidl_fuchsia_fonts::FamilyName,
737 ) -> fidl::client::QueryResponseFut<
738 ProviderGetTypefacesByFamilyResult,
739 fidl::encoding::DefaultFuchsiaResourceDialect,
740 > {
741 ProviderProxyInterface::r#get_typefaces_by_family(self, family)
742 }
743}
744
745impl ProviderProxyInterface for ProviderProxy {
746 type GetTypefaceByIdResponseFut = fidl::client::QueryResponseFut<
747 ProviderGetTypefaceByIdResult,
748 fidl::encoding::DefaultFuchsiaResourceDialect,
749 >;
750 fn r#get_typeface_by_id(&self, mut id: u32) -> Self::GetTypefaceByIdResponseFut {
751 fn _decode(
752 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
753 ) -> Result<ProviderGetTypefaceByIdResult, fidl::Error> {
754 let _response = fidl::client::decode_transaction_body::<
755 fidl::encoding::ResultType<ProviderGetTypefaceByIdResponse, Error>,
756 fidl::encoding::DefaultFuchsiaResourceDialect,
757 0x695e0babbf6c7f2c,
758 >(_buf?)?;
759 Ok(_response.map(|x| x.response))
760 }
761 self.client
762 .send_query_and_decode::<ProviderGetTypefaceByIdRequest, ProviderGetTypefaceByIdResult>(
763 (id,),
764 0x695e0babbf6c7f2c,
765 fidl::encoding::DynamicFlags::empty(),
766 _decode,
767 )
768 }
769
770 type ListTypefacesResponseFut = fidl::client::QueryResponseFut<
771 ProviderListTypefacesResult,
772 fidl::encoding::DefaultFuchsiaResourceDialect,
773 >;
774 fn r#list_typefaces(
775 &self,
776 mut request: &ListTypefacesRequest,
777 mut iterator: fidl::endpoints::ServerEnd<ListTypefacesIteratorMarker>,
778 ) -> Self::ListTypefacesResponseFut {
779 fn _decode(
780 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
781 ) -> Result<ProviderListTypefacesResult, fidl::Error> {
782 let _response = fidl::client::decode_transaction_body::<
783 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
784 fidl::encoding::DefaultFuchsiaResourceDialect,
785 0x5245158a60e08325,
786 >(_buf?)?;
787 Ok(_response.map(|x| x))
788 }
789 self.client
790 .send_query_and_decode::<ProviderListTypefacesRequest, ProviderListTypefacesResult>(
791 (request, iterator),
792 0x5245158a60e08325,
793 fidl::encoding::DynamicFlags::empty(),
794 _decode,
795 )
796 }
797
798 type GetTypefacesByFamilyResponseFut = fidl::client::QueryResponseFut<
799 ProviderGetTypefacesByFamilyResult,
800 fidl::encoding::DefaultFuchsiaResourceDialect,
801 >;
802 fn r#get_typefaces_by_family(
803 &self,
804 mut family: &fidl_fuchsia_fonts::FamilyName,
805 ) -> Self::GetTypefacesByFamilyResponseFut {
806 fn _decode(
807 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
808 ) -> Result<ProviderGetTypefacesByFamilyResult, fidl::Error> {
809 let _response = fidl::client::decode_transaction_body::<
810 fidl::encoding::ResultType<ProviderGetTypefacesByFamilyResponse, Error>,
811 fidl::encoding::DefaultFuchsiaResourceDialect,
812 0x64450c13bc304356,
813 >(_buf?)?;
814 Ok(_response.map(|x| x.response))
815 }
816 self.client.send_query_and_decode::<
817 ProviderGetTypefacesByFamilyRequest,
818 ProviderGetTypefacesByFamilyResult,
819 >(
820 (family,),
821 0x64450c13bc304356,
822 fidl::encoding::DynamicFlags::empty(),
823 _decode,
824 )
825 }
826}
827
828pub struct ProviderEventStream {
829 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
830}
831
832impl std::marker::Unpin for ProviderEventStream {}
833
834impl futures::stream::FusedStream for ProviderEventStream {
835 fn is_terminated(&self) -> bool {
836 self.event_receiver.is_terminated()
837 }
838}
839
840impl futures::Stream for ProviderEventStream {
841 type Item = Result<ProviderEvent, fidl::Error>;
842
843 fn poll_next(
844 mut self: std::pin::Pin<&mut Self>,
845 cx: &mut std::task::Context<'_>,
846 ) -> std::task::Poll<Option<Self::Item>> {
847 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
848 &mut self.event_receiver,
849 cx
850 )?) {
851 Some(buf) => std::task::Poll::Ready(Some(ProviderEvent::decode(buf))),
852 None => std::task::Poll::Ready(None),
853 }
854 }
855}
856
857#[derive(Debug)]
858pub enum ProviderEvent {}
859
860impl ProviderEvent {
861 fn decode(
863 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
864 ) -> Result<ProviderEvent, fidl::Error> {
865 let (bytes, _handles) = buf.split_mut();
866 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
867 debug_assert_eq!(tx_header.tx_id, 0);
868 match tx_header.ordinal {
869 _ => Err(fidl::Error::UnknownOrdinal {
870 ordinal: tx_header.ordinal,
871 protocol_name: <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
872 }),
873 }
874 }
875}
876
877pub struct ProviderRequestStream {
879 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
880 is_terminated: bool,
881}
882
883impl std::marker::Unpin for ProviderRequestStream {}
884
885impl futures::stream::FusedStream for ProviderRequestStream {
886 fn is_terminated(&self) -> bool {
887 self.is_terminated
888 }
889}
890
891impl fidl::endpoints::RequestStream for ProviderRequestStream {
892 type Protocol = ProviderMarker;
893 type ControlHandle = ProviderControlHandle;
894
895 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
896 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
897 }
898
899 fn control_handle(&self) -> Self::ControlHandle {
900 ProviderControlHandle { inner: self.inner.clone() }
901 }
902
903 fn into_inner(
904 self,
905 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
906 {
907 (self.inner, self.is_terminated)
908 }
909
910 fn from_inner(
911 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
912 is_terminated: bool,
913 ) -> Self {
914 Self { inner, is_terminated }
915 }
916}
917
918impl futures::Stream for ProviderRequestStream {
919 type Item = Result<ProviderRequest, fidl::Error>;
920
921 fn poll_next(
922 mut self: std::pin::Pin<&mut Self>,
923 cx: &mut std::task::Context<'_>,
924 ) -> std::task::Poll<Option<Self::Item>> {
925 let this = &mut *self;
926 if this.inner.check_shutdown(cx) {
927 this.is_terminated = true;
928 return std::task::Poll::Ready(None);
929 }
930 if this.is_terminated {
931 panic!("polled ProviderRequestStream after completion");
932 }
933 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
934 |bytes, handles| {
935 match this.inner.channel().read_etc(cx, bytes, handles) {
936 std::task::Poll::Ready(Ok(())) => {}
937 std::task::Poll::Pending => return std::task::Poll::Pending,
938 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
939 this.is_terminated = true;
940 return std::task::Poll::Ready(None);
941 }
942 std::task::Poll::Ready(Err(e)) => {
943 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
944 e.into(),
945 ))))
946 }
947 }
948
949 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
951
952 std::task::Poll::Ready(Some(match header.ordinal {
953 0x695e0babbf6c7f2c => {
954 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
955 let mut req = fidl::new_empty!(
956 ProviderGetTypefaceByIdRequest,
957 fidl::encoding::DefaultFuchsiaResourceDialect
958 );
959 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProviderGetTypefaceByIdRequest>(&header, _body_bytes, handles, &mut req)?;
960 let control_handle = ProviderControlHandle { inner: this.inner.clone() };
961 Ok(ProviderRequest::GetTypefaceById {
962 id: req.id,
963
964 responder: ProviderGetTypefaceByIdResponder {
965 control_handle: std::mem::ManuallyDrop::new(control_handle),
966 tx_id: header.tx_id,
967 },
968 })
969 }
970 0x5245158a60e08325 => {
971 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
972 let mut req = fidl::new_empty!(
973 ProviderListTypefacesRequest,
974 fidl::encoding::DefaultFuchsiaResourceDialect
975 );
976 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProviderListTypefacesRequest>(&header, _body_bytes, handles, &mut req)?;
977 let control_handle = ProviderControlHandle { inner: this.inner.clone() };
978 Ok(ProviderRequest::ListTypefaces {
979 request: req.request,
980 iterator: req.iterator,
981
982 responder: ProviderListTypefacesResponder {
983 control_handle: std::mem::ManuallyDrop::new(control_handle),
984 tx_id: header.tx_id,
985 },
986 })
987 }
988 0x64450c13bc304356 => {
989 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
990 let mut req = fidl::new_empty!(
991 ProviderGetTypefacesByFamilyRequest,
992 fidl::encoding::DefaultFuchsiaResourceDialect
993 );
994 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProviderGetTypefacesByFamilyRequest>(&header, _body_bytes, handles, &mut req)?;
995 let control_handle = ProviderControlHandle { inner: this.inner.clone() };
996 Ok(ProviderRequest::GetTypefacesByFamily {
997 family: req.family,
998
999 responder: ProviderGetTypefacesByFamilyResponder {
1000 control_handle: std::mem::ManuallyDrop::new(control_handle),
1001 tx_id: header.tx_id,
1002 },
1003 })
1004 }
1005 _ => Err(fidl::Error::UnknownOrdinal {
1006 ordinal: header.ordinal,
1007 protocol_name:
1008 <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1009 }),
1010 }))
1011 },
1012 )
1013 }
1014}
1015
1016#[derive(Debug)]
1018pub enum ProviderRequest {
1019 GetTypefaceById { id: u32, responder: ProviderGetTypefaceByIdResponder },
1030 ListTypefaces {
1036 request: ListTypefacesRequest,
1037 iterator: fidl::endpoints::ServerEnd<ListTypefacesIteratorMarker>,
1038 responder: ProviderListTypefacesResponder,
1039 },
1040 GetTypefacesByFamily {
1051 family: fidl_fuchsia_fonts::FamilyName,
1052 responder: ProviderGetTypefacesByFamilyResponder,
1053 },
1054}
1055
1056impl ProviderRequest {
1057 #[allow(irrefutable_let_patterns)]
1058 pub fn into_get_typeface_by_id(self) -> Option<(u32, ProviderGetTypefaceByIdResponder)> {
1059 if let ProviderRequest::GetTypefaceById { id, responder } = self {
1060 Some((id, responder))
1061 } else {
1062 None
1063 }
1064 }
1065
1066 #[allow(irrefutable_let_patterns)]
1067 pub fn into_list_typefaces(
1068 self,
1069 ) -> Option<(
1070 ListTypefacesRequest,
1071 fidl::endpoints::ServerEnd<ListTypefacesIteratorMarker>,
1072 ProviderListTypefacesResponder,
1073 )> {
1074 if let ProviderRequest::ListTypefaces { request, iterator, responder } = self {
1075 Some((request, iterator, responder))
1076 } else {
1077 None
1078 }
1079 }
1080
1081 #[allow(irrefutable_let_patterns)]
1082 pub fn into_get_typefaces_by_family(
1083 self,
1084 ) -> Option<(fidl_fuchsia_fonts::FamilyName, ProviderGetTypefacesByFamilyResponder)> {
1085 if let ProviderRequest::GetTypefacesByFamily { family, responder } = self {
1086 Some((family, responder))
1087 } else {
1088 None
1089 }
1090 }
1091
1092 pub fn method_name(&self) -> &'static str {
1094 match *self {
1095 ProviderRequest::GetTypefaceById { .. } => "get_typeface_by_id",
1096 ProviderRequest::ListTypefaces { .. } => "list_typefaces",
1097 ProviderRequest::GetTypefacesByFamily { .. } => "get_typefaces_by_family",
1098 }
1099 }
1100}
1101
1102#[derive(Debug, Clone)]
1103pub struct ProviderControlHandle {
1104 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1105}
1106
1107impl fidl::endpoints::ControlHandle for ProviderControlHandle {
1108 fn shutdown(&self) {
1109 self.inner.shutdown()
1110 }
1111 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1112 self.inner.shutdown_with_epitaph(status)
1113 }
1114
1115 fn is_closed(&self) -> bool {
1116 self.inner.channel().is_closed()
1117 }
1118 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1119 self.inner.channel().on_closed()
1120 }
1121
1122 #[cfg(target_os = "fuchsia")]
1123 fn signal_peer(
1124 &self,
1125 clear_mask: zx::Signals,
1126 set_mask: zx::Signals,
1127 ) -> Result<(), zx_status::Status> {
1128 use fidl::Peered;
1129 self.inner.channel().signal_peer(clear_mask, set_mask)
1130 }
1131}
1132
1133impl ProviderControlHandle {}
1134
1135#[must_use = "FIDL methods require a response to be sent"]
1136#[derive(Debug)]
1137pub struct ProviderGetTypefaceByIdResponder {
1138 control_handle: std::mem::ManuallyDrop<ProviderControlHandle>,
1139 tx_id: u32,
1140}
1141
1142impl std::ops::Drop for ProviderGetTypefaceByIdResponder {
1146 fn drop(&mut self) {
1147 self.control_handle.shutdown();
1148 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1150 }
1151}
1152
1153impl fidl::endpoints::Responder for ProviderGetTypefaceByIdResponder {
1154 type ControlHandle = ProviderControlHandle;
1155
1156 fn control_handle(&self) -> &ProviderControlHandle {
1157 &self.control_handle
1158 }
1159
1160 fn drop_without_shutdown(mut self) {
1161 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1163 std::mem::forget(self);
1165 }
1166}
1167
1168impl ProviderGetTypefaceByIdResponder {
1169 pub fn send(
1173 self,
1174 mut result: Result<fidl_fuchsia_fonts::TypefaceResponse, Error>,
1175 ) -> Result<(), fidl::Error> {
1176 let _result = self.send_raw(result);
1177 if _result.is_err() {
1178 self.control_handle.shutdown();
1179 }
1180 self.drop_without_shutdown();
1181 _result
1182 }
1183
1184 pub fn send_no_shutdown_on_err(
1186 self,
1187 mut result: Result<fidl_fuchsia_fonts::TypefaceResponse, Error>,
1188 ) -> Result<(), fidl::Error> {
1189 let _result = self.send_raw(result);
1190 self.drop_without_shutdown();
1191 _result
1192 }
1193
1194 fn send_raw(
1195 &self,
1196 mut result: Result<fidl_fuchsia_fonts::TypefaceResponse, Error>,
1197 ) -> Result<(), fidl::Error> {
1198 self.control_handle
1199 .inner
1200 .send::<fidl::encoding::ResultType<ProviderGetTypefaceByIdResponse, Error>>(
1201 result.as_mut().map_err(|e| *e).map(|response| (response,)),
1202 self.tx_id,
1203 0x695e0babbf6c7f2c,
1204 fidl::encoding::DynamicFlags::empty(),
1205 )
1206 }
1207}
1208
1209#[must_use = "FIDL methods require a response to be sent"]
1210#[derive(Debug)]
1211pub struct ProviderListTypefacesResponder {
1212 control_handle: std::mem::ManuallyDrop<ProviderControlHandle>,
1213 tx_id: u32,
1214}
1215
1216impl std::ops::Drop for ProviderListTypefacesResponder {
1220 fn drop(&mut self) {
1221 self.control_handle.shutdown();
1222 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1224 }
1225}
1226
1227impl fidl::endpoints::Responder for ProviderListTypefacesResponder {
1228 type ControlHandle = ProviderControlHandle;
1229
1230 fn control_handle(&self) -> &ProviderControlHandle {
1231 &self.control_handle
1232 }
1233
1234 fn drop_without_shutdown(mut self) {
1235 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1237 std::mem::forget(self);
1239 }
1240}
1241
1242impl ProviderListTypefacesResponder {
1243 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1247 let _result = self.send_raw(result);
1248 if _result.is_err() {
1249 self.control_handle.shutdown();
1250 }
1251 self.drop_without_shutdown();
1252 _result
1253 }
1254
1255 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1257 let _result = self.send_raw(result);
1258 self.drop_without_shutdown();
1259 _result
1260 }
1261
1262 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1263 self.control_handle
1264 .inner
1265 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
1266 result,
1267 self.tx_id,
1268 0x5245158a60e08325,
1269 fidl::encoding::DynamicFlags::empty(),
1270 )
1271 }
1272}
1273
1274#[must_use = "FIDL methods require a response to be sent"]
1275#[derive(Debug)]
1276pub struct ProviderGetTypefacesByFamilyResponder {
1277 control_handle: std::mem::ManuallyDrop<ProviderControlHandle>,
1278 tx_id: u32,
1279}
1280
1281impl std::ops::Drop for ProviderGetTypefacesByFamilyResponder {
1285 fn drop(&mut self) {
1286 self.control_handle.shutdown();
1287 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1289 }
1290}
1291
1292impl fidl::endpoints::Responder for ProviderGetTypefacesByFamilyResponder {
1293 type ControlHandle = ProviderControlHandle;
1294
1295 fn control_handle(&self) -> &ProviderControlHandle {
1296 &self.control_handle
1297 }
1298
1299 fn drop_without_shutdown(mut self) {
1300 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1302 std::mem::forget(self);
1304 }
1305}
1306
1307impl ProviderGetTypefacesByFamilyResponder {
1308 pub fn send(self, mut result: Result<&TypefaceInfoResponse, Error>) -> Result<(), fidl::Error> {
1312 let _result = self.send_raw(result);
1313 if _result.is_err() {
1314 self.control_handle.shutdown();
1315 }
1316 self.drop_without_shutdown();
1317 _result
1318 }
1319
1320 pub fn send_no_shutdown_on_err(
1322 self,
1323 mut result: Result<&TypefaceInfoResponse, Error>,
1324 ) -> Result<(), fidl::Error> {
1325 let _result = self.send_raw(result);
1326 self.drop_without_shutdown();
1327 _result
1328 }
1329
1330 fn send_raw(
1331 &self,
1332 mut result: Result<&TypefaceInfoResponse, Error>,
1333 ) -> Result<(), fidl::Error> {
1334 self.control_handle.inner.send::<fidl::encoding::ResultType<
1335 ProviderGetTypefacesByFamilyResponse,
1336 Error,
1337 >>(
1338 result.map(|response| (response,)),
1339 self.tx_id,
1340 0x64450c13bc304356,
1341 fidl::encoding::DynamicFlags::empty(),
1342 )
1343 }
1344}
1345
1346mod internal {
1347 use super::*;
1348
1349 impl fidl::encoding::ResourceTypeMarker for ProviderListTypefacesRequest {
1350 type Borrowed<'a> = &'a mut Self;
1351 fn take_or_borrow<'a>(
1352 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1353 ) -> Self::Borrowed<'a> {
1354 value
1355 }
1356 }
1357
1358 unsafe impl fidl::encoding::TypeMarker for ProviderListTypefacesRequest {
1359 type Owned = Self;
1360
1361 #[inline(always)]
1362 fn inline_align(_context: fidl::encoding::Context) -> usize {
1363 8
1364 }
1365
1366 #[inline(always)]
1367 fn inline_size(_context: fidl::encoding::Context) -> usize {
1368 24
1369 }
1370 }
1371
1372 unsafe impl
1373 fidl::encoding::Encode<
1374 ProviderListTypefacesRequest,
1375 fidl::encoding::DefaultFuchsiaResourceDialect,
1376 > for &mut ProviderListTypefacesRequest
1377 {
1378 #[inline]
1379 unsafe fn encode(
1380 self,
1381 encoder: &mut fidl::encoding::Encoder<
1382 '_,
1383 fidl::encoding::DefaultFuchsiaResourceDialect,
1384 >,
1385 offset: usize,
1386 _depth: fidl::encoding::Depth,
1387 ) -> fidl::Result<()> {
1388 encoder.debug_check_bounds::<ProviderListTypefacesRequest>(offset);
1389 fidl::encoding::Encode::<
1391 ProviderListTypefacesRequest,
1392 fidl::encoding::DefaultFuchsiaResourceDialect,
1393 >::encode(
1394 (
1395 <ListTypefacesRequest as fidl::encoding::ValueTypeMarker>::borrow(
1396 &self.request,
1397 ),
1398 <fidl::encoding::Endpoint<
1399 fidl::endpoints::ServerEnd<ListTypefacesIteratorMarker>,
1400 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1401 &mut self.iterator
1402 ),
1403 ),
1404 encoder,
1405 offset,
1406 _depth,
1407 )
1408 }
1409 }
1410 unsafe impl<
1411 T0: fidl::encoding::Encode<
1412 ListTypefacesRequest,
1413 fidl::encoding::DefaultFuchsiaResourceDialect,
1414 >,
1415 T1: fidl::encoding::Encode<
1416 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ListTypefacesIteratorMarker>>,
1417 fidl::encoding::DefaultFuchsiaResourceDialect,
1418 >,
1419 >
1420 fidl::encoding::Encode<
1421 ProviderListTypefacesRequest,
1422 fidl::encoding::DefaultFuchsiaResourceDialect,
1423 > for (T0, T1)
1424 {
1425 #[inline]
1426 unsafe fn encode(
1427 self,
1428 encoder: &mut fidl::encoding::Encoder<
1429 '_,
1430 fidl::encoding::DefaultFuchsiaResourceDialect,
1431 >,
1432 offset: usize,
1433 depth: fidl::encoding::Depth,
1434 ) -> fidl::Result<()> {
1435 encoder.debug_check_bounds::<ProviderListTypefacesRequest>(offset);
1436 unsafe {
1439 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
1440 (ptr as *mut u64).write_unaligned(0);
1441 }
1442 self.0.encode(encoder, offset + 0, depth)?;
1444 self.1.encode(encoder, offset + 16, depth)?;
1445 Ok(())
1446 }
1447 }
1448
1449 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1450 for ProviderListTypefacesRequest
1451 {
1452 #[inline(always)]
1453 fn new_empty() -> Self {
1454 Self {
1455 request: fidl::new_empty!(
1456 ListTypefacesRequest,
1457 fidl::encoding::DefaultFuchsiaResourceDialect
1458 ),
1459 iterator: fidl::new_empty!(
1460 fidl::encoding::Endpoint<
1461 fidl::endpoints::ServerEnd<ListTypefacesIteratorMarker>,
1462 >,
1463 fidl::encoding::DefaultFuchsiaResourceDialect
1464 ),
1465 }
1466 }
1467
1468 #[inline]
1469 unsafe fn decode(
1470 &mut self,
1471 decoder: &mut fidl::encoding::Decoder<
1472 '_,
1473 fidl::encoding::DefaultFuchsiaResourceDialect,
1474 >,
1475 offset: usize,
1476 _depth: fidl::encoding::Depth,
1477 ) -> fidl::Result<()> {
1478 decoder.debug_check_bounds::<Self>(offset);
1479 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
1481 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1482 let mask = 0xffffffff00000000u64;
1483 let maskedval = padval & mask;
1484 if maskedval != 0 {
1485 return Err(fidl::Error::NonZeroPadding {
1486 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
1487 });
1488 }
1489 fidl::decode!(
1490 ListTypefacesRequest,
1491 fidl::encoding::DefaultFuchsiaResourceDialect,
1492 &mut self.request,
1493 decoder,
1494 offset + 0,
1495 _depth
1496 )?;
1497 fidl::decode!(
1498 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ListTypefacesIteratorMarker>>,
1499 fidl::encoding::DefaultFuchsiaResourceDialect,
1500 &mut self.iterator,
1501 decoder,
1502 offset + 16,
1503 _depth
1504 )?;
1505 Ok(())
1506 }
1507 }
1508
1509 impl fidl::encoding::ResourceTypeMarker for ProviderGetTypefaceByIdResponse {
1510 type Borrowed<'a> = &'a mut Self;
1511 fn take_or_borrow<'a>(
1512 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1513 ) -> Self::Borrowed<'a> {
1514 value
1515 }
1516 }
1517
1518 unsafe impl fidl::encoding::TypeMarker for ProviderGetTypefaceByIdResponse {
1519 type Owned = Self;
1520
1521 #[inline(always)]
1522 fn inline_align(_context: fidl::encoding::Context) -> usize {
1523 8
1524 }
1525
1526 #[inline(always)]
1527 fn inline_size(_context: fidl::encoding::Context) -> usize {
1528 16
1529 }
1530 }
1531
1532 unsafe impl
1533 fidl::encoding::Encode<
1534 ProviderGetTypefaceByIdResponse,
1535 fidl::encoding::DefaultFuchsiaResourceDialect,
1536 > for &mut ProviderGetTypefaceByIdResponse
1537 {
1538 #[inline]
1539 unsafe fn encode(
1540 self,
1541 encoder: &mut fidl::encoding::Encoder<
1542 '_,
1543 fidl::encoding::DefaultFuchsiaResourceDialect,
1544 >,
1545 offset: usize,
1546 _depth: fidl::encoding::Depth,
1547 ) -> fidl::Result<()> {
1548 encoder.debug_check_bounds::<ProviderGetTypefaceByIdResponse>(offset);
1549 fidl::encoding::Encode::<ProviderGetTypefaceByIdResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1551 (
1552 <fidl_fuchsia_fonts::TypefaceResponse as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.response),
1553 ),
1554 encoder, offset, _depth
1555 )
1556 }
1557 }
1558 unsafe impl<
1559 T0: fidl::encoding::Encode<
1560 fidl_fuchsia_fonts::TypefaceResponse,
1561 fidl::encoding::DefaultFuchsiaResourceDialect,
1562 >,
1563 >
1564 fidl::encoding::Encode<
1565 ProviderGetTypefaceByIdResponse,
1566 fidl::encoding::DefaultFuchsiaResourceDialect,
1567 > for (T0,)
1568 {
1569 #[inline]
1570 unsafe fn encode(
1571 self,
1572 encoder: &mut fidl::encoding::Encoder<
1573 '_,
1574 fidl::encoding::DefaultFuchsiaResourceDialect,
1575 >,
1576 offset: usize,
1577 depth: fidl::encoding::Depth,
1578 ) -> fidl::Result<()> {
1579 encoder.debug_check_bounds::<ProviderGetTypefaceByIdResponse>(offset);
1580 self.0.encode(encoder, offset + 0, depth)?;
1584 Ok(())
1585 }
1586 }
1587
1588 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1589 for ProviderGetTypefaceByIdResponse
1590 {
1591 #[inline(always)]
1592 fn new_empty() -> Self {
1593 Self {
1594 response: fidl::new_empty!(
1595 fidl_fuchsia_fonts::TypefaceResponse,
1596 fidl::encoding::DefaultFuchsiaResourceDialect
1597 ),
1598 }
1599 }
1600
1601 #[inline]
1602 unsafe fn decode(
1603 &mut self,
1604 decoder: &mut fidl::encoding::Decoder<
1605 '_,
1606 fidl::encoding::DefaultFuchsiaResourceDialect,
1607 >,
1608 offset: usize,
1609 _depth: fidl::encoding::Depth,
1610 ) -> fidl::Result<()> {
1611 decoder.debug_check_bounds::<Self>(offset);
1612 fidl::decode!(
1614 fidl_fuchsia_fonts::TypefaceResponse,
1615 fidl::encoding::DefaultFuchsiaResourceDialect,
1616 &mut self.response,
1617 decoder,
1618 offset + 0,
1619 _depth
1620 )?;
1621 Ok(())
1622 }
1623 }
1624}