fidl_fuchsia_fonts/
fidl_fuchsia_fonts.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![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_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct ProviderGetFontResponse {
16    pub response: Option<Box<Response>>,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ProviderGetFontResponse {}
20
21#[derive(Debug, PartialEq)]
22pub struct ProviderGetTypefaceResponse {
23    pub response: TypefaceResponse,
24}
25
26impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
27    for ProviderGetTypefaceResponse
28{
29}
30
31#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
32pub struct ProviderRegisterFontSetEventListenerRequest {
33    pub listener: fidl::endpoints::ClientEnd<FontSetEventListenerMarker>,
34}
35
36impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
37    for ProviderRegisterFontSetEventListenerRequest
38{
39}
40
41#[derive(Debug, PartialEq)]
42pub struct Response {
43    pub buffer: fidl_fuchsia_mem::Buffer,
44    /// Buffer identifier for the buffer. Responses with the same buffer_id are
45    /// guaranteed to contain the same data in the buffer. Clients may use this
46    /// value to detect if they already have the font cached in parsed form.
47    pub buffer_id: u32,
48    /// Font index within `buffer`. Used for font formats that may contain more
49    /// than one font per file, e.g. TTC (TrueType Collection).
50    pub font_index: u32,
51}
52
53impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Response {}
54
55/// Response to a TypefaceRequest. Contains the digital font file and metadata corresponding to a
56/// returned typeface. Clients are expected to cache the results if they plan to reuse them.
57///
58/// If a matching typeface cannot be found, the table will be empty.
59#[derive(Debug, Default, PartialEq)]
60pub struct TypefaceResponse {
61    /// A memory buffer containing the bytes of a digital font file.
62    /// It is the client's responsibility to identify the type of file and to parse it (usually by
63    /// delegating to FreeType or a similar library).
64    pub buffer: Option<fidl_fuchsia_mem::Buffer>,
65    /// Identifier for the buffer. Responses with the same `buffer_id` are guaranteed to contain the
66    /// same data in the buffer. Clients may use this value to detect if they already have the font
67    /// cached in parsed form.
68    pub buffer_id: Option<u32>,
69    /// Index of the returned typeface within `buffer`. Used for digital font formats that may
70    /// contain more than one typeface per file, e.g. TTC (TrueType Collection).
71    pub font_index: Option<u32>,
72    #[doc(hidden)]
73    pub __source_breaking: fidl::marker::SourceBreaking,
74}
75
76impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for TypefaceResponse {}
77
78#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
79pub struct FontSetEventListenerMarker;
80
81impl fidl::endpoints::ProtocolMarker for FontSetEventListenerMarker {
82    type Proxy = FontSetEventListenerProxy;
83    type RequestStream = FontSetEventListenerRequestStream;
84    #[cfg(target_os = "fuchsia")]
85    type SynchronousProxy = FontSetEventListenerSynchronousProxy;
86
87    const DEBUG_NAME: &'static str = "(anonymous) FontSetEventListener";
88}
89
90pub trait FontSetEventListenerProxyInterface: Send + Sync {
91    type OnFontSetUpdatedResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
92    fn r#on_font_set_updated(
93        &self,
94        event: &FontSetUpdatedEvent,
95    ) -> Self::OnFontSetUpdatedResponseFut;
96}
97#[derive(Debug)]
98#[cfg(target_os = "fuchsia")]
99pub struct FontSetEventListenerSynchronousProxy {
100    client: fidl::client::sync::Client,
101}
102
103#[cfg(target_os = "fuchsia")]
104impl fidl::endpoints::SynchronousProxy for FontSetEventListenerSynchronousProxy {
105    type Proxy = FontSetEventListenerProxy;
106    type Protocol = FontSetEventListenerMarker;
107
108    fn from_channel(inner: fidl::Channel) -> Self {
109        Self::new(inner)
110    }
111
112    fn into_channel(self) -> fidl::Channel {
113        self.client.into_channel()
114    }
115
116    fn as_channel(&self) -> &fidl::Channel {
117        self.client.as_channel()
118    }
119}
120
121#[cfg(target_os = "fuchsia")]
122impl FontSetEventListenerSynchronousProxy {
123    pub fn new(channel: fidl::Channel) -> Self {
124        let protocol_name =
125            <FontSetEventListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
126        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
127    }
128
129    pub fn into_channel(self) -> fidl::Channel {
130        self.client.into_channel()
131    }
132
133    /// Waits until an event arrives and returns it. It is safe for other
134    /// threads to make concurrent requests while waiting for an event.
135    pub fn wait_for_event(
136        &self,
137        deadline: zx::MonotonicInstant,
138    ) -> Result<FontSetEventListenerEvent, fidl::Error> {
139        FontSetEventListenerEvent::decode(self.client.wait_for_event(deadline)?)
140    }
141
142    /// The set of fonts available in the `Provider` has changed. See
143    /// [`fuchsia.fonts/FontSetUpdatedEvent`].
144    pub fn r#on_font_set_updated(
145        &self,
146        mut event: &FontSetUpdatedEvent,
147        ___deadline: zx::MonotonicInstant,
148    ) -> Result<(), fidl::Error> {
149        let _response = self.client.send_query::<
150            FontSetEventListenerOnFontSetUpdatedRequest,
151            fidl::encoding::EmptyPayload,
152        >(
153            (event,),
154            0xf0cd2d121f881f9,
155            fidl::encoding::DynamicFlags::empty(),
156            ___deadline,
157        )?;
158        Ok(_response)
159    }
160}
161
162#[cfg(target_os = "fuchsia")]
163impl From<FontSetEventListenerSynchronousProxy> for zx::Handle {
164    fn from(value: FontSetEventListenerSynchronousProxy) -> Self {
165        value.into_channel().into()
166    }
167}
168
169#[cfg(target_os = "fuchsia")]
170impl From<fidl::Channel> for FontSetEventListenerSynchronousProxy {
171    fn from(value: fidl::Channel) -> Self {
172        Self::new(value)
173    }
174}
175
176#[derive(Debug, Clone)]
177pub struct FontSetEventListenerProxy {
178    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
179}
180
181impl fidl::endpoints::Proxy for FontSetEventListenerProxy {
182    type Protocol = FontSetEventListenerMarker;
183
184    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
185        Self::new(inner)
186    }
187
188    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
189        self.client.into_channel().map_err(|client| Self { client })
190    }
191
192    fn as_channel(&self) -> &::fidl::AsyncChannel {
193        self.client.as_channel()
194    }
195}
196
197impl FontSetEventListenerProxy {
198    /// Create a new Proxy for fuchsia.fonts/FontSetEventListener.
199    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
200        let protocol_name =
201            <FontSetEventListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
202        Self { client: fidl::client::Client::new(channel, protocol_name) }
203    }
204
205    /// Get a Stream of events from the remote end of the protocol.
206    ///
207    /// # Panics
208    ///
209    /// Panics if the event stream was already taken.
210    pub fn take_event_stream(&self) -> FontSetEventListenerEventStream {
211        FontSetEventListenerEventStream { event_receiver: self.client.take_event_receiver() }
212    }
213
214    /// The set of fonts available in the `Provider` has changed. See
215    /// [`fuchsia.fonts/FontSetUpdatedEvent`].
216    pub fn r#on_font_set_updated(
217        &self,
218        mut event: &FontSetUpdatedEvent,
219    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
220        FontSetEventListenerProxyInterface::r#on_font_set_updated(self, event)
221    }
222}
223
224impl FontSetEventListenerProxyInterface for FontSetEventListenerProxy {
225    type OnFontSetUpdatedResponseFut =
226        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
227    fn r#on_font_set_updated(
228        &self,
229        mut event: &FontSetUpdatedEvent,
230    ) -> Self::OnFontSetUpdatedResponseFut {
231        fn _decode(
232            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
233        ) -> Result<(), fidl::Error> {
234            let _response = fidl::client::decode_transaction_body::<
235                fidl::encoding::EmptyPayload,
236                fidl::encoding::DefaultFuchsiaResourceDialect,
237                0xf0cd2d121f881f9,
238            >(_buf?)?;
239            Ok(_response)
240        }
241        self.client.send_query_and_decode::<FontSetEventListenerOnFontSetUpdatedRequest, ()>(
242            (event,),
243            0xf0cd2d121f881f9,
244            fidl::encoding::DynamicFlags::empty(),
245            _decode,
246        )
247    }
248}
249
250pub struct FontSetEventListenerEventStream {
251    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
252}
253
254impl std::marker::Unpin for FontSetEventListenerEventStream {}
255
256impl futures::stream::FusedStream for FontSetEventListenerEventStream {
257    fn is_terminated(&self) -> bool {
258        self.event_receiver.is_terminated()
259    }
260}
261
262impl futures::Stream for FontSetEventListenerEventStream {
263    type Item = Result<FontSetEventListenerEvent, fidl::Error>;
264
265    fn poll_next(
266        mut self: std::pin::Pin<&mut Self>,
267        cx: &mut std::task::Context<'_>,
268    ) -> std::task::Poll<Option<Self::Item>> {
269        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
270            &mut self.event_receiver,
271            cx
272        )?) {
273            Some(buf) => std::task::Poll::Ready(Some(FontSetEventListenerEvent::decode(buf))),
274            None => std::task::Poll::Ready(None),
275        }
276    }
277}
278
279#[derive(Debug)]
280pub enum FontSetEventListenerEvent {}
281
282impl FontSetEventListenerEvent {
283    /// Decodes a message buffer as a [`FontSetEventListenerEvent`].
284    fn decode(
285        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
286    ) -> Result<FontSetEventListenerEvent, fidl::Error> {
287        let (bytes, _handles) = buf.split_mut();
288        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
289        debug_assert_eq!(tx_header.tx_id, 0);
290        match tx_header.ordinal {
291            _ => Err(fidl::Error::UnknownOrdinal {
292                ordinal: tx_header.ordinal,
293                protocol_name:
294                    <FontSetEventListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
295            }),
296        }
297    }
298}
299
300/// A Stream of incoming requests for fuchsia.fonts/FontSetEventListener.
301pub struct FontSetEventListenerRequestStream {
302    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
303    is_terminated: bool,
304}
305
306impl std::marker::Unpin for FontSetEventListenerRequestStream {}
307
308impl futures::stream::FusedStream for FontSetEventListenerRequestStream {
309    fn is_terminated(&self) -> bool {
310        self.is_terminated
311    }
312}
313
314impl fidl::endpoints::RequestStream for FontSetEventListenerRequestStream {
315    type Protocol = FontSetEventListenerMarker;
316    type ControlHandle = FontSetEventListenerControlHandle;
317
318    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
319        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
320    }
321
322    fn control_handle(&self) -> Self::ControlHandle {
323        FontSetEventListenerControlHandle { inner: self.inner.clone() }
324    }
325
326    fn into_inner(
327        self,
328    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
329    {
330        (self.inner, self.is_terminated)
331    }
332
333    fn from_inner(
334        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
335        is_terminated: bool,
336    ) -> Self {
337        Self { inner, is_terminated }
338    }
339}
340
341impl futures::Stream for FontSetEventListenerRequestStream {
342    type Item = Result<FontSetEventListenerRequest, fidl::Error>;
343
344    fn poll_next(
345        mut self: std::pin::Pin<&mut Self>,
346        cx: &mut std::task::Context<'_>,
347    ) -> std::task::Poll<Option<Self::Item>> {
348        let this = &mut *self;
349        if this.inner.check_shutdown(cx) {
350            this.is_terminated = true;
351            return std::task::Poll::Ready(None);
352        }
353        if this.is_terminated {
354            panic!("polled FontSetEventListenerRequestStream after completion");
355        }
356        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
357            |bytes, handles| {
358                match this.inner.channel().read_etc(cx, bytes, handles) {
359                    std::task::Poll::Ready(Ok(())) => {}
360                    std::task::Poll::Pending => return std::task::Poll::Pending,
361                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
362                        this.is_terminated = true;
363                        return std::task::Poll::Ready(None);
364                    }
365                    std::task::Poll::Ready(Err(e)) => {
366                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
367                            e.into(),
368                        ))))
369                    }
370                }
371
372                // A message has been received from the channel
373                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
374
375                std::task::Poll::Ready(Some(match header.ordinal {
376                0xf0cd2d121f881f9 => {
377                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
378                    let mut req = fidl::new_empty!(FontSetEventListenerOnFontSetUpdatedRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
379                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FontSetEventListenerOnFontSetUpdatedRequest>(&header, _body_bytes, handles, &mut req)?;
380                    let control_handle = FontSetEventListenerControlHandle {
381                        inner: this.inner.clone(),
382                    };
383                    Ok(FontSetEventListenerRequest::OnFontSetUpdated {event: req.event,
384
385                        responder: FontSetEventListenerOnFontSetUpdatedResponder {
386                            control_handle: std::mem::ManuallyDrop::new(control_handle),
387                            tx_id: header.tx_id,
388                        },
389                    })
390                }
391                _ => Err(fidl::Error::UnknownOrdinal {
392                    ordinal: header.ordinal,
393                    protocol_name: <FontSetEventListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
394                }),
395            }))
396            },
397        )
398    }
399}
400
401/// Protocol for listening to possible events that may occur in the `Provider`'s set of fonts.
402///
403/// Register a listener using [`fuchsia.fonts/Provider.RegisterFontSetEventListener`].
404#[derive(Debug)]
405pub enum FontSetEventListenerRequest {
406    /// The set of fonts available in the `Provider` has changed. See
407    /// [`fuchsia.fonts/FontSetUpdatedEvent`].
408    OnFontSetUpdated {
409        event: FontSetUpdatedEvent,
410        responder: FontSetEventListenerOnFontSetUpdatedResponder,
411    },
412}
413
414impl FontSetEventListenerRequest {
415    #[allow(irrefutable_let_patterns)]
416    pub fn into_on_font_set_updated(
417        self,
418    ) -> Option<(FontSetUpdatedEvent, FontSetEventListenerOnFontSetUpdatedResponder)> {
419        if let FontSetEventListenerRequest::OnFontSetUpdated { event, responder } = self {
420            Some((event, responder))
421        } else {
422            None
423        }
424    }
425
426    /// Name of the method defined in FIDL
427    pub fn method_name(&self) -> &'static str {
428        match *self {
429            FontSetEventListenerRequest::OnFontSetUpdated { .. } => "on_font_set_updated",
430        }
431    }
432}
433
434#[derive(Debug, Clone)]
435pub struct FontSetEventListenerControlHandle {
436    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
437}
438
439impl fidl::endpoints::ControlHandle for FontSetEventListenerControlHandle {
440    fn shutdown(&self) {
441        self.inner.shutdown()
442    }
443    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
444        self.inner.shutdown_with_epitaph(status)
445    }
446
447    fn is_closed(&self) -> bool {
448        self.inner.channel().is_closed()
449    }
450    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
451        self.inner.channel().on_closed()
452    }
453
454    #[cfg(target_os = "fuchsia")]
455    fn signal_peer(
456        &self,
457        clear_mask: zx::Signals,
458        set_mask: zx::Signals,
459    ) -> Result<(), zx_status::Status> {
460        use fidl::Peered;
461        self.inner.channel().signal_peer(clear_mask, set_mask)
462    }
463}
464
465impl FontSetEventListenerControlHandle {}
466
467#[must_use = "FIDL methods require a response to be sent"]
468#[derive(Debug)]
469pub struct FontSetEventListenerOnFontSetUpdatedResponder {
470    control_handle: std::mem::ManuallyDrop<FontSetEventListenerControlHandle>,
471    tx_id: u32,
472}
473
474/// Set the the channel to be shutdown (see [`FontSetEventListenerControlHandle::shutdown`])
475/// if the responder is dropped without sending a response, so that the client
476/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
477impl std::ops::Drop for FontSetEventListenerOnFontSetUpdatedResponder {
478    fn drop(&mut self) {
479        self.control_handle.shutdown();
480        // Safety: drops once, never accessed again
481        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
482    }
483}
484
485impl fidl::endpoints::Responder for FontSetEventListenerOnFontSetUpdatedResponder {
486    type ControlHandle = FontSetEventListenerControlHandle;
487
488    fn control_handle(&self) -> &FontSetEventListenerControlHandle {
489        &self.control_handle
490    }
491
492    fn drop_without_shutdown(mut self) {
493        // Safety: drops once, never accessed again due to mem::forget
494        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
495        // Prevent Drop from running (which would shut down the channel)
496        std::mem::forget(self);
497    }
498}
499
500impl FontSetEventListenerOnFontSetUpdatedResponder {
501    /// Sends a response to the FIDL transaction.
502    ///
503    /// Sets the channel to shutdown if an error occurs.
504    pub fn send(self) -> Result<(), fidl::Error> {
505        let _result = self.send_raw();
506        if _result.is_err() {
507            self.control_handle.shutdown();
508        }
509        self.drop_without_shutdown();
510        _result
511    }
512
513    /// Similar to "send" but does not shutdown the channel if an error occurs.
514    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
515        let _result = self.send_raw();
516        self.drop_without_shutdown();
517        _result
518    }
519
520    fn send_raw(&self) -> Result<(), fidl::Error> {
521        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
522            (),
523            self.tx_id,
524            0xf0cd2d121f881f9,
525            fidl::encoding::DynamicFlags::empty(),
526        )
527    }
528}
529
530#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
531pub struct ProviderMarker;
532
533impl fidl::endpoints::ProtocolMarker for ProviderMarker {
534    type Proxy = ProviderProxy;
535    type RequestStream = ProviderRequestStream;
536    #[cfg(target_os = "fuchsia")]
537    type SynchronousProxy = ProviderSynchronousProxy;
538
539    const DEBUG_NAME: &'static str = "fuchsia.fonts.Provider";
540}
541impl fidl::endpoints::DiscoverableProtocolMarker for ProviderMarker {}
542
543pub trait ProviderProxyInterface: Send + Sync {
544    type GetFontResponseFut: std::future::Future<Output = Result<Option<Box<Response>>, fidl::Error>>
545        + Send;
546    fn r#get_font(&self, request: &Request) -> Self::GetFontResponseFut;
547    type GetFamilyInfoResponseFut: std::future::Future<Output = Result<Option<Box<FamilyInfo>>, fidl::Error>>
548        + Send;
549    fn r#get_family_info(&self, family: &str) -> Self::GetFamilyInfoResponseFut;
550    type GetTypefaceResponseFut: std::future::Future<Output = Result<TypefaceResponse, fidl::Error>>
551        + Send;
552    fn r#get_typeface(&self, request: &TypefaceRequest) -> Self::GetTypefaceResponseFut;
553    type GetFontFamilyInfoResponseFut: std::future::Future<Output = Result<FontFamilyInfo, fidl::Error>>
554        + Send;
555    fn r#get_font_family_info(&self, family: &FamilyName) -> Self::GetFontFamilyInfoResponseFut;
556    type RegisterFontSetEventListenerResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
557        + Send;
558    fn r#register_font_set_event_listener(
559        &self,
560        listener: fidl::endpoints::ClientEnd<FontSetEventListenerMarker>,
561    ) -> Self::RegisterFontSetEventListenerResponseFut;
562}
563#[derive(Debug)]
564#[cfg(target_os = "fuchsia")]
565pub struct ProviderSynchronousProxy {
566    client: fidl::client::sync::Client,
567}
568
569#[cfg(target_os = "fuchsia")]
570impl fidl::endpoints::SynchronousProxy for ProviderSynchronousProxy {
571    type Proxy = ProviderProxy;
572    type Protocol = ProviderMarker;
573
574    fn from_channel(inner: fidl::Channel) -> Self {
575        Self::new(inner)
576    }
577
578    fn into_channel(self) -> fidl::Channel {
579        self.client.into_channel()
580    }
581
582    fn as_channel(&self) -> &fidl::Channel {
583        self.client.as_channel()
584    }
585}
586
587#[cfg(target_os = "fuchsia")]
588impl ProviderSynchronousProxy {
589    pub fn new(channel: fidl::Channel) -> Self {
590        let protocol_name = <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
591        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
592    }
593
594    pub fn into_channel(self) -> fidl::Channel {
595        self.client.into_channel()
596    }
597
598    /// Waits until an event arrives and returns it. It is safe for other
599    /// threads to make concurrent requests while waiting for an event.
600    pub fn wait_for_event(
601        &self,
602        deadline: zx::MonotonicInstant,
603    ) -> Result<ProviderEvent, fidl::Error> {
604        ProviderEvent::decode(self.client.wait_for_event(deadline)?)
605    }
606
607    /// Deprecated. See `GetTypeface`.
608    ///
609    /// Returns font that matches specified `request`.
610    pub fn r#get_font(
611        &self,
612        mut request: &Request,
613        ___deadline: zx::MonotonicInstant,
614    ) -> Result<Option<Box<Response>>, fidl::Error> {
615        let _response = self.client.send_query::<ProviderGetFontRequest, ProviderGetFontResponse>(
616            (request,),
617            0x6daeaad83184076b,
618            fidl::encoding::DynamicFlags::empty(),
619            ___deadline,
620        )?;
621        Ok(_response.response)
622    }
623
624    /// Deprecated. See `GetFontFamilyInfo`.
625    ///
626    /// Returns information for the specified font family or null if there is
627    /// no family with the specified name. This function respects family name
628    /// aliases and ignores case, so request for "robotoSLAB" will return
629    /// FamilyInfo for "Roboto Slab".
630    pub fn r#get_family_info(
631        &self,
632        mut family: &str,
633        ___deadline: zx::MonotonicInstant,
634    ) -> Result<Option<Box<FamilyInfo>>, fidl::Error> {
635        let _response =
636            self.client.send_query::<ProviderGetFamilyInfoRequest, ProviderGetFamilyInfoResponse>(
637                (family,),
638                0x27aba13280090db3,
639                fidl::encoding::DynamicFlags::empty(),
640                ___deadline,
641            )?;
642        Ok(_response.family_info)
643    }
644
645    /// Returns a typeface that matches the specified `request`, or an empty table if no matching
646    /// face is found. (The latter is more likely to happen if `TypefaceRequestFlags.EXACT_FAMILY`
647    /// is used to disable fallbacks.)
648    pub fn r#get_typeface(
649        &self,
650        mut request: &TypefaceRequest,
651        ___deadline: zx::MonotonicInstant,
652    ) -> Result<TypefaceResponse, fidl::Error> {
653        let _response =
654            self.client.send_query::<ProviderGetTypefaceRequest, ProviderGetTypefaceResponse>(
655                (request,),
656                0x5481d24f1a4b0671,
657                fidl::encoding::DynamicFlags::empty(),
658                ___deadline,
659            )?;
660        Ok(_response.response)
661    }
662
663    /// Returns information for the specified font family, or an empty table if there is no family
664    /// with the specified name.
665    ///
666    /// This function respects family name aliases and ignores case. For example, "RobotoSlab" is an
667    /// alias for the canonical name "Roboto Slab". A request for "robotoSLAB" would return the
668    /// `FontFamilyInfo` for "Roboto Slab" due to the case-insensitivity and alias resolution.
669    pub fn r#get_font_family_info(
670        &self,
671        mut family: &FamilyName,
672        ___deadline: zx::MonotonicInstant,
673    ) -> Result<FontFamilyInfo, fidl::Error> {
674        let _response = self
675            .client
676            .send_query::<ProviderGetFontFamilyInfoRequest, ProviderGetFontFamilyInfoResponse>(
677                (family,),
678                0x7520ee83bf25c9ca,
679                fidl::encoding::DynamicFlags::empty(),
680                ___deadline,
681            )?;
682        Ok(_response.family_info)
683    }
684
685    /// Register a listener to be notified when the set of available fonts or mappings has changed.
686    /// A client can register as many listeners as it wishes.
687    ///
688    /// To unregister, close the channel.
689    pub fn r#register_font_set_event_listener(
690        &self,
691        mut listener: fidl::endpoints::ClientEnd<FontSetEventListenerMarker>,
692        ___deadline: zx::MonotonicInstant,
693    ) -> Result<(), fidl::Error> {
694        let _response = self.client.send_query::<
695            ProviderRegisterFontSetEventListenerRequest,
696            fidl::encoding::EmptyPayload,
697        >(
698            (listener,),
699            0x196898fd17cb694c,
700            fidl::encoding::DynamicFlags::empty(),
701            ___deadline,
702        )?;
703        Ok(_response)
704    }
705}
706
707#[cfg(target_os = "fuchsia")]
708impl From<ProviderSynchronousProxy> for zx::Handle {
709    fn from(value: ProviderSynchronousProxy) -> Self {
710        value.into_channel().into()
711    }
712}
713
714#[cfg(target_os = "fuchsia")]
715impl From<fidl::Channel> for ProviderSynchronousProxy {
716    fn from(value: fidl::Channel) -> Self {
717        Self::new(value)
718    }
719}
720
721#[derive(Debug, Clone)]
722pub struct ProviderProxy {
723    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
724}
725
726impl fidl::endpoints::Proxy for ProviderProxy {
727    type Protocol = ProviderMarker;
728
729    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
730        Self::new(inner)
731    }
732
733    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
734        self.client.into_channel().map_err(|client| Self { client })
735    }
736
737    fn as_channel(&self) -> &::fidl::AsyncChannel {
738        self.client.as_channel()
739    }
740}
741
742impl ProviderProxy {
743    /// Create a new Proxy for fuchsia.fonts/Provider.
744    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
745        let protocol_name = <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
746        Self { client: fidl::client::Client::new(channel, protocol_name) }
747    }
748
749    /// Get a Stream of events from the remote end of the protocol.
750    ///
751    /// # Panics
752    ///
753    /// Panics if the event stream was already taken.
754    pub fn take_event_stream(&self) -> ProviderEventStream {
755        ProviderEventStream { event_receiver: self.client.take_event_receiver() }
756    }
757
758    /// Deprecated. See `GetTypeface`.
759    ///
760    /// Returns font that matches specified `request`.
761    pub fn r#get_font(
762        &self,
763        mut request: &Request,
764    ) -> fidl::client::QueryResponseFut<
765        Option<Box<Response>>,
766        fidl::encoding::DefaultFuchsiaResourceDialect,
767    > {
768        ProviderProxyInterface::r#get_font(self, request)
769    }
770
771    /// Deprecated. See `GetFontFamilyInfo`.
772    ///
773    /// Returns information for the specified font family or null if there is
774    /// no family with the specified name. This function respects family name
775    /// aliases and ignores case, so request for "robotoSLAB" will return
776    /// FamilyInfo for "Roboto Slab".
777    pub fn r#get_family_info(
778        &self,
779        mut family: &str,
780    ) -> fidl::client::QueryResponseFut<
781        Option<Box<FamilyInfo>>,
782        fidl::encoding::DefaultFuchsiaResourceDialect,
783    > {
784        ProviderProxyInterface::r#get_family_info(self, family)
785    }
786
787    /// Returns a typeface that matches the specified `request`, or an empty table if no matching
788    /// face is found. (The latter is more likely to happen if `TypefaceRequestFlags.EXACT_FAMILY`
789    /// is used to disable fallbacks.)
790    pub fn r#get_typeface(
791        &self,
792        mut request: &TypefaceRequest,
793    ) -> fidl::client::QueryResponseFut<
794        TypefaceResponse,
795        fidl::encoding::DefaultFuchsiaResourceDialect,
796    > {
797        ProviderProxyInterface::r#get_typeface(self, request)
798    }
799
800    /// Returns information for the specified font family, or an empty table if there is no family
801    /// with the specified name.
802    ///
803    /// This function respects family name aliases and ignores case. For example, "RobotoSlab" is an
804    /// alias for the canonical name "Roboto Slab". A request for "robotoSLAB" would return the
805    /// `FontFamilyInfo` for "Roboto Slab" due to the case-insensitivity and alias resolution.
806    pub fn r#get_font_family_info(
807        &self,
808        mut family: &FamilyName,
809    ) -> fidl::client::QueryResponseFut<FontFamilyInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
810    {
811        ProviderProxyInterface::r#get_font_family_info(self, family)
812    }
813
814    /// Register a listener to be notified when the set of available fonts or mappings has changed.
815    /// A client can register as many listeners as it wishes.
816    ///
817    /// To unregister, close the channel.
818    pub fn r#register_font_set_event_listener(
819        &self,
820        mut listener: fidl::endpoints::ClientEnd<FontSetEventListenerMarker>,
821    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
822        ProviderProxyInterface::r#register_font_set_event_listener(self, listener)
823    }
824}
825
826impl ProviderProxyInterface for ProviderProxy {
827    type GetFontResponseFut = fidl::client::QueryResponseFut<
828        Option<Box<Response>>,
829        fidl::encoding::DefaultFuchsiaResourceDialect,
830    >;
831    fn r#get_font(&self, mut request: &Request) -> Self::GetFontResponseFut {
832        fn _decode(
833            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
834        ) -> Result<Option<Box<Response>>, fidl::Error> {
835            let _response = fidl::client::decode_transaction_body::<
836                ProviderGetFontResponse,
837                fidl::encoding::DefaultFuchsiaResourceDialect,
838                0x6daeaad83184076b,
839            >(_buf?)?;
840            Ok(_response.response)
841        }
842        self.client.send_query_and_decode::<ProviderGetFontRequest, Option<Box<Response>>>(
843            (request,),
844            0x6daeaad83184076b,
845            fidl::encoding::DynamicFlags::empty(),
846            _decode,
847        )
848    }
849
850    type GetFamilyInfoResponseFut = fidl::client::QueryResponseFut<
851        Option<Box<FamilyInfo>>,
852        fidl::encoding::DefaultFuchsiaResourceDialect,
853    >;
854    fn r#get_family_info(&self, mut family: &str) -> Self::GetFamilyInfoResponseFut {
855        fn _decode(
856            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
857        ) -> Result<Option<Box<FamilyInfo>>, fidl::Error> {
858            let _response = fidl::client::decode_transaction_body::<
859                ProviderGetFamilyInfoResponse,
860                fidl::encoding::DefaultFuchsiaResourceDialect,
861                0x27aba13280090db3,
862            >(_buf?)?;
863            Ok(_response.family_info)
864        }
865        self.client.send_query_and_decode::<ProviderGetFamilyInfoRequest, Option<Box<FamilyInfo>>>(
866            (family,),
867            0x27aba13280090db3,
868            fidl::encoding::DynamicFlags::empty(),
869            _decode,
870        )
871    }
872
873    type GetTypefaceResponseFut = fidl::client::QueryResponseFut<
874        TypefaceResponse,
875        fidl::encoding::DefaultFuchsiaResourceDialect,
876    >;
877    fn r#get_typeface(&self, mut request: &TypefaceRequest) -> Self::GetTypefaceResponseFut {
878        fn _decode(
879            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
880        ) -> Result<TypefaceResponse, fidl::Error> {
881            let _response = fidl::client::decode_transaction_body::<
882                ProviderGetTypefaceResponse,
883                fidl::encoding::DefaultFuchsiaResourceDialect,
884                0x5481d24f1a4b0671,
885            >(_buf?)?;
886            Ok(_response.response)
887        }
888        self.client.send_query_and_decode::<ProviderGetTypefaceRequest, TypefaceResponse>(
889            (request,),
890            0x5481d24f1a4b0671,
891            fidl::encoding::DynamicFlags::empty(),
892            _decode,
893        )
894    }
895
896    type GetFontFamilyInfoResponseFut = fidl::client::QueryResponseFut<
897        FontFamilyInfo,
898        fidl::encoding::DefaultFuchsiaResourceDialect,
899    >;
900    fn r#get_font_family_info(
901        &self,
902        mut family: &FamilyName,
903    ) -> Self::GetFontFamilyInfoResponseFut {
904        fn _decode(
905            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
906        ) -> Result<FontFamilyInfo, fidl::Error> {
907            let _response = fidl::client::decode_transaction_body::<
908                ProviderGetFontFamilyInfoResponse,
909                fidl::encoding::DefaultFuchsiaResourceDialect,
910                0x7520ee83bf25c9ca,
911            >(_buf?)?;
912            Ok(_response.family_info)
913        }
914        self.client.send_query_and_decode::<ProviderGetFontFamilyInfoRequest, FontFamilyInfo>(
915            (family,),
916            0x7520ee83bf25c9ca,
917            fidl::encoding::DynamicFlags::empty(),
918            _decode,
919        )
920    }
921
922    type RegisterFontSetEventListenerResponseFut =
923        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
924    fn r#register_font_set_event_listener(
925        &self,
926        mut listener: fidl::endpoints::ClientEnd<FontSetEventListenerMarker>,
927    ) -> Self::RegisterFontSetEventListenerResponseFut {
928        fn _decode(
929            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
930        ) -> Result<(), fidl::Error> {
931            let _response = fidl::client::decode_transaction_body::<
932                fidl::encoding::EmptyPayload,
933                fidl::encoding::DefaultFuchsiaResourceDialect,
934                0x196898fd17cb694c,
935            >(_buf?)?;
936            Ok(_response)
937        }
938        self.client.send_query_and_decode::<ProviderRegisterFontSetEventListenerRequest, ()>(
939            (listener,),
940            0x196898fd17cb694c,
941            fidl::encoding::DynamicFlags::empty(),
942            _decode,
943        )
944    }
945}
946
947pub struct ProviderEventStream {
948    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
949}
950
951impl std::marker::Unpin for ProviderEventStream {}
952
953impl futures::stream::FusedStream for ProviderEventStream {
954    fn is_terminated(&self) -> bool {
955        self.event_receiver.is_terminated()
956    }
957}
958
959impl futures::Stream for ProviderEventStream {
960    type Item = Result<ProviderEvent, fidl::Error>;
961
962    fn poll_next(
963        mut self: std::pin::Pin<&mut Self>,
964        cx: &mut std::task::Context<'_>,
965    ) -> std::task::Poll<Option<Self::Item>> {
966        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
967            &mut self.event_receiver,
968            cx
969        )?) {
970            Some(buf) => std::task::Poll::Ready(Some(ProviderEvent::decode(buf))),
971            None => std::task::Poll::Ready(None),
972        }
973    }
974}
975
976#[derive(Debug)]
977pub enum ProviderEvent {}
978
979impl ProviderEvent {
980    /// Decodes a message buffer as a [`ProviderEvent`].
981    fn decode(
982        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
983    ) -> Result<ProviderEvent, fidl::Error> {
984        let (bytes, _handles) = buf.split_mut();
985        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
986        debug_assert_eq!(tx_header.tx_id, 0);
987        match tx_header.ordinal {
988            _ => Err(fidl::Error::UnknownOrdinal {
989                ordinal: tx_header.ordinal,
990                protocol_name: <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
991            }),
992        }
993    }
994}
995
996/// A Stream of incoming requests for fuchsia.fonts/Provider.
997pub struct ProviderRequestStream {
998    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
999    is_terminated: bool,
1000}
1001
1002impl std::marker::Unpin for ProviderRequestStream {}
1003
1004impl futures::stream::FusedStream for ProviderRequestStream {
1005    fn is_terminated(&self) -> bool {
1006        self.is_terminated
1007    }
1008}
1009
1010impl fidl::endpoints::RequestStream for ProviderRequestStream {
1011    type Protocol = ProviderMarker;
1012    type ControlHandle = ProviderControlHandle;
1013
1014    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1015        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1016    }
1017
1018    fn control_handle(&self) -> Self::ControlHandle {
1019        ProviderControlHandle { inner: self.inner.clone() }
1020    }
1021
1022    fn into_inner(
1023        self,
1024    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1025    {
1026        (self.inner, self.is_terminated)
1027    }
1028
1029    fn from_inner(
1030        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1031        is_terminated: bool,
1032    ) -> Self {
1033        Self { inner, is_terminated }
1034    }
1035}
1036
1037impl futures::Stream for ProviderRequestStream {
1038    type Item = Result<ProviderRequest, fidl::Error>;
1039
1040    fn poll_next(
1041        mut self: std::pin::Pin<&mut Self>,
1042        cx: &mut std::task::Context<'_>,
1043    ) -> std::task::Poll<Option<Self::Item>> {
1044        let this = &mut *self;
1045        if this.inner.check_shutdown(cx) {
1046            this.is_terminated = true;
1047            return std::task::Poll::Ready(None);
1048        }
1049        if this.is_terminated {
1050            panic!("polled ProviderRequestStream after completion");
1051        }
1052        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1053            |bytes, handles| {
1054                match this.inner.channel().read_etc(cx, bytes, handles) {
1055                    std::task::Poll::Ready(Ok(())) => {}
1056                    std::task::Poll::Pending => return std::task::Poll::Pending,
1057                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1058                        this.is_terminated = true;
1059                        return std::task::Poll::Ready(None);
1060                    }
1061                    std::task::Poll::Ready(Err(e)) => {
1062                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1063                            e.into(),
1064                        ))))
1065                    }
1066                }
1067
1068                // A message has been received from the channel
1069                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1070
1071                std::task::Poll::Ready(Some(match header.ordinal {
1072                    0x6daeaad83184076b => {
1073                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1074                        let mut req = fidl::new_empty!(
1075                            ProviderGetFontRequest,
1076                            fidl::encoding::DefaultFuchsiaResourceDialect
1077                        );
1078                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProviderGetFontRequest>(&header, _body_bytes, handles, &mut req)?;
1079                        let control_handle = ProviderControlHandle { inner: this.inner.clone() };
1080                        Ok(ProviderRequest::GetFont {
1081                            request: req.request,
1082
1083                            responder: ProviderGetFontResponder {
1084                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1085                                tx_id: header.tx_id,
1086                            },
1087                        })
1088                    }
1089                    0x27aba13280090db3 => {
1090                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1091                        let mut req = fidl::new_empty!(
1092                            ProviderGetFamilyInfoRequest,
1093                            fidl::encoding::DefaultFuchsiaResourceDialect
1094                        );
1095                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProviderGetFamilyInfoRequest>(&header, _body_bytes, handles, &mut req)?;
1096                        let control_handle = ProviderControlHandle { inner: this.inner.clone() };
1097                        Ok(ProviderRequest::GetFamilyInfo {
1098                            family: req.family,
1099
1100                            responder: ProviderGetFamilyInfoResponder {
1101                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1102                                tx_id: header.tx_id,
1103                            },
1104                        })
1105                    }
1106                    0x5481d24f1a4b0671 => {
1107                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1108                        let mut req = fidl::new_empty!(
1109                            ProviderGetTypefaceRequest,
1110                            fidl::encoding::DefaultFuchsiaResourceDialect
1111                        );
1112                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProviderGetTypefaceRequest>(&header, _body_bytes, handles, &mut req)?;
1113                        let control_handle = ProviderControlHandle { inner: this.inner.clone() };
1114                        Ok(ProviderRequest::GetTypeface {
1115                            request: req.request,
1116
1117                            responder: ProviderGetTypefaceResponder {
1118                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1119                                tx_id: header.tx_id,
1120                            },
1121                        })
1122                    }
1123                    0x7520ee83bf25c9ca => {
1124                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1125                        let mut req = fidl::new_empty!(
1126                            ProviderGetFontFamilyInfoRequest,
1127                            fidl::encoding::DefaultFuchsiaResourceDialect
1128                        );
1129                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProviderGetFontFamilyInfoRequest>(&header, _body_bytes, handles, &mut req)?;
1130                        let control_handle = ProviderControlHandle { inner: this.inner.clone() };
1131                        Ok(ProviderRequest::GetFontFamilyInfo {
1132                            family: req.family,
1133
1134                            responder: ProviderGetFontFamilyInfoResponder {
1135                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1136                                tx_id: header.tx_id,
1137                            },
1138                        })
1139                    }
1140                    0x196898fd17cb694c => {
1141                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1142                        let mut req = fidl::new_empty!(
1143                            ProviderRegisterFontSetEventListenerRequest,
1144                            fidl::encoding::DefaultFuchsiaResourceDialect
1145                        );
1146                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProviderRegisterFontSetEventListenerRequest>(&header, _body_bytes, handles, &mut req)?;
1147                        let control_handle = ProviderControlHandle { inner: this.inner.clone() };
1148                        Ok(ProviderRequest::RegisterFontSetEventListener {
1149                            listener: req.listener,
1150
1151                            responder: ProviderRegisterFontSetEventListenerResponder {
1152                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1153                                tx_id: header.tx_id,
1154                            },
1155                        })
1156                    }
1157                    _ => Err(fidl::Error::UnknownOrdinal {
1158                        ordinal: header.ordinal,
1159                        protocol_name:
1160                            <ProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1161                    }),
1162                }))
1163            },
1164        )
1165    }
1166}
1167
1168/// Provider of digital font files and metadata.
1169///
1170/// TODO(https://fxbug.dev/42170326): Remove deprecated methods and move to provider.fidl.
1171#[derive(Debug)]
1172pub enum ProviderRequest {
1173    /// Deprecated. See `GetTypeface`.
1174    ///
1175    /// Returns font that matches specified `request`.
1176    GetFont { request: Request, responder: ProviderGetFontResponder },
1177    /// Deprecated. See `GetFontFamilyInfo`.
1178    ///
1179    /// Returns information for the specified font family or null if there is
1180    /// no family with the specified name. This function respects family name
1181    /// aliases and ignores case, so request for "robotoSLAB" will return
1182    /// FamilyInfo for "Roboto Slab".
1183    GetFamilyInfo { family: String, responder: ProviderGetFamilyInfoResponder },
1184    /// Returns a typeface that matches the specified `request`, or an empty table if no matching
1185    /// face is found. (The latter is more likely to happen if `TypefaceRequestFlags.EXACT_FAMILY`
1186    /// is used to disable fallbacks.)
1187    GetTypeface { request: TypefaceRequest, responder: ProviderGetTypefaceResponder },
1188    /// Returns information for the specified font family, or an empty table if there is no family
1189    /// with the specified name.
1190    ///
1191    /// This function respects family name aliases and ignores case. For example, "RobotoSlab" is an
1192    /// alias for the canonical name "Roboto Slab". A request for "robotoSLAB" would return the
1193    /// `FontFamilyInfo` for "Roboto Slab" due to the case-insensitivity and alias resolution.
1194    GetFontFamilyInfo { family: FamilyName, responder: ProviderGetFontFamilyInfoResponder },
1195    /// Register a listener to be notified when the set of available fonts or mappings has changed.
1196    /// A client can register as many listeners as it wishes.
1197    ///
1198    /// To unregister, close the channel.
1199    RegisterFontSetEventListener {
1200        listener: fidl::endpoints::ClientEnd<FontSetEventListenerMarker>,
1201        responder: ProviderRegisterFontSetEventListenerResponder,
1202    },
1203}
1204
1205impl ProviderRequest {
1206    #[allow(irrefutable_let_patterns)]
1207    pub fn into_get_font(self) -> Option<(Request, ProviderGetFontResponder)> {
1208        if let ProviderRequest::GetFont { request, responder } = self {
1209            Some((request, responder))
1210        } else {
1211            None
1212        }
1213    }
1214
1215    #[allow(irrefutable_let_patterns)]
1216    pub fn into_get_family_info(self) -> Option<(String, ProviderGetFamilyInfoResponder)> {
1217        if let ProviderRequest::GetFamilyInfo { family, responder } = self {
1218            Some((family, responder))
1219        } else {
1220            None
1221        }
1222    }
1223
1224    #[allow(irrefutable_let_patterns)]
1225    pub fn into_get_typeface(self) -> Option<(TypefaceRequest, ProviderGetTypefaceResponder)> {
1226        if let ProviderRequest::GetTypeface { request, responder } = self {
1227            Some((request, responder))
1228        } else {
1229            None
1230        }
1231    }
1232
1233    #[allow(irrefutable_let_patterns)]
1234    pub fn into_get_font_family_info(
1235        self,
1236    ) -> Option<(FamilyName, ProviderGetFontFamilyInfoResponder)> {
1237        if let ProviderRequest::GetFontFamilyInfo { family, responder } = self {
1238            Some((family, responder))
1239        } else {
1240            None
1241        }
1242    }
1243
1244    #[allow(irrefutable_let_patterns)]
1245    pub fn into_register_font_set_event_listener(
1246        self,
1247    ) -> Option<(
1248        fidl::endpoints::ClientEnd<FontSetEventListenerMarker>,
1249        ProviderRegisterFontSetEventListenerResponder,
1250    )> {
1251        if let ProviderRequest::RegisterFontSetEventListener { listener, responder } = self {
1252            Some((listener, responder))
1253        } else {
1254            None
1255        }
1256    }
1257
1258    /// Name of the method defined in FIDL
1259    pub fn method_name(&self) -> &'static str {
1260        match *self {
1261            ProviderRequest::GetFont { .. } => "get_font",
1262            ProviderRequest::GetFamilyInfo { .. } => "get_family_info",
1263            ProviderRequest::GetTypeface { .. } => "get_typeface",
1264            ProviderRequest::GetFontFamilyInfo { .. } => "get_font_family_info",
1265            ProviderRequest::RegisterFontSetEventListener { .. } => {
1266                "register_font_set_event_listener"
1267            }
1268        }
1269    }
1270}
1271
1272#[derive(Debug, Clone)]
1273pub struct ProviderControlHandle {
1274    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1275}
1276
1277impl fidl::endpoints::ControlHandle for ProviderControlHandle {
1278    fn shutdown(&self) {
1279        self.inner.shutdown()
1280    }
1281    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1282        self.inner.shutdown_with_epitaph(status)
1283    }
1284
1285    fn is_closed(&self) -> bool {
1286        self.inner.channel().is_closed()
1287    }
1288    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1289        self.inner.channel().on_closed()
1290    }
1291
1292    #[cfg(target_os = "fuchsia")]
1293    fn signal_peer(
1294        &self,
1295        clear_mask: zx::Signals,
1296        set_mask: zx::Signals,
1297    ) -> Result<(), zx_status::Status> {
1298        use fidl::Peered;
1299        self.inner.channel().signal_peer(clear_mask, set_mask)
1300    }
1301}
1302
1303impl ProviderControlHandle {}
1304
1305#[must_use = "FIDL methods require a response to be sent"]
1306#[derive(Debug)]
1307pub struct ProviderGetFontResponder {
1308    control_handle: std::mem::ManuallyDrop<ProviderControlHandle>,
1309    tx_id: u32,
1310}
1311
1312/// Set the the channel to be shutdown (see [`ProviderControlHandle::shutdown`])
1313/// if the responder is dropped without sending a response, so that the client
1314/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1315impl std::ops::Drop for ProviderGetFontResponder {
1316    fn drop(&mut self) {
1317        self.control_handle.shutdown();
1318        // Safety: drops once, never accessed again
1319        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1320    }
1321}
1322
1323impl fidl::endpoints::Responder for ProviderGetFontResponder {
1324    type ControlHandle = ProviderControlHandle;
1325
1326    fn control_handle(&self) -> &ProviderControlHandle {
1327        &self.control_handle
1328    }
1329
1330    fn drop_without_shutdown(mut self) {
1331        // Safety: drops once, never accessed again due to mem::forget
1332        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1333        // Prevent Drop from running (which would shut down the channel)
1334        std::mem::forget(self);
1335    }
1336}
1337
1338impl ProviderGetFontResponder {
1339    /// Sends a response to the FIDL transaction.
1340    ///
1341    /// Sets the channel to shutdown if an error occurs.
1342    pub fn send(self, mut response: Option<Response>) -> Result<(), fidl::Error> {
1343        let _result = self.send_raw(response);
1344        if _result.is_err() {
1345            self.control_handle.shutdown();
1346        }
1347        self.drop_without_shutdown();
1348        _result
1349    }
1350
1351    /// Similar to "send" but does not shutdown the channel if an error occurs.
1352    pub fn send_no_shutdown_on_err(
1353        self,
1354        mut response: Option<Response>,
1355    ) -> Result<(), fidl::Error> {
1356        let _result = self.send_raw(response);
1357        self.drop_without_shutdown();
1358        _result
1359    }
1360
1361    fn send_raw(&self, mut response: Option<Response>) -> Result<(), fidl::Error> {
1362        self.control_handle.inner.send::<ProviderGetFontResponse>(
1363            (response.as_mut(),),
1364            self.tx_id,
1365            0x6daeaad83184076b,
1366            fidl::encoding::DynamicFlags::empty(),
1367        )
1368    }
1369}
1370
1371#[must_use = "FIDL methods require a response to be sent"]
1372#[derive(Debug)]
1373pub struct ProviderGetFamilyInfoResponder {
1374    control_handle: std::mem::ManuallyDrop<ProviderControlHandle>,
1375    tx_id: u32,
1376}
1377
1378/// Set the the channel to be shutdown (see [`ProviderControlHandle::shutdown`])
1379/// if the responder is dropped without sending a response, so that the client
1380/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1381impl std::ops::Drop for ProviderGetFamilyInfoResponder {
1382    fn drop(&mut self) {
1383        self.control_handle.shutdown();
1384        // Safety: drops once, never accessed again
1385        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1386    }
1387}
1388
1389impl fidl::endpoints::Responder for ProviderGetFamilyInfoResponder {
1390    type ControlHandle = ProviderControlHandle;
1391
1392    fn control_handle(&self) -> &ProviderControlHandle {
1393        &self.control_handle
1394    }
1395
1396    fn drop_without_shutdown(mut self) {
1397        // Safety: drops once, never accessed again due to mem::forget
1398        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1399        // Prevent Drop from running (which would shut down the channel)
1400        std::mem::forget(self);
1401    }
1402}
1403
1404impl ProviderGetFamilyInfoResponder {
1405    /// Sends a response to the FIDL transaction.
1406    ///
1407    /// Sets the channel to shutdown if an error occurs.
1408    pub fn send(self, mut family_info: Option<&FamilyInfo>) -> Result<(), fidl::Error> {
1409        let _result = self.send_raw(family_info);
1410        if _result.is_err() {
1411            self.control_handle.shutdown();
1412        }
1413        self.drop_without_shutdown();
1414        _result
1415    }
1416
1417    /// Similar to "send" but does not shutdown the channel if an error occurs.
1418    pub fn send_no_shutdown_on_err(
1419        self,
1420        mut family_info: Option<&FamilyInfo>,
1421    ) -> Result<(), fidl::Error> {
1422        let _result = self.send_raw(family_info);
1423        self.drop_without_shutdown();
1424        _result
1425    }
1426
1427    fn send_raw(&self, mut family_info: Option<&FamilyInfo>) -> Result<(), fidl::Error> {
1428        self.control_handle.inner.send::<ProviderGetFamilyInfoResponse>(
1429            (family_info,),
1430            self.tx_id,
1431            0x27aba13280090db3,
1432            fidl::encoding::DynamicFlags::empty(),
1433        )
1434    }
1435}
1436
1437#[must_use = "FIDL methods require a response to be sent"]
1438#[derive(Debug)]
1439pub struct ProviderGetTypefaceResponder {
1440    control_handle: std::mem::ManuallyDrop<ProviderControlHandle>,
1441    tx_id: u32,
1442}
1443
1444/// Set the the channel to be shutdown (see [`ProviderControlHandle::shutdown`])
1445/// if the responder is dropped without sending a response, so that the client
1446/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1447impl std::ops::Drop for ProviderGetTypefaceResponder {
1448    fn drop(&mut self) {
1449        self.control_handle.shutdown();
1450        // Safety: drops once, never accessed again
1451        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1452    }
1453}
1454
1455impl fidl::endpoints::Responder for ProviderGetTypefaceResponder {
1456    type ControlHandle = ProviderControlHandle;
1457
1458    fn control_handle(&self) -> &ProviderControlHandle {
1459        &self.control_handle
1460    }
1461
1462    fn drop_without_shutdown(mut self) {
1463        // Safety: drops once, never accessed again due to mem::forget
1464        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1465        // Prevent Drop from running (which would shut down the channel)
1466        std::mem::forget(self);
1467    }
1468}
1469
1470impl ProviderGetTypefaceResponder {
1471    /// Sends a response to the FIDL transaction.
1472    ///
1473    /// Sets the channel to shutdown if an error occurs.
1474    pub fn send(self, mut response: TypefaceResponse) -> Result<(), fidl::Error> {
1475        let _result = self.send_raw(response);
1476        if _result.is_err() {
1477            self.control_handle.shutdown();
1478        }
1479        self.drop_without_shutdown();
1480        _result
1481    }
1482
1483    /// Similar to "send" but does not shutdown the channel if an error occurs.
1484    pub fn send_no_shutdown_on_err(
1485        self,
1486        mut response: TypefaceResponse,
1487    ) -> Result<(), fidl::Error> {
1488        let _result = self.send_raw(response);
1489        self.drop_without_shutdown();
1490        _result
1491    }
1492
1493    fn send_raw(&self, mut response: TypefaceResponse) -> Result<(), fidl::Error> {
1494        self.control_handle.inner.send::<ProviderGetTypefaceResponse>(
1495            (&mut response,),
1496            self.tx_id,
1497            0x5481d24f1a4b0671,
1498            fidl::encoding::DynamicFlags::empty(),
1499        )
1500    }
1501}
1502
1503#[must_use = "FIDL methods require a response to be sent"]
1504#[derive(Debug)]
1505pub struct ProviderGetFontFamilyInfoResponder {
1506    control_handle: std::mem::ManuallyDrop<ProviderControlHandle>,
1507    tx_id: u32,
1508}
1509
1510/// Set the the channel to be shutdown (see [`ProviderControlHandle::shutdown`])
1511/// if the responder is dropped without sending a response, so that the client
1512/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1513impl std::ops::Drop for ProviderGetFontFamilyInfoResponder {
1514    fn drop(&mut self) {
1515        self.control_handle.shutdown();
1516        // Safety: drops once, never accessed again
1517        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1518    }
1519}
1520
1521impl fidl::endpoints::Responder for ProviderGetFontFamilyInfoResponder {
1522    type ControlHandle = ProviderControlHandle;
1523
1524    fn control_handle(&self) -> &ProviderControlHandle {
1525        &self.control_handle
1526    }
1527
1528    fn drop_without_shutdown(mut self) {
1529        // Safety: drops once, never accessed again due to mem::forget
1530        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1531        // Prevent Drop from running (which would shut down the channel)
1532        std::mem::forget(self);
1533    }
1534}
1535
1536impl ProviderGetFontFamilyInfoResponder {
1537    /// Sends a response to the FIDL transaction.
1538    ///
1539    /// Sets the channel to shutdown if an error occurs.
1540    pub fn send(self, mut family_info: &FontFamilyInfo) -> Result<(), fidl::Error> {
1541        let _result = self.send_raw(family_info);
1542        if _result.is_err() {
1543            self.control_handle.shutdown();
1544        }
1545        self.drop_without_shutdown();
1546        _result
1547    }
1548
1549    /// Similar to "send" but does not shutdown the channel if an error occurs.
1550    pub fn send_no_shutdown_on_err(
1551        self,
1552        mut family_info: &FontFamilyInfo,
1553    ) -> Result<(), fidl::Error> {
1554        let _result = self.send_raw(family_info);
1555        self.drop_without_shutdown();
1556        _result
1557    }
1558
1559    fn send_raw(&self, mut family_info: &FontFamilyInfo) -> Result<(), fidl::Error> {
1560        self.control_handle.inner.send::<ProviderGetFontFamilyInfoResponse>(
1561            (family_info,),
1562            self.tx_id,
1563            0x7520ee83bf25c9ca,
1564            fidl::encoding::DynamicFlags::empty(),
1565        )
1566    }
1567}
1568
1569#[must_use = "FIDL methods require a response to be sent"]
1570#[derive(Debug)]
1571pub struct ProviderRegisterFontSetEventListenerResponder {
1572    control_handle: std::mem::ManuallyDrop<ProviderControlHandle>,
1573    tx_id: u32,
1574}
1575
1576/// Set the the channel to be shutdown (see [`ProviderControlHandle::shutdown`])
1577/// if the responder is dropped without sending a response, so that the client
1578/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1579impl std::ops::Drop for ProviderRegisterFontSetEventListenerResponder {
1580    fn drop(&mut self) {
1581        self.control_handle.shutdown();
1582        // Safety: drops once, never accessed again
1583        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1584    }
1585}
1586
1587impl fidl::endpoints::Responder for ProviderRegisterFontSetEventListenerResponder {
1588    type ControlHandle = ProviderControlHandle;
1589
1590    fn control_handle(&self) -> &ProviderControlHandle {
1591        &self.control_handle
1592    }
1593
1594    fn drop_without_shutdown(mut self) {
1595        // Safety: drops once, never accessed again due to mem::forget
1596        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1597        // Prevent Drop from running (which would shut down the channel)
1598        std::mem::forget(self);
1599    }
1600}
1601
1602impl ProviderRegisterFontSetEventListenerResponder {
1603    /// Sends a response to the FIDL transaction.
1604    ///
1605    /// Sets the channel to shutdown if an error occurs.
1606    pub fn send(self) -> Result<(), fidl::Error> {
1607        let _result = self.send_raw();
1608        if _result.is_err() {
1609            self.control_handle.shutdown();
1610        }
1611        self.drop_without_shutdown();
1612        _result
1613    }
1614
1615    /// Similar to "send" but does not shutdown the channel if an error occurs.
1616    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1617        let _result = self.send_raw();
1618        self.drop_without_shutdown();
1619        _result
1620    }
1621
1622    fn send_raw(&self) -> Result<(), fidl::Error> {
1623        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1624            (),
1625            self.tx_id,
1626            0x196898fd17cb694c,
1627            fidl::encoding::DynamicFlags::empty(),
1628        )
1629    }
1630}
1631
1632mod internal {
1633    use super::*;
1634
1635    impl fidl::encoding::ResourceTypeMarker for ProviderGetFontResponse {
1636        type Borrowed<'a> = &'a mut Self;
1637        fn take_or_borrow<'a>(
1638            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1639        ) -> Self::Borrowed<'a> {
1640            value
1641        }
1642    }
1643
1644    unsafe impl fidl::encoding::TypeMarker for ProviderGetFontResponse {
1645        type Owned = Self;
1646
1647        #[inline(always)]
1648        fn inline_align(_context: fidl::encoding::Context) -> usize {
1649            8
1650        }
1651
1652        #[inline(always)]
1653        fn inline_size(_context: fidl::encoding::Context) -> usize {
1654            8
1655        }
1656    }
1657
1658    unsafe impl
1659        fidl::encoding::Encode<
1660            ProviderGetFontResponse,
1661            fidl::encoding::DefaultFuchsiaResourceDialect,
1662        > for &mut ProviderGetFontResponse
1663    {
1664        #[inline]
1665        unsafe fn encode(
1666            self,
1667            encoder: &mut fidl::encoding::Encoder<
1668                '_,
1669                fidl::encoding::DefaultFuchsiaResourceDialect,
1670            >,
1671            offset: usize,
1672            _depth: fidl::encoding::Depth,
1673        ) -> fidl::Result<()> {
1674            encoder.debug_check_bounds::<ProviderGetFontResponse>(offset);
1675            // Delegate to tuple encoding.
1676            fidl::encoding::Encode::<ProviderGetFontResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1677                (
1678                    <fidl::encoding::Boxed<Response> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.response),
1679                ),
1680                encoder, offset, _depth
1681            )
1682        }
1683    }
1684    unsafe impl<
1685            T0: fidl::encoding::Encode<
1686                fidl::encoding::Boxed<Response>,
1687                fidl::encoding::DefaultFuchsiaResourceDialect,
1688            >,
1689        >
1690        fidl::encoding::Encode<
1691            ProviderGetFontResponse,
1692            fidl::encoding::DefaultFuchsiaResourceDialect,
1693        > for (T0,)
1694    {
1695        #[inline]
1696        unsafe fn encode(
1697            self,
1698            encoder: &mut fidl::encoding::Encoder<
1699                '_,
1700                fidl::encoding::DefaultFuchsiaResourceDialect,
1701            >,
1702            offset: usize,
1703            depth: fidl::encoding::Depth,
1704        ) -> fidl::Result<()> {
1705            encoder.debug_check_bounds::<ProviderGetFontResponse>(offset);
1706            // Zero out padding regions. There's no need to apply masks
1707            // because the unmasked parts will be overwritten by fields.
1708            // Write the fields.
1709            self.0.encode(encoder, offset + 0, depth)?;
1710            Ok(())
1711        }
1712    }
1713
1714    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1715        for ProviderGetFontResponse
1716    {
1717        #[inline(always)]
1718        fn new_empty() -> Self {
1719            Self {
1720                response: fidl::new_empty!(
1721                    fidl::encoding::Boxed<Response>,
1722                    fidl::encoding::DefaultFuchsiaResourceDialect
1723                ),
1724            }
1725        }
1726
1727        #[inline]
1728        unsafe fn decode(
1729            &mut self,
1730            decoder: &mut fidl::encoding::Decoder<
1731                '_,
1732                fidl::encoding::DefaultFuchsiaResourceDialect,
1733            >,
1734            offset: usize,
1735            _depth: fidl::encoding::Depth,
1736        ) -> fidl::Result<()> {
1737            decoder.debug_check_bounds::<Self>(offset);
1738            // Verify that padding bytes are zero.
1739            fidl::decode!(
1740                fidl::encoding::Boxed<Response>,
1741                fidl::encoding::DefaultFuchsiaResourceDialect,
1742                &mut self.response,
1743                decoder,
1744                offset + 0,
1745                _depth
1746            )?;
1747            Ok(())
1748        }
1749    }
1750
1751    impl fidl::encoding::ResourceTypeMarker for ProviderGetTypefaceResponse {
1752        type Borrowed<'a> = &'a mut Self;
1753        fn take_or_borrow<'a>(
1754            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1755        ) -> Self::Borrowed<'a> {
1756            value
1757        }
1758    }
1759
1760    unsafe impl fidl::encoding::TypeMarker for ProviderGetTypefaceResponse {
1761        type Owned = Self;
1762
1763        #[inline(always)]
1764        fn inline_align(_context: fidl::encoding::Context) -> usize {
1765            8
1766        }
1767
1768        #[inline(always)]
1769        fn inline_size(_context: fidl::encoding::Context) -> usize {
1770            16
1771        }
1772    }
1773
1774    unsafe impl
1775        fidl::encoding::Encode<
1776            ProviderGetTypefaceResponse,
1777            fidl::encoding::DefaultFuchsiaResourceDialect,
1778        > for &mut ProviderGetTypefaceResponse
1779    {
1780        #[inline]
1781        unsafe fn encode(
1782            self,
1783            encoder: &mut fidl::encoding::Encoder<
1784                '_,
1785                fidl::encoding::DefaultFuchsiaResourceDialect,
1786            >,
1787            offset: usize,
1788            _depth: fidl::encoding::Depth,
1789        ) -> fidl::Result<()> {
1790            encoder.debug_check_bounds::<ProviderGetTypefaceResponse>(offset);
1791            // Delegate to tuple encoding.
1792            fidl::encoding::Encode::<
1793                ProviderGetTypefaceResponse,
1794                fidl::encoding::DefaultFuchsiaResourceDialect,
1795            >::encode(
1796                (<TypefaceResponse as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1797                    &mut self.response,
1798                ),),
1799                encoder,
1800                offset,
1801                _depth,
1802            )
1803        }
1804    }
1805    unsafe impl<
1806            T0: fidl::encoding::Encode<TypefaceResponse, fidl::encoding::DefaultFuchsiaResourceDialect>,
1807        >
1808        fidl::encoding::Encode<
1809            ProviderGetTypefaceResponse,
1810            fidl::encoding::DefaultFuchsiaResourceDialect,
1811        > for (T0,)
1812    {
1813        #[inline]
1814        unsafe fn encode(
1815            self,
1816            encoder: &mut fidl::encoding::Encoder<
1817                '_,
1818                fidl::encoding::DefaultFuchsiaResourceDialect,
1819            >,
1820            offset: usize,
1821            depth: fidl::encoding::Depth,
1822        ) -> fidl::Result<()> {
1823            encoder.debug_check_bounds::<ProviderGetTypefaceResponse>(offset);
1824            // Zero out padding regions. There's no need to apply masks
1825            // because the unmasked parts will be overwritten by fields.
1826            // Write the fields.
1827            self.0.encode(encoder, offset + 0, depth)?;
1828            Ok(())
1829        }
1830    }
1831
1832    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1833        for ProviderGetTypefaceResponse
1834    {
1835        #[inline(always)]
1836        fn new_empty() -> Self {
1837            Self {
1838                response: fidl::new_empty!(
1839                    TypefaceResponse,
1840                    fidl::encoding::DefaultFuchsiaResourceDialect
1841                ),
1842            }
1843        }
1844
1845        #[inline]
1846        unsafe fn decode(
1847            &mut self,
1848            decoder: &mut fidl::encoding::Decoder<
1849                '_,
1850                fidl::encoding::DefaultFuchsiaResourceDialect,
1851            >,
1852            offset: usize,
1853            _depth: fidl::encoding::Depth,
1854        ) -> fidl::Result<()> {
1855            decoder.debug_check_bounds::<Self>(offset);
1856            // Verify that padding bytes are zero.
1857            fidl::decode!(
1858                TypefaceResponse,
1859                fidl::encoding::DefaultFuchsiaResourceDialect,
1860                &mut self.response,
1861                decoder,
1862                offset + 0,
1863                _depth
1864            )?;
1865            Ok(())
1866        }
1867    }
1868
1869    impl fidl::encoding::ResourceTypeMarker for ProviderRegisterFontSetEventListenerRequest {
1870        type Borrowed<'a> = &'a mut Self;
1871        fn take_or_borrow<'a>(
1872            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1873        ) -> Self::Borrowed<'a> {
1874            value
1875        }
1876    }
1877
1878    unsafe impl fidl::encoding::TypeMarker for ProviderRegisterFontSetEventListenerRequest {
1879        type Owned = Self;
1880
1881        #[inline(always)]
1882        fn inline_align(_context: fidl::encoding::Context) -> usize {
1883            4
1884        }
1885
1886        #[inline(always)]
1887        fn inline_size(_context: fidl::encoding::Context) -> usize {
1888            4
1889        }
1890    }
1891
1892    unsafe impl
1893        fidl::encoding::Encode<
1894            ProviderRegisterFontSetEventListenerRequest,
1895            fidl::encoding::DefaultFuchsiaResourceDialect,
1896        > for &mut ProviderRegisterFontSetEventListenerRequest
1897    {
1898        #[inline]
1899        unsafe fn encode(
1900            self,
1901            encoder: &mut fidl::encoding::Encoder<
1902                '_,
1903                fidl::encoding::DefaultFuchsiaResourceDialect,
1904            >,
1905            offset: usize,
1906            _depth: fidl::encoding::Depth,
1907        ) -> fidl::Result<()> {
1908            encoder.debug_check_bounds::<ProviderRegisterFontSetEventListenerRequest>(offset);
1909            // Delegate to tuple encoding.
1910            fidl::encoding::Encode::<
1911                ProviderRegisterFontSetEventListenerRequest,
1912                fidl::encoding::DefaultFuchsiaResourceDialect,
1913            >::encode(
1914                (
1915                    <fidl::encoding::Endpoint<
1916                        fidl::endpoints::ClientEnd<FontSetEventListenerMarker>,
1917                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1918                        &mut self.listener
1919                    ),
1920                ),
1921                encoder,
1922                offset,
1923                _depth,
1924            )
1925        }
1926    }
1927    unsafe impl<
1928            T0: fidl::encoding::Encode<
1929                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<FontSetEventListenerMarker>>,
1930                fidl::encoding::DefaultFuchsiaResourceDialect,
1931            >,
1932        >
1933        fidl::encoding::Encode<
1934            ProviderRegisterFontSetEventListenerRequest,
1935            fidl::encoding::DefaultFuchsiaResourceDialect,
1936        > for (T0,)
1937    {
1938        #[inline]
1939        unsafe fn encode(
1940            self,
1941            encoder: &mut fidl::encoding::Encoder<
1942                '_,
1943                fidl::encoding::DefaultFuchsiaResourceDialect,
1944            >,
1945            offset: usize,
1946            depth: fidl::encoding::Depth,
1947        ) -> fidl::Result<()> {
1948            encoder.debug_check_bounds::<ProviderRegisterFontSetEventListenerRequest>(offset);
1949            // Zero out padding regions. There's no need to apply masks
1950            // because the unmasked parts will be overwritten by fields.
1951            // Write the fields.
1952            self.0.encode(encoder, offset + 0, depth)?;
1953            Ok(())
1954        }
1955    }
1956
1957    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1958        for ProviderRegisterFontSetEventListenerRequest
1959    {
1960        #[inline(always)]
1961        fn new_empty() -> Self {
1962            Self {
1963                listener: fidl::new_empty!(
1964                    fidl::encoding::Endpoint<
1965                        fidl::endpoints::ClientEnd<FontSetEventListenerMarker>,
1966                    >,
1967                    fidl::encoding::DefaultFuchsiaResourceDialect
1968                ),
1969            }
1970        }
1971
1972        #[inline]
1973        unsafe fn decode(
1974            &mut self,
1975            decoder: &mut fidl::encoding::Decoder<
1976                '_,
1977                fidl::encoding::DefaultFuchsiaResourceDialect,
1978            >,
1979            offset: usize,
1980            _depth: fidl::encoding::Depth,
1981        ) -> fidl::Result<()> {
1982            decoder.debug_check_bounds::<Self>(offset);
1983            // Verify that padding bytes are zero.
1984            fidl::decode!(
1985                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<FontSetEventListenerMarker>>,
1986                fidl::encoding::DefaultFuchsiaResourceDialect,
1987                &mut self.listener,
1988                decoder,
1989                offset + 0,
1990                _depth
1991            )?;
1992            Ok(())
1993        }
1994    }
1995
1996    impl fidl::encoding::ResourceTypeMarker for Response {
1997        type Borrowed<'a> = &'a mut Self;
1998        fn take_or_borrow<'a>(
1999            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2000        ) -> Self::Borrowed<'a> {
2001            value
2002        }
2003    }
2004
2005    unsafe impl fidl::encoding::TypeMarker for Response {
2006        type Owned = Self;
2007
2008        #[inline(always)]
2009        fn inline_align(_context: fidl::encoding::Context) -> usize {
2010            8
2011        }
2012
2013        #[inline(always)]
2014        fn inline_size(_context: fidl::encoding::Context) -> usize {
2015            24
2016        }
2017    }
2018
2019    unsafe impl fidl::encoding::Encode<Response, fidl::encoding::DefaultFuchsiaResourceDialect>
2020        for &mut Response
2021    {
2022        #[inline]
2023        unsafe fn encode(
2024            self,
2025            encoder: &mut fidl::encoding::Encoder<
2026                '_,
2027                fidl::encoding::DefaultFuchsiaResourceDialect,
2028            >,
2029            offset: usize,
2030            _depth: fidl::encoding::Depth,
2031        ) -> fidl::Result<()> {
2032            encoder.debug_check_bounds::<Response>(offset);
2033            // Delegate to tuple encoding.
2034            fidl::encoding::Encode::<Response, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2035                (
2036                    <fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.buffer),
2037                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.buffer_id),
2038                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.font_index),
2039                ),
2040                encoder, offset, _depth
2041            )
2042        }
2043    }
2044    unsafe impl<
2045            T0: fidl::encoding::Encode<
2046                fidl_fuchsia_mem::Buffer,
2047                fidl::encoding::DefaultFuchsiaResourceDialect,
2048            >,
2049            T1: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
2050            T2: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
2051        > fidl::encoding::Encode<Response, fidl::encoding::DefaultFuchsiaResourceDialect>
2052        for (T0, T1, T2)
2053    {
2054        #[inline]
2055        unsafe fn encode(
2056            self,
2057            encoder: &mut fidl::encoding::Encoder<
2058                '_,
2059                fidl::encoding::DefaultFuchsiaResourceDialect,
2060            >,
2061            offset: usize,
2062            depth: fidl::encoding::Depth,
2063        ) -> fidl::Result<()> {
2064            encoder.debug_check_bounds::<Response>(offset);
2065            // Zero out padding regions. There's no need to apply masks
2066            // because the unmasked parts will be overwritten by fields.
2067            // Write the fields.
2068            self.0.encode(encoder, offset + 0, depth)?;
2069            self.1.encode(encoder, offset + 16, depth)?;
2070            self.2.encode(encoder, offset + 20, depth)?;
2071            Ok(())
2072        }
2073    }
2074
2075    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Response {
2076        #[inline(always)]
2077        fn new_empty() -> Self {
2078            Self {
2079                buffer: fidl::new_empty!(
2080                    fidl_fuchsia_mem::Buffer,
2081                    fidl::encoding::DefaultFuchsiaResourceDialect
2082                ),
2083                buffer_id: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
2084                font_index: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
2085            }
2086        }
2087
2088        #[inline]
2089        unsafe fn decode(
2090            &mut self,
2091            decoder: &mut fidl::encoding::Decoder<
2092                '_,
2093                fidl::encoding::DefaultFuchsiaResourceDialect,
2094            >,
2095            offset: usize,
2096            _depth: fidl::encoding::Depth,
2097        ) -> fidl::Result<()> {
2098            decoder.debug_check_bounds::<Self>(offset);
2099            // Verify that padding bytes are zero.
2100            fidl::decode!(
2101                fidl_fuchsia_mem::Buffer,
2102                fidl::encoding::DefaultFuchsiaResourceDialect,
2103                &mut self.buffer,
2104                decoder,
2105                offset + 0,
2106                _depth
2107            )?;
2108            fidl::decode!(
2109                u32,
2110                fidl::encoding::DefaultFuchsiaResourceDialect,
2111                &mut self.buffer_id,
2112                decoder,
2113                offset + 16,
2114                _depth
2115            )?;
2116            fidl::decode!(
2117                u32,
2118                fidl::encoding::DefaultFuchsiaResourceDialect,
2119                &mut self.font_index,
2120                decoder,
2121                offset + 20,
2122                _depth
2123            )?;
2124            Ok(())
2125        }
2126    }
2127
2128    impl TypefaceResponse {
2129        #[inline(always)]
2130        fn max_ordinal_present(&self) -> u64 {
2131            if let Some(_) = self.font_index {
2132                return 3;
2133            }
2134            if let Some(_) = self.buffer_id {
2135                return 2;
2136            }
2137            if let Some(_) = self.buffer {
2138                return 1;
2139            }
2140            0
2141        }
2142    }
2143
2144    impl fidl::encoding::ResourceTypeMarker for TypefaceResponse {
2145        type Borrowed<'a> = &'a mut Self;
2146        fn take_or_borrow<'a>(
2147            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2148        ) -> Self::Borrowed<'a> {
2149            value
2150        }
2151    }
2152
2153    unsafe impl fidl::encoding::TypeMarker for TypefaceResponse {
2154        type Owned = Self;
2155
2156        #[inline(always)]
2157        fn inline_align(_context: fidl::encoding::Context) -> usize {
2158            8
2159        }
2160
2161        #[inline(always)]
2162        fn inline_size(_context: fidl::encoding::Context) -> usize {
2163            16
2164        }
2165    }
2166
2167    unsafe impl
2168        fidl::encoding::Encode<TypefaceResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
2169        for &mut TypefaceResponse
2170    {
2171        unsafe fn encode(
2172            self,
2173            encoder: &mut fidl::encoding::Encoder<
2174                '_,
2175                fidl::encoding::DefaultFuchsiaResourceDialect,
2176            >,
2177            offset: usize,
2178            mut depth: fidl::encoding::Depth,
2179        ) -> fidl::Result<()> {
2180            encoder.debug_check_bounds::<TypefaceResponse>(offset);
2181            // Vector header
2182            let max_ordinal: u64 = self.max_ordinal_present();
2183            encoder.write_num(max_ordinal, offset);
2184            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2185            // Calling encoder.out_of_line_offset(0) is not allowed.
2186            if max_ordinal == 0 {
2187                return Ok(());
2188            }
2189            depth.increment()?;
2190            let envelope_size = 8;
2191            let bytes_len = max_ordinal as usize * envelope_size;
2192            #[allow(unused_variables)]
2193            let offset = encoder.out_of_line_offset(bytes_len);
2194            let mut _prev_end_offset: usize = 0;
2195            if 1 > max_ordinal {
2196                return Ok(());
2197            }
2198
2199            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2200            // are envelope_size bytes.
2201            let cur_offset: usize = (1 - 1) * envelope_size;
2202
2203            // Zero reserved fields.
2204            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2205
2206            // Safety:
2207            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2208            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2209            //   envelope_size bytes, there is always sufficient room.
2210            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_mem::Buffer, fidl::encoding::DefaultFuchsiaResourceDialect>(
2211            self.buffer.as_mut().map(<fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
2212            encoder, offset + cur_offset, depth
2213        )?;
2214
2215            _prev_end_offset = cur_offset + envelope_size;
2216            if 2 > max_ordinal {
2217                return Ok(());
2218            }
2219
2220            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2221            // are envelope_size bytes.
2222            let cur_offset: usize = (2 - 1) * envelope_size;
2223
2224            // Zero reserved fields.
2225            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2226
2227            // Safety:
2228            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2229            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2230            //   envelope_size bytes, there is always sufficient room.
2231            fidl::encoding::encode_in_envelope_optional::<
2232                u32,
2233                fidl::encoding::DefaultFuchsiaResourceDialect,
2234            >(
2235                self.buffer_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
2236                encoder,
2237                offset + cur_offset,
2238                depth,
2239            )?;
2240
2241            _prev_end_offset = cur_offset + envelope_size;
2242            if 3 > max_ordinal {
2243                return Ok(());
2244            }
2245
2246            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2247            // are envelope_size bytes.
2248            let cur_offset: usize = (3 - 1) * envelope_size;
2249
2250            // Zero reserved fields.
2251            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2252
2253            // Safety:
2254            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2255            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2256            //   envelope_size bytes, there is always sufficient room.
2257            fidl::encoding::encode_in_envelope_optional::<
2258                u32,
2259                fidl::encoding::DefaultFuchsiaResourceDialect,
2260            >(
2261                self.font_index.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
2262                encoder,
2263                offset + cur_offset,
2264                depth,
2265            )?;
2266
2267            _prev_end_offset = cur_offset + envelope_size;
2268
2269            Ok(())
2270        }
2271    }
2272
2273    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2274        for TypefaceResponse
2275    {
2276        #[inline(always)]
2277        fn new_empty() -> Self {
2278            Self::default()
2279        }
2280
2281        unsafe fn decode(
2282            &mut self,
2283            decoder: &mut fidl::encoding::Decoder<
2284                '_,
2285                fidl::encoding::DefaultFuchsiaResourceDialect,
2286            >,
2287            offset: usize,
2288            mut depth: fidl::encoding::Depth,
2289        ) -> fidl::Result<()> {
2290            decoder.debug_check_bounds::<Self>(offset);
2291            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2292                None => return Err(fidl::Error::NotNullable),
2293                Some(len) => len,
2294            };
2295            // Calling decoder.out_of_line_offset(0) is not allowed.
2296            if len == 0 {
2297                return Ok(());
2298            };
2299            depth.increment()?;
2300            let envelope_size = 8;
2301            let bytes_len = len * envelope_size;
2302            let offset = decoder.out_of_line_offset(bytes_len)?;
2303            // Decode the envelope for each type.
2304            let mut _next_ordinal_to_read = 0;
2305            let mut next_offset = offset;
2306            let end_offset = offset + bytes_len;
2307            _next_ordinal_to_read += 1;
2308            if next_offset >= end_offset {
2309                return Ok(());
2310            }
2311
2312            // Decode unknown envelopes for gaps in ordinals.
2313            while _next_ordinal_to_read < 1 {
2314                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2315                _next_ordinal_to_read += 1;
2316                next_offset += envelope_size;
2317            }
2318
2319            let next_out_of_line = decoder.next_out_of_line();
2320            let handles_before = decoder.remaining_handles();
2321            if let Some((inlined, num_bytes, num_handles)) =
2322                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2323            {
2324                let member_inline_size =
2325                    <fidl_fuchsia_mem::Buffer as fidl::encoding::TypeMarker>::inline_size(
2326                        decoder.context,
2327                    );
2328                if inlined != (member_inline_size <= 4) {
2329                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2330                }
2331                let inner_offset;
2332                let mut inner_depth = depth.clone();
2333                if inlined {
2334                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2335                    inner_offset = next_offset;
2336                } else {
2337                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2338                    inner_depth.increment()?;
2339                }
2340                let val_ref = self.buffer.get_or_insert_with(|| {
2341                    fidl::new_empty!(
2342                        fidl_fuchsia_mem::Buffer,
2343                        fidl::encoding::DefaultFuchsiaResourceDialect
2344                    )
2345                });
2346                fidl::decode!(
2347                    fidl_fuchsia_mem::Buffer,
2348                    fidl::encoding::DefaultFuchsiaResourceDialect,
2349                    val_ref,
2350                    decoder,
2351                    inner_offset,
2352                    inner_depth
2353                )?;
2354                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2355                {
2356                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2357                }
2358                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2359                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2360                }
2361            }
2362
2363            next_offset += envelope_size;
2364            _next_ordinal_to_read += 1;
2365            if next_offset >= end_offset {
2366                return Ok(());
2367            }
2368
2369            // Decode unknown envelopes for gaps in ordinals.
2370            while _next_ordinal_to_read < 2 {
2371                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2372                _next_ordinal_to_read += 1;
2373                next_offset += envelope_size;
2374            }
2375
2376            let next_out_of_line = decoder.next_out_of_line();
2377            let handles_before = decoder.remaining_handles();
2378            if let Some((inlined, num_bytes, num_handles)) =
2379                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2380            {
2381                let member_inline_size =
2382                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2383                if inlined != (member_inline_size <= 4) {
2384                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2385                }
2386                let inner_offset;
2387                let mut inner_depth = depth.clone();
2388                if inlined {
2389                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2390                    inner_offset = next_offset;
2391                } else {
2392                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2393                    inner_depth.increment()?;
2394                }
2395                let val_ref = self.buffer_id.get_or_insert_with(|| {
2396                    fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
2397                });
2398                fidl::decode!(
2399                    u32,
2400                    fidl::encoding::DefaultFuchsiaResourceDialect,
2401                    val_ref,
2402                    decoder,
2403                    inner_offset,
2404                    inner_depth
2405                )?;
2406                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2407                {
2408                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2409                }
2410                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2411                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2412                }
2413            }
2414
2415            next_offset += envelope_size;
2416            _next_ordinal_to_read += 1;
2417            if next_offset >= end_offset {
2418                return Ok(());
2419            }
2420
2421            // Decode unknown envelopes for gaps in ordinals.
2422            while _next_ordinal_to_read < 3 {
2423                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2424                _next_ordinal_to_read += 1;
2425                next_offset += envelope_size;
2426            }
2427
2428            let next_out_of_line = decoder.next_out_of_line();
2429            let handles_before = decoder.remaining_handles();
2430            if let Some((inlined, num_bytes, num_handles)) =
2431                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2432            {
2433                let member_inline_size =
2434                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2435                if inlined != (member_inline_size <= 4) {
2436                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2437                }
2438                let inner_offset;
2439                let mut inner_depth = depth.clone();
2440                if inlined {
2441                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2442                    inner_offset = next_offset;
2443                } else {
2444                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2445                    inner_depth.increment()?;
2446                }
2447                let val_ref = self.font_index.get_or_insert_with(|| {
2448                    fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
2449                });
2450                fidl::decode!(
2451                    u32,
2452                    fidl::encoding::DefaultFuchsiaResourceDialect,
2453                    val_ref,
2454                    decoder,
2455                    inner_offset,
2456                    inner_depth
2457                )?;
2458                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2459                {
2460                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2461                }
2462                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2463                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2464                }
2465            }
2466
2467            next_offset += envelope_size;
2468
2469            // Decode the remaining unknown envelopes.
2470            while next_offset < end_offset {
2471                _next_ordinal_to_read += 1;
2472                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2473                next_offset += envelope_size;
2474            }
2475
2476            Ok(())
2477        }
2478    }
2479}