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 type Weight = u16;
12
13pub const DEFAULT_SLANT: Slant = Slant::Upright;
15
16pub const DEFAULT_WEIGHT: u16 = WEIGHT_NORMAL as u16;
18
19pub const DEFAULT_WIDTH: Width = Width::Normal;
21
22pub const MAX_FACE_QUERY_CODE_POINTS: u32 = 128;
24
25pub const MAX_FACE_QUERY_LANGUAGES: u32 = 8;
27
28pub const MAX_FAMILY_NAME_LENGTH: u32 = 128;
30
31pub const MAX_FAMILY_STYLES: u32 = 300;
33
34pub const MAX_POSTSCRIPT_TYPEFACE_NAME_LENGTH: u32 = 63;
37
38pub const MAX_TYPEFACE_NAME_LENGTH: u32 = 128;
40
41pub const REQUEST_FLAG_EXACT_MATCH: u32 = 2;
45
46pub const REQUEST_FLAG_NO_FALLBACK: u32 = 1;
51
52pub const WEIGHT_BLACK: u16 = 900;
53
54pub const WEIGHT_BOLD: u16 = 700;
55
56pub const WEIGHT_EXTRA_BOLD: u16 = 800;
57
58pub const WEIGHT_EXTRA_LIGHT: u16 = 200;
59
60pub const WEIGHT_LIGHT: u16 = 300;
61
62pub const WEIGHT_MEDIUM: u16 = 500;
63
64pub const WEIGHT_NORMAL: u16 = 400;
65
66pub const WEIGHT_SEMI_BOLD: u16 = 600;
67
68pub const WEIGHT_THIN: u16 = 100;
69
70bitflags! {
71 #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
73 pub struct TypefaceRequestFlags: u32 {
74 const EXACT_FAMILY = 1;
77 const EXACT_STYLE = 2;
81 }
82}
83
84impl TypefaceRequestFlags {
85 #[deprecated = "Strict bits should not use `has_unknown_bits`"]
86 #[inline(always)]
87 pub fn has_unknown_bits(&self) -> bool {
88 false
89 }
90
91 #[deprecated = "Strict bits should not use `get_unknown_bits`"]
92 #[inline(always)]
93 pub fn get_unknown_bits(&self) -> u32 {
94 0
95 }
96}
97
98#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
101#[repr(u32)]
102pub enum CacheMissPolicy {
103 BlockUntilDownloaded = 1,
109 ReturnEmptyResponse = 2,
115 ReturnFallback = 3,
121}
122
123impl CacheMissPolicy {
124 #[inline]
125 pub fn from_primitive(prim: u32) -> Option<Self> {
126 match prim {
127 1 => Some(Self::BlockUntilDownloaded),
128 2 => Some(Self::ReturnEmptyResponse),
129 3 => Some(Self::ReturnFallback),
130 _ => None,
131 }
132 }
133
134 #[inline]
135 pub const fn into_primitive(self) -> u32 {
136 self as u32
137 }
138
139 #[deprecated = "Strict enums should not use `is_unknown`"]
140 #[inline]
141 pub fn is_unknown(&self) -> bool {
142 false
143 }
144}
145
146#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
148#[repr(u32)]
149pub enum FallbackGroup {
150 None = 0,
151 Serif = 1,
152 SansSerif = 2,
153 Monospace = 3,
154 Cursive = 4,
155 Fantasy = 5,
156}
157
158impl FallbackGroup {
159 #[inline]
160 pub fn from_primitive(prim: u32) -> Option<Self> {
161 match prim {
162 0 => Some(Self::None),
163 1 => Some(Self::Serif),
164 2 => Some(Self::SansSerif),
165 3 => Some(Self::Monospace),
166 4 => Some(Self::Cursive),
167 5 => Some(Self::Fantasy),
168 _ => None,
169 }
170 }
171
172 #[inline]
173 pub const fn into_primitive(self) -> u32 {
174 self as u32
175 }
176
177 #[deprecated = "Strict enums should not use `is_unknown`"]
178 #[inline]
179 pub fn is_unknown(&self) -> bool {
180 false
181 }
182}
183
184#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
196#[repr(u32)]
197pub enum GenericFontFamily {
198 Serif = 1,
201 SansSerif = 2,
204 Monospace = 3,
207 Cursive = 4,
210 Fantasy = 5,
213 SystemUi = 6,
220 Emoji = 7,
223 Math = 8,
227 Fangsong = 9,
232}
233
234impl GenericFontFamily {
235 #[inline]
236 pub fn from_primitive(prim: u32) -> Option<Self> {
237 match prim {
238 1 => Some(Self::Serif),
239 2 => Some(Self::SansSerif),
240 3 => Some(Self::Monospace),
241 4 => Some(Self::Cursive),
242 5 => Some(Self::Fantasy),
243 6 => Some(Self::SystemUi),
244 7 => Some(Self::Emoji),
245 8 => Some(Self::Math),
246 9 => Some(Self::Fangsong),
247 _ => None,
248 }
249 }
250
251 #[inline]
252 pub const fn into_primitive(self) -> u32 {
253 self as u32
254 }
255
256 #[deprecated = "Strict enums should not use `is_unknown`"]
257 #[inline]
258 pub fn is_unknown(&self) -> bool {
259 false
260 }
261}
262
263#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
265#[repr(u32)]
266pub enum Slant {
267 Upright = 1,
269 Italic = 2,
271 Oblique = 3,
274}
275
276impl Slant {
277 #[inline]
278 pub fn from_primitive(prim: u32) -> Option<Self> {
279 match prim {
280 1 => Some(Self::Upright),
281 2 => Some(Self::Italic),
282 3 => Some(Self::Oblique),
283 _ => None,
284 }
285 }
286
287 #[inline]
288 pub const fn into_primitive(self) -> u32 {
289 self as u32
290 }
291
292 #[deprecated = "Strict enums should not use `is_unknown`"]
293 #[inline]
294 pub fn is_unknown(&self) -> bool {
295 false
296 }
297}
298
299#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
303#[repr(u32)]
304pub enum Width {
305 UltraCondensed = 1,
307 ExtraCondensed = 2,
309 Condensed = 3,
311 SemiCondensed = 4,
313 Normal = 5,
315 SemiExpanded = 6,
317 Expanded = 7,
319 ExtraExpanded = 8,
321 UltraExpanded = 9,
323}
324
325impl Width {
326 #[inline]
327 pub fn from_primitive(prim: u32) -> Option<Self> {
328 match prim {
329 1 => Some(Self::UltraCondensed),
330 2 => Some(Self::ExtraCondensed),
331 3 => Some(Self::Condensed),
332 4 => Some(Self::SemiCondensed),
333 5 => Some(Self::Normal),
334 6 => Some(Self::SemiExpanded),
335 7 => Some(Self::Expanded),
336 8 => Some(Self::ExtraExpanded),
337 9 => Some(Self::UltraExpanded),
338 _ => None,
339 }
340 }
341
342 #[inline]
343 pub const fn into_primitive(self) -> u32 {
344 self as u32
345 }
346
347 #[deprecated = "Strict enums should not use `is_unknown`"]
348 #[inline]
349 pub fn is_unknown(&self) -> bool {
350 false
351 }
352}
353
354#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
358pub struct FamilyInfo {
359 pub name: String,
364 pub styles: Vec<Style>,
366}
367
368impl fidl::Persistable for FamilyInfo {}
369
370#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
374pub struct FamilyName {
375 pub name: String,
377}
378
379impl fidl::Persistable for FamilyName {}
380
381#[derive(Clone, Debug, PartialEq)]
382pub struct FontSetEventListenerOnFontSetUpdatedRequest {
383 pub event: FontSetUpdatedEvent,
384}
385
386impl fidl::Persistable for FontSetEventListenerOnFontSetUpdatedRequest {}
387
388#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
389pub struct ProviderGetFamilyInfoRequest {
390 pub family: String,
391}
392
393impl fidl::Persistable for ProviderGetFamilyInfoRequest {}
394
395#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
396pub struct ProviderGetFamilyInfoResponse {
397 pub family_info: Option<Box<FamilyInfo>>,
398}
399
400impl fidl::Persistable for ProviderGetFamilyInfoResponse {}
401
402#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
403pub struct ProviderGetFontFamilyInfoRequest {
404 pub family: FamilyName,
405}
406
407impl fidl::Persistable for ProviderGetFontFamilyInfoRequest {}
408
409#[derive(Clone, Debug, PartialEq)]
410pub struct ProviderGetFontFamilyInfoResponse {
411 pub family_info: FontFamilyInfo,
412}
413
414impl fidl::Persistable for ProviderGetFontFamilyInfoResponse {}
415
416#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
417pub struct ProviderGetFontRequest {
418 pub request: Request,
419}
420
421impl fidl::Persistable for ProviderGetFontRequest {}
422
423#[derive(Clone, Debug, PartialEq)]
424pub struct ProviderGetTypefaceRequest {
425 pub request: TypefaceRequest,
426}
427
428impl fidl::Persistable for ProviderGetTypefaceRequest {}
429
430#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
432pub struct Request {
433 pub family: Option<String>,
439 pub weight: u32,
441 pub width: u32,
445 pub slant: Slant,
446 pub language: Option<Vec<String>>,
449 pub character: u32,
454 pub fallback_group: FallbackGroup,
458 pub flags: u32,
459}
460
461impl fidl::Persistable for Request {}
462
463#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
466pub struct Style {
467 pub weight: u32,
468 pub width: u32,
469 pub slant: Slant,
470}
471
472impl fidl::Persistable for Style {}
473
474#[derive(Clone, Debug, Default, PartialEq)]
478pub struct FontFamilyInfo {
479 pub name: Option<FamilyName>,
483 pub styles: Option<Vec<Style2>>,
485 #[doc(hidden)]
486 pub __source_breaking: fidl::marker::SourceBreaking,
487}
488
489impl fidl::Persistable for FontFamilyInfo {}
490
491#[derive(Clone, Debug, Default, PartialEq)]
495pub struct FontSetUpdatedEvent {
496 #[doc(hidden)]
497 pub __source_breaking: fidl::marker::SourceBreaking,
498}
499
500impl fidl::Persistable for FontSetUpdatedEvent {}
501
502#[derive(Clone, Debug, Default, PartialEq)]
504pub struct Style2 {
505 pub slant: Option<Slant>,
507 pub weight: Option<u16>,
515 pub width: Option<Width>,
517 #[doc(hidden)]
518 pub __source_breaking: fidl::marker::SourceBreaking,
519}
520
521impl fidl::Persistable for Style2 {}
522
523#[derive(Clone, Debug, Default, PartialEq)]
525pub struct TypefaceQuery {
526 pub family: Option<FamilyName>,
532 pub style: Option<Style2>,
534 pub languages: Option<Vec<fidl_fuchsia_intl::LocaleId>>,
539 pub code_points: Option<Vec<u32>>,
544 pub fallback_family: Option<GenericFontFamily>,
554 pub postscript_name: Option<String>,
562 pub full_name: Option<String>,
567 #[doc(hidden)]
568 pub __source_breaking: fidl::marker::SourceBreaking,
569}
570
571impl fidl::Persistable for TypefaceQuery {}
572
573#[derive(Clone, Debug, Default, PartialEq)]
575pub struct TypefaceRequest {
576 pub query: Option<TypefaceQuery>,
578 pub flags: Option<TypefaceRequestFlags>,
580 pub cache_miss_policy: Option<CacheMissPolicy>,
590 #[doc(hidden)]
591 pub __source_breaking: fidl::marker::SourceBreaking,
592}
593
594impl fidl::Persistable for TypefaceRequest {}
595
596mod internal {
597 use super::*;
598 unsafe impl fidl::encoding::TypeMarker for TypefaceRequestFlags {
599 type Owned = Self;
600
601 #[inline(always)]
602 fn inline_align(_context: fidl::encoding::Context) -> usize {
603 4
604 }
605
606 #[inline(always)]
607 fn inline_size(_context: fidl::encoding::Context) -> usize {
608 4
609 }
610 }
611
612 impl fidl::encoding::ValueTypeMarker for TypefaceRequestFlags {
613 type Borrowed<'a> = Self;
614 #[inline(always)]
615 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
616 *value
617 }
618 }
619
620 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
621 for TypefaceRequestFlags
622 {
623 #[inline]
624 unsafe fn encode(
625 self,
626 encoder: &mut fidl::encoding::Encoder<'_, D>,
627 offset: usize,
628 _depth: fidl::encoding::Depth,
629 ) -> fidl::Result<()> {
630 encoder.debug_check_bounds::<Self>(offset);
631 if self.bits() & Self::all().bits() != self.bits() {
632 return Err(fidl::Error::InvalidBitsValue);
633 }
634 encoder.write_num(self.bits(), offset);
635 Ok(())
636 }
637 }
638
639 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TypefaceRequestFlags {
640 #[inline(always)]
641 fn new_empty() -> Self {
642 Self::empty()
643 }
644
645 #[inline]
646 unsafe fn decode(
647 &mut self,
648 decoder: &mut fidl::encoding::Decoder<'_, D>,
649 offset: usize,
650 _depth: fidl::encoding::Depth,
651 ) -> fidl::Result<()> {
652 decoder.debug_check_bounds::<Self>(offset);
653 let prim = decoder.read_num::<u32>(offset);
654 *self = Self::from_bits(prim).ok_or(fidl::Error::InvalidBitsValue)?;
655 Ok(())
656 }
657 }
658 unsafe impl fidl::encoding::TypeMarker for CacheMissPolicy {
659 type Owned = Self;
660
661 #[inline(always)]
662 fn inline_align(_context: fidl::encoding::Context) -> usize {
663 std::mem::align_of::<u32>()
664 }
665
666 #[inline(always)]
667 fn inline_size(_context: fidl::encoding::Context) -> usize {
668 std::mem::size_of::<u32>()
669 }
670
671 #[inline(always)]
672 fn encode_is_copy() -> bool {
673 true
674 }
675
676 #[inline(always)]
677 fn decode_is_copy() -> bool {
678 false
679 }
680 }
681
682 impl fidl::encoding::ValueTypeMarker for CacheMissPolicy {
683 type Borrowed<'a> = Self;
684 #[inline(always)]
685 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
686 *value
687 }
688 }
689
690 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
691 for CacheMissPolicy
692 {
693 #[inline]
694 unsafe fn encode(
695 self,
696 encoder: &mut fidl::encoding::Encoder<'_, D>,
697 offset: usize,
698 _depth: fidl::encoding::Depth,
699 ) -> fidl::Result<()> {
700 encoder.debug_check_bounds::<Self>(offset);
701 encoder.write_num(self.into_primitive(), offset);
702 Ok(())
703 }
704 }
705
706 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CacheMissPolicy {
707 #[inline(always)]
708 fn new_empty() -> Self {
709 Self::BlockUntilDownloaded
710 }
711
712 #[inline]
713 unsafe fn decode(
714 &mut self,
715 decoder: &mut fidl::encoding::Decoder<'_, D>,
716 offset: usize,
717 _depth: fidl::encoding::Depth,
718 ) -> fidl::Result<()> {
719 decoder.debug_check_bounds::<Self>(offset);
720 let prim = decoder.read_num::<u32>(offset);
721
722 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
723 Ok(())
724 }
725 }
726 unsafe impl fidl::encoding::TypeMarker for FallbackGroup {
727 type Owned = Self;
728
729 #[inline(always)]
730 fn inline_align(_context: fidl::encoding::Context) -> usize {
731 std::mem::align_of::<u32>()
732 }
733
734 #[inline(always)]
735 fn inline_size(_context: fidl::encoding::Context) -> usize {
736 std::mem::size_of::<u32>()
737 }
738
739 #[inline(always)]
740 fn encode_is_copy() -> bool {
741 true
742 }
743
744 #[inline(always)]
745 fn decode_is_copy() -> bool {
746 false
747 }
748 }
749
750 impl fidl::encoding::ValueTypeMarker for FallbackGroup {
751 type Borrowed<'a> = Self;
752 #[inline(always)]
753 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
754 *value
755 }
756 }
757
758 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for FallbackGroup {
759 #[inline]
760 unsafe fn encode(
761 self,
762 encoder: &mut fidl::encoding::Encoder<'_, D>,
763 offset: usize,
764 _depth: fidl::encoding::Depth,
765 ) -> fidl::Result<()> {
766 encoder.debug_check_bounds::<Self>(offset);
767 encoder.write_num(self.into_primitive(), offset);
768 Ok(())
769 }
770 }
771
772 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for FallbackGroup {
773 #[inline(always)]
774 fn new_empty() -> Self {
775 Self::None
776 }
777
778 #[inline]
779 unsafe fn decode(
780 &mut self,
781 decoder: &mut fidl::encoding::Decoder<'_, D>,
782 offset: usize,
783 _depth: fidl::encoding::Depth,
784 ) -> fidl::Result<()> {
785 decoder.debug_check_bounds::<Self>(offset);
786 let prim = decoder.read_num::<u32>(offset);
787
788 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
789 Ok(())
790 }
791 }
792 unsafe impl fidl::encoding::TypeMarker for GenericFontFamily {
793 type Owned = Self;
794
795 #[inline(always)]
796 fn inline_align(_context: fidl::encoding::Context) -> usize {
797 std::mem::align_of::<u32>()
798 }
799
800 #[inline(always)]
801 fn inline_size(_context: fidl::encoding::Context) -> usize {
802 std::mem::size_of::<u32>()
803 }
804
805 #[inline(always)]
806 fn encode_is_copy() -> bool {
807 true
808 }
809
810 #[inline(always)]
811 fn decode_is_copy() -> bool {
812 false
813 }
814 }
815
816 impl fidl::encoding::ValueTypeMarker for GenericFontFamily {
817 type Borrowed<'a> = Self;
818 #[inline(always)]
819 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
820 *value
821 }
822 }
823
824 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
825 for GenericFontFamily
826 {
827 #[inline]
828 unsafe fn encode(
829 self,
830 encoder: &mut fidl::encoding::Encoder<'_, D>,
831 offset: usize,
832 _depth: fidl::encoding::Depth,
833 ) -> fidl::Result<()> {
834 encoder.debug_check_bounds::<Self>(offset);
835 encoder.write_num(self.into_primitive(), offset);
836 Ok(())
837 }
838 }
839
840 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for GenericFontFamily {
841 #[inline(always)]
842 fn new_empty() -> Self {
843 Self::Serif
844 }
845
846 #[inline]
847 unsafe fn decode(
848 &mut self,
849 decoder: &mut fidl::encoding::Decoder<'_, D>,
850 offset: usize,
851 _depth: fidl::encoding::Depth,
852 ) -> fidl::Result<()> {
853 decoder.debug_check_bounds::<Self>(offset);
854 let prim = decoder.read_num::<u32>(offset);
855
856 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
857 Ok(())
858 }
859 }
860 unsafe impl fidl::encoding::TypeMarker for Slant {
861 type Owned = Self;
862
863 #[inline(always)]
864 fn inline_align(_context: fidl::encoding::Context) -> usize {
865 std::mem::align_of::<u32>()
866 }
867
868 #[inline(always)]
869 fn inline_size(_context: fidl::encoding::Context) -> usize {
870 std::mem::size_of::<u32>()
871 }
872
873 #[inline(always)]
874 fn encode_is_copy() -> bool {
875 true
876 }
877
878 #[inline(always)]
879 fn decode_is_copy() -> bool {
880 false
881 }
882 }
883
884 impl fidl::encoding::ValueTypeMarker for Slant {
885 type Borrowed<'a> = Self;
886 #[inline(always)]
887 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
888 *value
889 }
890 }
891
892 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Slant {
893 #[inline]
894 unsafe fn encode(
895 self,
896 encoder: &mut fidl::encoding::Encoder<'_, D>,
897 offset: usize,
898 _depth: fidl::encoding::Depth,
899 ) -> fidl::Result<()> {
900 encoder.debug_check_bounds::<Self>(offset);
901 encoder.write_num(self.into_primitive(), offset);
902 Ok(())
903 }
904 }
905
906 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Slant {
907 #[inline(always)]
908 fn new_empty() -> Self {
909 Self::Upright
910 }
911
912 #[inline]
913 unsafe fn decode(
914 &mut self,
915 decoder: &mut fidl::encoding::Decoder<'_, D>,
916 offset: usize,
917 _depth: fidl::encoding::Depth,
918 ) -> fidl::Result<()> {
919 decoder.debug_check_bounds::<Self>(offset);
920 let prim = decoder.read_num::<u32>(offset);
921
922 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
923 Ok(())
924 }
925 }
926 unsafe impl fidl::encoding::TypeMarker for Width {
927 type Owned = Self;
928
929 #[inline(always)]
930 fn inline_align(_context: fidl::encoding::Context) -> usize {
931 std::mem::align_of::<u32>()
932 }
933
934 #[inline(always)]
935 fn inline_size(_context: fidl::encoding::Context) -> usize {
936 std::mem::size_of::<u32>()
937 }
938
939 #[inline(always)]
940 fn encode_is_copy() -> bool {
941 true
942 }
943
944 #[inline(always)]
945 fn decode_is_copy() -> bool {
946 false
947 }
948 }
949
950 impl fidl::encoding::ValueTypeMarker for Width {
951 type Borrowed<'a> = Self;
952 #[inline(always)]
953 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
954 *value
955 }
956 }
957
958 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Width {
959 #[inline]
960 unsafe fn encode(
961 self,
962 encoder: &mut fidl::encoding::Encoder<'_, D>,
963 offset: usize,
964 _depth: fidl::encoding::Depth,
965 ) -> fidl::Result<()> {
966 encoder.debug_check_bounds::<Self>(offset);
967 encoder.write_num(self.into_primitive(), offset);
968 Ok(())
969 }
970 }
971
972 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Width {
973 #[inline(always)]
974 fn new_empty() -> Self {
975 Self::UltraCondensed
976 }
977
978 #[inline]
979 unsafe fn decode(
980 &mut self,
981 decoder: &mut fidl::encoding::Decoder<'_, D>,
982 offset: usize,
983 _depth: fidl::encoding::Depth,
984 ) -> fidl::Result<()> {
985 decoder.debug_check_bounds::<Self>(offset);
986 let prim = decoder.read_num::<u32>(offset);
987
988 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
989 Ok(())
990 }
991 }
992
993 impl fidl::encoding::ValueTypeMarker for FamilyInfo {
994 type Borrowed<'a> = &'a Self;
995 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
996 value
997 }
998 }
999
1000 unsafe impl fidl::encoding::TypeMarker for FamilyInfo {
1001 type Owned = Self;
1002
1003 #[inline(always)]
1004 fn inline_align(_context: fidl::encoding::Context) -> usize {
1005 8
1006 }
1007
1008 #[inline(always)]
1009 fn inline_size(_context: fidl::encoding::Context) -> usize {
1010 32
1011 }
1012 }
1013
1014 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<FamilyInfo, D>
1015 for &FamilyInfo
1016 {
1017 #[inline]
1018 unsafe fn encode(
1019 self,
1020 encoder: &mut fidl::encoding::Encoder<'_, D>,
1021 offset: usize,
1022 _depth: fidl::encoding::Depth,
1023 ) -> fidl::Result<()> {
1024 encoder.debug_check_bounds::<FamilyInfo>(offset);
1025 fidl::encoding::Encode::<FamilyInfo, D>::encode(
1027 (
1028 <fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow(
1029 &self.name,
1030 ),
1031 <fidl::encoding::Vector<Style, 300> as fidl::encoding::ValueTypeMarker>::borrow(
1032 &self.styles,
1033 ),
1034 ),
1035 encoder,
1036 offset,
1037 _depth,
1038 )
1039 }
1040 }
1041 unsafe impl<
1042 D: fidl::encoding::ResourceDialect,
1043 T0: fidl::encoding::Encode<fidl::encoding::BoundedString<128>, D>,
1044 T1: fidl::encoding::Encode<fidl::encoding::Vector<Style, 300>, D>,
1045 > fidl::encoding::Encode<FamilyInfo, D> for (T0, T1)
1046 {
1047 #[inline]
1048 unsafe fn encode(
1049 self,
1050 encoder: &mut fidl::encoding::Encoder<'_, D>,
1051 offset: usize,
1052 depth: fidl::encoding::Depth,
1053 ) -> fidl::Result<()> {
1054 encoder.debug_check_bounds::<FamilyInfo>(offset);
1055 self.0.encode(encoder, offset + 0, depth)?;
1059 self.1.encode(encoder, offset + 16, depth)?;
1060 Ok(())
1061 }
1062 }
1063
1064 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for FamilyInfo {
1065 #[inline(always)]
1066 fn new_empty() -> Self {
1067 Self {
1068 name: fidl::new_empty!(fidl::encoding::BoundedString<128>, D),
1069 styles: fidl::new_empty!(fidl::encoding::Vector<Style, 300>, D),
1070 }
1071 }
1072
1073 #[inline]
1074 unsafe fn decode(
1075 &mut self,
1076 decoder: &mut fidl::encoding::Decoder<'_, D>,
1077 offset: usize,
1078 _depth: fidl::encoding::Depth,
1079 ) -> fidl::Result<()> {
1080 decoder.debug_check_bounds::<Self>(offset);
1081 fidl::decode!(
1083 fidl::encoding::BoundedString<128>,
1084 D,
1085 &mut self.name,
1086 decoder,
1087 offset + 0,
1088 _depth
1089 )?;
1090 fidl::decode!(fidl::encoding::Vector<Style, 300>, D, &mut self.styles, decoder, offset + 16, _depth)?;
1091 Ok(())
1092 }
1093 }
1094
1095 impl fidl::encoding::ValueTypeMarker for FamilyName {
1096 type Borrowed<'a> = &'a Self;
1097 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1098 value
1099 }
1100 }
1101
1102 unsafe impl fidl::encoding::TypeMarker for FamilyName {
1103 type Owned = Self;
1104
1105 #[inline(always)]
1106 fn inline_align(_context: fidl::encoding::Context) -> usize {
1107 8
1108 }
1109
1110 #[inline(always)]
1111 fn inline_size(_context: fidl::encoding::Context) -> usize {
1112 16
1113 }
1114 }
1115
1116 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<FamilyName, D>
1117 for &FamilyName
1118 {
1119 #[inline]
1120 unsafe fn encode(
1121 self,
1122 encoder: &mut fidl::encoding::Encoder<'_, D>,
1123 offset: usize,
1124 _depth: fidl::encoding::Depth,
1125 ) -> fidl::Result<()> {
1126 encoder.debug_check_bounds::<FamilyName>(offset);
1127 fidl::encoding::Encode::<FamilyName, D>::encode(
1129 (<fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow(
1130 &self.name,
1131 ),),
1132 encoder,
1133 offset,
1134 _depth,
1135 )
1136 }
1137 }
1138 unsafe impl<
1139 D: fidl::encoding::ResourceDialect,
1140 T0: fidl::encoding::Encode<fidl::encoding::BoundedString<128>, D>,
1141 > fidl::encoding::Encode<FamilyName, D> for (T0,)
1142 {
1143 #[inline]
1144 unsafe fn encode(
1145 self,
1146 encoder: &mut fidl::encoding::Encoder<'_, D>,
1147 offset: usize,
1148 depth: fidl::encoding::Depth,
1149 ) -> fidl::Result<()> {
1150 encoder.debug_check_bounds::<FamilyName>(offset);
1151 self.0.encode(encoder, offset + 0, depth)?;
1155 Ok(())
1156 }
1157 }
1158
1159 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for FamilyName {
1160 #[inline(always)]
1161 fn new_empty() -> Self {
1162 Self { name: fidl::new_empty!(fidl::encoding::BoundedString<128>, D) }
1163 }
1164
1165 #[inline]
1166 unsafe fn decode(
1167 &mut self,
1168 decoder: &mut fidl::encoding::Decoder<'_, D>,
1169 offset: usize,
1170 _depth: fidl::encoding::Depth,
1171 ) -> fidl::Result<()> {
1172 decoder.debug_check_bounds::<Self>(offset);
1173 fidl::decode!(
1175 fidl::encoding::BoundedString<128>,
1176 D,
1177 &mut self.name,
1178 decoder,
1179 offset + 0,
1180 _depth
1181 )?;
1182 Ok(())
1183 }
1184 }
1185
1186 impl fidl::encoding::ValueTypeMarker for FontSetEventListenerOnFontSetUpdatedRequest {
1187 type Borrowed<'a> = &'a Self;
1188 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1189 value
1190 }
1191 }
1192
1193 unsafe impl fidl::encoding::TypeMarker for FontSetEventListenerOnFontSetUpdatedRequest {
1194 type Owned = Self;
1195
1196 #[inline(always)]
1197 fn inline_align(_context: fidl::encoding::Context) -> usize {
1198 8
1199 }
1200
1201 #[inline(always)]
1202 fn inline_size(_context: fidl::encoding::Context) -> usize {
1203 16
1204 }
1205 }
1206
1207 unsafe impl<D: fidl::encoding::ResourceDialect>
1208 fidl::encoding::Encode<FontSetEventListenerOnFontSetUpdatedRequest, D>
1209 for &FontSetEventListenerOnFontSetUpdatedRequest
1210 {
1211 #[inline]
1212 unsafe fn encode(
1213 self,
1214 encoder: &mut fidl::encoding::Encoder<'_, D>,
1215 offset: usize,
1216 _depth: fidl::encoding::Depth,
1217 ) -> fidl::Result<()> {
1218 encoder.debug_check_bounds::<FontSetEventListenerOnFontSetUpdatedRequest>(offset);
1219 fidl::encoding::Encode::<FontSetEventListenerOnFontSetUpdatedRequest, D>::encode(
1221 (<FontSetUpdatedEvent as fidl::encoding::ValueTypeMarker>::borrow(&self.event),),
1222 encoder,
1223 offset,
1224 _depth,
1225 )
1226 }
1227 }
1228 unsafe impl<
1229 D: fidl::encoding::ResourceDialect,
1230 T0: fidl::encoding::Encode<FontSetUpdatedEvent, D>,
1231 > fidl::encoding::Encode<FontSetEventListenerOnFontSetUpdatedRequest, D> for (T0,)
1232 {
1233 #[inline]
1234 unsafe fn encode(
1235 self,
1236 encoder: &mut fidl::encoding::Encoder<'_, D>,
1237 offset: usize,
1238 depth: fidl::encoding::Depth,
1239 ) -> fidl::Result<()> {
1240 encoder.debug_check_bounds::<FontSetEventListenerOnFontSetUpdatedRequest>(offset);
1241 self.0.encode(encoder, offset + 0, depth)?;
1245 Ok(())
1246 }
1247 }
1248
1249 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1250 for FontSetEventListenerOnFontSetUpdatedRequest
1251 {
1252 #[inline(always)]
1253 fn new_empty() -> Self {
1254 Self { event: fidl::new_empty!(FontSetUpdatedEvent, D) }
1255 }
1256
1257 #[inline]
1258 unsafe fn decode(
1259 &mut self,
1260 decoder: &mut fidl::encoding::Decoder<'_, D>,
1261 offset: usize,
1262 _depth: fidl::encoding::Depth,
1263 ) -> fidl::Result<()> {
1264 decoder.debug_check_bounds::<Self>(offset);
1265 fidl::decode!(FontSetUpdatedEvent, D, &mut self.event, decoder, offset + 0, _depth)?;
1267 Ok(())
1268 }
1269 }
1270
1271 impl fidl::encoding::ValueTypeMarker for ProviderGetFamilyInfoRequest {
1272 type Borrowed<'a> = &'a Self;
1273 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1274 value
1275 }
1276 }
1277
1278 unsafe impl fidl::encoding::TypeMarker for ProviderGetFamilyInfoRequest {
1279 type Owned = Self;
1280
1281 #[inline(always)]
1282 fn inline_align(_context: fidl::encoding::Context) -> usize {
1283 8
1284 }
1285
1286 #[inline(always)]
1287 fn inline_size(_context: fidl::encoding::Context) -> usize {
1288 16
1289 }
1290 }
1291
1292 unsafe impl<D: fidl::encoding::ResourceDialect>
1293 fidl::encoding::Encode<ProviderGetFamilyInfoRequest, D> for &ProviderGetFamilyInfoRequest
1294 {
1295 #[inline]
1296 unsafe fn encode(
1297 self,
1298 encoder: &mut fidl::encoding::Encoder<'_, D>,
1299 offset: usize,
1300 _depth: fidl::encoding::Depth,
1301 ) -> fidl::Result<()> {
1302 encoder.debug_check_bounds::<ProviderGetFamilyInfoRequest>(offset);
1303 fidl::encoding::Encode::<ProviderGetFamilyInfoRequest, D>::encode(
1305 (<fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow(
1306 &self.family,
1307 ),),
1308 encoder,
1309 offset,
1310 _depth,
1311 )
1312 }
1313 }
1314 unsafe impl<
1315 D: fidl::encoding::ResourceDialect,
1316 T0: fidl::encoding::Encode<fidl::encoding::BoundedString<128>, D>,
1317 > fidl::encoding::Encode<ProviderGetFamilyInfoRequest, D> for (T0,)
1318 {
1319 #[inline]
1320 unsafe fn encode(
1321 self,
1322 encoder: &mut fidl::encoding::Encoder<'_, D>,
1323 offset: usize,
1324 depth: fidl::encoding::Depth,
1325 ) -> fidl::Result<()> {
1326 encoder.debug_check_bounds::<ProviderGetFamilyInfoRequest>(offset);
1327 self.0.encode(encoder, offset + 0, depth)?;
1331 Ok(())
1332 }
1333 }
1334
1335 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1336 for ProviderGetFamilyInfoRequest
1337 {
1338 #[inline(always)]
1339 fn new_empty() -> Self {
1340 Self { family: fidl::new_empty!(fidl::encoding::BoundedString<128>, D) }
1341 }
1342
1343 #[inline]
1344 unsafe fn decode(
1345 &mut self,
1346 decoder: &mut fidl::encoding::Decoder<'_, D>,
1347 offset: usize,
1348 _depth: fidl::encoding::Depth,
1349 ) -> fidl::Result<()> {
1350 decoder.debug_check_bounds::<Self>(offset);
1351 fidl::decode!(
1353 fidl::encoding::BoundedString<128>,
1354 D,
1355 &mut self.family,
1356 decoder,
1357 offset + 0,
1358 _depth
1359 )?;
1360 Ok(())
1361 }
1362 }
1363
1364 impl fidl::encoding::ValueTypeMarker for ProviderGetFamilyInfoResponse {
1365 type Borrowed<'a> = &'a Self;
1366 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1367 value
1368 }
1369 }
1370
1371 unsafe impl fidl::encoding::TypeMarker for ProviderGetFamilyInfoResponse {
1372 type Owned = Self;
1373
1374 #[inline(always)]
1375 fn inline_align(_context: fidl::encoding::Context) -> usize {
1376 8
1377 }
1378
1379 #[inline(always)]
1380 fn inline_size(_context: fidl::encoding::Context) -> usize {
1381 8
1382 }
1383 }
1384
1385 unsafe impl<D: fidl::encoding::ResourceDialect>
1386 fidl::encoding::Encode<ProviderGetFamilyInfoResponse, D>
1387 for &ProviderGetFamilyInfoResponse
1388 {
1389 #[inline]
1390 unsafe fn encode(
1391 self,
1392 encoder: &mut fidl::encoding::Encoder<'_, D>,
1393 offset: usize,
1394 _depth: fidl::encoding::Depth,
1395 ) -> fidl::Result<()> {
1396 encoder.debug_check_bounds::<ProviderGetFamilyInfoResponse>(offset);
1397 fidl::encoding::Encode::<ProviderGetFamilyInfoResponse, D>::encode(
1399 (<fidl::encoding::Boxed<FamilyInfo> as fidl::encoding::ValueTypeMarker>::borrow(
1400 &self.family_info,
1401 ),),
1402 encoder,
1403 offset,
1404 _depth,
1405 )
1406 }
1407 }
1408 unsafe impl<
1409 D: fidl::encoding::ResourceDialect,
1410 T0: fidl::encoding::Encode<fidl::encoding::Boxed<FamilyInfo>, D>,
1411 > fidl::encoding::Encode<ProviderGetFamilyInfoResponse, D> for (T0,)
1412 {
1413 #[inline]
1414 unsafe fn encode(
1415 self,
1416 encoder: &mut fidl::encoding::Encoder<'_, D>,
1417 offset: usize,
1418 depth: fidl::encoding::Depth,
1419 ) -> fidl::Result<()> {
1420 encoder.debug_check_bounds::<ProviderGetFamilyInfoResponse>(offset);
1421 self.0.encode(encoder, offset + 0, depth)?;
1425 Ok(())
1426 }
1427 }
1428
1429 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1430 for ProviderGetFamilyInfoResponse
1431 {
1432 #[inline(always)]
1433 fn new_empty() -> Self {
1434 Self { family_info: fidl::new_empty!(fidl::encoding::Boxed<FamilyInfo>, D) }
1435 }
1436
1437 #[inline]
1438 unsafe fn decode(
1439 &mut self,
1440 decoder: &mut fidl::encoding::Decoder<'_, D>,
1441 offset: usize,
1442 _depth: fidl::encoding::Depth,
1443 ) -> fidl::Result<()> {
1444 decoder.debug_check_bounds::<Self>(offset);
1445 fidl::decode!(
1447 fidl::encoding::Boxed<FamilyInfo>,
1448 D,
1449 &mut self.family_info,
1450 decoder,
1451 offset + 0,
1452 _depth
1453 )?;
1454 Ok(())
1455 }
1456 }
1457
1458 impl fidl::encoding::ValueTypeMarker for ProviderGetFontFamilyInfoRequest {
1459 type Borrowed<'a> = &'a Self;
1460 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1461 value
1462 }
1463 }
1464
1465 unsafe impl fidl::encoding::TypeMarker for ProviderGetFontFamilyInfoRequest {
1466 type Owned = Self;
1467
1468 #[inline(always)]
1469 fn inline_align(_context: fidl::encoding::Context) -> usize {
1470 8
1471 }
1472
1473 #[inline(always)]
1474 fn inline_size(_context: fidl::encoding::Context) -> usize {
1475 16
1476 }
1477 }
1478
1479 unsafe impl<D: fidl::encoding::ResourceDialect>
1480 fidl::encoding::Encode<ProviderGetFontFamilyInfoRequest, D>
1481 for &ProviderGetFontFamilyInfoRequest
1482 {
1483 #[inline]
1484 unsafe fn encode(
1485 self,
1486 encoder: &mut fidl::encoding::Encoder<'_, D>,
1487 offset: usize,
1488 _depth: fidl::encoding::Depth,
1489 ) -> fidl::Result<()> {
1490 encoder.debug_check_bounds::<ProviderGetFontFamilyInfoRequest>(offset);
1491 fidl::encoding::Encode::<ProviderGetFontFamilyInfoRequest, D>::encode(
1493 (<FamilyName as fidl::encoding::ValueTypeMarker>::borrow(&self.family),),
1494 encoder,
1495 offset,
1496 _depth,
1497 )
1498 }
1499 }
1500 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<FamilyName, D>>
1501 fidl::encoding::Encode<ProviderGetFontFamilyInfoRequest, D> for (T0,)
1502 {
1503 #[inline]
1504 unsafe fn encode(
1505 self,
1506 encoder: &mut fidl::encoding::Encoder<'_, D>,
1507 offset: usize,
1508 depth: fidl::encoding::Depth,
1509 ) -> fidl::Result<()> {
1510 encoder.debug_check_bounds::<ProviderGetFontFamilyInfoRequest>(offset);
1511 self.0.encode(encoder, offset + 0, depth)?;
1515 Ok(())
1516 }
1517 }
1518
1519 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1520 for ProviderGetFontFamilyInfoRequest
1521 {
1522 #[inline(always)]
1523 fn new_empty() -> Self {
1524 Self { family: fidl::new_empty!(FamilyName, D) }
1525 }
1526
1527 #[inline]
1528 unsafe fn decode(
1529 &mut self,
1530 decoder: &mut fidl::encoding::Decoder<'_, D>,
1531 offset: usize,
1532 _depth: fidl::encoding::Depth,
1533 ) -> fidl::Result<()> {
1534 decoder.debug_check_bounds::<Self>(offset);
1535 fidl::decode!(FamilyName, D, &mut self.family, decoder, offset + 0, _depth)?;
1537 Ok(())
1538 }
1539 }
1540
1541 impl fidl::encoding::ValueTypeMarker for ProviderGetFontFamilyInfoResponse {
1542 type Borrowed<'a> = &'a Self;
1543 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1544 value
1545 }
1546 }
1547
1548 unsafe impl fidl::encoding::TypeMarker for ProviderGetFontFamilyInfoResponse {
1549 type Owned = Self;
1550
1551 #[inline(always)]
1552 fn inline_align(_context: fidl::encoding::Context) -> usize {
1553 8
1554 }
1555
1556 #[inline(always)]
1557 fn inline_size(_context: fidl::encoding::Context) -> usize {
1558 16
1559 }
1560 }
1561
1562 unsafe impl<D: fidl::encoding::ResourceDialect>
1563 fidl::encoding::Encode<ProviderGetFontFamilyInfoResponse, D>
1564 for &ProviderGetFontFamilyInfoResponse
1565 {
1566 #[inline]
1567 unsafe fn encode(
1568 self,
1569 encoder: &mut fidl::encoding::Encoder<'_, D>,
1570 offset: usize,
1571 _depth: fidl::encoding::Depth,
1572 ) -> fidl::Result<()> {
1573 encoder.debug_check_bounds::<ProviderGetFontFamilyInfoResponse>(offset);
1574 fidl::encoding::Encode::<ProviderGetFontFamilyInfoResponse, D>::encode(
1576 (<FontFamilyInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.family_info),),
1577 encoder,
1578 offset,
1579 _depth,
1580 )
1581 }
1582 }
1583 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<FontFamilyInfo, D>>
1584 fidl::encoding::Encode<ProviderGetFontFamilyInfoResponse, D> for (T0,)
1585 {
1586 #[inline]
1587 unsafe fn encode(
1588 self,
1589 encoder: &mut fidl::encoding::Encoder<'_, D>,
1590 offset: usize,
1591 depth: fidl::encoding::Depth,
1592 ) -> fidl::Result<()> {
1593 encoder.debug_check_bounds::<ProviderGetFontFamilyInfoResponse>(offset);
1594 self.0.encode(encoder, offset + 0, depth)?;
1598 Ok(())
1599 }
1600 }
1601
1602 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1603 for ProviderGetFontFamilyInfoResponse
1604 {
1605 #[inline(always)]
1606 fn new_empty() -> Self {
1607 Self { family_info: fidl::new_empty!(FontFamilyInfo, D) }
1608 }
1609
1610 #[inline]
1611 unsafe fn decode(
1612 &mut self,
1613 decoder: &mut fidl::encoding::Decoder<'_, D>,
1614 offset: usize,
1615 _depth: fidl::encoding::Depth,
1616 ) -> fidl::Result<()> {
1617 decoder.debug_check_bounds::<Self>(offset);
1618 fidl::decode!(FontFamilyInfo, D, &mut self.family_info, decoder, offset + 0, _depth)?;
1620 Ok(())
1621 }
1622 }
1623
1624 impl fidl::encoding::ValueTypeMarker for ProviderGetFontRequest {
1625 type Borrowed<'a> = &'a Self;
1626 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1627 value
1628 }
1629 }
1630
1631 unsafe impl fidl::encoding::TypeMarker for ProviderGetFontRequest {
1632 type Owned = Self;
1633
1634 #[inline(always)]
1635 fn inline_align(_context: fidl::encoding::Context) -> usize {
1636 8
1637 }
1638
1639 #[inline(always)]
1640 fn inline_size(_context: fidl::encoding::Context) -> usize {
1641 64
1642 }
1643 }
1644
1645 unsafe impl<D: fidl::encoding::ResourceDialect>
1646 fidl::encoding::Encode<ProviderGetFontRequest, D> for &ProviderGetFontRequest
1647 {
1648 #[inline]
1649 unsafe fn encode(
1650 self,
1651 encoder: &mut fidl::encoding::Encoder<'_, D>,
1652 offset: usize,
1653 _depth: fidl::encoding::Depth,
1654 ) -> fidl::Result<()> {
1655 encoder.debug_check_bounds::<ProviderGetFontRequest>(offset);
1656 fidl::encoding::Encode::<ProviderGetFontRequest, D>::encode(
1658 (<Request as fidl::encoding::ValueTypeMarker>::borrow(&self.request),),
1659 encoder,
1660 offset,
1661 _depth,
1662 )
1663 }
1664 }
1665 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Request, D>>
1666 fidl::encoding::Encode<ProviderGetFontRequest, D> for (T0,)
1667 {
1668 #[inline]
1669 unsafe fn encode(
1670 self,
1671 encoder: &mut fidl::encoding::Encoder<'_, D>,
1672 offset: usize,
1673 depth: fidl::encoding::Depth,
1674 ) -> fidl::Result<()> {
1675 encoder.debug_check_bounds::<ProviderGetFontRequest>(offset);
1676 self.0.encode(encoder, offset + 0, depth)?;
1680 Ok(())
1681 }
1682 }
1683
1684 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1685 for ProviderGetFontRequest
1686 {
1687 #[inline(always)]
1688 fn new_empty() -> Self {
1689 Self { request: fidl::new_empty!(Request, D) }
1690 }
1691
1692 #[inline]
1693 unsafe fn decode(
1694 &mut self,
1695 decoder: &mut fidl::encoding::Decoder<'_, D>,
1696 offset: usize,
1697 _depth: fidl::encoding::Depth,
1698 ) -> fidl::Result<()> {
1699 decoder.debug_check_bounds::<Self>(offset);
1700 fidl::decode!(Request, D, &mut self.request, decoder, offset + 0, _depth)?;
1702 Ok(())
1703 }
1704 }
1705
1706 impl fidl::encoding::ValueTypeMarker for ProviderGetTypefaceRequest {
1707 type Borrowed<'a> = &'a Self;
1708 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1709 value
1710 }
1711 }
1712
1713 unsafe impl fidl::encoding::TypeMarker for ProviderGetTypefaceRequest {
1714 type Owned = Self;
1715
1716 #[inline(always)]
1717 fn inline_align(_context: fidl::encoding::Context) -> usize {
1718 8
1719 }
1720
1721 #[inline(always)]
1722 fn inline_size(_context: fidl::encoding::Context) -> usize {
1723 16
1724 }
1725 }
1726
1727 unsafe impl<D: fidl::encoding::ResourceDialect>
1728 fidl::encoding::Encode<ProviderGetTypefaceRequest, D> for &ProviderGetTypefaceRequest
1729 {
1730 #[inline]
1731 unsafe fn encode(
1732 self,
1733 encoder: &mut fidl::encoding::Encoder<'_, D>,
1734 offset: usize,
1735 _depth: fidl::encoding::Depth,
1736 ) -> fidl::Result<()> {
1737 encoder.debug_check_bounds::<ProviderGetTypefaceRequest>(offset);
1738 fidl::encoding::Encode::<ProviderGetTypefaceRequest, D>::encode(
1740 (<TypefaceRequest as fidl::encoding::ValueTypeMarker>::borrow(&self.request),),
1741 encoder,
1742 offset,
1743 _depth,
1744 )
1745 }
1746 }
1747 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<TypefaceRequest, D>>
1748 fidl::encoding::Encode<ProviderGetTypefaceRequest, D> for (T0,)
1749 {
1750 #[inline]
1751 unsafe fn encode(
1752 self,
1753 encoder: &mut fidl::encoding::Encoder<'_, D>,
1754 offset: usize,
1755 depth: fidl::encoding::Depth,
1756 ) -> fidl::Result<()> {
1757 encoder.debug_check_bounds::<ProviderGetTypefaceRequest>(offset);
1758 self.0.encode(encoder, offset + 0, depth)?;
1762 Ok(())
1763 }
1764 }
1765
1766 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1767 for ProviderGetTypefaceRequest
1768 {
1769 #[inline(always)]
1770 fn new_empty() -> Self {
1771 Self { request: fidl::new_empty!(TypefaceRequest, D) }
1772 }
1773
1774 #[inline]
1775 unsafe fn decode(
1776 &mut self,
1777 decoder: &mut fidl::encoding::Decoder<'_, D>,
1778 offset: usize,
1779 _depth: fidl::encoding::Depth,
1780 ) -> fidl::Result<()> {
1781 decoder.debug_check_bounds::<Self>(offset);
1782 fidl::decode!(TypefaceRequest, D, &mut self.request, decoder, offset + 0, _depth)?;
1784 Ok(())
1785 }
1786 }
1787
1788 impl fidl::encoding::ValueTypeMarker for Request {
1789 type Borrowed<'a> = &'a Self;
1790 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1791 value
1792 }
1793 }
1794
1795 unsafe impl fidl::encoding::TypeMarker for Request {
1796 type Owned = Self;
1797
1798 #[inline(always)]
1799 fn inline_align(_context: fidl::encoding::Context) -> usize {
1800 8
1801 }
1802
1803 #[inline(always)]
1804 fn inline_size(_context: fidl::encoding::Context) -> usize {
1805 64
1806 }
1807 }
1808
1809 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Request, D> for &Request {
1810 #[inline]
1811 unsafe fn encode(
1812 self,
1813 encoder: &mut fidl::encoding::Encoder<'_, D>,
1814 offset: usize,
1815 _depth: fidl::encoding::Depth,
1816 ) -> fidl::Result<()> {
1817 encoder.debug_check_bounds::<Request>(offset);
1818 fidl::encoding::Encode::<Request, D>::encode(
1820 (
1821 <fidl::encoding::Optional<fidl::encoding::BoundedString<128>> as fidl::encoding::ValueTypeMarker>::borrow(&self.family),
1822 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.weight),
1823 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.width),
1824 <Slant as fidl::encoding::ValueTypeMarker>::borrow(&self.slant),
1825 <fidl::encoding::Optional<fidl::encoding::Vector<fidl::encoding::BoundedString<35>, 8>> as fidl::encoding::ValueTypeMarker>::borrow(&self.language),
1826 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.character),
1827 <FallbackGroup as fidl::encoding::ValueTypeMarker>::borrow(&self.fallback_group),
1828 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.flags),
1829 ),
1830 encoder, offset, _depth
1831 )
1832 }
1833 }
1834 unsafe impl<
1835 D: fidl::encoding::ResourceDialect,
1836 T0: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::BoundedString<128>>, D>,
1837 T1: fidl::encoding::Encode<u32, D>,
1838 T2: fidl::encoding::Encode<u32, D>,
1839 T3: fidl::encoding::Encode<Slant, D>,
1840 T4: fidl::encoding::Encode<
1841 fidl::encoding::Optional<
1842 fidl::encoding::Vector<fidl::encoding::BoundedString<35>, 8>,
1843 >,
1844 D,
1845 >,
1846 T5: fidl::encoding::Encode<u32, D>,
1847 T6: fidl::encoding::Encode<FallbackGroup, D>,
1848 T7: fidl::encoding::Encode<u32, D>,
1849 > fidl::encoding::Encode<Request, D> for (T0, T1, T2, T3, T4, T5, T6, T7)
1850 {
1851 #[inline]
1852 unsafe fn encode(
1853 self,
1854 encoder: &mut fidl::encoding::Encoder<'_, D>,
1855 offset: usize,
1856 depth: fidl::encoding::Depth,
1857 ) -> fidl::Result<()> {
1858 encoder.debug_check_bounds::<Request>(offset);
1859 unsafe {
1862 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
1863 (ptr as *mut u64).write_unaligned(0);
1864 }
1865 unsafe {
1866 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(56);
1867 (ptr as *mut u64).write_unaligned(0);
1868 }
1869 self.0.encode(encoder, offset + 0, depth)?;
1871 self.1.encode(encoder, offset + 16, depth)?;
1872 self.2.encode(encoder, offset + 20, depth)?;
1873 self.3.encode(encoder, offset + 24, depth)?;
1874 self.4.encode(encoder, offset + 32, depth)?;
1875 self.5.encode(encoder, offset + 48, depth)?;
1876 self.6.encode(encoder, offset + 52, depth)?;
1877 self.7.encode(encoder, offset + 56, depth)?;
1878 Ok(())
1879 }
1880 }
1881
1882 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Request {
1883 #[inline(always)]
1884 fn new_empty() -> Self {
1885 Self {
1886 family: fidl::new_empty!(
1887 fidl::encoding::Optional<fidl::encoding::BoundedString<128>>,
1888 D
1889 ),
1890 weight: fidl::new_empty!(u32, D),
1891 width: fidl::new_empty!(u32, D),
1892 slant: fidl::new_empty!(Slant, D),
1893 language: fidl::new_empty!(
1894 fidl::encoding::Optional<
1895 fidl::encoding::Vector<fidl::encoding::BoundedString<35>, 8>,
1896 >,
1897 D
1898 ),
1899 character: fidl::new_empty!(u32, D),
1900 fallback_group: fidl::new_empty!(FallbackGroup, D),
1901 flags: fidl::new_empty!(u32, D),
1902 }
1903 }
1904
1905 #[inline]
1906 unsafe fn decode(
1907 &mut self,
1908 decoder: &mut fidl::encoding::Decoder<'_, D>,
1909 offset: usize,
1910 _depth: fidl::encoding::Depth,
1911 ) -> fidl::Result<()> {
1912 decoder.debug_check_bounds::<Self>(offset);
1913 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
1915 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1916 let mask = 0xffffffff00000000u64;
1917 let maskedval = padval & mask;
1918 if maskedval != 0 {
1919 return Err(fidl::Error::NonZeroPadding {
1920 padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
1921 });
1922 }
1923 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(56) };
1924 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1925 let mask = 0xffffffff00000000u64;
1926 let maskedval = padval & mask;
1927 if maskedval != 0 {
1928 return Err(fidl::Error::NonZeroPadding {
1929 padding_start: offset + 56 + ((mask as u64).trailing_zeros() / 8) as usize,
1930 });
1931 }
1932 fidl::decode!(
1933 fidl::encoding::Optional<fidl::encoding::BoundedString<128>>,
1934 D,
1935 &mut self.family,
1936 decoder,
1937 offset + 0,
1938 _depth
1939 )?;
1940 fidl::decode!(u32, D, &mut self.weight, decoder, offset + 16, _depth)?;
1941 fidl::decode!(u32, D, &mut self.width, decoder, offset + 20, _depth)?;
1942 fidl::decode!(Slant, D, &mut self.slant, decoder, offset + 24, _depth)?;
1943 fidl::decode!(
1944 fidl::encoding::Optional<
1945 fidl::encoding::Vector<fidl::encoding::BoundedString<35>, 8>,
1946 >,
1947 D,
1948 &mut self.language,
1949 decoder,
1950 offset + 32,
1951 _depth
1952 )?;
1953 fidl::decode!(u32, D, &mut self.character, decoder, offset + 48, _depth)?;
1954 fidl::decode!(
1955 FallbackGroup,
1956 D,
1957 &mut self.fallback_group,
1958 decoder,
1959 offset + 52,
1960 _depth
1961 )?;
1962 fidl::decode!(u32, D, &mut self.flags, decoder, offset + 56, _depth)?;
1963 Ok(())
1964 }
1965 }
1966
1967 impl fidl::encoding::ValueTypeMarker for Style {
1968 type Borrowed<'a> = &'a Self;
1969 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1970 value
1971 }
1972 }
1973
1974 unsafe impl fidl::encoding::TypeMarker for Style {
1975 type Owned = Self;
1976
1977 #[inline(always)]
1978 fn inline_align(_context: fidl::encoding::Context) -> usize {
1979 4
1980 }
1981
1982 #[inline(always)]
1983 fn inline_size(_context: fidl::encoding::Context) -> usize {
1984 12
1985 }
1986 }
1987
1988 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Style, D> for &Style {
1989 #[inline]
1990 unsafe fn encode(
1991 self,
1992 encoder: &mut fidl::encoding::Encoder<'_, D>,
1993 offset: usize,
1994 _depth: fidl::encoding::Depth,
1995 ) -> fidl::Result<()> {
1996 encoder.debug_check_bounds::<Style>(offset);
1997 fidl::encoding::Encode::<Style, D>::encode(
1999 (
2000 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.weight),
2001 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.width),
2002 <Slant as fidl::encoding::ValueTypeMarker>::borrow(&self.slant),
2003 ),
2004 encoder,
2005 offset,
2006 _depth,
2007 )
2008 }
2009 }
2010 unsafe impl<
2011 D: fidl::encoding::ResourceDialect,
2012 T0: fidl::encoding::Encode<u32, D>,
2013 T1: fidl::encoding::Encode<u32, D>,
2014 T2: fidl::encoding::Encode<Slant, D>,
2015 > fidl::encoding::Encode<Style, D> for (T0, T1, T2)
2016 {
2017 #[inline]
2018 unsafe fn encode(
2019 self,
2020 encoder: &mut fidl::encoding::Encoder<'_, D>,
2021 offset: usize,
2022 depth: fidl::encoding::Depth,
2023 ) -> fidl::Result<()> {
2024 encoder.debug_check_bounds::<Style>(offset);
2025 self.0.encode(encoder, offset + 0, depth)?;
2029 self.1.encode(encoder, offset + 4, depth)?;
2030 self.2.encode(encoder, offset + 8, depth)?;
2031 Ok(())
2032 }
2033 }
2034
2035 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Style {
2036 #[inline(always)]
2037 fn new_empty() -> Self {
2038 Self {
2039 weight: fidl::new_empty!(u32, D),
2040 width: fidl::new_empty!(u32, D),
2041 slant: fidl::new_empty!(Slant, D),
2042 }
2043 }
2044
2045 #[inline]
2046 unsafe fn decode(
2047 &mut self,
2048 decoder: &mut fidl::encoding::Decoder<'_, D>,
2049 offset: usize,
2050 _depth: fidl::encoding::Depth,
2051 ) -> fidl::Result<()> {
2052 decoder.debug_check_bounds::<Self>(offset);
2053 fidl::decode!(u32, D, &mut self.weight, decoder, offset + 0, _depth)?;
2055 fidl::decode!(u32, D, &mut self.width, decoder, offset + 4, _depth)?;
2056 fidl::decode!(Slant, D, &mut self.slant, decoder, offset + 8, _depth)?;
2057 Ok(())
2058 }
2059 }
2060
2061 impl FontFamilyInfo {
2062 #[inline(always)]
2063 fn max_ordinal_present(&self) -> u64 {
2064 if let Some(_) = self.styles {
2065 return 2;
2066 }
2067 if let Some(_) = self.name {
2068 return 1;
2069 }
2070 0
2071 }
2072 }
2073
2074 impl fidl::encoding::ValueTypeMarker for FontFamilyInfo {
2075 type Borrowed<'a> = &'a Self;
2076 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2077 value
2078 }
2079 }
2080
2081 unsafe impl fidl::encoding::TypeMarker for FontFamilyInfo {
2082 type Owned = Self;
2083
2084 #[inline(always)]
2085 fn inline_align(_context: fidl::encoding::Context) -> usize {
2086 8
2087 }
2088
2089 #[inline(always)]
2090 fn inline_size(_context: fidl::encoding::Context) -> usize {
2091 16
2092 }
2093 }
2094
2095 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<FontFamilyInfo, D>
2096 for &FontFamilyInfo
2097 {
2098 unsafe fn encode(
2099 self,
2100 encoder: &mut fidl::encoding::Encoder<'_, D>,
2101 offset: usize,
2102 mut depth: fidl::encoding::Depth,
2103 ) -> fidl::Result<()> {
2104 encoder.debug_check_bounds::<FontFamilyInfo>(offset);
2105 let max_ordinal: u64 = self.max_ordinal_present();
2107 encoder.write_num(max_ordinal, offset);
2108 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2109 if max_ordinal == 0 {
2111 return Ok(());
2112 }
2113 depth.increment()?;
2114 let envelope_size = 8;
2115 let bytes_len = max_ordinal as usize * envelope_size;
2116 #[allow(unused_variables)]
2117 let offset = encoder.out_of_line_offset(bytes_len);
2118 let mut _prev_end_offset: usize = 0;
2119 if 1 > max_ordinal {
2120 return Ok(());
2121 }
2122
2123 let cur_offset: usize = (1 - 1) * envelope_size;
2126
2127 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2129
2130 fidl::encoding::encode_in_envelope_optional::<FamilyName, D>(
2135 self.name.as_ref().map(<FamilyName as fidl::encoding::ValueTypeMarker>::borrow),
2136 encoder,
2137 offset + cur_offset,
2138 depth,
2139 )?;
2140
2141 _prev_end_offset = cur_offset + envelope_size;
2142 if 2 > max_ordinal {
2143 return Ok(());
2144 }
2145
2146 let cur_offset: usize = (2 - 1) * envelope_size;
2149
2150 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2152
2153 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<Style2, 300>, D>(
2158 self.styles.as_ref().map(<fidl::encoding::Vector<Style2, 300> as fidl::encoding::ValueTypeMarker>::borrow),
2159 encoder, offset + cur_offset, depth
2160 )?;
2161
2162 _prev_end_offset = cur_offset + envelope_size;
2163
2164 Ok(())
2165 }
2166 }
2167
2168 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for FontFamilyInfo {
2169 #[inline(always)]
2170 fn new_empty() -> Self {
2171 Self::default()
2172 }
2173
2174 unsafe fn decode(
2175 &mut self,
2176 decoder: &mut fidl::encoding::Decoder<'_, D>,
2177 offset: usize,
2178 mut depth: fidl::encoding::Depth,
2179 ) -> fidl::Result<()> {
2180 decoder.debug_check_bounds::<Self>(offset);
2181 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2182 None => return Err(fidl::Error::NotNullable),
2183 Some(len) => len,
2184 };
2185 if len == 0 {
2187 return Ok(());
2188 };
2189 depth.increment()?;
2190 let envelope_size = 8;
2191 let bytes_len = len * envelope_size;
2192 let offset = decoder.out_of_line_offset(bytes_len)?;
2193 let mut _next_ordinal_to_read = 0;
2195 let mut next_offset = offset;
2196 let end_offset = offset + bytes_len;
2197 _next_ordinal_to_read += 1;
2198 if next_offset >= end_offset {
2199 return Ok(());
2200 }
2201
2202 while _next_ordinal_to_read < 1 {
2204 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2205 _next_ordinal_to_read += 1;
2206 next_offset += envelope_size;
2207 }
2208
2209 let next_out_of_line = decoder.next_out_of_line();
2210 let handles_before = decoder.remaining_handles();
2211 if let Some((inlined, num_bytes, num_handles)) =
2212 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2213 {
2214 let member_inline_size =
2215 <FamilyName as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2216 if inlined != (member_inline_size <= 4) {
2217 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2218 }
2219 let inner_offset;
2220 let mut inner_depth = depth.clone();
2221 if inlined {
2222 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2223 inner_offset = next_offset;
2224 } else {
2225 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2226 inner_depth.increment()?;
2227 }
2228 let val_ref = self.name.get_or_insert_with(|| fidl::new_empty!(FamilyName, D));
2229 fidl::decode!(FamilyName, D, val_ref, decoder, inner_offset, inner_depth)?;
2230 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2231 {
2232 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2233 }
2234 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2235 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2236 }
2237 }
2238
2239 next_offset += envelope_size;
2240 _next_ordinal_to_read += 1;
2241 if next_offset >= end_offset {
2242 return Ok(());
2243 }
2244
2245 while _next_ordinal_to_read < 2 {
2247 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2248 _next_ordinal_to_read += 1;
2249 next_offset += envelope_size;
2250 }
2251
2252 let next_out_of_line = decoder.next_out_of_line();
2253 let handles_before = decoder.remaining_handles();
2254 if let Some((inlined, num_bytes, num_handles)) =
2255 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2256 {
2257 let member_inline_size = <fidl::encoding::Vector<Style2, 300> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2258 if inlined != (member_inline_size <= 4) {
2259 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2260 }
2261 let inner_offset;
2262 let mut inner_depth = depth.clone();
2263 if inlined {
2264 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2265 inner_offset = next_offset;
2266 } else {
2267 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2268 inner_depth.increment()?;
2269 }
2270 let val_ref = self.styles.get_or_insert_with(
2271 || fidl::new_empty!(fidl::encoding::Vector<Style2, 300>, D),
2272 );
2273 fidl::decode!(fidl::encoding::Vector<Style2, 300>, D, val_ref, decoder, inner_offset, inner_depth)?;
2274 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2275 {
2276 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2277 }
2278 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2279 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2280 }
2281 }
2282
2283 next_offset += envelope_size;
2284
2285 while next_offset < end_offset {
2287 _next_ordinal_to_read += 1;
2288 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2289 next_offset += envelope_size;
2290 }
2291
2292 Ok(())
2293 }
2294 }
2295
2296 impl FontSetUpdatedEvent {
2297 #[inline(always)]
2298 fn max_ordinal_present(&self) -> u64 {
2299 0
2300 }
2301 }
2302
2303 impl fidl::encoding::ValueTypeMarker for FontSetUpdatedEvent {
2304 type Borrowed<'a> = &'a Self;
2305 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2306 value
2307 }
2308 }
2309
2310 unsafe impl fidl::encoding::TypeMarker for FontSetUpdatedEvent {
2311 type Owned = Self;
2312
2313 #[inline(always)]
2314 fn inline_align(_context: fidl::encoding::Context) -> usize {
2315 8
2316 }
2317
2318 #[inline(always)]
2319 fn inline_size(_context: fidl::encoding::Context) -> usize {
2320 16
2321 }
2322 }
2323
2324 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<FontSetUpdatedEvent, D>
2325 for &FontSetUpdatedEvent
2326 {
2327 unsafe fn encode(
2328 self,
2329 encoder: &mut fidl::encoding::Encoder<'_, D>,
2330 offset: usize,
2331 mut depth: fidl::encoding::Depth,
2332 ) -> fidl::Result<()> {
2333 encoder.debug_check_bounds::<FontSetUpdatedEvent>(offset);
2334 let max_ordinal: u64 = self.max_ordinal_present();
2336 encoder.write_num(max_ordinal, offset);
2337 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2338 if max_ordinal == 0 {
2340 return Ok(());
2341 }
2342 depth.increment()?;
2343 let envelope_size = 8;
2344 let bytes_len = max_ordinal as usize * envelope_size;
2345 #[allow(unused_variables)]
2346 let offset = encoder.out_of_line_offset(bytes_len);
2347 let mut _prev_end_offset: usize = 0;
2348
2349 Ok(())
2350 }
2351 }
2352
2353 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for FontSetUpdatedEvent {
2354 #[inline(always)]
2355 fn new_empty() -> Self {
2356 Self::default()
2357 }
2358
2359 unsafe fn decode(
2360 &mut self,
2361 decoder: &mut fidl::encoding::Decoder<'_, D>,
2362 offset: usize,
2363 mut depth: fidl::encoding::Depth,
2364 ) -> fidl::Result<()> {
2365 decoder.debug_check_bounds::<Self>(offset);
2366 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2367 None => return Err(fidl::Error::NotNullable),
2368 Some(len) => len,
2369 };
2370 if len == 0 {
2372 return Ok(());
2373 };
2374 depth.increment()?;
2375 let envelope_size = 8;
2376 let bytes_len = len * envelope_size;
2377 let offset = decoder.out_of_line_offset(bytes_len)?;
2378 let mut _next_ordinal_to_read = 0;
2380 let mut next_offset = offset;
2381 let end_offset = offset + bytes_len;
2382
2383 while next_offset < end_offset {
2385 _next_ordinal_to_read += 1;
2386 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2387 next_offset += envelope_size;
2388 }
2389
2390 Ok(())
2391 }
2392 }
2393
2394 impl Style2 {
2395 #[inline(always)]
2396 fn max_ordinal_present(&self) -> u64 {
2397 if let Some(_) = self.width {
2398 return 3;
2399 }
2400 if let Some(_) = self.weight {
2401 return 2;
2402 }
2403 if let Some(_) = self.slant {
2404 return 1;
2405 }
2406 0
2407 }
2408 }
2409
2410 impl fidl::encoding::ValueTypeMarker for Style2 {
2411 type Borrowed<'a> = &'a Self;
2412 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2413 value
2414 }
2415 }
2416
2417 unsafe impl fidl::encoding::TypeMarker for Style2 {
2418 type Owned = Self;
2419
2420 #[inline(always)]
2421 fn inline_align(_context: fidl::encoding::Context) -> usize {
2422 8
2423 }
2424
2425 #[inline(always)]
2426 fn inline_size(_context: fidl::encoding::Context) -> usize {
2427 16
2428 }
2429 }
2430
2431 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Style2, D> for &Style2 {
2432 unsafe fn encode(
2433 self,
2434 encoder: &mut fidl::encoding::Encoder<'_, D>,
2435 offset: usize,
2436 mut depth: fidl::encoding::Depth,
2437 ) -> fidl::Result<()> {
2438 encoder.debug_check_bounds::<Style2>(offset);
2439 let max_ordinal: u64 = self.max_ordinal_present();
2441 encoder.write_num(max_ordinal, offset);
2442 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2443 if max_ordinal == 0 {
2445 return Ok(());
2446 }
2447 depth.increment()?;
2448 let envelope_size = 8;
2449 let bytes_len = max_ordinal as usize * envelope_size;
2450 #[allow(unused_variables)]
2451 let offset = encoder.out_of_line_offset(bytes_len);
2452 let mut _prev_end_offset: usize = 0;
2453 if 1 > max_ordinal {
2454 return Ok(());
2455 }
2456
2457 let cur_offset: usize = (1 - 1) * envelope_size;
2460
2461 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2463
2464 fidl::encoding::encode_in_envelope_optional::<Slant, D>(
2469 self.slant.as_ref().map(<Slant as fidl::encoding::ValueTypeMarker>::borrow),
2470 encoder,
2471 offset + cur_offset,
2472 depth,
2473 )?;
2474
2475 _prev_end_offset = cur_offset + envelope_size;
2476 if 2 > max_ordinal {
2477 return Ok(());
2478 }
2479
2480 let cur_offset: usize = (2 - 1) * envelope_size;
2483
2484 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2486
2487 fidl::encoding::encode_in_envelope_optional::<u16, D>(
2492 self.weight.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
2493 encoder,
2494 offset + cur_offset,
2495 depth,
2496 )?;
2497
2498 _prev_end_offset = cur_offset + envelope_size;
2499 if 3 > max_ordinal {
2500 return Ok(());
2501 }
2502
2503 let cur_offset: usize = (3 - 1) * envelope_size;
2506
2507 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2509
2510 fidl::encoding::encode_in_envelope_optional::<Width, D>(
2515 self.width.as_ref().map(<Width as fidl::encoding::ValueTypeMarker>::borrow),
2516 encoder,
2517 offset + cur_offset,
2518 depth,
2519 )?;
2520
2521 _prev_end_offset = cur_offset + envelope_size;
2522
2523 Ok(())
2524 }
2525 }
2526
2527 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Style2 {
2528 #[inline(always)]
2529 fn new_empty() -> Self {
2530 Self::default()
2531 }
2532
2533 unsafe fn decode(
2534 &mut self,
2535 decoder: &mut fidl::encoding::Decoder<'_, D>,
2536 offset: usize,
2537 mut depth: fidl::encoding::Depth,
2538 ) -> fidl::Result<()> {
2539 decoder.debug_check_bounds::<Self>(offset);
2540 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2541 None => return Err(fidl::Error::NotNullable),
2542 Some(len) => len,
2543 };
2544 if len == 0 {
2546 return Ok(());
2547 };
2548 depth.increment()?;
2549 let envelope_size = 8;
2550 let bytes_len = len * envelope_size;
2551 let offset = decoder.out_of_line_offset(bytes_len)?;
2552 let mut _next_ordinal_to_read = 0;
2554 let mut next_offset = offset;
2555 let end_offset = offset + bytes_len;
2556 _next_ordinal_to_read += 1;
2557 if next_offset >= end_offset {
2558 return Ok(());
2559 }
2560
2561 while _next_ordinal_to_read < 1 {
2563 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2564 _next_ordinal_to_read += 1;
2565 next_offset += envelope_size;
2566 }
2567
2568 let next_out_of_line = decoder.next_out_of_line();
2569 let handles_before = decoder.remaining_handles();
2570 if let Some((inlined, num_bytes, num_handles)) =
2571 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2572 {
2573 let member_inline_size =
2574 <Slant as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2575 if inlined != (member_inline_size <= 4) {
2576 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2577 }
2578 let inner_offset;
2579 let mut inner_depth = depth.clone();
2580 if inlined {
2581 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2582 inner_offset = next_offset;
2583 } else {
2584 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2585 inner_depth.increment()?;
2586 }
2587 let val_ref = self.slant.get_or_insert_with(|| fidl::new_empty!(Slant, D));
2588 fidl::decode!(Slant, D, val_ref, decoder, inner_offset, inner_depth)?;
2589 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2590 {
2591 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2592 }
2593 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2594 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2595 }
2596 }
2597
2598 next_offset += envelope_size;
2599 _next_ordinal_to_read += 1;
2600 if next_offset >= end_offset {
2601 return Ok(());
2602 }
2603
2604 while _next_ordinal_to_read < 2 {
2606 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2607 _next_ordinal_to_read += 1;
2608 next_offset += envelope_size;
2609 }
2610
2611 let next_out_of_line = decoder.next_out_of_line();
2612 let handles_before = decoder.remaining_handles();
2613 if let Some((inlined, num_bytes, num_handles)) =
2614 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2615 {
2616 let member_inline_size =
2617 <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2618 if inlined != (member_inline_size <= 4) {
2619 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2620 }
2621 let inner_offset;
2622 let mut inner_depth = depth.clone();
2623 if inlined {
2624 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2625 inner_offset = next_offset;
2626 } else {
2627 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2628 inner_depth.increment()?;
2629 }
2630 let val_ref = self.weight.get_or_insert_with(|| fidl::new_empty!(u16, D));
2631 fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
2632 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2633 {
2634 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2635 }
2636 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2637 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2638 }
2639 }
2640
2641 next_offset += envelope_size;
2642 _next_ordinal_to_read += 1;
2643 if next_offset >= end_offset {
2644 return Ok(());
2645 }
2646
2647 while _next_ordinal_to_read < 3 {
2649 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2650 _next_ordinal_to_read += 1;
2651 next_offset += envelope_size;
2652 }
2653
2654 let next_out_of_line = decoder.next_out_of_line();
2655 let handles_before = decoder.remaining_handles();
2656 if let Some((inlined, num_bytes, num_handles)) =
2657 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2658 {
2659 let member_inline_size =
2660 <Width as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2661 if inlined != (member_inline_size <= 4) {
2662 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2663 }
2664 let inner_offset;
2665 let mut inner_depth = depth.clone();
2666 if inlined {
2667 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2668 inner_offset = next_offset;
2669 } else {
2670 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2671 inner_depth.increment()?;
2672 }
2673 let val_ref = self.width.get_or_insert_with(|| fidl::new_empty!(Width, D));
2674 fidl::decode!(Width, D, val_ref, decoder, inner_offset, inner_depth)?;
2675 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2676 {
2677 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2678 }
2679 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2680 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2681 }
2682 }
2683
2684 next_offset += envelope_size;
2685
2686 while next_offset < end_offset {
2688 _next_ordinal_to_read += 1;
2689 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2690 next_offset += envelope_size;
2691 }
2692
2693 Ok(())
2694 }
2695 }
2696
2697 impl TypefaceQuery {
2698 #[inline(always)]
2699 fn max_ordinal_present(&self) -> u64 {
2700 if let Some(_) = self.full_name {
2701 return 7;
2702 }
2703 if let Some(_) = self.postscript_name {
2704 return 6;
2705 }
2706 if let Some(_) = self.fallback_family {
2707 return 5;
2708 }
2709 if let Some(_) = self.code_points {
2710 return 4;
2711 }
2712 if let Some(_) = self.languages {
2713 return 3;
2714 }
2715 if let Some(_) = self.style {
2716 return 2;
2717 }
2718 if let Some(_) = self.family {
2719 return 1;
2720 }
2721 0
2722 }
2723 }
2724
2725 impl fidl::encoding::ValueTypeMarker for TypefaceQuery {
2726 type Borrowed<'a> = &'a Self;
2727 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2728 value
2729 }
2730 }
2731
2732 unsafe impl fidl::encoding::TypeMarker for TypefaceQuery {
2733 type Owned = Self;
2734
2735 #[inline(always)]
2736 fn inline_align(_context: fidl::encoding::Context) -> usize {
2737 8
2738 }
2739
2740 #[inline(always)]
2741 fn inline_size(_context: fidl::encoding::Context) -> usize {
2742 16
2743 }
2744 }
2745
2746 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TypefaceQuery, D>
2747 for &TypefaceQuery
2748 {
2749 unsafe fn encode(
2750 self,
2751 encoder: &mut fidl::encoding::Encoder<'_, D>,
2752 offset: usize,
2753 mut depth: fidl::encoding::Depth,
2754 ) -> fidl::Result<()> {
2755 encoder.debug_check_bounds::<TypefaceQuery>(offset);
2756 let max_ordinal: u64 = self.max_ordinal_present();
2758 encoder.write_num(max_ordinal, offset);
2759 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2760 if max_ordinal == 0 {
2762 return Ok(());
2763 }
2764 depth.increment()?;
2765 let envelope_size = 8;
2766 let bytes_len = max_ordinal as usize * envelope_size;
2767 #[allow(unused_variables)]
2768 let offset = encoder.out_of_line_offset(bytes_len);
2769 let mut _prev_end_offset: usize = 0;
2770 if 1 > max_ordinal {
2771 return Ok(());
2772 }
2773
2774 let cur_offset: usize = (1 - 1) * envelope_size;
2777
2778 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2780
2781 fidl::encoding::encode_in_envelope_optional::<FamilyName, D>(
2786 self.family.as_ref().map(<FamilyName as fidl::encoding::ValueTypeMarker>::borrow),
2787 encoder,
2788 offset + cur_offset,
2789 depth,
2790 )?;
2791
2792 _prev_end_offset = cur_offset + envelope_size;
2793 if 2 > max_ordinal {
2794 return Ok(());
2795 }
2796
2797 let cur_offset: usize = (2 - 1) * envelope_size;
2800
2801 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2803
2804 fidl::encoding::encode_in_envelope_optional::<Style2, D>(
2809 self.style.as_ref().map(<Style2 as fidl::encoding::ValueTypeMarker>::borrow),
2810 encoder,
2811 offset + cur_offset,
2812 depth,
2813 )?;
2814
2815 _prev_end_offset = cur_offset + envelope_size;
2816 if 3 > max_ordinal {
2817 return Ok(());
2818 }
2819
2820 let cur_offset: usize = (3 - 1) * envelope_size;
2823
2824 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2826
2827 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_intl::LocaleId, 8>, D>(
2832 self.languages.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_intl::LocaleId, 8> as fidl::encoding::ValueTypeMarker>::borrow),
2833 encoder, offset + cur_offset, depth
2834 )?;
2835
2836 _prev_end_offset = cur_offset + envelope_size;
2837 if 4 > max_ordinal {
2838 return Ok(());
2839 }
2840
2841 let cur_offset: usize = (4 - 1) * envelope_size;
2844
2845 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2847
2848 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u32, 128>, D>(
2853 self.code_points.as_ref().map(
2854 <fidl::encoding::Vector<u32, 128> as fidl::encoding::ValueTypeMarker>::borrow,
2855 ),
2856 encoder,
2857 offset + cur_offset,
2858 depth,
2859 )?;
2860
2861 _prev_end_offset = cur_offset + envelope_size;
2862 if 5 > max_ordinal {
2863 return Ok(());
2864 }
2865
2866 let cur_offset: usize = (5 - 1) * envelope_size;
2869
2870 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2872
2873 fidl::encoding::encode_in_envelope_optional::<GenericFontFamily, D>(
2878 self.fallback_family
2879 .as_ref()
2880 .map(<GenericFontFamily as fidl::encoding::ValueTypeMarker>::borrow),
2881 encoder,
2882 offset + cur_offset,
2883 depth,
2884 )?;
2885
2886 _prev_end_offset = cur_offset + envelope_size;
2887 if 6 > max_ordinal {
2888 return Ok(());
2889 }
2890
2891 let cur_offset: usize = (6 - 1) * envelope_size;
2894
2895 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2897
2898 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<63>, D>(
2903 self.postscript_name.as_ref().map(
2904 <fidl::encoding::BoundedString<63> as fidl::encoding::ValueTypeMarker>::borrow,
2905 ),
2906 encoder,
2907 offset + cur_offset,
2908 depth,
2909 )?;
2910
2911 _prev_end_offset = cur_offset + envelope_size;
2912 if 7 > max_ordinal {
2913 return Ok(());
2914 }
2915
2916 let cur_offset: usize = (7 - 1) * envelope_size;
2919
2920 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2922
2923 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<128>, D>(
2928 self.full_name.as_ref().map(
2929 <fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow,
2930 ),
2931 encoder,
2932 offset + cur_offset,
2933 depth,
2934 )?;
2935
2936 _prev_end_offset = cur_offset + envelope_size;
2937
2938 Ok(())
2939 }
2940 }
2941
2942 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TypefaceQuery {
2943 #[inline(always)]
2944 fn new_empty() -> Self {
2945 Self::default()
2946 }
2947
2948 unsafe fn decode(
2949 &mut self,
2950 decoder: &mut fidl::encoding::Decoder<'_, D>,
2951 offset: usize,
2952 mut depth: fidl::encoding::Depth,
2953 ) -> fidl::Result<()> {
2954 decoder.debug_check_bounds::<Self>(offset);
2955 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2956 None => return Err(fidl::Error::NotNullable),
2957 Some(len) => len,
2958 };
2959 if len == 0 {
2961 return Ok(());
2962 };
2963 depth.increment()?;
2964 let envelope_size = 8;
2965 let bytes_len = len * envelope_size;
2966 let offset = decoder.out_of_line_offset(bytes_len)?;
2967 let mut _next_ordinal_to_read = 0;
2969 let mut next_offset = offset;
2970 let end_offset = offset + bytes_len;
2971 _next_ordinal_to_read += 1;
2972 if next_offset >= end_offset {
2973 return Ok(());
2974 }
2975
2976 while _next_ordinal_to_read < 1 {
2978 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2979 _next_ordinal_to_read += 1;
2980 next_offset += envelope_size;
2981 }
2982
2983 let next_out_of_line = decoder.next_out_of_line();
2984 let handles_before = decoder.remaining_handles();
2985 if let Some((inlined, num_bytes, num_handles)) =
2986 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2987 {
2988 let member_inline_size =
2989 <FamilyName as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2990 if inlined != (member_inline_size <= 4) {
2991 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2992 }
2993 let inner_offset;
2994 let mut inner_depth = depth.clone();
2995 if inlined {
2996 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2997 inner_offset = next_offset;
2998 } else {
2999 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3000 inner_depth.increment()?;
3001 }
3002 let val_ref = self.family.get_or_insert_with(|| fidl::new_empty!(FamilyName, D));
3003 fidl::decode!(FamilyName, D, val_ref, decoder, inner_offset, inner_depth)?;
3004 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3005 {
3006 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3007 }
3008 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3009 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3010 }
3011 }
3012
3013 next_offset += envelope_size;
3014 _next_ordinal_to_read += 1;
3015 if next_offset >= end_offset {
3016 return Ok(());
3017 }
3018
3019 while _next_ordinal_to_read < 2 {
3021 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3022 _next_ordinal_to_read += 1;
3023 next_offset += envelope_size;
3024 }
3025
3026 let next_out_of_line = decoder.next_out_of_line();
3027 let handles_before = decoder.remaining_handles();
3028 if let Some((inlined, num_bytes, num_handles)) =
3029 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3030 {
3031 let member_inline_size =
3032 <Style2 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3033 if inlined != (member_inline_size <= 4) {
3034 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3035 }
3036 let inner_offset;
3037 let mut inner_depth = depth.clone();
3038 if inlined {
3039 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3040 inner_offset = next_offset;
3041 } else {
3042 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3043 inner_depth.increment()?;
3044 }
3045 let val_ref = self.style.get_or_insert_with(|| fidl::new_empty!(Style2, D));
3046 fidl::decode!(Style2, D, val_ref, decoder, inner_offset, inner_depth)?;
3047 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3048 {
3049 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3050 }
3051 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3052 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3053 }
3054 }
3055
3056 next_offset += envelope_size;
3057 _next_ordinal_to_read += 1;
3058 if next_offset >= end_offset {
3059 return Ok(());
3060 }
3061
3062 while _next_ordinal_to_read < 3 {
3064 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3065 _next_ordinal_to_read += 1;
3066 next_offset += envelope_size;
3067 }
3068
3069 let next_out_of_line = decoder.next_out_of_line();
3070 let handles_before = decoder.remaining_handles();
3071 if let Some((inlined, num_bytes, num_handles)) =
3072 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3073 {
3074 let member_inline_size = <fidl::encoding::Vector<fidl_fuchsia_intl::LocaleId, 8> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3075 if inlined != (member_inline_size <= 4) {
3076 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3077 }
3078 let inner_offset;
3079 let mut inner_depth = depth.clone();
3080 if inlined {
3081 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3082 inner_offset = next_offset;
3083 } else {
3084 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3085 inner_depth.increment()?;
3086 }
3087 let val_ref = self.languages.get_or_insert_with(
3088 || fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_intl::LocaleId, 8>, D),
3089 );
3090 fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_intl::LocaleId, 8>, D, val_ref, decoder, inner_offset, inner_depth)?;
3091 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3092 {
3093 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3094 }
3095 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3096 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3097 }
3098 }
3099
3100 next_offset += envelope_size;
3101 _next_ordinal_to_read += 1;
3102 if next_offset >= end_offset {
3103 return Ok(());
3104 }
3105
3106 while _next_ordinal_to_read < 4 {
3108 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3109 _next_ordinal_to_read += 1;
3110 next_offset += envelope_size;
3111 }
3112
3113 let next_out_of_line = decoder.next_out_of_line();
3114 let handles_before = decoder.remaining_handles();
3115 if let Some((inlined, num_bytes, num_handles)) =
3116 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3117 {
3118 let member_inline_size =
3119 <fidl::encoding::Vector<u32, 128> as fidl::encoding::TypeMarker>::inline_size(
3120 decoder.context,
3121 );
3122 if inlined != (member_inline_size <= 4) {
3123 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3124 }
3125 let inner_offset;
3126 let mut inner_depth = depth.clone();
3127 if inlined {
3128 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3129 inner_offset = next_offset;
3130 } else {
3131 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3132 inner_depth.increment()?;
3133 }
3134 let val_ref = self
3135 .code_points
3136 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u32, 128>, D));
3137 fidl::decode!(fidl::encoding::Vector<u32, 128>, D, val_ref, decoder, inner_offset, inner_depth)?;
3138 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3139 {
3140 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3141 }
3142 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3143 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3144 }
3145 }
3146
3147 next_offset += envelope_size;
3148 _next_ordinal_to_read += 1;
3149 if next_offset >= end_offset {
3150 return Ok(());
3151 }
3152
3153 while _next_ordinal_to_read < 5 {
3155 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3156 _next_ordinal_to_read += 1;
3157 next_offset += envelope_size;
3158 }
3159
3160 let next_out_of_line = decoder.next_out_of_line();
3161 let handles_before = decoder.remaining_handles();
3162 if let Some((inlined, num_bytes, num_handles)) =
3163 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3164 {
3165 let member_inline_size =
3166 <GenericFontFamily as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3167 if inlined != (member_inline_size <= 4) {
3168 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3169 }
3170 let inner_offset;
3171 let mut inner_depth = depth.clone();
3172 if inlined {
3173 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3174 inner_offset = next_offset;
3175 } else {
3176 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3177 inner_depth.increment()?;
3178 }
3179 let val_ref = self
3180 .fallback_family
3181 .get_or_insert_with(|| fidl::new_empty!(GenericFontFamily, D));
3182 fidl::decode!(GenericFontFamily, D, val_ref, decoder, inner_offset, inner_depth)?;
3183 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3184 {
3185 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3186 }
3187 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3188 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3189 }
3190 }
3191
3192 next_offset += envelope_size;
3193 _next_ordinal_to_read += 1;
3194 if next_offset >= end_offset {
3195 return Ok(());
3196 }
3197
3198 while _next_ordinal_to_read < 6 {
3200 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3201 _next_ordinal_to_read += 1;
3202 next_offset += envelope_size;
3203 }
3204
3205 let next_out_of_line = decoder.next_out_of_line();
3206 let handles_before = decoder.remaining_handles();
3207 if let Some((inlined, num_bytes, num_handles)) =
3208 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3209 {
3210 let member_inline_size =
3211 <fidl::encoding::BoundedString<63> as fidl::encoding::TypeMarker>::inline_size(
3212 decoder.context,
3213 );
3214 if inlined != (member_inline_size <= 4) {
3215 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3216 }
3217 let inner_offset;
3218 let mut inner_depth = depth.clone();
3219 if inlined {
3220 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3221 inner_offset = next_offset;
3222 } else {
3223 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3224 inner_depth.increment()?;
3225 }
3226 let val_ref = self
3227 .postscript_name
3228 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<63>, D));
3229 fidl::decode!(
3230 fidl::encoding::BoundedString<63>,
3231 D,
3232 val_ref,
3233 decoder,
3234 inner_offset,
3235 inner_depth
3236 )?;
3237 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3238 {
3239 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3240 }
3241 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3242 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3243 }
3244 }
3245
3246 next_offset += envelope_size;
3247 _next_ordinal_to_read += 1;
3248 if next_offset >= end_offset {
3249 return Ok(());
3250 }
3251
3252 while _next_ordinal_to_read < 7 {
3254 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3255 _next_ordinal_to_read += 1;
3256 next_offset += envelope_size;
3257 }
3258
3259 let next_out_of_line = decoder.next_out_of_line();
3260 let handles_before = decoder.remaining_handles();
3261 if let Some((inlined, num_bytes, num_handles)) =
3262 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3263 {
3264 let member_inline_size =
3265 <fidl::encoding::BoundedString<128> as fidl::encoding::TypeMarker>::inline_size(
3266 decoder.context,
3267 );
3268 if inlined != (member_inline_size <= 4) {
3269 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3270 }
3271 let inner_offset;
3272 let mut inner_depth = depth.clone();
3273 if inlined {
3274 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3275 inner_offset = next_offset;
3276 } else {
3277 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3278 inner_depth.increment()?;
3279 }
3280 let val_ref = self
3281 .full_name
3282 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<128>, D));
3283 fidl::decode!(
3284 fidl::encoding::BoundedString<128>,
3285 D,
3286 val_ref,
3287 decoder,
3288 inner_offset,
3289 inner_depth
3290 )?;
3291 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3292 {
3293 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3294 }
3295 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3296 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3297 }
3298 }
3299
3300 next_offset += envelope_size;
3301
3302 while next_offset < end_offset {
3304 _next_ordinal_to_read += 1;
3305 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3306 next_offset += envelope_size;
3307 }
3308
3309 Ok(())
3310 }
3311 }
3312
3313 impl TypefaceRequest {
3314 #[inline(always)]
3315 fn max_ordinal_present(&self) -> u64 {
3316 if let Some(_) = self.cache_miss_policy {
3317 return 3;
3318 }
3319 if let Some(_) = self.flags {
3320 return 2;
3321 }
3322 if let Some(_) = self.query {
3323 return 1;
3324 }
3325 0
3326 }
3327 }
3328
3329 impl fidl::encoding::ValueTypeMarker for TypefaceRequest {
3330 type Borrowed<'a> = &'a Self;
3331 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3332 value
3333 }
3334 }
3335
3336 unsafe impl fidl::encoding::TypeMarker for TypefaceRequest {
3337 type Owned = Self;
3338
3339 #[inline(always)]
3340 fn inline_align(_context: fidl::encoding::Context) -> usize {
3341 8
3342 }
3343
3344 #[inline(always)]
3345 fn inline_size(_context: fidl::encoding::Context) -> usize {
3346 16
3347 }
3348 }
3349
3350 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TypefaceRequest, D>
3351 for &TypefaceRequest
3352 {
3353 unsafe fn encode(
3354 self,
3355 encoder: &mut fidl::encoding::Encoder<'_, D>,
3356 offset: usize,
3357 mut depth: fidl::encoding::Depth,
3358 ) -> fidl::Result<()> {
3359 encoder.debug_check_bounds::<TypefaceRequest>(offset);
3360 let max_ordinal: u64 = self.max_ordinal_present();
3362 encoder.write_num(max_ordinal, offset);
3363 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3364 if max_ordinal == 0 {
3366 return Ok(());
3367 }
3368 depth.increment()?;
3369 let envelope_size = 8;
3370 let bytes_len = max_ordinal as usize * envelope_size;
3371 #[allow(unused_variables)]
3372 let offset = encoder.out_of_line_offset(bytes_len);
3373 let mut _prev_end_offset: usize = 0;
3374 if 1 > max_ordinal {
3375 return Ok(());
3376 }
3377
3378 let cur_offset: usize = (1 - 1) * envelope_size;
3381
3382 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3384
3385 fidl::encoding::encode_in_envelope_optional::<TypefaceQuery, D>(
3390 self.query.as_ref().map(<TypefaceQuery as fidl::encoding::ValueTypeMarker>::borrow),
3391 encoder,
3392 offset + cur_offset,
3393 depth,
3394 )?;
3395
3396 _prev_end_offset = cur_offset + envelope_size;
3397 if 2 > max_ordinal {
3398 return Ok(());
3399 }
3400
3401 let cur_offset: usize = (2 - 1) * envelope_size;
3404
3405 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3407
3408 fidl::encoding::encode_in_envelope_optional::<TypefaceRequestFlags, D>(
3413 self.flags
3414 .as_ref()
3415 .map(<TypefaceRequestFlags as fidl::encoding::ValueTypeMarker>::borrow),
3416 encoder,
3417 offset + cur_offset,
3418 depth,
3419 )?;
3420
3421 _prev_end_offset = cur_offset + envelope_size;
3422 if 3 > max_ordinal {
3423 return Ok(());
3424 }
3425
3426 let cur_offset: usize = (3 - 1) * envelope_size;
3429
3430 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3432
3433 fidl::encoding::encode_in_envelope_optional::<CacheMissPolicy, D>(
3438 self.cache_miss_policy
3439 .as_ref()
3440 .map(<CacheMissPolicy as fidl::encoding::ValueTypeMarker>::borrow),
3441 encoder,
3442 offset + cur_offset,
3443 depth,
3444 )?;
3445
3446 _prev_end_offset = cur_offset + envelope_size;
3447
3448 Ok(())
3449 }
3450 }
3451
3452 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TypefaceRequest {
3453 #[inline(always)]
3454 fn new_empty() -> Self {
3455 Self::default()
3456 }
3457
3458 unsafe fn decode(
3459 &mut self,
3460 decoder: &mut fidl::encoding::Decoder<'_, D>,
3461 offset: usize,
3462 mut depth: fidl::encoding::Depth,
3463 ) -> fidl::Result<()> {
3464 decoder.debug_check_bounds::<Self>(offset);
3465 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3466 None => return Err(fidl::Error::NotNullable),
3467 Some(len) => len,
3468 };
3469 if len == 0 {
3471 return Ok(());
3472 };
3473 depth.increment()?;
3474 let envelope_size = 8;
3475 let bytes_len = len * envelope_size;
3476 let offset = decoder.out_of_line_offset(bytes_len)?;
3477 let mut _next_ordinal_to_read = 0;
3479 let mut next_offset = offset;
3480 let end_offset = offset + bytes_len;
3481 _next_ordinal_to_read += 1;
3482 if next_offset >= end_offset {
3483 return Ok(());
3484 }
3485
3486 while _next_ordinal_to_read < 1 {
3488 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3489 _next_ordinal_to_read += 1;
3490 next_offset += envelope_size;
3491 }
3492
3493 let next_out_of_line = decoder.next_out_of_line();
3494 let handles_before = decoder.remaining_handles();
3495 if let Some((inlined, num_bytes, num_handles)) =
3496 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3497 {
3498 let member_inline_size =
3499 <TypefaceQuery as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3500 if inlined != (member_inline_size <= 4) {
3501 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3502 }
3503 let inner_offset;
3504 let mut inner_depth = depth.clone();
3505 if inlined {
3506 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3507 inner_offset = next_offset;
3508 } else {
3509 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3510 inner_depth.increment()?;
3511 }
3512 let val_ref = self.query.get_or_insert_with(|| fidl::new_empty!(TypefaceQuery, D));
3513 fidl::decode!(TypefaceQuery, D, val_ref, decoder, inner_offset, inner_depth)?;
3514 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3515 {
3516 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3517 }
3518 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3519 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3520 }
3521 }
3522
3523 next_offset += envelope_size;
3524 _next_ordinal_to_read += 1;
3525 if next_offset >= end_offset {
3526 return Ok(());
3527 }
3528
3529 while _next_ordinal_to_read < 2 {
3531 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3532 _next_ordinal_to_read += 1;
3533 next_offset += envelope_size;
3534 }
3535
3536 let next_out_of_line = decoder.next_out_of_line();
3537 let handles_before = decoder.remaining_handles();
3538 if let Some((inlined, num_bytes, num_handles)) =
3539 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3540 {
3541 let member_inline_size =
3542 <TypefaceRequestFlags as fidl::encoding::TypeMarker>::inline_size(
3543 decoder.context,
3544 );
3545 if inlined != (member_inline_size <= 4) {
3546 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3547 }
3548 let inner_offset;
3549 let mut inner_depth = depth.clone();
3550 if inlined {
3551 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3552 inner_offset = next_offset;
3553 } else {
3554 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3555 inner_depth.increment()?;
3556 }
3557 let val_ref =
3558 self.flags.get_or_insert_with(|| fidl::new_empty!(TypefaceRequestFlags, D));
3559 fidl::decode!(
3560 TypefaceRequestFlags,
3561 D,
3562 val_ref,
3563 decoder,
3564 inner_offset,
3565 inner_depth
3566 )?;
3567 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3568 {
3569 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3570 }
3571 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3572 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3573 }
3574 }
3575
3576 next_offset += envelope_size;
3577 _next_ordinal_to_read += 1;
3578 if next_offset >= end_offset {
3579 return Ok(());
3580 }
3581
3582 while _next_ordinal_to_read < 3 {
3584 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3585 _next_ordinal_to_read += 1;
3586 next_offset += envelope_size;
3587 }
3588
3589 let next_out_of_line = decoder.next_out_of_line();
3590 let handles_before = decoder.remaining_handles();
3591 if let Some((inlined, num_bytes, num_handles)) =
3592 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3593 {
3594 let member_inline_size =
3595 <CacheMissPolicy as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3596 if inlined != (member_inline_size <= 4) {
3597 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3598 }
3599 let inner_offset;
3600 let mut inner_depth = depth.clone();
3601 if inlined {
3602 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3603 inner_offset = next_offset;
3604 } else {
3605 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3606 inner_depth.increment()?;
3607 }
3608 let val_ref = self
3609 .cache_miss_policy
3610 .get_or_insert_with(|| fidl::new_empty!(CacheMissPolicy, D));
3611 fidl::decode!(CacheMissPolicy, D, val_ref, decoder, inner_offset, inner_depth)?;
3612 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3613 {
3614 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3615 }
3616 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3617 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3618 }
3619 }
3620
3621 next_offset += envelope_size;
3622
3623 while next_offset < end_offset {
3625 _next_ordinal_to_read += 1;
3626 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3627 next_offset += envelope_size;
3628 }
3629
3630 Ok(())
3631 }
3632 }
3633}