1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11pub const MAX_TYPEFACE_RESULTS: u32 = 16;
14
15bitflags! {
16 #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
17 pub struct ListTypefacesFlags: u32 {
18 const MATCH_FAMILY_NAME_SUBSTRING = 1;
24 }
25}
26
27impl ListTypefacesFlags {
28 #[deprecated = "Strict bits should not use `has_unknown_bits`"]
29 #[inline(always)]
30 pub fn has_unknown_bits(&self) -> bool {
31 false
32 }
33
34 #[deprecated = "Strict bits should not use `get_unknown_bits`"]
35 #[inline(always)]
36 pub fn get_unknown_bits(&self) -> u32 {
37 0
38 }
39}
40
41#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
42#[repr(u32)]
43pub enum Error {
44 NotFound = 1,
45 Internal = 2,
46}
47
48impl Error {
49 #[inline]
50 pub fn from_primitive(prim: u32) -> Option<Self> {
51 match prim {
52 1 => Some(Self::NotFound),
53 2 => Some(Self::Internal),
54 _ => None,
55 }
56 }
57
58 #[inline]
59 pub const fn into_primitive(self) -> u32 {
60 self as u32
61 }
62
63 #[deprecated = "Strict enums should not use `is_unknown`"]
64 #[inline]
65 pub fn is_unknown(&self) -> bool {
66 false
67 }
68}
69
70#[derive(Clone, Debug, PartialEq)]
71pub struct ListTypefacesIteratorGetNextResponse {
72 pub response: TypefaceInfoResponse,
73}
74
75impl fidl::Persistable for ListTypefacesIteratorGetNextResponse {}
76
77#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
78#[repr(C)]
79pub struct ProviderGetTypefaceByIdRequest {
80 pub id: u32,
81}
82
83impl fidl::Persistable for ProviderGetTypefaceByIdRequest {}
84
85#[derive(Clone, Debug, PartialEq)]
86pub struct ProviderGetTypefacesByFamilyRequest {
87 pub family: fidl_fuchsia_fonts::FamilyName,
88}
89
90impl fidl::Persistable for ProviderGetTypefacesByFamilyRequest {}
91
92#[derive(Clone, Debug, PartialEq)]
93pub struct ProviderGetTypefacesByFamilyResponse {
94 pub response: TypefaceInfoResponse,
95}
96
97impl fidl::Persistable for ProviderGetTypefacesByFamilyResponse {}
98
99#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
101pub struct SlantRange {
102 pub lower: fidl_fuchsia_fonts::Slant,
103 pub upper: fidl_fuchsia_fonts::Slant,
104}
105
106impl fidl::Persistable for SlantRange {}
107
108#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
110#[repr(C)]
111pub struct WeightRange {
112 pub lower: u16,
113 pub upper: u16,
114}
115
116impl fidl::Persistable for WeightRange {}
117
118#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
120pub struct WidthRange {
121 pub lower: fidl_fuchsia_fonts::Width,
122 pub upper: fidl_fuchsia_fonts::Width,
123}
124
125impl fidl::Persistable for WidthRange {}
126
127#[derive(Clone, Debug, Default, PartialEq)]
130pub struct ListTypefacesRequest {
131 pub flags: Option<ListTypefacesFlags>,
134 pub family: Option<fidl_fuchsia_fonts::FamilyName>,
138 pub slant: Option<SlantRange>,
140 pub weight: Option<WeightRange>,
142 pub width: Option<WidthRange>,
144 pub languages: Option<Vec<fidl_fuchsia_intl::LocaleId>>,
147 pub code_points: Option<Vec<u32>>,
150 pub generic_family: Option<fidl_fuchsia_fonts::GenericFontFamily>,
154 #[doc(hidden)]
155 pub __source_breaking: fidl::marker::SourceBreaking,
156}
157
158impl fidl::Persistable for ListTypefacesRequest {}
159
160#[derive(Clone, Debug, Default, PartialEq)]
163pub struct TypefaceInfo {
164 pub asset_id: Option<u32>,
168 pub font_index: Option<u32>,
171 pub family: Option<fidl_fuchsia_fonts::FamilyName>,
172 pub style: Option<fidl_fuchsia_fonts::Style2>,
173 pub languages: Option<Vec<fidl_fuchsia_intl::LocaleId>>,
174 pub generic_family: Option<fidl_fuchsia_fonts::GenericFontFamily>,
175 #[doc(hidden)]
176 pub __source_breaking: fidl::marker::SourceBreaking,
177}
178
179impl fidl::Persistable for TypefaceInfo {}
180
181#[derive(Clone, Debug, Default, PartialEq)]
182pub struct TypefaceInfoResponse {
183 pub results: Option<Vec<TypefaceInfo>>,
184 #[doc(hidden)]
185 pub __source_breaking: fidl::marker::SourceBreaking,
186}
187
188impl fidl::Persistable for TypefaceInfoResponse {}
189
190mod internal {
191 use super::*;
192 unsafe impl fidl::encoding::TypeMarker for ListTypefacesFlags {
193 type Owned = Self;
194
195 #[inline(always)]
196 fn inline_align(_context: fidl::encoding::Context) -> usize {
197 4
198 }
199
200 #[inline(always)]
201 fn inline_size(_context: fidl::encoding::Context) -> usize {
202 4
203 }
204 }
205
206 impl fidl::encoding::ValueTypeMarker for ListTypefacesFlags {
207 type Borrowed<'a> = Self;
208 #[inline(always)]
209 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
210 *value
211 }
212 }
213
214 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
215 for ListTypefacesFlags
216 {
217 #[inline]
218 unsafe fn encode(
219 self,
220 encoder: &mut fidl::encoding::Encoder<'_, D>,
221 offset: usize,
222 _depth: fidl::encoding::Depth,
223 ) -> fidl::Result<()> {
224 encoder.debug_check_bounds::<Self>(offset);
225 if self.bits() & Self::all().bits() != self.bits() {
226 return Err(fidl::Error::InvalidBitsValue);
227 }
228 encoder.write_num(self.bits(), offset);
229 Ok(())
230 }
231 }
232
233 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ListTypefacesFlags {
234 #[inline(always)]
235 fn new_empty() -> Self {
236 Self::empty()
237 }
238
239 #[inline]
240 unsafe fn decode(
241 &mut self,
242 decoder: &mut fidl::encoding::Decoder<'_, D>,
243 offset: usize,
244 _depth: fidl::encoding::Depth,
245 ) -> fidl::Result<()> {
246 decoder.debug_check_bounds::<Self>(offset);
247 let prim = decoder.read_num::<u32>(offset);
248 *self = Self::from_bits(prim).ok_or(fidl::Error::InvalidBitsValue)?;
249 Ok(())
250 }
251 }
252 unsafe impl fidl::encoding::TypeMarker for Error {
253 type Owned = Self;
254
255 #[inline(always)]
256 fn inline_align(_context: fidl::encoding::Context) -> usize {
257 std::mem::align_of::<u32>()
258 }
259
260 #[inline(always)]
261 fn inline_size(_context: fidl::encoding::Context) -> usize {
262 std::mem::size_of::<u32>()
263 }
264
265 #[inline(always)]
266 fn encode_is_copy() -> bool {
267 true
268 }
269
270 #[inline(always)]
271 fn decode_is_copy() -> bool {
272 false
273 }
274 }
275
276 impl fidl::encoding::ValueTypeMarker for Error {
277 type Borrowed<'a> = Self;
278 #[inline(always)]
279 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
280 *value
281 }
282 }
283
284 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Error {
285 #[inline]
286 unsafe fn encode(
287 self,
288 encoder: &mut fidl::encoding::Encoder<'_, D>,
289 offset: usize,
290 _depth: fidl::encoding::Depth,
291 ) -> fidl::Result<()> {
292 encoder.debug_check_bounds::<Self>(offset);
293 encoder.write_num(self.into_primitive(), offset);
294 Ok(())
295 }
296 }
297
298 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Error {
299 #[inline(always)]
300 fn new_empty() -> Self {
301 Self::NotFound
302 }
303
304 #[inline]
305 unsafe fn decode(
306 &mut self,
307 decoder: &mut fidl::encoding::Decoder<'_, D>,
308 offset: usize,
309 _depth: fidl::encoding::Depth,
310 ) -> fidl::Result<()> {
311 decoder.debug_check_bounds::<Self>(offset);
312 let prim = decoder.read_num::<u32>(offset);
313
314 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
315 Ok(())
316 }
317 }
318
319 impl fidl::encoding::ValueTypeMarker for ListTypefacesIteratorGetNextResponse {
320 type Borrowed<'a> = &'a Self;
321 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
322 value
323 }
324 }
325
326 unsafe impl fidl::encoding::TypeMarker for ListTypefacesIteratorGetNextResponse {
327 type Owned = Self;
328
329 #[inline(always)]
330 fn inline_align(_context: fidl::encoding::Context) -> usize {
331 8
332 }
333
334 #[inline(always)]
335 fn inline_size(_context: fidl::encoding::Context) -> usize {
336 16
337 }
338 }
339
340 unsafe impl<D: fidl::encoding::ResourceDialect>
341 fidl::encoding::Encode<ListTypefacesIteratorGetNextResponse, D>
342 for &ListTypefacesIteratorGetNextResponse
343 {
344 #[inline]
345 unsafe fn encode(
346 self,
347 encoder: &mut fidl::encoding::Encoder<'_, D>,
348 offset: usize,
349 _depth: fidl::encoding::Depth,
350 ) -> fidl::Result<()> {
351 encoder.debug_check_bounds::<ListTypefacesIteratorGetNextResponse>(offset);
352 fidl::encoding::Encode::<ListTypefacesIteratorGetNextResponse, D>::encode(
354 (<TypefaceInfoResponse as fidl::encoding::ValueTypeMarker>::borrow(&self.response),),
355 encoder,
356 offset,
357 _depth,
358 )
359 }
360 }
361 unsafe impl<
362 D: fidl::encoding::ResourceDialect,
363 T0: fidl::encoding::Encode<TypefaceInfoResponse, D>,
364 > fidl::encoding::Encode<ListTypefacesIteratorGetNextResponse, D> for (T0,)
365 {
366 #[inline]
367 unsafe fn encode(
368 self,
369 encoder: &mut fidl::encoding::Encoder<'_, D>,
370 offset: usize,
371 depth: fidl::encoding::Depth,
372 ) -> fidl::Result<()> {
373 encoder.debug_check_bounds::<ListTypefacesIteratorGetNextResponse>(offset);
374 self.0.encode(encoder, offset + 0, depth)?;
378 Ok(())
379 }
380 }
381
382 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
383 for ListTypefacesIteratorGetNextResponse
384 {
385 #[inline(always)]
386 fn new_empty() -> Self {
387 Self { response: fidl::new_empty!(TypefaceInfoResponse, D) }
388 }
389
390 #[inline]
391 unsafe fn decode(
392 &mut self,
393 decoder: &mut fidl::encoding::Decoder<'_, D>,
394 offset: usize,
395 _depth: fidl::encoding::Depth,
396 ) -> fidl::Result<()> {
397 decoder.debug_check_bounds::<Self>(offset);
398 fidl::decode!(
400 TypefaceInfoResponse,
401 D,
402 &mut self.response,
403 decoder,
404 offset + 0,
405 _depth
406 )?;
407 Ok(())
408 }
409 }
410
411 impl fidl::encoding::ValueTypeMarker for ProviderGetTypefaceByIdRequest {
412 type Borrowed<'a> = &'a Self;
413 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
414 value
415 }
416 }
417
418 unsafe impl fidl::encoding::TypeMarker for ProviderGetTypefaceByIdRequest {
419 type Owned = Self;
420
421 #[inline(always)]
422 fn inline_align(_context: fidl::encoding::Context) -> usize {
423 4
424 }
425
426 #[inline(always)]
427 fn inline_size(_context: fidl::encoding::Context) -> usize {
428 4
429 }
430 #[inline(always)]
431 fn encode_is_copy() -> bool {
432 true
433 }
434
435 #[inline(always)]
436 fn decode_is_copy() -> bool {
437 true
438 }
439 }
440
441 unsafe impl<D: fidl::encoding::ResourceDialect>
442 fidl::encoding::Encode<ProviderGetTypefaceByIdRequest, D>
443 for &ProviderGetTypefaceByIdRequest
444 {
445 #[inline]
446 unsafe fn encode(
447 self,
448 encoder: &mut fidl::encoding::Encoder<'_, D>,
449 offset: usize,
450 _depth: fidl::encoding::Depth,
451 ) -> fidl::Result<()> {
452 encoder.debug_check_bounds::<ProviderGetTypefaceByIdRequest>(offset);
453 unsafe {
454 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
456 (buf_ptr as *mut ProviderGetTypefaceByIdRequest)
457 .write_unaligned((self as *const ProviderGetTypefaceByIdRequest).read());
458 }
461 Ok(())
462 }
463 }
464 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
465 fidl::encoding::Encode<ProviderGetTypefaceByIdRequest, D> for (T0,)
466 {
467 #[inline]
468 unsafe fn encode(
469 self,
470 encoder: &mut fidl::encoding::Encoder<'_, D>,
471 offset: usize,
472 depth: fidl::encoding::Depth,
473 ) -> fidl::Result<()> {
474 encoder.debug_check_bounds::<ProviderGetTypefaceByIdRequest>(offset);
475 self.0.encode(encoder, offset + 0, depth)?;
479 Ok(())
480 }
481 }
482
483 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
484 for ProviderGetTypefaceByIdRequest
485 {
486 #[inline(always)]
487 fn new_empty() -> Self {
488 Self { id: fidl::new_empty!(u32, D) }
489 }
490
491 #[inline]
492 unsafe fn decode(
493 &mut self,
494 decoder: &mut fidl::encoding::Decoder<'_, D>,
495 offset: usize,
496 _depth: fidl::encoding::Depth,
497 ) -> fidl::Result<()> {
498 decoder.debug_check_bounds::<Self>(offset);
499 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
500 unsafe {
503 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
504 }
505 Ok(())
506 }
507 }
508
509 impl fidl::encoding::ValueTypeMarker for ProviderGetTypefacesByFamilyRequest {
510 type Borrowed<'a> = &'a Self;
511 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
512 value
513 }
514 }
515
516 unsafe impl fidl::encoding::TypeMarker for ProviderGetTypefacesByFamilyRequest {
517 type Owned = Self;
518
519 #[inline(always)]
520 fn inline_align(_context: fidl::encoding::Context) -> usize {
521 8
522 }
523
524 #[inline(always)]
525 fn inline_size(_context: fidl::encoding::Context) -> usize {
526 16
527 }
528 }
529
530 unsafe impl<D: fidl::encoding::ResourceDialect>
531 fidl::encoding::Encode<ProviderGetTypefacesByFamilyRequest, D>
532 for &ProviderGetTypefacesByFamilyRequest
533 {
534 #[inline]
535 unsafe fn encode(
536 self,
537 encoder: &mut fidl::encoding::Encoder<'_, D>,
538 offset: usize,
539 _depth: fidl::encoding::Depth,
540 ) -> fidl::Result<()> {
541 encoder.debug_check_bounds::<ProviderGetTypefacesByFamilyRequest>(offset);
542 fidl::encoding::Encode::<ProviderGetTypefacesByFamilyRequest, D>::encode(
544 (<fidl_fuchsia_fonts::FamilyName as fidl::encoding::ValueTypeMarker>::borrow(
545 &self.family,
546 ),),
547 encoder,
548 offset,
549 _depth,
550 )
551 }
552 }
553 unsafe impl<
554 D: fidl::encoding::ResourceDialect,
555 T0: fidl::encoding::Encode<fidl_fuchsia_fonts::FamilyName, D>,
556 > fidl::encoding::Encode<ProviderGetTypefacesByFamilyRequest, D> for (T0,)
557 {
558 #[inline]
559 unsafe fn encode(
560 self,
561 encoder: &mut fidl::encoding::Encoder<'_, D>,
562 offset: usize,
563 depth: fidl::encoding::Depth,
564 ) -> fidl::Result<()> {
565 encoder.debug_check_bounds::<ProviderGetTypefacesByFamilyRequest>(offset);
566 self.0.encode(encoder, offset + 0, depth)?;
570 Ok(())
571 }
572 }
573
574 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
575 for ProviderGetTypefacesByFamilyRequest
576 {
577 #[inline(always)]
578 fn new_empty() -> Self {
579 Self { family: fidl::new_empty!(fidl_fuchsia_fonts::FamilyName, D) }
580 }
581
582 #[inline]
583 unsafe fn decode(
584 &mut self,
585 decoder: &mut fidl::encoding::Decoder<'_, D>,
586 offset: usize,
587 _depth: fidl::encoding::Depth,
588 ) -> fidl::Result<()> {
589 decoder.debug_check_bounds::<Self>(offset);
590 fidl::decode!(
592 fidl_fuchsia_fonts::FamilyName,
593 D,
594 &mut self.family,
595 decoder,
596 offset + 0,
597 _depth
598 )?;
599 Ok(())
600 }
601 }
602
603 impl fidl::encoding::ValueTypeMarker for ProviderGetTypefacesByFamilyResponse {
604 type Borrowed<'a> = &'a Self;
605 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
606 value
607 }
608 }
609
610 unsafe impl fidl::encoding::TypeMarker for ProviderGetTypefacesByFamilyResponse {
611 type Owned = Self;
612
613 #[inline(always)]
614 fn inline_align(_context: fidl::encoding::Context) -> usize {
615 8
616 }
617
618 #[inline(always)]
619 fn inline_size(_context: fidl::encoding::Context) -> usize {
620 16
621 }
622 }
623
624 unsafe impl<D: fidl::encoding::ResourceDialect>
625 fidl::encoding::Encode<ProviderGetTypefacesByFamilyResponse, D>
626 for &ProviderGetTypefacesByFamilyResponse
627 {
628 #[inline]
629 unsafe fn encode(
630 self,
631 encoder: &mut fidl::encoding::Encoder<'_, D>,
632 offset: usize,
633 _depth: fidl::encoding::Depth,
634 ) -> fidl::Result<()> {
635 encoder.debug_check_bounds::<ProviderGetTypefacesByFamilyResponse>(offset);
636 fidl::encoding::Encode::<ProviderGetTypefacesByFamilyResponse, D>::encode(
638 (<TypefaceInfoResponse as fidl::encoding::ValueTypeMarker>::borrow(&self.response),),
639 encoder,
640 offset,
641 _depth,
642 )
643 }
644 }
645 unsafe impl<
646 D: fidl::encoding::ResourceDialect,
647 T0: fidl::encoding::Encode<TypefaceInfoResponse, D>,
648 > fidl::encoding::Encode<ProviderGetTypefacesByFamilyResponse, D> for (T0,)
649 {
650 #[inline]
651 unsafe fn encode(
652 self,
653 encoder: &mut fidl::encoding::Encoder<'_, D>,
654 offset: usize,
655 depth: fidl::encoding::Depth,
656 ) -> fidl::Result<()> {
657 encoder.debug_check_bounds::<ProviderGetTypefacesByFamilyResponse>(offset);
658 self.0.encode(encoder, offset + 0, depth)?;
662 Ok(())
663 }
664 }
665
666 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
667 for ProviderGetTypefacesByFamilyResponse
668 {
669 #[inline(always)]
670 fn new_empty() -> Self {
671 Self { response: fidl::new_empty!(TypefaceInfoResponse, D) }
672 }
673
674 #[inline]
675 unsafe fn decode(
676 &mut self,
677 decoder: &mut fidl::encoding::Decoder<'_, D>,
678 offset: usize,
679 _depth: fidl::encoding::Depth,
680 ) -> fidl::Result<()> {
681 decoder.debug_check_bounds::<Self>(offset);
682 fidl::decode!(
684 TypefaceInfoResponse,
685 D,
686 &mut self.response,
687 decoder,
688 offset + 0,
689 _depth
690 )?;
691 Ok(())
692 }
693 }
694
695 impl fidl::encoding::ValueTypeMarker for SlantRange {
696 type Borrowed<'a> = &'a Self;
697 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
698 value
699 }
700 }
701
702 unsafe impl fidl::encoding::TypeMarker for SlantRange {
703 type Owned = Self;
704
705 #[inline(always)]
706 fn inline_align(_context: fidl::encoding::Context) -> usize {
707 4
708 }
709
710 #[inline(always)]
711 fn inline_size(_context: fidl::encoding::Context) -> usize {
712 8
713 }
714 }
715
716 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SlantRange, D>
717 for &SlantRange
718 {
719 #[inline]
720 unsafe fn encode(
721 self,
722 encoder: &mut fidl::encoding::Encoder<'_, D>,
723 offset: usize,
724 _depth: fidl::encoding::Depth,
725 ) -> fidl::Result<()> {
726 encoder.debug_check_bounds::<SlantRange>(offset);
727 fidl::encoding::Encode::<SlantRange, D>::encode(
729 (
730 <fidl_fuchsia_fonts::Slant as fidl::encoding::ValueTypeMarker>::borrow(
731 &self.lower,
732 ),
733 <fidl_fuchsia_fonts::Slant as fidl::encoding::ValueTypeMarker>::borrow(
734 &self.upper,
735 ),
736 ),
737 encoder,
738 offset,
739 _depth,
740 )
741 }
742 }
743 unsafe impl<
744 D: fidl::encoding::ResourceDialect,
745 T0: fidl::encoding::Encode<fidl_fuchsia_fonts::Slant, D>,
746 T1: fidl::encoding::Encode<fidl_fuchsia_fonts::Slant, D>,
747 > fidl::encoding::Encode<SlantRange, D> for (T0, T1)
748 {
749 #[inline]
750 unsafe fn encode(
751 self,
752 encoder: &mut fidl::encoding::Encoder<'_, D>,
753 offset: usize,
754 depth: fidl::encoding::Depth,
755 ) -> fidl::Result<()> {
756 encoder.debug_check_bounds::<SlantRange>(offset);
757 self.0.encode(encoder, offset + 0, depth)?;
761 self.1.encode(encoder, offset + 4, depth)?;
762 Ok(())
763 }
764 }
765
766 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SlantRange {
767 #[inline(always)]
768 fn new_empty() -> Self {
769 Self {
770 lower: fidl::new_empty!(fidl_fuchsia_fonts::Slant, D),
771 upper: fidl::new_empty!(fidl_fuchsia_fonts::Slant, D),
772 }
773 }
774
775 #[inline]
776 unsafe fn decode(
777 &mut self,
778 decoder: &mut fidl::encoding::Decoder<'_, D>,
779 offset: usize,
780 _depth: fidl::encoding::Depth,
781 ) -> fidl::Result<()> {
782 decoder.debug_check_bounds::<Self>(offset);
783 fidl::decode!(
785 fidl_fuchsia_fonts::Slant,
786 D,
787 &mut self.lower,
788 decoder,
789 offset + 0,
790 _depth
791 )?;
792 fidl::decode!(
793 fidl_fuchsia_fonts::Slant,
794 D,
795 &mut self.upper,
796 decoder,
797 offset + 4,
798 _depth
799 )?;
800 Ok(())
801 }
802 }
803
804 impl fidl::encoding::ValueTypeMarker for WeightRange {
805 type Borrowed<'a> = &'a Self;
806 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
807 value
808 }
809 }
810
811 unsafe impl fidl::encoding::TypeMarker for WeightRange {
812 type Owned = Self;
813
814 #[inline(always)]
815 fn inline_align(_context: fidl::encoding::Context) -> usize {
816 2
817 }
818
819 #[inline(always)]
820 fn inline_size(_context: fidl::encoding::Context) -> usize {
821 4
822 }
823 #[inline(always)]
824 fn encode_is_copy() -> bool {
825 true
826 }
827
828 #[inline(always)]
829 fn decode_is_copy() -> bool {
830 true
831 }
832 }
833
834 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<WeightRange, D>
835 for &WeightRange
836 {
837 #[inline]
838 unsafe fn encode(
839 self,
840 encoder: &mut fidl::encoding::Encoder<'_, D>,
841 offset: usize,
842 _depth: fidl::encoding::Depth,
843 ) -> fidl::Result<()> {
844 encoder.debug_check_bounds::<WeightRange>(offset);
845 unsafe {
846 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
848 (buf_ptr as *mut WeightRange).write_unaligned((self as *const WeightRange).read());
849 }
852 Ok(())
853 }
854 }
855 unsafe impl<
856 D: fidl::encoding::ResourceDialect,
857 T0: fidl::encoding::Encode<u16, D>,
858 T1: fidl::encoding::Encode<u16, D>,
859 > fidl::encoding::Encode<WeightRange, D> for (T0, T1)
860 {
861 #[inline]
862 unsafe fn encode(
863 self,
864 encoder: &mut fidl::encoding::Encoder<'_, D>,
865 offset: usize,
866 depth: fidl::encoding::Depth,
867 ) -> fidl::Result<()> {
868 encoder.debug_check_bounds::<WeightRange>(offset);
869 self.0.encode(encoder, offset + 0, depth)?;
873 self.1.encode(encoder, offset + 2, depth)?;
874 Ok(())
875 }
876 }
877
878 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WeightRange {
879 #[inline(always)]
880 fn new_empty() -> Self {
881 Self { lower: fidl::new_empty!(u16, D), upper: fidl::new_empty!(u16, D) }
882 }
883
884 #[inline]
885 unsafe fn decode(
886 &mut self,
887 decoder: &mut fidl::encoding::Decoder<'_, D>,
888 offset: usize,
889 _depth: fidl::encoding::Depth,
890 ) -> fidl::Result<()> {
891 decoder.debug_check_bounds::<Self>(offset);
892 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
893 unsafe {
896 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
897 }
898 Ok(())
899 }
900 }
901
902 impl fidl::encoding::ValueTypeMarker for WidthRange {
903 type Borrowed<'a> = &'a Self;
904 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
905 value
906 }
907 }
908
909 unsafe impl fidl::encoding::TypeMarker for WidthRange {
910 type Owned = Self;
911
912 #[inline(always)]
913 fn inline_align(_context: fidl::encoding::Context) -> usize {
914 4
915 }
916
917 #[inline(always)]
918 fn inline_size(_context: fidl::encoding::Context) -> usize {
919 8
920 }
921 }
922
923 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<WidthRange, D>
924 for &WidthRange
925 {
926 #[inline]
927 unsafe fn encode(
928 self,
929 encoder: &mut fidl::encoding::Encoder<'_, D>,
930 offset: usize,
931 _depth: fidl::encoding::Depth,
932 ) -> fidl::Result<()> {
933 encoder.debug_check_bounds::<WidthRange>(offset);
934 fidl::encoding::Encode::<WidthRange, D>::encode(
936 (
937 <fidl_fuchsia_fonts::Width as fidl::encoding::ValueTypeMarker>::borrow(
938 &self.lower,
939 ),
940 <fidl_fuchsia_fonts::Width as fidl::encoding::ValueTypeMarker>::borrow(
941 &self.upper,
942 ),
943 ),
944 encoder,
945 offset,
946 _depth,
947 )
948 }
949 }
950 unsafe impl<
951 D: fidl::encoding::ResourceDialect,
952 T0: fidl::encoding::Encode<fidl_fuchsia_fonts::Width, D>,
953 T1: fidl::encoding::Encode<fidl_fuchsia_fonts::Width, D>,
954 > fidl::encoding::Encode<WidthRange, D> for (T0, T1)
955 {
956 #[inline]
957 unsafe fn encode(
958 self,
959 encoder: &mut fidl::encoding::Encoder<'_, D>,
960 offset: usize,
961 depth: fidl::encoding::Depth,
962 ) -> fidl::Result<()> {
963 encoder.debug_check_bounds::<WidthRange>(offset);
964 self.0.encode(encoder, offset + 0, depth)?;
968 self.1.encode(encoder, offset + 4, depth)?;
969 Ok(())
970 }
971 }
972
973 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WidthRange {
974 #[inline(always)]
975 fn new_empty() -> Self {
976 Self {
977 lower: fidl::new_empty!(fidl_fuchsia_fonts::Width, D),
978 upper: fidl::new_empty!(fidl_fuchsia_fonts::Width, D),
979 }
980 }
981
982 #[inline]
983 unsafe fn decode(
984 &mut self,
985 decoder: &mut fidl::encoding::Decoder<'_, D>,
986 offset: usize,
987 _depth: fidl::encoding::Depth,
988 ) -> fidl::Result<()> {
989 decoder.debug_check_bounds::<Self>(offset);
990 fidl::decode!(
992 fidl_fuchsia_fonts::Width,
993 D,
994 &mut self.lower,
995 decoder,
996 offset + 0,
997 _depth
998 )?;
999 fidl::decode!(
1000 fidl_fuchsia_fonts::Width,
1001 D,
1002 &mut self.upper,
1003 decoder,
1004 offset + 4,
1005 _depth
1006 )?;
1007 Ok(())
1008 }
1009 }
1010
1011 impl ListTypefacesRequest {
1012 #[inline(always)]
1013 fn max_ordinal_present(&self) -> u64 {
1014 if let Some(_) = self.generic_family {
1015 return 8;
1016 }
1017 if let Some(_) = self.code_points {
1018 return 7;
1019 }
1020 if let Some(_) = self.languages {
1021 return 6;
1022 }
1023 if let Some(_) = self.width {
1024 return 5;
1025 }
1026 if let Some(_) = self.weight {
1027 return 4;
1028 }
1029 if let Some(_) = self.slant {
1030 return 3;
1031 }
1032 if let Some(_) = self.family {
1033 return 2;
1034 }
1035 if let Some(_) = self.flags {
1036 return 1;
1037 }
1038 0
1039 }
1040 }
1041
1042 impl fidl::encoding::ValueTypeMarker for ListTypefacesRequest {
1043 type Borrowed<'a> = &'a Self;
1044 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1045 value
1046 }
1047 }
1048
1049 unsafe impl fidl::encoding::TypeMarker for ListTypefacesRequest {
1050 type Owned = Self;
1051
1052 #[inline(always)]
1053 fn inline_align(_context: fidl::encoding::Context) -> usize {
1054 8
1055 }
1056
1057 #[inline(always)]
1058 fn inline_size(_context: fidl::encoding::Context) -> usize {
1059 16
1060 }
1061 }
1062
1063 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ListTypefacesRequest, D>
1064 for &ListTypefacesRequest
1065 {
1066 unsafe fn encode(
1067 self,
1068 encoder: &mut fidl::encoding::Encoder<'_, D>,
1069 offset: usize,
1070 mut depth: fidl::encoding::Depth,
1071 ) -> fidl::Result<()> {
1072 encoder.debug_check_bounds::<ListTypefacesRequest>(offset);
1073 let max_ordinal: u64 = self.max_ordinal_present();
1075 encoder.write_num(max_ordinal, offset);
1076 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1077 if max_ordinal == 0 {
1079 return Ok(());
1080 }
1081 depth.increment()?;
1082 let envelope_size = 8;
1083 let bytes_len = max_ordinal as usize * envelope_size;
1084 #[allow(unused_variables)]
1085 let offset = encoder.out_of_line_offset(bytes_len);
1086 let mut _prev_end_offset: usize = 0;
1087 if 1 > max_ordinal {
1088 return Ok(());
1089 }
1090
1091 let cur_offset: usize = (1 - 1) * envelope_size;
1094
1095 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1097
1098 fidl::encoding::encode_in_envelope_optional::<ListTypefacesFlags, D>(
1103 self.flags
1104 .as_ref()
1105 .map(<ListTypefacesFlags as fidl::encoding::ValueTypeMarker>::borrow),
1106 encoder,
1107 offset + cur_offset,
1108 depth,
1109 )?;
1110
1111 _prev_end_offset = cur_offset + envelope_size;
1112 if 2 > max_ordinal {
1113 return Ok(());
1114 }
1115
1116 let cur_offset: usize = (2 - 1) * envelope_size;
1119
1120 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1122
1123 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_fonts::FamilyName, D>(
1128 self.family.as_ref().map(
1129 <fidl_fuchsia_fonts::FamilyName as fidl::encoding::ValueTypeMarker>::borrow,
1130 ),
1131 encoder,
1132 offset + cur_offset,
1133 depth,
1134 )?;
1135
1136 _prev_end_offset = cur_offset + envelope_size;
1137 if 3 > max_ordinal {
1138 return Ok(());
1139 }
1140
1141 let cur_offset: usize = (3 - 1) * envelope_size;
1144
1145 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1147
1148 fidl::encoding::encode_in_envelope_optional::<SlantRange, D>(
1153 self.slant.as_ref().map(<SlantRange as fidl::encoding::ValueTypeMarker>::borrow),
1154 encoder,
1155 offset + cur_offset,
1156 depth,
1157 )?;
1158
1159 _prev_end_offset = cur_offset + envelope_size;
1160 if 4 > max_ordinal {
1161 return Ok(());
1162 }
1163
1164 let cur_offset: usize = (4 - 1) * envelope_size;
1167
1168 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1170
1171 fidl::encoding::encode_in_envelope_optional::<WeightRange, D>(
1176 self.weight.as_ref().map(<WeightRange as fidl::encoding::ValueTypeMarker>::borrow),
1177 encoder,
1178 offset + cur_offset,
1179 depth,
1180 )?;
1181
1182 _prev_end_offset = cur_offset + envelope_size;
1183 if 5 > max_ordinal {
1184 return Ok(());
1185 }
1186
1187 let cur_offset: usize = (5 - 1) * envelope_size;
1190
1191 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1193
1194 fidl::encoding::encode_in_envelope_optional::<WidthRange, D>(
1199 self.width.as_ref().map(<WidthRange as fidl::encoding::ValueTypeMarker>::borrow),
1200 encoder,
1201 offset + cur_offset,
1202 depth,
1203 )?;
1204
1205 _prev_end_offset = cur_offset + envelope_size;
1206 if 6 > max_ordinal {
1207 return Ok(());
1208 }
1209
1210 let cur_offset: usize = (6 - 1) * envelope_size;
1213
1214 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1216
1217 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_intl::LocaleId, 8>, D>(
1222 self.languages.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_intl::LocaleId, 8> as fidl::encoding::ValueTypeMarker>::borrow),
1223 encoder, offset + cur_offset, depth
1224 )?;
1225
1226 _prev_end_offset = cur_offset + envelope_size;
1227 if 7 > max_ordinal {
1228 return Ok(());
1229 }
1230
1231 let cur_offset: usize = (7 - 1) * envelope_size;
1234
1235 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1237
1238 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<u32>, D>(
1243 self.code_points.as_ref().map(<fidl::encoding::UnboundedVector<u32> as fidl::encoding::ValueTypeMarker>::borrow),
1244 encoder, offset + cur_offset, depth
1245 )?;
1246
1247 _prev_end_offset = cur_offset + envelope_size;
1248 if 8 > max_ordinal {
1249 return Ok(());
1250 }
1251
1252 let cur_offset: usize = (8 - 1) * envelope_size;
1255
1256 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1258
1259 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_fonts::GenericFontFamily, D>(
1264 self.generic_family.as_ref().map(<fidl_fuchsia_fonts::GenericFontFamily as fidl::encoding::ValueTypeMarker>::borrow),
1265 encoder, offset + cur_offset, depth
1266 )?;
1267
1268 _prev_end_offset = cur_offset + envelope_size;
1269
1270 Ok(())
1271 }
1272 }
1273
1274 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ListTypefacesRequest {
1275 #[inline(always)]
1276 fn new_empty() -> Self {
1277 Self::default()
1278 }
1279
1280 unsafe fn decode(
1281 &mut self,
1282 decoder: &mut fidl::encoding::Decoder<'_, D>,
1283 offset: usize,
1284 mut depth: fidl::encoding::Depth,
1285 ) -> fidl::Result<()> {
1286 decoder.debug_check_bounds::<Self>(offset);
1287 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1288 None => return Err(fidl::Error::NotNullable),
1289 Some(len) => len,
1290 };
1291 if len == 0 {
1293 return Ok(());
1294 };
1295 depth.increment()?;
1296 let envelope_size = 8;
1297 let bytes_len = len * envelope_size;
1298 let offset = decoder.out_of_line_offset(bytes_len)?;
1299 let mut _next_ordinal_to_read = 0;
1301 let mut next_offset = offset;
1302 let end_offset = offset + bytes_len;
1303 _next_ordinal_to_read += 1;
1304 if next_offset >= end_offset {
1305 return Ok(());
1306 }
1307
1308 while _next_ordinal_to_read < 1 {
1310 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1311 _next_ordinal_to_read += 1;
1312 next_offset += envelope_size;
1313 }
1314
1315 let next_out_of_line = decoder.next_out_of_line();
1316 let handles_before = decoder.remaining_handles();
1317 if let Some((inlined, num_bytes, num_handles)) =
1318 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1319 {
1320 let member_inline_size =
1321 <ListTypefacesFlags as fidl::encoding::TypeMarker>::inline_size(
1322 decoder.context,
1323 );
1324 if inlined != (member_inline_size <= 4) {
1325 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1326 }
1327 let inner_offset;
1328 let mut inner_depth = depth.clone();
1329 if inlined {
1330 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1331 inner_offset = next_offset;
1332 } else {
1333 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1334 inner_depth.increment()?;
1335 }
1336 let val_ref =
1337 self.flags.get_or_insert_with(|| fidl::new_empty!(ListTypefacesFlags, D));
1338 fidl::decode!(ListTypefacesFlags, D, val_ref, decoder, inner_offset, inner_depth)?;
1339 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1340 {
1341 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1342 }
1343 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1344 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1345 }
1346 }
1347
1348 next_offset += envelope_size;
1349 _next_ordinal_to_read += 1;
1350 if next_offset >= end_offset {
1351 return Ok(());
1352 }
1353
1354 while _next_ordinal_to_read < 2 {
1356 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1357 _next_ordinal_to_read += 1;
1358 next_offset += envelope_size;
1359 }
1360
1361 let next_out_of_line = decoder.next_out_of_line();
1362 let handles_before = decoder.remaining_handles();
1363 if let Some((inlined, num_bytes, num_handles)) =
1364 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1365 {
1366 let member_inline_size =
1367 <fidl_fuchsia_fonts::FamilyName as fidl::encoding::TypeMarker>::inline_size(
1368 decoder.context,
1369 );
1370 if inlined != (member_inline_size <= 4) {
1371 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1372 }
1373 let inner_offset;
1374 let mut inner_depth = depth.clone();
1375 if inlined {
1376 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1377 inner_offset = next_offset;
1378 } else {
1379 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1380 inner_depth.increment()?;
1381 }
1382 let val_ref = self
1383 .family
1384 .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_fonts::FamilyName, D));
1385 fidl::decode!(
1386 fidl_fuchsia_fonts::FamilyName,
1387 D,
1388 val_ref,
1389 decoder,
1390 inner_offset,
1391 inner_depth
1392 )?;
1393 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1394 {
1395 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1396 }
1397 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1398 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1399 }
1400 }
1401
1402 next_offset += envelope_size;
1403 _next_ordinal_to_read += 1;
1404 if next_offset >= end_offset {
1405 return Ok(());
1406 }
1407
1408 while _next_ordinal_to_read < 3 {
1410 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1411 _next_ordinal_to_read += 1;
1412 next_offset += envelope_size;
1413 }
1414
1415 let next_out_of_line = decoder.next_out_of_line();
1416 let handles_before = decoder.remaining_handles();
1417 if let Some((inlined, num_bytes, num_handles)) =
1418 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1419 {
1420 let member_inline_size =
1421 <SlantRange as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1422 if inlined != (member_inline_size <= 4) {
1423 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1424 }
1425 let inner_offset;
1426 let mut inner_depth = depth.clone();
1427 if inlined {
1428 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1429 inner_offset = next_offset;
1430 } else {
1431 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1432 inner_depth.increment()?;
1433 }
1434 let val_ref = self.slant.get_or_insert_with(|| fidl::new_empty!(SlantRange, D));
1435 fidl::decode!(SlantRange, D, val_ref, decoder, inner_offset, inner_depth)?;
1436 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1437 {
1438 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1439 }
1440 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1441 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1442 }
1443 }
1444
1445 next_offset += envelope_size;
1446 _next_ordinal_to_read += 1;
1447 if next_offset >= end_offset {
1448 return Ok(());
1449 }
1450
1451 while _next_ordinal_to_read < 4 {
1453 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1454 _next_ordinal_to_read += 1;
1455 next_offset += envelope_size;
1456 }
1457
1458 let next_out_of_line = decoder.next_out_of_line();
1459 let handles_before = decoder.remaining_handles();
1460 if let Some((inlined, num_bytes, num_handles)) =
1461 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1462 {
1463 let member_inline_size =
1464 <WeightRange as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1465 if inlined != (member_inline_size <= 4) {
1466 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1467 }
1468 let inner_offset;
1469 let mut inner_depth = depth.clone();
1470 if inlined {
1471 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1472 inner_offset = next_offset;
1473 } else {
1474 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1475 inner_depth.increment()?;
1476 }
1477 let val_ref = self.weight.get_or_insert_with(|| fidl::new_empty!(WeightRange, D));
1478 fidl::decode!(WeightRange, D, val_ref, decoder, inner_offset, inner_depth)?;
1479 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1480 {
1481 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1482 }
1483 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1484 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1485 }
1486 }
1487
1488 next_offset += envelope_size;
1489 _next_ordinal_to_read += 1;
1490 if next_offset >= end_offset {
1491 return Ok(());
1492 }
1493
1494 while _next_ordinal_to_read < 5 {
1496 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1497 _next_ordinal_to_read += 1;
1498 next_offset += envelope_size;
1499 }
1500
1501 let next_out_of_line = decoder.next_out_of_line();
1502 let handles_before = decoder.remaining_handles();
1503 if let Some((inlined, num_bytes, num_handles)) =
1504 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1505 {
1506 let member_inline_size =
1507 <WidthRange as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1508 if inlined != (member_inline_size <= 4) {
1509 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1510 }
1511 let inner_offset;
1512 let mut inner_depth = depth.clone();
1513 if inlined {
1514 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1515 inner_offset = next_offset;
1516 } else {
1517 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1518 inner_depth.increment()?;
1519 }
1520 let val_ref = self.width.get_or_insert_with(|| fidl::new_empty!(WidthRange, D));
1521 fidl::decode!(WidthRange, D, val_ref, decoder, inner_offset, inner_depth)?;
1522 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1523 {
1524 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1525 }
1526 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1527 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1528 }
1529 }
1530
1531 next_offset += envelope_size;
1532 _next_ordinal_to_read += 1;
1533 if next_offset >= end_offset {
1534 return Ok(());
1535 }
1536
1537 while _next_ordinal_to_read < 6 {
1539 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1540 _next_ordinal_to_read += 1;
1541 next_offset += envelope_size;
1542 }
1543
1544 let next_out_of_line = decoder.next_out_of_line();
1545 let handles_before = decoder.remaining_handles();
1546 if let Some((inlined, num_bytes, num_handles)) =
1547 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1548 {
1549 let member_inline_size = <fidl::encoding::Vector<fidl_fuchsia_intl::LocaleId, 8> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1550 if inlined != (member_inline_size <= 4) {
1551 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1552 }
1553 let inner_offset;
1554 let mut inner_depth = depth.clone();
1555 if inlined {
1556 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1557 inner_offset = next_offset;
1558 } else {
1559 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1560 inner_depth.increment()?;
1561 }
1562 let val_ref = self.languages.get_or_insert_with(
1563 || fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_intl::LocaleId, 8>, D),
1564 );
1565 fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_intl::LocaleId, 8>, D, val_ref, decoder, inner_offset, inner_depth)?;
1566 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1567 {
1568 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1569 }
1570 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1571 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1572 }
1573 }
1574
1575 next_offset += envelope_size;
1576 _next_ordinal_to_read += 1;
1577 if next_offset >= end_offset {
1578 return Ok(());
1579 }
1580
1581 while _next_ordinal_to_read < 7 {
1583 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1584 _next_ordinal_to_read += 1;
1585 next_offset += envelope_size;
1586 }
1587
1588 let next_out_of_line = decoder.next_out_of_line();
1589 let handles_before = decoder.remaining_handles();
1590 if let Some((inlined, num_bytes, num_handles)) =
1591 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1592 {
1593 let member_inline_size = <fidl::encoding::UnboundedVector<u32> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1594 if inlined != (member_inline_size <= 4) {
1595 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1596 }
1597 let inner_offset;
1598 let mut inner_depth = depth.clone();
1599 if inlined {
1600 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1601 inner_offset = next_offset;
1602 } else {
1603 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1604 inner_depth.increment()?;
1605 }
1606 let val_ref = self.code_points.get_or_insert_with(|| {
1607 fidl::new_empty!(fidl::encoding::UnboundedVector<u32>, D)
1608 });
1609 fidl::decode!(
1610 fidl::encoding::UnboundedVector<u32>,
1611 D,
1612 val_ref,
1613 decoder,
1614 inner_offset,
1615 inner_depth
1616 )?;
1617 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1618 {
1619 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1620 }
1621 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1622 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1623 }
1624 }
1625
1626 next_offset += envelope_size;
1627 _next_ordinal_to_read += 1;
1628 if next_offset >= end_offset {
1629 return Ok(());
1630 }
1631
1632 while _next_ordinal_to_read < 8 {
1634 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1635 _next_ordinal_to_read += 1;
1636 next_offset += envelope_size;
1637 }
1638
1639 let next_out_of_line = decoder.next_out_of_line();
1640 let handles_before = decoder.remaining_handles();
1641 if let Some((inlined, num_bytes, num_handles)) =
1642 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1643 {
1644 let member_inline_size = <fidl_fuchsia_fonts::GenericFontFamily as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1645 if inlined != (member_inline_size <= 4) {
1646 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1647 }
1648 let inner_offset;
1649 let mut inner_depth = depth.clone();
1650 if inlined {
1651 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1652 inner_offset = next_offset;
1653 } else {
1654 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1655 inner_depth.increment()?;
1656 }
1657 let val_ref = self.generic_family.get_or_insert_with(|| {
1658 fidl::new_empty!(fidl_fuchsia_fonts::GenericFontFamily, D)
1659 });
1660 fidl::decode!(
1661 fidl_fuchsia_fonts::GenericFontFamily,
1662 D,
1663 val_ref,
1664 decoder,
1665 inner_offset,
1666 inner_depth
1667 )?;
1668 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1669 {
1670 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1671 }
1672 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1673 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1674 }
1675 }
1676
1677 next_offset += envelope_size;
1678
1679 while next_offset < end_offset {
1681 _next_ordinal_to_read += 1;
1682 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1683 next_offset += envelope_size;
1684 }
1685
1686 Ok(())
1687 }
1688 }
1689
1690 impl TypefaceInfo {
1691 #[inline(always)]
1692 fn max_ordinal_present(&self) -> u64 {
1693 if let Some(_) = self.generic_family {
1694 return 6;
1695 }
1696 if let Some(_) = self.languages {
1697 return 5;
1698 }
1699 if let Some(_) = self.style {
1700 return 4;
1701 }
1702 if let Some(_) = self.family {
1703 return 3;
1704 }
1705 if let Some(_) = self.font_index {
1706 return 2;
1707 }
1708 if let Some(_) = self.asset_id {
1709 return 1;
1710 }
1711 0
1712 }
1713 }
1714
1715 impl fidl::encoding::ValueTypeMarker for TypefaceInfo {
1716 type Borrowed<'a> = &'a Self;
1717 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1718 value
1719 }
1720 }
1721
1722 unsafe impl fidl::encoding::TypeMarker for TypefaceInfo {
1723 type Owned = Self;
1724
1725 #[inline(always)]
1726 fn inline_align(_context: fidl::encoding::Context) -> usize {
1727 8
1728 }
1729
1730 #[inline(always)]
1731 fn inline_size(_context: fidl::encoding::Context) -> usize {
1732 16
1733 }
1734 }
1735
1736 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TypefaceInfo, D>
1737 for &TypefaceInfo
1738 {
1739 unsafe fn encode(
1740 self,
1741 encoder: &mut fidl::encoding::Encoder<'_, D>,
1742 offset: usize,
1743 mut depth: fidl::encoding::Depth,
1744 ) -> fidl::Result<()> {
1745 encoder.debug_check_bounds::<TypefaceInfo>(offset);
1746 let max_ordinal: u64 = self.max_ordinal_present();
1748 encoder.write_num(max_ordinal, offset);
1749 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1750 if max_ordinal == 0 {
1752 return Ok(());
1753 }
1754 depth.increment()?;
1755 let envelope_size = 8;
1756 let bytes_len = max_ordinal as usize * envelope_size;
1757 #[allow(unused_variables)]
1758 let offset = encoder.out_of_line_offset(bytes_len);
1759 let mut _prev_end_offset: usize = 0;
1760 if 1 > max_ordinal {
1761 return Ok(());
1762 }
1763
1764 let cur_offset: usize = (1 - 1) * envelope_size;
1767
1768 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1770
1771 fidl::encoding::encode_in_envelope_optional::<u32, D>(
1776 self.asset_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
1777 encoder,
1778 offset + cur_offset,
1779 depth,
1780 )?;
1781
1782 _prev_end_offset = cur_offset + envelope_size;
1783 if 2 > max_ordinal {
1784 return Ok(());
1785 }
1786
1787 let cur_offset: usize = (2 - 1) * envelope_size;
1790
1791 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1793
1794 fidl::encoding::encode_in_envelope_optional::<u32, D>(
1799 self.font_index.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
1800 encoder,
1801 offset + cur_offset,
1802 depth,
1803 )?;
1804
1805 _prev_end_offset = cur_offset + envelope_size;
1806 if 3 > max_ordinal {
1807 return Ok(());
1808 }
1809
1810 let cur_offset: usize = (3 - 1) * envelope_size;
1813
1814 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1816
1817 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_fonts::FamilyName, D>(
1822 self.family.as_ref().map(
1823 <fidl_fuchsia_fonts::FamilyName as fidl::encoding::ValueTypeMarker>::borrow,
1824 ),
1825 encoder,
1826 offset + cur_offset,
1827 depth,
1828 )?;
1829
1830 _prev_end_offset = cur_offset + envelope_size;
1831 if 4 > max_ordinal {
1832 return Ok(());
1833 }
1834
1835 let cur_offset: usize = (4 - 1) * envelope_size;
1838
1839 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1841
1842 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_fonts::Style2, D>(
1847 self.style
1848 .as_ref()
1849 .map(<fidl_fuchsia_fonts::Style2 as fidl::encoding::ValueTypeMarker>::borrow),
1850 encoder,
1851 offset + cur_offset,
1852 depth,
1853 )?;
1854
1855 _prev_end_offset = cur_offset + envelope_size;
1856 if 5 > max_ordinal {
1857 return Ok(());
1858 }
1859
1860 let cur_offset: usize = (5 - 1) * envelope_size;
1863
1864 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1866
1867 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl_fuchsia_intl::LocaleId>, D>(
1872 self.languages.as_ref().map(<fidl::encoding::UnboundedVector<fidl_fuchsia_intl::LocaleId> as fidl::encoding::ValueTypeMarker>::borrow),
1873 encoder, offset + cur_offset, depth
1874 )?;
1875
1876 _prev_end_offset = cur_offset + envelope_size;
1877 if 6 > max_ordinal {
1878 return Ok(());
1879 }
1880
1881 let cur_offset: usize = (6 - 1) * envelope_size;
1884
1885 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1887
1888 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_fonts::GenericFontFamily, D>(
1893 self.generic_family.as_ref().map(<fidl_fuchsia_fonts::GenericFontFamily as fidl::encoding::ValueTypeMarker>::borrow),
1894 encoder, offset + cur_offset, depth
1895 )?;
1896
1897 _prev_end_offset = cur_offset + envelope_size;
1898
1899 Ok(())
1900 }
1901 }
1902
1903 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TypefaceInfo {
1904 #[inline(always)]
1905 fn new_empty() -> Self {
1906 Self::default()
1907 }
1908
1909 unsafe fn decode(
1910 &mut self,
1911 decoder: &mut fidl::encoding::Decoder<'_, D>,
1912 offset: usize,
1913 mut depth: fidl::encoding::Depth,
1914 ) -> fidl::Result<()> {
1915 decoder.debug_check_bounds::<Self>(offset);
1916 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1917 None => return Err(fidl::Error::NotNullable),
1918 Some(len) => len,
1919 };
1920 if len == 0 {
1922 return Ok(());
1923 };
1924 depth.increment()?;
1925 let envelope_size = 8;
1926 let bytes_len = len * envelope_size;
1927 let offset = decoder.out_of_line_offset(bytes_len)?;
1928 let mut _next_ordinal_to_read = 0;
1930 let mut next_offset = offset;
1931 let end_offset = offset + bytes_len;
1932 _next_ordinal_to_read += 1;
1933 if next_offset >= end_offset {
1934 return Ok(());
1935 }
1936
1937 while _next_ordinal_to_read < 1 {
1939 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1940 _next_ordinal_to_read += 1;
1941 next_offset += envelope_size;
1942 }
1943
1944 let next_out_of_line = decoder.next_out_of_line();
1945 let handles_before = decoder.remaining_handles();
1946 if let Some((inlined, num_bytes, num_handles)) =
1947 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1948 {
1949 let member_inline_size =
1950 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1951 if inlined != (member_inline_size <= 4) {
1952 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1953 }
1954 let inner_offset;
1955 let mut inner_depth = depth.clone();
1956 if inlined {
1957 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1958 inner_offset = next_offset;
1959 } else {
1960 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1961 inner_depth.increment()?;
1962 }
1963 let val_ref = self.asset_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
1964 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
1965 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1966 {
1967 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1968 }
1969 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1970 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1971 }
1972 }
1973
1974 next_offset += envelope_size;
1975 _next_ordinal_to_read += 1;
1976 if next_offset >= end_offset {
1977 return Ok(());
1978 }
1979
1980 while _next_ordinal_to_read < 2 {
1982 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1983 _next_ordinal_to_read += 1;
1984 next_offset += envelope_size;
1985 }
1986
1987 let next_out_of_line = decoder.next_out_of_line();
1988 let handles_before = decoder.remaining_handles();
1989 if let Some((inlined, num_bytes, num_handles)) =
1990 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1991 {
1992 let member_inline_size =
1993 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1994 if inlined != (member_inline_size <= 4) {
1995 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1996 }
1997 let inner_offset;
1998 let mut inner_depth = depth.clone();
1999 if inlined {
2000 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2001 inner_offset = next_offset;
2002 } else {
2003 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2004 inner_depth.increment()?;
2005 }
2006 let val_ref = self.font_index.get_or_insert_with(|| fidl::new_empty!(u32, D));
2007 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
2008 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2009 {
2010 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2011 }
2012 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2013 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2014 }
2015 }
2016
2017 next_offset += envelope_size;
2018 _next_ordinal_to_read += 1;
2019 if next_offset >= end_offset {
2020 return Ok(());
2021 }
2022
2023 while _next_ordinal_to_read < 3 {
2025 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2026 _next_ordinal_to_read += 1;
2027 next_offset += envelope_size;
2028 }
2029
2030 let next_out_of_line = decoder.next_out_of_line();
2031 let handles_before = decoder.remaining_handles();
2032 if let Some((inlined, num_bytes, num_handles)) =
2033 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2034 {
2035 let member_inline_size =
2036 <fidl_fuchsia_fonts::FamilyName as fidl::encoding::TypeMarker>::inline_size(
2037 decoder.context,
2038 );
2039 if inlined != (member_inline_size <= 4) {
2040 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2041 }
2042 let inner_offset;
2043 let mut inner_depth = depth.clone();
2044 if inlined {
2045 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2046 inner_offset = next_offset;
2047 } else {
2048 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2049 inner_depth.increment()?;
2050 }
2051 let val_ref = self
2052 .family
2053 .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_fonts::FamilyName, D));
2054 fidl::decode!(
2055 fidl_fuchsia_fonts::FamilyName,
2056 D,
2057 val_ref,
2058 decoder,
2059 inner_offset,
2060 inner_depth
2061 )?;
2062 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2063 {
2064 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2065 }
2066 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2067 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2068 }
2069 }
2070
2071 next_offset += envelope_size;
2072 _next_ordinal_to_read += 1;
2073 if next_offset >= end_offset {
2074 return Ok(());
2075 }
2076
2077 while _next_ordinal_to_read < 4 {
2079 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2080 _next_ordinal_to_read += 1;
2081 next_offset += envelope_size;
2082 }
2083
2084 let next_out_of_line = decoder.next_out_of_line();
2085 let handles_before = decoder.remaining_handles();
2086 if let Some((inlined, num_bytes, num_handles)) =
2087 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2088 {
2089 let member_inline_size =
2090 <fidl_fuchsia_fonts::Style2 as fidl::encoding::TypeMarker>::inline_size(
2091 decoder.context,
2092 );
2093 if inlined != (member_inline_size <= 4) {
2094 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2095 }
2096 let inner_offset;
2097 let mut inner_depth = depth.clone();
2098 if inlined {
2099 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2100 inner_offset = next_offset;
2101 } else {
2102 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2103 inner_depth.increment()?;
2104 }
2105 let val_ref = self
2106 .style
2107 .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_fonts::Style2, D));
2108 fidl::decode!(
2109 fidl_fuchsia_fonts::Style2,
2110 D,
2111 val_ref,
2112 decoder,
2113 inner_offset,
2114 inner_depth
2115 )?;
2116 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2117 {
2118 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2119 }
2120 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2121 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2122 }
2123 }
2124
2125 next_offset += envelope_size;
2126 _next_ordinal_to_read += 1;
2127 if next_offset >= end_offset {
2128 return Ok(());
2129 }
2130
2131 while _next_ordinal_to_read < 5 {
2133 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2134 _next_ordinal_to_read += 1;
2135 next_offset += envelope_size;
2136 }
2137
2138 let next_out_of_line = decoder.next_out_of_line();
2139 let handles_before = decoder.remaining_handles();
2140 if let Some((inlined, num_bytes, num_handles)) =
2141 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2142 {
2143 let member_inline_size = <fidl::encoding::UnboundedVector<
2144 fidl_fuchsia_intl::LocaleId,
2145 > as fidl::encoding::TypeMarker>::inline_size(
2146 decoder.context
2147 );
2148 if inlined != (member_inline_size <= 4) {
2149 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2150 }
2151 let inner_offset;
2152 let mut inner_depth = depth.clone();
2153 if inlined {
2154 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2155 inner_offset = next_offset;
2156 } else {
2157 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2158 inner_depth.increment()?;
2159 }
2160 let val_ref = self.languages.get_or_insert_with(|| {
2161 fidl::new_empty!(
2162 fidl::encoding::UnboundedVector<fidl_fuchsia_intl::LocaleId>,
2163 D
2164 )
2165 });
2166 fidl::decode!(
2167 fidl::encoding::UnboundedVector<fidl_fuchsia_intl::LocaleId>,
2168 D,
2169 val_ref,
2170 decoder,
2171 inner_offset,
2172 inner_depth
2173 )?;
2174 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2175 {
2176 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2177 }
2178 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2179 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2180 }
2181 }
2182
2183 next_offset += envelope_size;
2184 _next_ordinal_to_read += 1;
2185 if next_offset >= end_offset {
2186 return Ok(());
2187 }
2188
2189 while _next_ordinal_to_read < 6 {
2191 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2192 _next_ordinal_to_read += 1;
2193 next_offset += envelope_size;
2194 }
2195
2196 let next_out_of_line = decoder.next_out_of_line();
2197 let handles_before = decoder.remaining_handles();
2198 if let Some((inlined, num_bytes, num_handles)) =
2199 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2200 {
2201 let member_inline_size = <fidl_fuchsia_fonts::GenericFontFamily as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2202 if inlined != (member_inline_size <= 4) {
2203 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2204 }
2205 let inner_offset;
2206 let mut inner_depth = depth.clone();
2207 if inlined {
2208 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2209 inner_offset = next_offset;
2210 } else {
2211 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2212 inner_depth.increment()?;
2213 }
2214 let val_ref = self.generic_family.get_or_insert_with(|| {
2215 fidl::new_empty!(fidl_fuchsia_fonts::GenericFontFamily, D)
2216 });
2217 fidl::decode!(
2218 fidl_fuchsia_fonts::GenericFontFamily,
2219 D,
2220 val_ref,
2221 decoder,
2222 inner_offset,
2223 inner_depth
2224 )?;
2225 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2226 {
2227 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2228 }
2229 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2230 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2231 }
2232 }
2233
2234 next_offset += envelope_size;
2235
2236 while next_offset < end_offset {
2238 _next_ordinal_to_read += 1;
2239 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2240 next_offset += envelope_size;
2241 }
2242
2243 Ok(())
2244 }
2245 }
2246
2247 impl TypefaceInfoResponse {
2248 #[inline(always)]
2249 fn max_ordinal_present(&self) -> u64 {
2250 if let Some(_) = self.results {
2251 return 1;
2252 }
2253 0
2254 }
2255 }
2256
2257 impl fidl::encoding::ValueTypeMarker for TypefaceInfoResponse {
2258 type Borrowed<'a> = &'a Self;
2259 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2260 value
2261 }
2262 }
2263
2264 unsafe impl fidl::encoding::TypeMarker for TypefaceInfoResponse {
2265 type Owned = Self;
2266
2267 #[inline(always)]
2268 fn inline_align(_context: fidl::encoding::Context) -> usize {
2269 8
2270 }
2271
2272 #[inline(always)]
2273 fn inline_size(_context: fidl::encoding::Context) -> usize {
2274 16
2275 }
2276 }
2277
2278 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TypefaceInfoResponse, D>
2279 for &TypefaceInfoResponse
2280 {
2281 unsafe fn encode(
2282 self,
2283 encoder: &mut fidl::encoding::Encoder<'_, D>,
2284 offset: usize,
2285 mut depth: fidl::encoding::Depth,
2286 ) -> fidl::Result<()> {
2287 encoder.debug_check_bounds::<TypefaceInfoResponse>(offset);
2288 let max_ordinal: u64 = self.max_ordinal_present();
2290 encoder.write_num(max_ordinal, offset);
2291 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2292 if max_ordinal == 0 {
2294 return Ok(());
2295 }
2296 depth.increment()?;
2297 let envelope_size = 8;
2298 let bytes_len = max_ordinal as usize * envelope_size;
2299 #[allow(unused_variables)]
2300 let offset = encoder.out_of_line_offset(bytes_len);
2301 let mut _prev_end_offset: usize = 0;
2302 if 1 > max_ordinal {
2303 return Ok(());
2304 }
2305
2306 let cur_offset: usize = (1 - 1) * envelope_size;
2309
2310 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2312
2313 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<TypefaceInfo, 16>, D>(
2318 self.results.as_ref().map(<fidl::encoding::Vector<TypefaceInfo, 16> as fidl::encoding::ValueTypeMarker>::borrow),
2319 encoder, offset + cur_offset, depth
2320 )?;
2321
2322 _prev_end_offset = cur_offset + envelope_size;
2323
2324 Ok(())
2325 }
2326 }
2327
2328 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TypefaceInfoResponse {
2329 #[inline(always)]
2330 fn new_empty() -> Self {
2331 Self::default()
2332 }
2333
2334 unsafe fn decode(
2335 &mut self,
2336 decoder: &mut fidl::encoding::Decoder<'_, D>,
2337 offset: usize,
2338 mut depth: fidl::encoding::Depth,
2339 ) -> fidl::Result<()> {
2340 decoder.debug_check_bounds::<Self>(offset);
2341 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2342 None => return Err(fidl::Error::NotNullable),
2343 Some(len) => len,
2344 };
2345 if len == 0 {
2347 return Ok(());
2348 };
2349 depth.increment()?;
2350 let envelope_size = 8;
2351 let bytes_len = len * envelope_size;
2352 let offset = decoder.out_of_line_offset(bytes_len)?;
2353 let mut _next_ordinal_to_read = 0;
2355 let mut next_offset = offset;
2356 let end_offset = offset + bytes_len;
2357 _next_ordinal_to_read += 1;
2358 if next_offset >= end_offset {
2359 return Ok(());
2360 }
2361
2362 while _next_ordinal_to_read < 1 {
2364 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2365 _next_ordinal_to_read += 1;
2366 next_offset += envelope_size;
2367 }
2368
2369 let next_out_of_line = decoder.next_out_of_line();
2370 let handles_before = decoder.remaining_handles();
2371 if let Some((inlined, num_bytes, num_handles)) =
2372 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2373 {
2374 let member_inline_size = <fidl::encoding::Vector<TypefaceInfo, 16> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2375 if inlined != (member_inline_size <= 4) {
2376 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2377 }
2378 let inner_offset;
2379 let mut inner_depth = depth.clone();
2380 if inlined {
2381 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2382 inner_offset = next_offset;
2383 } else {
2384 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2385 inner_depth.increment()?;
2386 }
2387 let val_ref = self.results.get_or_insert_with(
2388 || fidl::new_empty!(fidl::encoding::Vector<TypefaceInfo, 16>, D),
2389 );
2390 fidl::decode!(fidl::encoding::Vector<TypefaceInfo, 16>, D, val_ref, decoder, inner_offset, inner_depth)?;
2391 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2392 {
2393 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2394 }
2395 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2396 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2397 }
2398 }
2399
2400 next_offset += envelope_size;
2401
2402 while next_offset < end_offset {
2404 _next_ordinal_to_read += 1;
2405 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2406 next_offset += envelope_size;
2407 }
2408
2409 Ok(())
2410 }
2411 }
2412}