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 CookieName = String;
12
13pub type NavigationId = u64;
16
17pub type Url = String;
18
19pub type UrlHostName = String;
20
21pub type UrlSchemeAndHostName = String;
22
23pub type UrlSchemeName = String;
24
25pub const MAX_HEADERS_COUNT: i32 = 4096;
26
27pub const MAX_HOST_LENGTH: i32 = 255;
28
29pub const MAX_RULE_COUNT: i32 = 4096;
30
31pub const MAX_SCHEME_AND_HOST_LENGTH: i32 = 513;
32
33pub const MAX_URL_LENGTH: i32 = 65536;
34
35pub const MAX_URL_SCHEME_NAME_LENGTH: i32 = 255;
36
37bitflags! {
38 #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
42 pub struct ContextFeatureFlags: u64 {
43 const NETWORK = 1;
48 const AUDIO = 2;
53 const VULKAN = 4;
58 const HARDWARE_VIDEO_DECODER = 8;
63 const HARDWARE_VIDEO_DECODER_ONLY = 16;
68 const WIDEVINE_CDM = 32;
73 const HEADLESS = 64;
76 const LEGACYMETRICS = 128;
78 const KEYBOARD = 256;
81 const VIRTUAL_KEYBOARD = 512;
86 const DISABLE_DYNAMIC_CODE_GENERATION = 1024;
93 }
94}
95
96impl ContextFeatureFlags {
97 #[deprecated = "Strict bits should not use `has_unknown_bits`"]
98 #[inline(always)]
99 pub fn has_unknown_bits(&self) -> bool {
100 false
101 }
102
103 #[deprecated = "Strict bits should not use `get_unknown_bits`"]
104 #[inline(always)]
105 pub fn get_unknown_bits(&self) -> u64 {
106 0
107 }
108}
109
110bitflags! {
111 #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
113 pub struct InputTypes: u64 {
114 const KEY = 1;
116 const MOUSE_CLICK = 2;
118 const MOUSE_WHEEL = 4;
120 const MOUSE_MOVE = 8;
122 const GESTURE_TAP = 16;
124 const GESTURE_PINCH = 32;
126 const GESTURE_DRAG = 64;
128 const ALL = 9223372036854775808;
130 }
131}
132
133impl InputTypes {
134 #[deprecated = "Strict bits should not use `has_unknown_bits`"]
135 #[inline(always)]
136 pub fn has_unknown_bits(&self) -> bool {
137 false
138 }
139
140 #[deprecated = "Strict bits should not use `get_unknown_bits`"]
141 #[inline(always)]
142 pub fn get_unknown_bits(&self) -> u64 {
143 0
144 }
145}
146
147bitflags! {
148 #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
151 pub struct NavigationEventListenerFlags: u64 {
152 const FAVICON = 1;
154 }
155}
156
157impl NavigationEventListenerFlags {
158 #[deprecated = "Strict bits should not use `has_unknown_bits`"]
159 #[inline(always)]
160 pub fn has_unknown_bits(&self) -> bool {
161 false
162 }
163
164 #[deprecated = "Strict bits should not use `get_unknown_bits`"]
165 #[inline(always)]
166 pub fn get_unknown_bits(&self) -> u64 {
167 0
168 }
169}
170
171bitflags! {
172 #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
174 pub struct NavigationPhase: u32 {
175 const START = 1;
177 const REDIRECT = 2;
179 const PROCESS_RESPONSE = 4;
182 const FAIL = 8;
184 }
185}
186
187impl NavigationPhase {
188 #[deprecated = "Strict bits should not use `has_unknown_bits`"]
189 #[inline(always)]
190 pub fn has_unknown_bits(&self) -> bool {
191 false
192 }
193
194 #[deprecated = "Strict bits should not use `get_unknown_bits`"]
195 #[inline(always)]
196 pub fn get_unknown_bits(&self) -> u32 {
197 0
198 }
199}
200
201#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
204#[repr(i32)]
205pub enum AllowInputState {
206 Allow = 1,
207 Deny = 2,
208}
209
210impl AllowInputState {
211 #[inline]
212 pub fn from_primitive(prim: i32) -> Option<Self> {
213 match prim {
214 1 => Some(Self::Allow),
215 2 => Some(Self::Deny),
216 _ => None,
217 }
218 }
219
220 #[inline]
221 pub const fn into_primitive(self) -> i32 {
222 self as i32
223 }
224
225 #[deprecated = "Strict enums should not use `is_unknown`"]
226 #[inline]
227 pub fn is_unknown(&self) -> bool {
228 false
229 }
230}
231
232#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
234#[repr(i32)]
235pub enum AutoplayPolicy {
236 Allow = 1,
238 RequireUserActivation = 2,
241}
242
243impl AutoplayPolicy {
244 #[inline]
245 pub fn from_primitive(prim: i32) -> Option<Self> {
246 match prim {
247 1 => Some(Self::Allow),
248 2 => Some(Self::RequireUserActivation),
249 _ => None,
250 }
251 }
252
253 #[inline]
254 pub const fn into_primitive(self) -> i32 {
255 self as i32
256 }
257
258 #[deprecated = "Strict enums should not use `is_unknown`"]
259 #[inline]
260 pub fn is_unknown(&self) -> bool {
261 false
262 }
263}
264
265#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
266#[repr(i32)]
267pub enum ConsoleLogLevel {
268 None = 100,
270 Debug = -1,
272 Info = 0,
274 Warn = 1,
276 Error = 2,
278}
279
280impl ConsoleLogLevel {
281 #[inline]
282 pub fn from_primitive(prim: i32) -> Option<Self> {
283 match prim {
284 100 => Some(Self::None),
285 -1 => Some(Self::Debug),
286 0 => Some(Self::Info),
287 1 => Some(Self::Warn),
288 2 => Some(Self::Error),
289 _ => None,
290 }
291 }
292
293 #[inline]
294 pub const fn into_primitive(self) -> i32 {
295 self as i32
296 }
297
298 #[deprecated = "Strict enums should not use `is_unknown`"]
299 #[inline]
300 pub fn is_unknown(&self) -> bool {
301 false
302 }
303}
304
305#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
306#[repr(i32)]
307pub enum ContextError {
308 RemoteDebuggingPortNotOpened = 1,
310}
311
312impl ContextError {
313 #[inline]
314 pub fn from_primitive(prim: i32) -> Option<Self> {
315 match prim {
316 1 => Some(Self::RemoteDebuggingPortNotOpened),
317 _ => None,
318 }
319 }
320
321 #[inline]
322 pub const fn into_primitive(self) -> i32 {
323 self as i32
324 }
325
326 #[deprecated = "Strict enums should not use `is_unknown`"]
327 #[inline]
328 pub fn is_unknown(&self) -> bool {
329 false
330 }
331}
332
333#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
335pub enum ErrorDetail {
336 LoadFailed,
338 ExplicitContentBlocked,
342 Crash,
344 #[doc(hidden)]
345 __SourceBreaking { unknown_ordinal: u32 },
346}
347
348#[macro_export]
350macro_rules! ErrorDetailUnknown {
351 () => {
352 _
353 };
354}
355
356impl ErrorDetail {
357 #[inline]
358 pub fn from_primitive(prim: u32) -> Option<Self> {
359 match prim {
360 0 => Some(Self::LoadFailed),
361 1 => Some(Self::ExplicitContentBlocked),
362 2 => Some(Self::Crash),
363 _ => None,
364 }
365 }
366
367 #[inline]
368 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
369 match prim {
370 0 => Self::LoadFailed,
371 1 => Self::ExplicitContentBlocked,
372 2 => Self::Crash,
373 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
374 }
375 }
376
377 #[inline]
378 pub fn unknown() -> Self {
379 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
380 }
381
382 #[inline]
383 pub const fn into_primitive(self) -> u32 {
384 match self {
385 Self::LoadFailed => 0,
386 Self::ExplicitContentBlocked => 1,
387 Self::Crash => 2,
388 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
389 }
390 }
391
392 #[inline]
393 pub fn is_unknown(&self) -> bool {
394 match self {
395 Self::__SourceBreaking { unknown_ordinal: _ } => true,
396 _ => false,
397 }
398 }
399}
400
401#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
403#[repr(i32)]
404pub enum FrameError {
405 InternalError = 1,
407 BufferNotUtf8 = 2,
409 InvalidOrigin = 3,
411 NoDataInMessage = 4,
413}
414
415impl FrameError {
416 #[inline]
417 pub fn from_primitive(prim: i32) -> Option<Self> {
418 match prim {
419 1 => Some(Self::InternalError),
420 2 => Some(Self::BufferNotUtf8),
421 3 => Some(Self::InvalidOrigin),
422 4 => Some(Self::NoDataInMessage),
423 _ => None,
424 }
425 }
426
427 #[inline]
428 pub const fn into_primitive(self) -> i32 {
429 self as i32
430 }
431
432 #[deprecated = "Strict enums should not use `is_unknown`"]
433 #[inline]
434 pub fn is_unknown(&self) -> bool {
435 false
436 }
437}
438
439#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
441#[repr(u32)]
442pub enum LoadUrlReason {
443 Link = 0,
445 Typed = 1,
447}
448
449impl LoadUrlReason {
450 #[inline]
451 pub fn from_primitive(prim: u32) -> Option<Self> {
452 match prim {
453 0 => Some(Self::Link),
454 1 => Some(Self::Typed),
455 _ => None,
456 }
457 }
458
459 #[inline]
460 pub const fn into_primitive(self) -> u32 {
461 self as u32
462 }
463
464 #[deprecated = "Strict enums should not use `is_unknown`"]
465 #[inline]
466 pub fn is_unknown(&self) -> bool {
467 false
468 }
469}
470
471#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
473#[repr(i32)]
474pub enum NavigationControllerError {
475 InvalidUrl = 1,
477 InvalidHeader = 2,
479}
480
481impl NavigationControllerError {
482 #[inline]
483 pub fn from_primitive(prim: i32) -> Option<Self> {
484 match prim {
485 1 => Some(Self::InvalidUrl),
486 2 => Some(Self::InvalidHeader),
487 _ => None,
488 }
489 }
490
491 #[inline]
492 pub const fn into_primitive(self) -> i32 {
493 self as i32
494 }
495
496 #[deprecated = "Strict enums should not use `is_unknown`"]
497 #[inline]
498 pub fn is_unknown(&self) -> bool {
499 false
500 }
501}
502
503#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
505#[repr(u32)]
506pub enum PageType {
507 Normal = 0,
509 Error = 1,
511}
512
513impl PageType {
514 #[inline]
515 pub fn from_primitive(prim: u32) -> Option<Self> {
516 match prim {
517 0 => Some(Self::Normal),
518 1 => Some(Self::Error),
519 _ => None,
520 }
521 }
522
523 #[inline]
524 pub const fn into_primitive(self) -> u32 {
525 self as u32
526 }
527
528 #[deprecated = "Strict enums should not use `is_unknown`"]
529 #[inline]
530 pub fn is_unknown(&self) -> bool {
531 false
532 }
533}
534
535#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
537#[repr(u8)]
538pub enum PermissionState {
539 Denied = 1,
541 Granted = 2,
543}
544
545impl PermissionState {
546 #[inline]
547 pub fn from_primitive(prim: u8) -> Option<Self> {
548 match prim {
549 1 => Some(Self::Denied),
550 2 => Some(Self::Granted),
551 _ => None,
552 }
553 }
554
555 #[inline]
556 pub const fn into_primitive(self) -> u8 {
557 self as u8
558 }
559
560 #[deprecated = "Strict enums should not use `is_unknown`"]
561 #[inline]
562 pub fn is_unknown(&self) -> bool {
563 false
564 }
565}
566
567#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
569#[repr(u16)]
570pub enum PermissionType {
571 Microphone = 1,
573 Camera = 2,
575 ProtectedMediaIdentifier = 3,
577 PersistentStorage = 4,
579}
580
581impl PermissionType {
582 #[inline]
583 pub fn from_primitive(prim: u16) -> Option<Self> {
584 match prim {
585 1 => Some(Self::Microphone),
586 2 => Some(Self::Camera),
587 3 => Some(Self::ProtectedMediaIdentifier),
588 4 => Some(Self::PersistentStorage),
589 _ => None,
590 }
591 }
592
593 #[inline]
594 pub const fn into_primitive(self) -> u16 {
595 self as u16
596 }
597
598 #[deprecated = "Strict enums should not use `is_unknown`"]
599 #[inline]
600 pub fn is_unknown(&self) -> bool {
601 false
602 }
603}
604
605#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
607#[repr(u32)]
608pub enum ReloadType {
609 PartialCache = 0,
611 NoCache = 1,
613}
614
615impl ReloadType {
616 #[inline]
617 pub fn from_primitive(prim: u32) -> Option<Self> {
618 match prim {
619 0 => Some(Self::PartialCache),
620 1 => Some(Self::NoCache),
621 _ => None,
622 }
623 }
624
625 #[inline]
626 pub const fn into_primitive(self) -> u32 {
627 self as u32
628 }
629
630 #[deprecated = "Strict enums should not use `is_unknown`"]
631 #[inline]
632 pub fn is_unknown(&self) -> bool {
633 false
634 }
635}
636
637#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
638#[repr(i32)]
639pub enum UrlRequestAction {
640 Allow = 1,
642 Deny = 2,
644}
645
646impl UrlRequestAction {
647 #[inline]
648 pub fn from_primitive(prim: i32) -> Option<Self> {
649 match prim {
650 1 => Some(Self::Allow),
651 2 => Some(Self::Deny),
652 _ => None,
653 }
654 }
655
656 #[inline]
657 pub const fn into_primitive(self) -> i32 {
658 self as i32
659 }
660
661 #[deprecated = "Strict enums should not use `is_unknown`"]
662 #[inline]
663 pub fn is_unknown(&self) -> bool {
664 false
665 }
666}
667
668#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
669#[repr(C)]
670pub struct ContextGetRemoteDebuggingPortResponse {
671 pub port: u16,
672}
673
674impl fidl::Persistable for ContextGetRemoteDebuggingPortResponse {}
675
676#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
677#[repr(C)]
678pub struct DevToolsPerContextListenerOnHttpPortOpenRequest {
679 pub port: u16,
680}
681
682impl fidl::Persistable for DevToolsPerContextListenerOnHttpPortOpenRequest {}
683
684#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
685pub struct FrameConfigureInputTypesRequest {
686 pub types: InputTypes,
687 pub allow: AllowInputState,
688}
689
690impl fidl::Persistable for FrameConfigureInputTypesRequest {}
691
692#[derive(Clone, Debug, PartialEq)]
693pub struct FrameForceContentDimensionsRequest {
694 pub web_dips: Option<Box<fidl_fuchsia_ui_gfx::Vec2>>,
695}
696
697impl fidl::Persistable for FrameForceContentDimensionsRequest {}
698
699#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
700#[repr(C)]
701pub struct FrameGetPrivateMemorySizeResponse {
702 pub size_bytes: u64,
703}
704
705impl fidl::Persistable for FrameGetPrivateMemorySizeResponse {}
706
707#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
708#[repr(C)]
709pub struct FrameRemoveBeforeLoadJavaScriptRequest {
710 pub id: u64,
711}
712
713impl fidl::Persistable for FrameRemoveBeforeLoadJavaScriptRequest {}
714
715#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
716pub struct FrameSetBlockMediaLoadingRequest {
717 pub blocked: bool,
718}
719
720impl fidl::Persistable for FrameSetBlockMediaLoadingRequest {}
721
722#[derive(Clone, Debug, PartialEq)]
723pub struct FrameSetContentAreaSettingsRequest {
724 pub settings: ContentAreaSettings,
725}
726
727impl fidl::Persistable for FrameSetContentAreaSettingsRequest {}
728
729#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
730pub struct FrameSetJavaScriptLogLevelRequest {
731 pub level: ConsoleLogLevel,
732}
733
734impl fidl::Persistable for FrameSetJavaScriptLogLevelRequest {}
735
736#[derive(Clone, Debug, PartialEq)]
737pub struct FrameSetMediaSettingsRequest {
738 pub settings: FrameMediaSettings,
739}
740
741impl fidl::Persistable for FrameSetMediaSettingsRequest {}
742
743#[derive(Clone, Debug, PartialEq)]
744pub struct FrameSetPermissionStateRequest {
745 pub permission: PermissionDescriptor,
746 pub web_origin: String,
747 pub state: PermissionState,
748}
749
750impl fidl::Persistable for FrameSetPermissionStateRequest {}
751
752#[derive(Clone, Debug, PartialEq)]
753pub struct FrameSetUrlRequestRewriteRulesRequest {
754 pub rules: Vec<UrlRequestRewriteRule>,
755}
756
757impl fidl::Persistable for FrameSetUrlRequestRewriteRulesRequest {}
758
759#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
760pub struct NavigationControllerReloadRequest {
761 pub type_: ReloadType,
762}
763
764impl fidl::Persistable for NavigationControllerReloadRequest {}
765
766#[derive(Clone, Debug, PartialEq)]
767pub struct NavigationPolicyProviderEvaluateRequestedNavigationRequest {
768 pub requested_navigation: RequestedNavigation,
769}
770
771impl fidl::Persistable for NavigationPolicyProviderEvaluateRequestedNavigationRequest {}
772
773#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
775pub struct NoArgumentsAction;
776
777impl fidl::Persistable for NoArgumentsAction {}
778
779#[derive(Clone, Debug, Default, PartialEq)]
782pub struct ContentAreaSettings {
783 pub hide_scrollbars: Option<bool>,
785 pub autoplay_policy: Option<AutoplayPolicy>,
788 pub theme: Option<fidl_fuchsia_settings::ThemeType>,
795 pub page_scale: Option<f32>,
808 #[doc(hidden)]
809 pub __source_breaking: fidl::marker::SourceBreaking,
810}
811
812impl fidl::Persistable for ContentAreaSettings {}
813
814#[derive(Clone, Debug, Default, PartialEq)]
815pub struct CookieId {
816 pub name: Option<String>,
818 pub domain: Option<String>,
821 pub path: Option<String>,
824 #[doc(hidden)]
825 pub __source_breaking: fidl::marker::SourceBreaking,
826}
827
828impl fidl::Persistable for CookieId {}
829
830#[derive(Clone, Debug, Default, PartialEq)]
831pub struct FrameCloseRequest {
832 pub timeout: Option<i64>,
834 #[doc(hidden)]
835 pub __source_breaking: fidl::marker::SourceBreaking,
836}
837
838impl fidl::Persistable for FrameCloseRequest {}
839
840#[derive(Clone, Debug, Default, PartialEq)]
841pub struct FrameMediaSettings {
842 pub renderer_usage: Option<fidl_fuchsia_media::AudioRenderUsage>,
846 pub audio_consumer_session_id: Option<u64>,
849 pub renderer_usage2: Option<fidl_fuchsia_media::AudioRenderUsage2>,
853 #[doc(hidden)]
854 pub __source_breaking: fidl::marker::SourceBreaking,
855}
856
857impl fidl::Persistable for FrameMediaSettings {}
858
859#[derive(Clone, Debug, Default, PartialEq)]
861pub struct NavigationPolicyProviderParams {
862 pub main_frame_phases: Option<NavigationPhase>,
864 pub subframe_phases: Option<NavigationPhase>,
866 #[doc(hidden)]
867 pub __source_breaking: fidl::marker::SourceBreaking,
868}
869
870impl fidl::Persistable for NavigationPolicyProviderParams {}
871
872#[derive(Clone, Debug, Default, PartialEq)]
874pub struct PermissionDescriptor {
875 pub type_: Option<PermissionType>,
876 #[doc(hidden)]
877 pub __source_breaking: fidl::marker::SourceBreaking,
878}
879
880impl fidl::Persistable for PermissionDescriptor {}
881
882#[derive(Clone, Debug, Default, PartialEq)]
883pub struct RequestedNavigation {
884 pub id: Option<u64>,
886 pub phase: Option<NavigationPhase>,
888 pub is_main_frame: Option<bool>,
890 pub is_same_document: Option<bool>,
892 pub is_http_post: Option<bool>,
894 pub url: Option<String>,
897 pub has_gesture: Option<bool>,
899 pub was_server_redirect: Option<bool>,
901 #[doc(hidden)]
902 pub __source_breaking: fidl::marker::SourceBreaking,
903}
904
905impl fidl::Persistable for RequestedNavigation {}
906
907#[derive(Clone, Debug, Default, PartialEq)]
913pub struct UrlRequestRewriteAddHeaders {
914 pub headers: Option<Vec<fidl_fuchsia_net_http::Header>>,
915 #[doc(hidden)]
916 pub __source_breaking: fidl::marker::SourceBreaking,
917}
918
919impl fidl::Persistable for UrlRequestRewriteAddHeaders {}
920
921#[derive(Clone, Debug, Default, PartialEq)]
926pub struct UrlRequestRewriteAppendToQuery {
927 pub query: Option<String>,
928 #[doc(hidden)]
929 pub __source_breaking: fidl::marker::SourceBreaking,
930}
931
932impl fidl::Persistable for UrlRequestRewriteAppendToQuery {}
933
934#[derive(Clone, Debug, Default, PartialEq)]
940pub struct UrlRequestRewriteRemoveHeader {
941 pub query_pattern: Option<String>,
942 pub header_name: Option<Vec<u8>>,
943 #[doc(hidden)]
944 pub __source_breaking: fidl::marker::SourceBreaking,
945}
946
947impl fidl::Persistable for UrlRequestRewriteRemoveHeader {}
948
949#[derive(Clone, Debug, Default, PartialEq)]
955pub struct UrlRequestRewriteReplaceUrl {
956 pub url_ends_with: Option<String>,
957 pub new_url: Option<String>,
958 #[doc(hidden)]
959 pub __source_breaking: fidl::marker::SourceBreaking,
960}
961
962impl fidl::Persistable for UrlRequestRewriteReplaceUrl {}
963
964#[derive(Clone, Debug, Default, PartialEq)]
965pub struct UrlRequestRewriteRule {
966 pub hosts_filter: Option<Vec<String>>,
969 pub schemes_filter: Option<Vec<String>>,
972 pub rewrites: Option<Vec<UrlRequestRewrite>>,
974 pub action: Option<UrlRequestAction>,
977 #[doc(hidden)]
978 pub __source_breaking: fidl::marker::SourceBreaking,
979}
980
981impl fidl::Persistable for UrlRequestRewriteRule {}
982
983#[derive(Clone, Debug, Default, PartialEq)]
988pub struct UrlRequestRewriteSubstituteQueryPattern {
989 pub pattern: Option<String>,
990 pub substitution: Option<String>,
991 #[doc(hidden)]
992 pub __source_breaking: fidl::marker::SourceBreaking,
993}
994
995impl fidl::Persistable for UrlRequestRewriteSubstituteQueryPattern {}
996
997#[derive(Clone, Debug)]
998pub enum UrlRequestRewrite {
999 AddHeaders(UrlRequestRewriteAddHeaders),
1001 RemoveHeader(UrlRequestRewriteRemoveHeader),
1003 SubstituteQueryPattern(UrlRequestRewriteSubstituteQueryPattern),
1005 ReplaceUrl(UrlRequestRewriteReplaceUrl),
1007 AppendToQuery(UrlRequestRewriteAppendToQuery),
1009 #[doc(hidden)]
1010 __SourceBreaking { unknown_ordinal: u64 },
1011}
1012
1013#[macro_export]
1015macro_rules! UrlRequestRewriteUnknown {
1016 () => {
1017 _
1018 };
1019}
1020
1021impl PartialEq for UrlRequestRewrite {
1023 fn eq(&self, other: &Self) -> bool {
1024 match (self, other) {
1025 (Self::AddHeaders(x), Self::AddHeaders(y)) => *x == *y,
1026 (Self::RemoveHeader(x), Self::RemoveHeader(y)) => *x == *y,
1027 (Self::SubstituteQueryPattern(x), Self::SubstituteQueryPattern(y)) => *x == *y,
1028 (Self::ReplaceUrl(x), Self::ReplaceUrl(y)) => *x == *y,
1029 (Self::AppendToQuery(x), Self::AppendToQuery(y)) => *x == *y,
1030 _ => false,
1031 }
1032 }
1033}
1034
1035impl UrlRequestRewrite {
1036 #[inline]
1037 pub fn ordinal(&self) -> u64 {
1038 match *self {
1039 Self::AddHeaders(_) => 1,
1040 Self::RemoveHeader(_) => 2,
1041 Self::SubstituteQueryPattern(_) => 3,
1042 Self::ReplaceUrl(_) => 4,
1043 Self::AppendToQuery(_) => 5,
1044 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
1045 }
1046 }
1047
1048 #[inline]
1049 pub fn unknown_variant_for_testing() -> Self {
1050 Self::__SourceBreaking { unknown_ordinal: 0 }
1051 }
1052
1053 #[inline]
1054 pub fn is_unknown(&self) -> bool {
1055 match self {
1056 Self::__SourceBreaking { .. } => true,
1057 _ => false,
1058 }
1059 }
1060}
1061
1062impl fidl::Persistable for UrlRequestRewrite {}
1063
1064mod internal {
1065 use super::*;
1066 unsafe impl fidl::encoding::TypeMarker for ContextFeatureFlags {
1067 type Owned = Self;
1068
1069 #[inline(always)]
1070 fn inline_align(_context: fidl::encoding::Context) -> usize {
1071 8
1072 }
1073
1074 #[inline(always)]
1075 fn inline_size(_context: fidl::encoding::Context) -> usize {
1076 8
1077 }
1078 }
1079
1080 impl fidl::encoding::ValueTypeMarker for ContextFeatureFlags {
1081 type Borrowed<'a> = Self;
1082 #[inline(always)]
1083 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1084 *value
1085 }
1086 }
1087
1088 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1089 for ContextFeatureFlags
1090 {
1091 #[inline]
1092 unsafe fn encode(
1093 self,
1094 encoder: &mut fidl::encoding::Encoder<'_, D>,
1095 offset: usize,
1096 _depth: fidl::encoding::Depth,
1097 ) -> fidl::Result<()> {
1098 encoder.debug_check_bounds::<Self>(offset);
1099 if self.bits() & Self::all().bits() != self.bits() {
1100 return Err(fidl::Error::InvalidBitsValue);
1101 }
1102 encoder.write_num(self.bits(), offset);
1103 Ok(())
1104 }
1105 }
1106
1107 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ContextFeatureFlags {
1108 #[inline(always)]
1109 fn new_empty() -> Self {
1110 Self::empty()
1111 }
1112
1113 #[inline]
1114 unsafe fn decode(
1115 &mut self,
1116 decoder: &mut fidl::encoding::Decoder<'_, D>,
1117 offset: usize,
1118 _depth: fidl::encoding::Depth,
1119 ) -> fidl::Result<()> {
1120 decoder.debug_check_bounds::<Self>(offset);
1121 let prim = decoder.read_num::<u64>(offset);
1122 *self = Self::from_bits(prim).ok_or(fidl::Error::InvalidBitsValue)?;
1123 Ok(())
1124 }
1125 }
1126 unsafe impl fidl::encoding::TypeMarker for InputTypes {
1127 type Owned = Self;
1128
1129 #[inline(always)]
1130 fn inline_align(_context: fidl::encoding::Context) -> usize {
1131 8
1132 }
1133
1134 #[inline(always)]
1135 fn inline_size(_context: fidl::encoding::Context) -> usize {
1136 8
1137 }
1138 }
1139
1140 impl fidl::encoding::ValueTypeMarker for InputTypes {
1141 type Borrowed<'a> = Self;
1142 #[inline(always)]
1143 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1144 *value
1145 }
1146 }
1147
1148 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for InputTypes {
1149 #[inline]
1150 unsafe fn encode(
1151 self,
1152 encoder: &mut fidl::encoding::Encoder<'_, D>,
1153 offset: usize,
1154 _depth: fidl::encoding::Depth,
1155 ) -> fidl::Result<()> {
1156 encoder.debug_check_bounds::<Self>(offset);
1157 if self.bits() & Self::all().bits() != self.bits() {
1158 return Err(fidl::Error::InvalidBitsValue);
1159 }
1160 encoder.write_num(self.bits(), offset);
1161 Ok(())
1162 }
1163 }
1164
1165 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InputTypes {
1166 #[inline(always)]
1167 fn new_empty() -> Self {
1168 Self::empty()
1169 }
1170
1171 #[inline]
1172 unsafe fn decode(
1173 &mut self,
1174 decoder: &mut fidl::encoding::Decoder<'_, D>,
1175 offset: usize,
1176 _depth: fidl::encoding::Depth,
1177 ) -> fidl::Result<()> {
1178 decoder.debug_check_bounds::<Self>(offset);
1179 let prim = decoder.read_num::<u64>(offset);
1180 *self = Self::from_bits(prim).ok_or(fidl::Error::InvalidBitsValue)?;
1181 Ok(())
1182 }
1183 }
1184 unsafe impl fidl::encoding::TypeMarker for NavigationEventListenerFlags {
1185 type Owned = Self;
1186
1187 #[inline(always)]
1188 fn inline_align(_context: fidl::encoding::Context) -> usize {
1189 8
1190 }
1191
1192 #[inline(always)]
1193 fn inline_size(_context: fidl::encoding::Context) -> usize {
1194 8
1195 }
1196 }
1197
1198 impl fidl::encoding::ValueTypeMarker for NavigationEventListenerFlags {
1199 type Borrowed<'a> = Self;
1200 #[inline(always)]
1201 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1202 *value
1203 }
1204 }
1205
1206 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1207 for NavigationEventListenerFlags
1208 {
1209 #[inline]
1210 unsafe fn encode(
1211 self,
1212 encoder: &mut fidl::encoding::Encoder<'_, D>,
1213 offset: usize,
1214 _depth: fidl::encoding::Depth,
1215 ) -> fidl::Result<()> {
1216 encoder.debug_check_bounds::<Self>(offset);
1217 if self.bits() & Self::all().bits() != self.bits() {
1218 return Err(fidl::Error::InvalidBitsValue);
1219 }
1220 encoder.write_num(self.bits(), offset);
1221 Ok(())
1222 }
1223 }
1224
1225 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1226 for NavigationEventListenerFlags
1227 {
1228 #[inline(always)]
1229 fn new_empty() -> Self {
1230 Self::empty()
1231 }
1232
1233 #[inline]
1234 unsafe fn decode(
1235 &mut self,
1236 decoder: &mut fidl::encoding::Decoder<'_, D>,
1237 offset: usize,
1238 _depth: fidl::encoding::Depth,
1239 ) -> fidl::Result<()> {
1240 decoder.debug_check_bounds::<Self>(offset);
1241 let prim = decoder.read_num::<u64>(offset);
1242 *self = Self::from_bits(prim).ok_or(fidl::Error::InvalidBitsValue)?;
1243 Ok(())
1244 }
1245 }
1246 unsafe impl fidl::encoding::TypeMarker for NavigationPhase {
1247 type Owned = Self;
1248
1249 #[inline(always)]
1250 fn inline_align(_context: fidl::encoding::Context) -> usize {
1251 4
1252 }
1253
1254 #[inline(always)]
1255 fn inline_size(_context: fidl::encoding::Context) -> usize {
1256 4
1257 }
1258 }
1259
1260 impl fidl::encoding::ValueTypeMarker for NavigationPhase {
1261 type Borrowed<'a> = Self;
1262 #[inline(always)]
1263 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1264 *value
1265 }
1266 }
1267
1268 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1269 for NavigationPhase
1270 {
1271 #[inline]
1272 unsafe fn encode(
1273 self,
1274 encoder: &mut fidl::encoding::Encoder<'_, D>,
1275 offset: usize,
1276 _depth: fidl::encoding::Depth,
1277 ) -> fidl::Result<()> {
1278 encoder.debug_check_bounds::<Self>(offset);
1279 if self.bits() & Self::all().bits() != self.bits() {
1280 return Err(fidl::Error::InvalidBitsValue);
1281 }
1282 encoder.write_num(self.bits(), offset);
1283 Ok(())
1284 }
1285 }
1286
1287 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for NavigationPhase {
1288 #[inline(always)]
1289 fn new_empty() -> Self {
1290 Self::empty()
1291 }
1292
1293 #[inline]
1294 unsafe fn decode(
1295 &mut self,
1296 decoder: &mut fidl::encoding::Decoder<'_, D>,
1297 offset: usize,
1298 _depth: fidl::encoding::Depth,
1299 ) -> fidl::Result<()> {
1300 decoder.debug_check_bounds::<Self>(offset);
1301 let prim = decoder.read_num::<u32>(offset);
1302 *self = Self::from_bits(prim).ok_or(fidl::Error::InvalidBitsValue)?;
1303 Ok(())
1304 }
1305 }
1306 unsafe impl fidl::encoding::TypeMarker for AllowInputState {
1307 type Owned = Self;
1308
1309 #[inline(always)]
1310 fn inline_align(_context: fidl::encoding::Context) -> usize {
1311 std::mem::align_of::<i32>()
1312 }
1313
1314 #[inline(always)]
1315 fn inline_size(_context: fidl::encoding::Context) -> usize {
1316 std::mem::size_of::<i32>()
1317 }
1318
1319 #[inline(always)]
1320 fn encode_is_copy() -> bool {
1321 true
1322 }
1323
1324 #[inline(always)]
1325 fn decode_is_copy() -> bool {
1326 false
1327 }
1328 }
1329
1330 impl fidl::encoding::ValueTypeMarker for AllowInputState {
1331 type Borrowed<'a> = Self;
1332 #[inline(always)]
1333 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1334 *value
1335 }
1336 }
1337
1338 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1339 for AllowInputState
1340 {
1341 #[inline]
1342 unsafe fn encode(
1343 self,
1344 encoder: &mut fidl::encoding::Encoder<'_, D>,
1345 offset: usize,
1346 _depth: fidl::encoding::Depth,
1347 ) -> fidl::Result<()> {
1348 encoder.debug_check_bounds::<Self>(offset);
1349 encoder.write_num(self.into_primitive(), offset);
1350 Ok(())
1351 }
1352 }
1353
1354 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AllowInputState {
1355 #[inline(always)]
1356 fn new_empty() -> Self {
1357 Self::Allow
1358 }
1359
1360 #[inline]
1361 unsafe fn decode(
1362 &mut self,
1363 decoder: &mut fidl::encoding::Decoder<'_, D>,
1364 offset: usize,
1365 _depth: fidl::encoding::Depth,
1366 ) -> fidl::Result<()> {
1367 decoder.debug_check_bounds::<Self>(offset);
1368 let prim = decoder.read_num::<i32>(offset);
1369
1370 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1371 Ok(())
1372 }
1373 }
1374 unsafe impl fidl::encoding::TypeMarker for AutoplayPolicy {
1375 type Owned = Self;
1376
1377 #[inline(always)]
1378 fn inline_align(_context: fidl::encoding::Context) -> usize {
1379 std::mem::align_of::<i32>()
1380 }
1381
1382 #[inline(always)]
1383 fn inline_size(_context: fidl::encoding::Context) -> usize {
1384 std::mem::size_of::<i32>()
1385 }
1386
1387 #[inline(always)]
1388 fn encode_is_copy() -> bool {
1389 true
1390 }
1391
1392 #[inline(always)]
1393 fn decode_is_copy() -> bool {
1394 false
1395 }
1396 }
1397
1398 impl fidl::encoding::ValueTypeMarker for AutoplayPolicy {
1399 type Borrowed<'a> = Self;
1400 #[inline(always)]
1401 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1402 *value
1403 }
1404 }
1405
1406 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for AutoplayPolicy {
1407 #[inline]
1408 unsafe fn encode(
1409 self,
1410 encoder: &mut fidl::encoding::Encoder<'_, D>,
1411 offset: usize,
1412 _depth: fidl::encoding::Depth,
1413 ) -> fidl::Result<()> {
1414 encoder.debug_check_bounds::<Self>(offset);
1415 encoder.write_num(self.into_primitive(), offset);
1416 Ok(())
1417 }
1418 }
1419
1420 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AutoplayPolicy {
1421 #[inline(always)]
1422 fn new_empty() -> Self {
1423 Self::Allow
1424 }
1425
1426 #[inline]
1427 unsafe fn decode(
1428 &mut self,
1429 decoder: &mut fidl::encoding::Decoder<'_, D>,
1430 offset: usize,
1431 _depth: fidl::encoding::Depth,
1432 ) -> fidl::Result<()> {
1433 decoder.debug_check_bounds::<Self>(offset);
1434 let prim = decoder.read_num::<i32>(offset);
1435
1436 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1437 Ok(())
1438 }
1439 }
1440 unsafe impl fidl::encoding::TypeMarker for ConsoleLogLevel {
1441 type Owned = Self;
1442
1443 #[inline(always)]
1444 fn inline_align(_context: fidl::encoding::Context) -> usize {
1445 std::mem::align_of::<i32>()
1446 }
1447
1448 #[inline(always)]
1449 fn inline_size(_context: fidl::encoding::Context) -> usize {
1450 std::mem::size_of::<i32>()
1451 }
1452
1453 #[inline(always)]
1454 fn encode_is_copy() -> bool {
1455 true
1456 }
1457
1458 #[inline(always)]
1459 fn decode_is_copy() -> bool {
1460 false
1461 }
1462 }
1463
1464 impl fidl::encoding::ValueTypeMarker for ConsoleLogLevel {
1465 type Borrowed<'a> = Self;
1466 #[inline(always)]
1467 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1468 *value
1469 }
1470 }
1471
1472 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1473 for ConsoleLogLevel
1474 {
1475 #[inline]
1476 unsafe fn encode(
1477 self,
1478 encoder: &mut fidl::encoding::Encoder<'_, D>,
1479 offset: usize,
1480 _depth: fidl::encoding::Depth,
1481 ) -> fidl::Result<()> {
1482 encoder.debug_check_bounds::<Self>(offset);
1483 encoder.write_num(self.into_primitive(), offset);
1484 Ok(())
1485 }
1486 }
1487
1488 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ConsoleLogLevel {
1489 #[inline(always)]
1490 fn new_empty() -> Self {
1491 Self::Debug
1492 }
1493
1494 #[inline]
1495 unsafe fn decode(
1496 &mut self,
1497 decoder: &mut fidl::encoding::Decoder<'_, D>,
1498 offset: usize,
1499 _depth: fidl::encoding::Depth,
1500 ) -> fidl::Result<()> {
1501 decoder.debug_check_bounds::<Self>(offset);
1502 let prim = decoder.read_num::<i32>(offset);
1503
1504 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1505 Ok(())
1506 }
1507 }
1508 unsafe impl fidl::encoding::TypeMarker for ContextError {
1509 type Owned = Self;
1510
1511 #[inline(always)]
1512 fn inline_align(_context: fidl::encoding::Context) -> usize {
1513 std::mem::align_of::<i32>()
1514 }
1515
1516 #[inline(always)]
1517 fn inline_size(_context: fidl::encoding::Context) -> usize {
1518 std::mem::size_of::<i32>()
1519 }
1520
1521 #[inline(always)]
1522 fn encode_is_copy() -> bool {
1523 true
1524 }
1525
1526 #[inline(always)]
1527 fn decode_is_copy() -> bool {
1528 false
1529 }
1530 }
1531
1532 impl fidl::encoding::ValueTypeMarker for ContextError {
1533 type Borrowed<'a> = Self;
1534 #[inline(always)]
1535 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1536 *value
1537 }
1538 }
1539
1540 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for ContextError {
1541 #[inline]
1542 unsafe fn encode(
1543 self,
1544 encoder: &mut fidl::encoding::Encoder<'_, D>,
1545 offset: usize,
1546 _depth: fidl::encoding::Depth,
1547 ) -> fidl::Result<()> {
1548 encoder.debug_check_bounds::<Self>(offset);
1549 encoder.write_num(self.into_primitive(), offset);
1550 Ok(())
1551 }
1552 }
1553
1554 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ContextError {
1555 #[inline(always)]
1556 fn new_empty() -> Self {
1557 Self::RemoteDebuggingPortNotOpened
1558 }
1559
1560 #[inline]
1561 unsafe fn decode(
1562 &mut self,
1563 decoder: &mut fidl::encoding::Decoder<'_, D>,
1564 offset: usize,
1565 _depth: fidl::encoding::Depth,
1566 ) -> fidl::Result<()> {
1567 decoder.debug_check_bounds::<Self>(offset);
1568 let prim = decoder.read_num::<i32>(offset);
1569
1570 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1571 Ok(())
1572 }
1573 }
1574 unsafe impl fidl::encoding::TypeMarker for ErrorDetail {
1575 type Owned = Self;
1576
1577 #[inline(always)]
1578 fn inline_align(_context: fidl::encoding::Context) -> usize {
1579 std::mem::align_of::<u32>()
1580 }
1581
1582 #[inline(always)]
1583 fn inline_size(_context: fidl::encoding::Context) -> usize {
1584 std::mem::size_of::<u32>()
1585 }
1586
1587 #[inline(always)]
1588 fn encode_is_copy() -> bool {
1589 false
1590 }
1591
1592 #[inline(always)]
1593 fn decode_is_copy() -> bool {
1594 false
1595 }
1596 }
1597
1598 impl fidl::encoding::ValueTypeMarker for ErrorDetail {
1599 type Borrowed<'a> = Self;
1600 #[inline(always)]
1601 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1602 *value
1603 }
1604 }
1605
1606 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for ErrorDetail {
1607 #[inline]
1608 unsafe fn encode(
1609 self,
1610 encoder: &mut fidl::encoding::Encoder<'_, D>,
1611 offset: usize,
1612 _depth: fidl::encoding::Depth,
1613 ) -> fidl::Result<()> {
1614 encoder.debug_check_bounds::<Self>(offset);
1615 encoder.write_num(self.into_primitive(), offset);
1616 Ok(())
1617 }
1618 }
1619
1620 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ErrorDetail {
1621 #[inline(always)]
1622 fn new_empty() -> Self {
1623 Self::unknown()
1624 }
1625
1626 #[inline]
1627 unsafe fn decode(
1628 &mut self,
1629 decoder: &mut fidl::encoding::Decoder<'_, D>,
1630 offset: usize,
1631 _depth: fidl::encoding::Depth,
1632 ) -> fidl::Result<()> {
1633 decoder.debug_check_bounds::<Self>(offset);
1634 let prim = decoder.read_num::<u32>(offset);
1635
1636 *self = Self::from_primitive_allow_unknown(prim);
1637 Ok(())
1638 }
1639 }
1640 unsafe impl fidl::encoding::TypeMarker for FrameError {
1641 type Owned = Self;
1642
1643 #[inline(always)]
1644 fn inline_align(_context: fidl::encoding::Context) -> usize {
1645 std::mem::align_of::<i32>()
1646 }
1647
1648 #[inline(always)]
1649 fn inline_size(_context: fidl::encoding::Context) -> usize {
1650 std::mem::size_of::<i32>()
1651 }
1652
1653 #[inline(always)]
1654 fn encode_is_copy() -> bool {
1655 true
1656 }
1657
1658 #[inline(always)]
1659 fn decode_is_copy() -> bool {
1660 false
1661 }
1662 }
1663
1664 impl fidl::encoding::ValueTypeMarker for FrameError {
1665 type Borrowed<'a> = Self;
1666 #[inline(always)]
1667 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1668 *value
1669 }
1670 }
1671
1672 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for FrameError {
1673 #[inline]
1674 unsafe fn encode(
1675 self,
1676 encoder: &mut fidl::encoding::Encoder<'_, D>,
1677 offset: usize,
1678 _depth: fidl::encoding::Depth,
1679 ) -> fidl::Result<()> {
1680 encoder.debug_check_bounds::<Self>(offset);
1681 encoder.write_num(self.into_primitive(), offset);
1682 Ok(())
1683 }
1684 }
1685
1686 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for FrameError {
1687 #[inline(always)]
1688 fn new_empty() -> Self {
1689 Self::InternalError
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 let prim = decoder.read_num::<i32>(offset);
1701
1702 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1703 Ok(())
1704 }
1705 }
1706 unsafe impl fidl::encoding::TypeMarker for LoadUrlReason {
1707 type Owned = Self;
1708
1709 #[inline(always)]
1710 fn inline_align(_context: fidl::encoding::Context) -> usize {
1711 std::mem::align_of::<u32>()
1712 }
1713
1714 #[inline(always)]
1715 fn inline_size(_context: fidl::encoding::Context) -> usize {
1716 std::mem::size_of::<u32>()
1717 }
1718
1719 #[inline(always)]
1720 fn encode_is_copy() -> bool {
1721 true
1722 }
1723
1724 #[inline(always)]
1725 fn decode_is_copy() -> bool {
1726 false
1727 }
1728 }
1729
1730 impl fidl::encoding::ValueTypeMarker for LoadUrlReason {
1731 type Borrowed<'a> = Self;
1732 #[inline(always)]
1733 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1734 *value
1735 }
1736 }
1737
1738 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for LoadUrlReason {
1739 #[inline]
1740 unsafe fn encode(
1741 self,
1742 encoder: &mut fidl::encoding::Encoder<'_, D>,
1743 offset: usize,
1744 _depth: fidl::encoding::Depth,
1745 ) -> fidl::Result<()> {
1746 encoder.debug_check_bounds::<Self>(offset);
1747 encoder.write_num(self.into_primitive(), offset);
1748 Ok(())
1749 }
1750 }
1751
1752 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LoadUrlReason {
1753 #[inline(always)]
1754 fn new_empty() -> Self {
1755 Self::Link
1756 }
1757
1758 #[inline]
1759 unsafe fn decode(
1760 &mut self,
1761 decoder: &mut fidl::encoding::Decoder<'_, D>,
1762 offset: usize,
1763 _depth: fidl::encoding::Depth,
1764 ) -> fidl::Result<()> {
1765 decoder.debug_check_bounds::<Self>(offset);
1766 let prim = decoder.read_num::<u32>(offset);
1767
1768 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1769 Ok(())
1770 }
1771 }
1772 unsafe impl fidl::encoding::TypeMarker for NavigationControllerError {
1773 type Owned = Self;
1774
1775 #[inline(always)]
1776 fn inline_align(_context: fidl::encoding::Context) -> usize {
1777 std::mem::align_of::<i32>()
1778 }
1779
1780 #[inline(always)]
1781 fn inline_size(_context: fidl::encoding::Context) -> usize {
1782 std::mem::size_of::<i32>()
1783 }
1784
1785 #[inline(always)]
1786 fn encode_is_copy() -> bool {
1787 true
1788 }
1789
1790 #[inline(always)]
1791 fn decode_is_copy() -> bool {
1792 false
1793 }
1794 }
1795
1796 impl fidl::encoding::ValueTypeMarker for NavigationControllerError {
1797 type Borrowed<'a> = Self;
1798 #[inline(always)]
1799 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1800 *value
1801 }
1802 }
1803
1804 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1805 for NavigationControllerError
1806 {
1807 #[inline]
1808 unsafe fn encode(
1809 self,
1810 encoder: &mut fidl::encoding::Encoder<'_, D>,
1811 offset: usize,
1812 _depth: fidl::encoding::Depth,
1813 ) -> fidl::Result<()> {
1814 encoder.debug_check_bounds::<Self>(offset);
1815 encoder.write_num(self.into_primitive(), offset);
1816 Ok(())
1817 }
1818 }
1819
1820 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1821 for NavigationControllerError
1822 {
1823 #[inline(always)]
1824 fn new_empty() -> Self {
1825 Self::InvalidUrl
1826 }
1827
1828 #[inline]
1829 unsafe fn decode(
1830 &mut self,
1831 decoder: &mut fidl::encoding::Decoder<'_, D>,
1832 offset: usize,
1833 _depth: fidl::encoding::Depth,
1834 ) -> fidl::Result<()> {
1835 decoder.debug_check_bounds::<Self>(offset);
1836 let prim = decoder.read_num::<i32>(offset);
1837
1838 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1839 Ok(())
1840 }
1841 }
1842 unsafe impl fidl::encoding::TypeMarker for PageType {
1843 type Owned = Self;
1844
1845 #[inline(always)]
1846 fn inline_align(_context: fidl::encoding::Context) -> usize {
1847 std::mem::align_of::<u32>()
1848 }
1849
1850 #[inline(always)]
1851 fn inline_size(_context: fidl::encoding::Context) -> usize {
1852 std::mem::size_of::<u32>()
1853 }
1854
1855 #[inline(always)]
1856 fn encode_is_copy() -> bool {
1857 true
1858 }
1859
1860 #[inline(always)]
1861 fn decode_is_copy() -> bool {
1862 false
1863 }
1864 }
1865
1866 impl fidl::encoding::ValueTypeMarker for PageType {
1867 type Borrowed<'a> = Self;
1868 #[inline(always)]
1869 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1870 *value
1871 }
1872 }
1873
1874 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for PageType {
1875 #[inline]
1876 unsafe fn encode(
1877 self,
1878 encoder: &mut fidl::encoding::Encoder<'_, D>,
1879 offset: usize,
1880 _depth: fidl::encoding::Depth,
1881 ) -> fidl::Result<()> {
1882 encoder.debug_check_bounds::<Self>(offset);
1883 encoder.write_num(self.into_primitive(), offset);
1884 Ok(())
1885 }
1886 }
1887
1888 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PageType {
1889 #[inline(always)]
1890 fn new_empty() -> Self {
1891 Self::Normal
1892 }
1893
1894 #[inline]
1895 unsafe fn decode(
1896 &mut self,
1897 decoder: &mut fidl::encoding::Decoder<'_, D>,
1898 offset: usize,
1899 _depth: fidl::encoding::Depth,
1900 ) -> fidl::Result<()> {
1901 decoder.debug_check_bounds::<Self>(offset);
1902 let prim = decoder.read_num::<u32>(offset);
1903
1904 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1905 Ok(())
1906 }
1907 }
1908 unsafe impl fidl::encoding::TypeMarker for PermissionState {
1909 type Owned = Self;
1910
1911 #[inline(always)]
1912 fn inline_align(_context: fidl::encoding::Context) -> usize {
1913 std::mem::align_of::<u8>()
1914 }
1915
1916 #[inline(always)]
1917 fn inline_size(_context: fidl::encoding::Context) -> usize {
1918 std::mem::size_of::<u8>()
1919 }
1920
1921 #[inline(always)]
1922 fn encode_is_copy() -> bool {
1923 true
1924 }
1925
1926 #[inline(always)]
1927 fn decode_is_copy() -> bool {
1928 false
1929 }
1930 }
1931
1932 impl fidl::encoding::ValueTypeMarker for PermissionState {
1933 type Borrowed<'a> = Self;
1934 #[inline(always)]
1935 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1936 *value
1937 }
1938 }
1939
1940 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1941 for PermissionState
1942 {
1943 #[inline]
1944 unsafe fn encode(
1945 self,
1946 encoder: &mut fidl::encoding::Encoder<'_, D>,
1947 offset: usize,
1948 _depth: fidl::encoding::Depth,
1949 ) -> fidl::Result<()> {
1950 encoder.debug_check_bounds::<Self>(offset);
1951 encoder.write_num(self.into_primitive(), offset);
1952 Ok(())
1953 }
1954 }
1955
1956 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PermissionState {
1957 #[inline(always)]
1958 fn new_empty() -> Self {
1959 Self::Denied
1960 }
1961
1962 #[inline]
1963 unsafe fn decode(
1964 &mut self,
1965 decoder: &mut fidl::encoding::Decoder<'_, D>,
1966 offset: usize,
1967 _depth: fidl::encoding::Depth,
1968 ) -> fidl::Result<()> {
1969 decoder.debug_check_bounds::<Self>(offset);
1970 let prim = decoder.read_num::<u8>(offset);
1971
1972 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1973 Ok(())
1974 }
1975 }
1976 unsafe impl fidl::encoding::TypeMarker for PermissionType {
1977 type Owned = Self;
1978
1979 #[inline(always)]
1980 fn inline_align(_context: fidl::encoding::Context) -> usize {
1981 std::mem::align_of::<u16>()
1982 }
1983
1984 #[inline(always)]
1985 fn inline_size(_context: fidl::encoding::Context) -> usize {
1986 std::mem::size_of::<u16>()
1987 }
1988
1989 #[inline(always)]
1990 fn encode_is_copy() -> bool {
1991 true
1992 }
1993
1994 #[inline(always)]
1995 fn decode_is_copy() -> bool {
1996 false
1997 }
1998 }
1999
2000 impl fidl::encoding::ValueTypeMarker for PermissionType {
2001 type Borrowed<'a> = Self;
2002 #[inline(always)]
2003 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2004 *value
2005 }
2006 }
2007
2008 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for PermissionType {
2009 #[inline]
2010 unsafe fn encode(
2011 self,
2012 encoder: &mut fidl::encoding::Encoder<'_, D>,
2013 offset: usize,
2014 _depth: fidl::encoding::Depth,
2015 ) -> fidl::Result<()> {
2016 encoder.debug_check_bounds::<Self>(offset);
2017 encoder.write_num(self.into_primitive(), offset);
2018 Ok(())
2019 }
2020 }
2021
2022 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PermissionType {
2023 #[inline(always)]
2024 fn new_empty() -> Self {
2025 Self::Microphone
2026 }
2027
2028 #[inline]
2029 unsafe fn decode(
2030 &mut self,
2031 decoder: &mut fidl::encoding::Decoder<'_, D>,
2032 offset: usize,
2033 _depth: fidl::encoding::Depth,
2034 ) -> fidl::Result<()> {
2035 decoder.debug_check_bounds::<Self>(offset);
2036 let prim = decoder.read_num::<u16>(offset);
2037
2038 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
2039 Ok(())
2040 }
2041 }
2042 unsafe impl fidl::encoding::TypeMarker for ReloadType {
2043 type Owned = Self;
2044
2045 #[inline(always)]
2046 fn inline_align(_context: fidl::encoding::Context) -> usize {
2047 std::mem::align_of::<u32>()
2048 }
2049
2050 #[inline(always)]
2051 fn inline_size(_context: fidl::encoding::Context) -> usize {
2052 std::mem::size_of::<u32>()
2053 }
2054
2055 #[inline(always)]
2056 fn encode_is_copy() -> bool {
2057 true
2058 }
2059
2060 #[inline(always)]
2061 fn decode_is_copy() -> bool {
2062 false
2063 }
2064 }
2065
2066 impl fidl::encoding::ValueTypeMarker for ReloadType {
2067 type Borrowed<'a> = Self;
2068 #[inline(always)]
2069 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2070 *value
2071 }
2072 }
2073
2074 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for ReloadType {
2075 #[inline]
2076 unsafe fn encode(
2077 self,
2078 encoder: &mut fidl::encoding::Encoder<'_, D>,
2079 offset: usize,
2080 _depth: fidl::encoding::Depth,
2081 ) -> fidl::Result<()> {
2082 encoder.debug_check_bounds::<Self>(offset);
2083 encoder.write_num(self.into_primitive(), offset);
2084 Ok(())
2085 }
2086 }
2087
2088 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ReloadType {
2089 #[inline(always)]
2090 fn new_empty() -> Self {
2091 Self::PartialCache
2092 }
2093
2094 #[inline]
2095 unsafe fn decode(
2096 &mut self,
2097 decoder: &mut fidl::encoding::Decoder<'_, D>,
2098 offset: usize,
2099 _depth: fidl::encoding::Depth,
2100 ) -> fidl::Result<()> {
2101 decoder.debug_check_bounds::<Self>(offset);
2102 let prim = decoder.read_num::<u32>(offset);
2103
2104 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
2105 Ok(())
2106 }
2107 }
2108 unsafe impl fidl::encoding::TypeMarker for UrlRequestAction {
2109 type Owned = Self;
2110
2111 #[inline(always)]
2112 fn inline_align(_context: fidl::encoding::Context) -> usize {
2113 std::mem::align_of::<i32>()
2114 }
2115
2116 #[inline(always)]
2117 fn inline_size(_context: fidl::encoding::Context) -> usize {
2118 std::mem::size_of::<i32>()
2119 }
2120
2121 #[inline(always)]
2122 fn encode_is_copy() -> bool {
2123 true
2124 }
2125
2126 #[inline(always)]
2127 fn decode_is_copy() -> bool {
2128 false
2129 }
2130 }
2131
2132 impl fidl::encoding::ValueTypeMarker for UrlRequestAction {
2133 type Borrowed<'a> = Self;
2134 #[inline(always)]
2135 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2136 *value
2137 }
2138 }
2139
2140 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
2141 for UrlRequestAction
2142 {
2143 #[inline]
2144 unsafe fn encode(
2145 self,
2146 encoder: &mut fidl::encoding::Encoder<'_, D>,
2147 offset: usize,
2148 _depth: fidl::encoding::Depth,
2149 ) -> fidl::Result<()> {
2150 encoder.debug_check_bounds::<Self>(offset);
2151 encoder.write_num(self.into_primitive(), offset);
2152 Ok(())
2153 }
2154 }
2155
2156 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for UrlRequestAction {
2157 #[inline(always)]
2158 fn new_empty() -> Self {
2159 Self::Allow
2160 }
2161
2162 #[inline]
2163 unsafe fn decode(
2164 &mut self,
2165 decoder: &mut fidl::encoding::Decoder<'_, D>,
2166 offset: usize,
2167 _depth: fidl::encoding::Depth,
2168 ) -> fidl::Result<()> {
2169 decoder.debug_check_bounds::<Self>(offset);
2170 let prim = decoder.read_num::<i32>(offset);
2171
2172 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
2173 Ok(())
2174 }
2175 }
2176
2177 impl fidl::encoding::ValueTypeMarker for ContextGetRemoteDebuggingPortResponse {
2178 type Borrowed<'a> = &'a Self;
2179 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2180 value
2181 }
2182 }
2183
2184 unsafe impl fidl::encoding::TypeMarker for ContextGetRemoteDebuggingPortResponse {
2185 type Owned = Self;
2186
2187 #[inline(always)]
2188 fn inline_align(_context: fidl::encoding::Context) -> usize {
2189 2
2190 }
2191
2192 #[inline(always)]
2193 fn inline_size(_context: fidl::encoding::Context) -> usize {
2194 2
2195 }
2196 #[inline(always)]
2197 fn encode_is_copy() -> bool {
2198 true
2199 }
2200
2201 #[inline(always)]
2202 fn decode_is_copy() -> bool {
2203 true
2204 }
2205 }
2206
2207 unsafe impl<D: fidl::encoding::ResourceDialect>
2208 fidl::encoding::Encode<ContextGetRemoteDebuggingPortResponse, D>
2209 for &ContextGetRemoteDebuggingPortResponse
2210 {
2211 #[inline]
2212 unsafe fn encode(
2213 self,
2214 encoder: &mut fidl::encoding::Encoder<'_, D>,
2215 offset: usize,
2216 _depth: fidl::encoding::Depth,
2217 ) -> fidl::Result<()> {
2218 encoder.debug_check_bounds::<ContextGetRemoteDebuggingPortResponse>(offset);
2219 unsafe {
2220 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2222 (buf_ptr as *mut ContextGetRemoteDebuggingPortResponse)
2223 .write_unaligned((self as *const ContextGetRemoteDebuggingPortResponse).read());
2224 }
2227 Ok(())
2228 }
2229 }
2230 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u16, D>>
2231 fidl::encoding::Encode<ContextGetRemoteDebuggingPortResponse, D> for (T0,)
2232 {
2233 #[inline]
2234 unsafe fn encode(
2235 self,
2236 encoder: &mut fidl::encoding::Encoder<'_, D>,
2237 offset: usize,
2238 depth: fidl::encoding::Depth,
2239 ) -> fidl::Result<()> {
2240 encoder.debug_check_bounds::<ContextGetRemoteDebuggingPortResponse>(offset);
2241 self.0.encode(encoder, offset + 0, depth)?;
2245 Ok(())
2246 }
2247 }
2248
2249 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2250 for ContextGetRemoteDebuggingPortResponse
2251 {
2252 #[inline(always)]
2253 fn new_empty() -> Self {
2254 Self { port: fidl::new_empty!(u16, D) }
2255 }
2256
2257 #[inline]
2258 unsafe fn decode(
2259 &mut self,
2260 decoder: &mut fidl::encoding::Decoder<'_, D>,
2261 offset: usize,
2262 _depth: fidl::encoding::Depth,
2263 ) -> fidl::Result<()> {
2264 decoder.debug_check_bounds::<Self>(offset);
2265 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2266 unsafe {
2269 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 2);
2270 }
2271 Ok(())
2272 }
2273 }
2274
2275 impl fidl::encoding::ValueTypeMarker for DevToolsPerContextListenerOnHttpPortOpenRequest {
2276 type Borrowed<'a> = &'a Self;
2277 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2278 value
2279 }
2280 }
2281
2282 unsafe impl fidl::encoding::TypeMarker for DevToolsPerContextListenerOnHttpPortOpenRequest {
2283 type Owned = Self;
2284
2285 #[inline(always)]
2286 fn inline_align(_context: fidl::encoding::Context) -> usize {
2287 2
2288 }
2289
2290 #[inline(always)]
2291 fn inline_size(_context: fidl::encoding::Context) -> usize {
2292 2
2293 }
2294 #[inline(always)]
2295 fn encode_is_copy() -> bool {
2296 true
2297 }
2298
2299 #[inline(always)]
2300 fn decode_is_copy() -> bool {
2301 true
2302 }
2303 }
2304
2305 unsafe impl<D: fidl::encoding::ResourceDialect>
2306 fidl::encoding::Encode<DevToolsPerContextListenerOnHttpPortOpenRequest, D>
2307 for &DevToolsPerContextListenerOnHttpPortOpenRequest
2308 {
2309 #[inline]
2310 unsafe fn encode(
2311 self,
2312 encoder: &mut fidl::encoding::Encoder<'_, D>,
2313 offset: usize,
2314 _depth: fidl::encoding::Depth,
2315 ) -> fidl::Result<()> {
2316 encoder.debug_check_bounds::<DevToolsPerContextListenerOnHttpPortOpenRequest>(offset);
2317 unsafe {
2318 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2320 (buf_ptr as *mut DevToolsPerContextListenerOnHttpPortOpenRequest).write_unaligned(
2321 (self as *const DevToolsPerContextListenerOnHttpPortOpenRequest).read(),
2322 );
2323 }
2326 Ok(())
2327 }
2328 }
2329 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u16, D>>
2330 fidl::encoding::Encode<DevToolsPerContextListenerOnHttpPortOpenRequest, D> for (T0,)
2331 {
2332 #[inline]
2333 unsafe fn encode(
2334 self,
2335 encoder: &mut fidl::encoding::Encoder<'_, D>,
2336 offset: usize,
2337 depth: fidl::encoding::Depth,
2338 ) -> fidl::Result<()> {
2339 encoder.debug_check_bounds::<DevToolsPerContextListenerOnHttpPortOpenRequest>(offset);
2340 self.0.encode(encoder, offset + 0, depth)?;
2344 Ok(())
2345 }
2346 }
2347
2348 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2349 for DevToolsPerContextListenerOnHttpPortOpenRequest
2350 {
2351 #[inline(always)]
2352 fn new_empty() -> Self {
2353 Self { port: fidl::new_empty!(u16, D) }
2354 }
2355
2356 #[inline]
2357 unsafe fn decode(
2358 &mut self,
2359 decoder: &mut fidl::encoding::Decoder<'_, D>,
2360 offset: usize,
2361 _depth: fidl::encoding::Depth,
2362 ) -> fidl::Result<()> {
2363 decoder.debug_check_bounds::<Self>(offset);
2364 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2365 unsafe {
2368 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 2);
2369 }
2370 Ok(())
2371 }
2372 }
2373
2374 impl fidl::encoding::ValueTypeMarker for FrameConfigureInputTypesRequest {
2375 type Borrowed<'a> = &'a Self;
2376 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2377 value
2378 }
2379 }
2380
2381 unsafe impl fidl::encoding::TypeMarker for FrameConfigureInputTypesRequest {
2382 type Owned = Self;
2383
2384 #[inline(always)]
2385 fn inline_align(_context: fidl::encoding::Context) -> usize {
2386 8
2387 }
2388
2389 #[inline(always)]
2390 fn inline_size(_context: fidl::encoding::Context) -> usize {
2391 16
2392 }
2393 }
2394
2395 unsafe impl<D: fidl::encoding::ResourceDialect>
2396 fidl::encoding::Encode<FrameConfigureInputTypesRequest, D>
2397 for &FrameConfigureInputTypesRequest
2398 {
2399 #[inline]
2400 unsafe fn encode(
2401 self,
2402 encoder: &mut fidl::encoding::Encoder<'_, D>,
2403 offset: usize,
2404 _depth: fidl::encoding::Depth,
2405 ) -> fidl::Result<()> {
2406 encoder.debug_check_bounds::<FrameConfigureInputTypesRequest>(offset);
2407 fidl::encoding::Encode::<FrameConfigureInputTypesRequest, D>::encode(
2409 (
2410 <InputTypes as fidl::encoding::ValueTypeMarker>::borrow(&self.types),
2411 <AllowInputState as fidl::encoding::ValueTypeMarker>::borrow(&self.allow),
2412 ),
2413 encoder,
2414 offset,
2415 _depth,
2416 )
2417 }
2418 }
2419 unsafe impl<
2420 D: fidl::encoding::ResourceDialect,
2421 T0: fidl::encoding::Encode<InputTypes, D>,
2422 T1: fidl::encoding::Encode<AllowInputState, D>,
2423 > fidl::encoding::Encode<FrameConfigureInputTypesRequest, D> for (T0, T1)
2424 {
2425 #[inline]
2426 unsafe fn encode(
2427 self,
2428 encoder: &mut fidl::encoding::Encoder<'_, D>,
2429 offset: usize,
2430 depth: fidl::encoding::Depth,
2431 ) -> fidl::Result<()> {
2432 encoder.debug_check_bounds::<FrameConfigureInputTypesRequest>(offset);
2433 unsafe {
2436 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
2437 (ptr as *mut u64).write_unaligned(0);
2438 }
2439 self.0.encode(encoder, offset + 0, depth)?;
2441 self.1.encode(encoder, offset + 8, depth)?;
2442 Ok(())
2443 }
2444 }
2445
2446 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2447 for FrameConfigureInputTypesRequest
2448 {
2449 #[inline(always)]
2450 fn new_empty() -> Self {
2451 Self {
2452 types: fidl::new_empty!(InputTypes, D),
2453 allow: fidl::new_empty!(AllowInputState, D),
2454 }
2455 }
2456
2457 #[inline]
2458 unsafe fn decode(
2459 &mut self,
2460 decoder: &mut fidl::encoding::Decoder<'_, D>,
2461 offset: usize,
2462 _depth: fidl::encoding::Depth,
2463 ) -> fidl::Result<()> {
2464 decoder.debug_check_bounds::<Self>(offset);
2465 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
2467 let padval = unsafe { (ptr as *const u64).read_unaligned() };
2468 let mask = 0xffffffff00000000u64;
2469 let maskedval = padval & mask;
2470 if maskedval != 0 {
2471 return Err(fidl::Error::NonZeroPadding {
2472 padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
2473 });
2474 }
2475 fidl::decode!(InputTypes, D, &mut self.types, decoder, offset + 0, _depth)?;
2476 fidl::decode!(AllowInputState, D, &mut self.allow, decoder, offset + 8, _depth)?;
2477 Ok(())
2478 }
2479 }
2480
2481 impl fidl::encoding::ValueTypeMarker for FrameForceContentDimensionsRequest {
2482 type Borrowed<'a> = &'a Self;
2483 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2484 value
2485 }
2486 }
2487
2488 unsafe impl fidl::encoding::TypeMarker for FrameForceContentDimensionsRequest {
2489 type Owned = Self;
2490
2491 #[inline(always)]
2492 fn inline_align(_context: fidl::encoding::Context) -> usize {
2493 8
2494 }
2495
2496 #[inline(always)]
2497 fn inline_size(_context: fidl::encoding::Context) -> usize {
2498 8
2499 }
2500 }
2501
2502 unsafe impl<D: fidl::encoding::ResourceDialect>
2503 fidl::encoding::Encode<FrameForceContentDimensionsRequest, D>
2504 for &FrameForceContentDimensionsRequest
2505 {
2506 #[inline]
2507 unsafe fn encode(
2508 self,
2509 encoder: &mut fidl::encoding::Encoder<'_, D>,
2510 offset: usize,
2511 _depth: fidl::encoding::Depth,
2512 ) -> fidl::Result<()> {
2513 encoder.debug_check_bounds::<FrameForceContentDimensionsRequest>(offset);
2514 fidl::encoding::Encode::<FrameForceContentDimensionsRequest, D>::encode(
2516 (
2517 <fidl::encoding::Boxed<fidl_fuchsia_ui_gfx::Vec2> as fidl::encoding::ValueTypeMarker>::borrow(&self.web_dips),
2518 ),
2519 encoder, offset, _depth
2520 )
2521 }
2522 }
2523 unsafe impl<
2524 D: fidl::encoding::ResourceDialect,
2525 T0: fidl::encoding::Encode<fidl::encoding::Boxed<fidl_fuchsia_ui_gfx::Vec2>, D>,
2526 > fidl::encoding::Encode<FrameForceContentDimensionsRequest, D> for (T0,)
2527 {
2528 #[inline]
2529 unsafe fn encode(
2530 self,
2531 encoder: &mut fidl::encoding::Encoder<'_, D>,
2532 offset: usize,
2533 depth: fidl::encoding::Depth,
2534 ) -> fidl::Result<()> {
2535 encoder.debug_check_bounds::<FrameForceContentDimensionsRequest>(offset);
2536 self.0.encode(encoder, offset + 0, depth)?;
2540 Ok(())
2541 }
2542 }
2543
2544 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2545 for FrameForceContentDimensionsRequest
2546 {
2547 #[inline(always)]
2548 fn new_empty() -> Self {
2549 Self { web_dips: fidl::new_empty!(fidl::encoding::Boxed<fidl_fuchsia_ui_gfx::Vec2>, D) }
2550 }
2551
2552 #[inline]
2553 unsafe fn decode(
2554 &mut self,
2555 decoder: &mut fidl::encoding::Decoder<'_, D>,
2556 offset: usize,
2557 _depth: fidl::encoding::Depth,
2558 ) -> fidl::Result<()> {
2559 decoder.debug_check_bounds::<Self>(offset);
2560 fidl::decode!(
2562 fidl::encoding::Boxed<fidl_fuchsia_ui_gfx::Vec2>,
2563 D,
2564 &mut self.web_dips,
2565 decoder,
2566 offset + 0,
2567 _depth
2568 )?;
2569 Ok(())
2570 }
2571 }
2572
2573 impl fidl::encoding::ValueTypeMarker for FrameGetPrivateMemorySizeResponse {
2574 type Borrowed<'a> = &'a Self;
2575 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2576 value
2577 }
2578 }
2579
2580 unsafe impl fidl::encoding::TypeMarker for FrameGetPrivateMemorySizeResponse {
2581 type Owned = Self;
2582
2583 #[inline(always)]
2584 fn inline_align(_context: fidl::encoding::Context) -> usize {
2585 8
2586 }
2587
2588 #[inline(always)]
2589 fn inline_size(_context: fidl::encoding::Context) -> usize {
2590 8
2591 }
2592 #[inline(always)]
2593 fn encode_is_copy() -> bool {
2594 true
2595 }
2596
2597 #[inline(always)]
2598 fn decode_is_copy() -> bool {
2599 true
2600 }
2601 }
2602
2603 unsafe impl<D: fidl::encoding::ResourceDialect>
2604 fidl::encoding::Encode<FrameGetPrivateMemorySizeResponse, D>
2605 for &FrameGetPrivateMemorySizeResponse
2606 {
2607 #[inline]
2608 unsafe fn encode(
2609 self,
2610 encoder: &mut fidl::encoding::Encoder<'_, D>,
2611 offset: usize,
2612 _depth: fidl::encoding::Depth,
2613 ) -> fidl::Result<()> {
2614 encoder.debug_check_bounds::<FrameGetPrivateMemorySizeResponse>(offset);
2615 unsafe {
2616 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2618 (buf_ptr as *mut FrameGetPrivateMemorySizeResponse)
2619 .write_unaligned((self as *const FrameGetPrivateMemorySizeResponse).read());
2620 }
2623 Ok(())
2624 }
2625 }
2626 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
2627 fidl::encoding::Encode<FrameGetPrivateMemorySizeResponse, D> for (T0,)
2628 {
2629 #[inline]
2630 unsafe fn encode(
2631 self,
2632 encoder: &mut fidl::encoding::Encoder<'_, D>,
2633 offset: usize,
2634 depth: fidl::encoding::Depth,
2635 ) -> fidl::Result<()> {
2636 encoder.debug_check_bounds::<FrameGetPrivateMemorySizeResponse>(offset);
2637 self.0.encode(encoder, offset + 0, depth)?;
2641 Ok(())
2642 }
2643 }
2644
2645 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2646 for FrameGetPrivateMemorySizeResponse
2647 {
2648 #[inline(always)]
2649 fn new_empty() -> Self {
2650 Self { size_bytes: fidl::new_empty!(u64, D) }
2651 }
2652
2653 #[inline]
2654 unsafe fn decode(
2655 &mut self,
2656 decoder: &mut fidl::encoding::Decoder<'_, D>,
2657 offset: usize,
2658 _depth: fidl::encoding::Depth,
2659 ) -> fidl::Result<()> {
2660 decoder.debug_check_bounds::<Self>(offset);
2661 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2662 unsafe {
2665 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
2666 }
2667 Ok(())
2668 }
2669 }
2670
2671 impl fidl::encoding::ValueTypeMarker for FrameRemoveBeforeLoadJavaScriptRequest {
2672 type Borrowed<'a> = &'a Self;
2673 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2674 value
2675 }
2676 }
2677
2678 unsafe impl fidl::encoding::TypeMarker for FrameRemoveBeforeLoadJavaScriptRequest {
2679 type Owned = Self;
2680
2681 #[inline(always)]
2682 fn inline_align(_context: fidl::encoding::Context) -> usize {
2683 8
2684 }
2685
2686 #[inline(always)]
2687 fn inline_size(_context: fidl::encoding::Context) -> usize {
2688 8
2689 }
2690 #[inline(always)]
2691 fn encode_is_copy() -> bool {
2692 true
2693 }
2694
2695 #[inline(always)]
2696 fn decode_is_copy() -> bool {
2697 true
2698 }
2699 }
2700
2701 unsafe impl<D: fidl::encoding::ResourceDialect>
2702 fidl::encoding::Encode<FrameRemoveBeforeLoadJavaScriptRequest, D>
2703 for &FrameRemoveBeforeLoadJavaScriptRequest
2704 {
2705 #[inline]
2706 unsafe fn encode(
2707 self,
2708 encoder: &mut fidl::encoding::Encoder<'_, D>,
2709 offset: usize,
2710 _depth: fidl::encoding::Depth,
2711 ) -> fidl::Result<()> {
2712 encoder.debug_check_bounds::<FrameRemoveBeforeLoadJavaScriptRequest>(offset);
2713 unsafe {
2714 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2716 (buf_ptr as *mut FrameRemoveBeforeLoadJavaScriptRequest).write_unaligned(
2717 (self as *const FrameRemoveBeforeLoadJavaScriptRequest).read(),
2718 );
2719 }
2722 Ok(())
2723 }
2724 }
2725 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
2726 fidl::encoding::Encode<FrameRemoveBeforeLoadJavaScriptRequest, D> for (T0,)
2727 {
2728 #[inline]
2729 unsafe fn encode(
2730 self,
2731 encoder: &mut fidl::encoding::Encoder<'_, D>,
2732 offset: usize,
2733 depth: fidl::encoding::Depth,
2734 ) -> fidl::Result<()> {
2735 encoder.debug_check_bounds::<FrameRemoveBeforeLoadJavaScriptRequest>(offset);
2736 self.0.encode(encoder, offset + 0, depth)?;
2740 Ok(())
2741 }
2742 }
2743
2744 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2745 for FrameRemoveBeforeLoadJavaScriptRequest
2746 {
2747 #[inline(always)]
2748 fn new_empty() -> Self {
2749 Self { id: fidl::new_empty!(u64, D) }
2750 }
2751
2752 #[inline]
2753 unsafe fn decode(
2754 &mut self,
2755 decoder: &mut fidl::encoding::Decoder<'_, D>,
2756 offset: usize,
2757 _depth: fidl::encoding::Depth,
2758 ) -> fidl::Result<()> {
2759 decoder.debug_check_bounds::<Self>(offset);
2760 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2761 unsafe {
2764 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
2765 }
2766 Ok(())
2767 }
2768 }
2769
2770 impl fidl::encoding::ValueTypeMarker for FrameSetBlockMediaLoadingRequest {
2771 type Borrowed<'a> = &'a Self;
2772 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2773 value
2774 }
2775 }
2776
2777 unsafe impl fidl::encoding::TypeMarker for FrameSetBlockMediaLoadingRequest {
2778 type Owned = Self;
2779
2780 #[inline(always)]
2781 fn inline_align(_context: fidl::encoding::Context) -> usize {
2782 1
2783 }
2784
2785 #[inline(always)]
2786 fn inline_size(_context: fidl::encoding::Context) -> usize {
2787 1
2788 }
2789 }
2790
2791 unsafe impl<D: fidl::encoding::ResourceDialect>
2792 fidl::encoding::Encode<FrameSetBlockMediaLoadingRequest, D>
2793 for &FrameSetBlockMediaLoadingRequest
2794 {
2795 #[inline]
2796 unsafe fn encode(
2797 self,
2798 encoder: &mut fidl::encoding::Encoder<'_, D>,
2799 offset: usize,
2800 _depth: fidl::encoding::Depth,
2801 ) -> fidl::Result<()> {
2802 encoder.debug_check_bounds::<FrameSetBlockMediaLoadingRequest>(offset);
2803 fidl::encoding::Encode::<FrameSetBlockMediaLoadingRequest, D>::encode(
2805 (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.blocked),),
2806 encoder,
2807 offset,
2808 _depth,
2809 )
2810 }
2811 }
2812 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
2813 fidl::encoding::Encode<FrameSetBlockMediaLoadingRequest, D> for (T0,)
2814 {
2815 #[inline]
2816 unsafe fn encode(
2817 self,
2818 encoder: &mut fidl::encoding::Encoder<'_, D>,
2819 offset: usize,
2820 depth: fidl::encoding::Depth,
2821 ) -> fidl::Result<()> {
2822 encoder.debug_check_bounds::<FrameSetBlockMediaLoadingRequest>(offset);
2823 self.0.encode(encoder, offset + 0, depth)?;
2827 Ok(())
2828 }
2829 }
2830
2831 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2832 for FrameSetBlockMediaLoadingRequest
2833 {
2834 #[inline(always)]
2835 fn new_empty() -> Self {
2836 Self { blocked: fidl::new_empty!(bool, D) }
2837 }
2838
2839 #[inline]
2840 unsafe fn decode(
2841 &mut self,
2842 decoder: &mut fidl::encoding::Decoder<'_, D>,
2843 offset: usize,
2844 _depth: fidl::encoding::Depth,
2845 ) -> fidl::Result<()> {
2846 decoder.debug_check_bounds::<Self>(offset);
2847 fidl::decode!(bool, D, &mut self.blocked, decoder, offset + 0, _depth)?;
2849 Ok(())
2850 }
2851 }
2852
2853 impl fidl::encoding::ValueTypeMarker for FrameSetContentAreaSettingsRequest {
2854 type Borrowed<'a> = &'a Self;
2855 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2856 value
2857 }
2858 }
2859
2860 unsafe impl fidl::encoding::TypeMarker for FrameSetContentAreaSettingsRequest {
2861 type Owned = Self;
2862
2863 #[inline(always)]
2864 fn inline_align(_context: fidl::encoding::Context) -> usize {
2865 8
2866 }
2867
2868 #[inline(always)]
2869 fn inline_size(_context: fidl::encoding::Context) -> usize {
2870 16
2871 }
2872 }
2873
2874 unsafe impl<D: fidl::encoding::ResourceDialect>
2875 fidl::encoding::Encode<FrameSetContentAreaSettingsRequest, D>
2876 for &FrameSetContentAreaSettingsRequest
2877 {
2878 #[inline]
2879 unsafe fn encode(
2880 self,
2881 encoder: &mut fidl::encoding::Encoder<'_, D>,
2882 offset: usize,
2883 _depth: fidl::encoding::Depth,
2884 ) -> fidl::Result<()> {
2885 encoder.debug_check_bounds::<FrameSetContentAreaSettingsRequest>(offset);
2886 fidl::encoding::Encode::<FrameSetContentAreaSettingsRequest, D>::encode(
2888 (<ContentAreaSettings as fidl::encoding::ValueTypeMarker>::borrow(&self.settings),),
2889 encoder,
2890 offset,
2891 _depth,
2892 )
2893 }
2894 }
2895 unsafe impl<
2896 D: fidl::encoding::ResourceDialect,
2897 T0: fidl::encoding::Encode<ContentAreaSettings, D>,
2898 > fidl::encoding::Encode<FrameSetContentAreaSettingsRequest, D> for (T0,)
2899 {
2900 #[inline]
2901 unsafe fn encode(
2902 self,
2903 encoder: &mut fidl::encoding::Encoder<'_, D>,
2904 offset: usize,
2905 depth: fidl::encoding::Depth,
2906 ) -> fidl::Result<()> {
2907 encoder.debug_check_bounds::<FrameSetContentAreaSettingsRequest>(offset);
2908 self.0.encode(encoder, offset + 0, depth)?;
2912 Ok(())
2913 }
2914 }
2915
2916 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2917 for FrameSetContentAreaSettingsRequest
2918 {
2919 #[inline(always)]
2920 fn new_empty() -> Self {
2921 Self { settings: fidl::new_empty!(ContentAreaSettings, D) }
2922 }
2923
2924 #[inline]
2925 unsafe fn decode(
2926 &mut self,
2927 decoder: &mut fidl::encoding::Decoder<'_, D>,
2928 offset: usize,
2929 _depth: fidl::encoding::Depth,
2930 ) -> fidl::Result<()> {
2931 decoder.debug_check_bounds::<Self>(offset);
2932 fidl::decode!(ContentAreaSettings, D, &mut self.settings, decoder, offset + 0, _depth)?;
2934 Ok(())
2935 }
2936 }
2937
2938 impl fidl::encoding::ValueTypeMarker for FrameSetJavaScriptLogLevelRequest {
2939 type Borrowed<'a> = &'a Self;
2940 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2941 value
2942 }
2943 }
2944
2945 unsafe impl fidl::encoding::TypeMarker for FrameSetJavaScriptLogLevelRequest {
2946 type Owned = Self;
2947
2948 #[inline(always)]
2949 fn inline_align(_context: fidl::encoding::Context) -> usize {
2950 4
2951 }
2952
2953 #[inline(always)]
2954 fn inline_size(_context: fidl::encoding::Context) -> usize {
2955 4
2956 }
2957 }
2958
2959 unsafe impl<D: fidl::encoding::ResourceDialect>
2960 fidl::encoding::Encode<FrameSetJavaScriptLogLevelRequest, D>
2961 for &FrameSetJavaScriptLogLevelRequest
2962 {
2963 #[inline]
2964 unsafe fn encode(
2965 self,
2966 encoder: &mut fidl::encoding::Encoder<'_, D>,
2967 offset: usize,
2968 _depth: fidl::encoding::Depth,
2969 ) -> fidl::Result<()> {
2970 encoder.debug_check_bounds::<FrameSetJavaScriptLogLevelRequest>(offset);
2971 fidl::encoding::Encode::<FrameSetJavaScriptLogLevelRequest, D>::encode(
2973 (<ConsoleLogLevel as fidl::encoding::ValueTypeMarker>::borrow(&self.level),),
2974 encoder,
2975 offset,
2976 _depth,
2977 )
2978 }
2979 }
2980 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<ConsoleLogLevel, D>>
2981 fidl::encoding::Encode<FrameSetJavaScriptLogLevelRequest, D> for (T0,)
2982 {
2983 #[inline]
2984 unsafe fn encode(
2985 self,
2986 encoder: &mut fidl::encoding::Encoder<'_, D>,
2987 offset: usize,
2988 depth: fidl::encoding::Depth,
2989 ) -> fidl::Result<()> {
2990 encoder.debug_check_bounds::<FrameSetJavaScriptLogLevelRequest>(offset);
2991 self.0.encode(encoder, offset + 0, depth)?;
2995 Ok(())
2996 }
2997 }
2998
2999 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3000 for FrameSetJavaScriptLogLevelRequest
3001 {
3002 #[inline(always)]
3003 fn new_empty() -> Self {
3004 Self { level: fidl::new_empty!(ConsoleLogLevel, D) }
3005 }
3006
3007 #[inline]
3008 unsafe fn decode(
3009 &mut self,
3010 decoder: &mut fidl::encoding::Decoder<'_, D>,
3011 offset: usize,
3012 _depth: fidl::encoding::Depth,
3013 ) -> fidl::Result<()> {
3014 decoder.debug_check_bounds::<Self>(offset);
3015 fidl::decode!(ConsoleLogLevel, D, &mut self.level, decoder, offset + 0, _depth)?;
3017 Ok(())
3018 }
3019 }
3020
3021 impl fidl::encoding::ValueTypeMarker for FrameSetMediaSettingsRequest {
3022 type Borrowed<'a> = &'a Self;
3023 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3024 value
3025 }
3026 }
3027
3028 unsafe impl fidl::encoding::TypeMarker for FrameSetMediaSettingsRequest {
3029 type Owned = Self;
3030
3031 #[inline(always)]
3032 fn inline_align(_context: fidl::encoding::Context) -> usize {
3033 8
3034 }
3035
3036 #[inline(always)]
3037 fn inline_size(_context: fidl::encoding::Context) -> usize {
3038 16
3039 }
3040 }
3041
3042 unsafe impl<D: fidl::encoding::ResourceDialect>
3043 fidl::encoding::Encode<FrameSetMediaSettingsRequest, D> for &FrameSetMediaSettingsRequest
3044 {
3045 #[inline]
3046 unsafe fn encode(
3047 self,
3048 encoder: &mut fidl::encoding::Encoder<'_, D>,
3049 offset: usize,
3050 _depth: fidl::encoding::Depth,
3051 ) -> fidl::Result<()> {
3052 encoder.debug_check_bounds::<FrameSetMediaSettingsRequest>(offset);
3053 fidl::encoding::Encode::<FrameSetMediaSettingsRequest, D>::encode(
3055 (<FrameMediaSettings as fidl::encoding::ValueTypeMarker>::borrow(&self.settings),),
3056 encoder,
3057 offset,
3058 _depth,
3059 )
3060 }
3061 }
3062 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<FrameMediaSettings, D>>
3063 fidl::encoding::Encode<FrameSetMediaSettingsRequest, D> for (T0,)
3064 {
3065 #[inline]
3066 unsafe fn encode(
3067 self,
3068 encoder: &mut fidl::encoding::Encoder<'_, D>,
3069 offset: usize,
3070 depth: fidl::encoding::Depth,
3071 ) -> fidl::Result<()> {
3072 encoder.debug_check_bounds::<FrameSetMediaSettingsRequest>(offset);
3073 self.0.encode(encoder, offset + 0, depth)?;
3077 Ok(())
3078 }
3079 }
3080
3081 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3082 for FrameSetMediaSettingsRequest
3083 {
3084 #[inline(always)]
3085 fn new_empty() -> Self {
3086 Self { settings: fidl::new_empty!(FrameMediaSettings, D) }
3087 }
3088
3089 #[inline]
3090 unsafe fn decode(
3091 &mut self,
3092 decoder: &mut fidl::encoding::Decoder<'_, D>,
3093 offset: usize,
3094 _depth: fidl::encoding::Depth,
3095 ) -> fidl::Result<()> {
3096 decoder.debug_check_bounds::<Self>(offset);
3097 fidl::decode!(FrameMediaSettings, D, &mut self.settings, decoder, offset + 0, _depth)?;
3099 Ok(())
3100 }
3101 }
3102
3103 impl fidl::encoding::ValueTypeMarker for FrameSetPermissionStateRequest {
3104 type Borrowed<'a> = &'a Self;
3105 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3106 value
3107 }
3108 }
3109
3110 unsafe impl fidl::encoding::TypeMarker for FrameSetPermissionStateRequest {
3111 type Owned = Self;
3112
3113 #[inline(always)]
3114 fn inline_align(_context: fidl::encoding::Context) -> usize {
3115 8
3116 }
3117
3118 #[inline(always)]
3119 fn inline_size(_context: fidl::encoding::Context) -> usize {
3120 40
3121 }
3122 }
3123
3124 unsafe impl<D: fidl::encoding::ResourceDialect>
3125 fidl::encoding::Encode<FrameSetPermissionStateRequest, D>
3126 for &FrameSetPermissionStateRequest
3127 {
3128 #[inline]
3129 unsafe fn encode(
3130 self,
3131 encoder: &mut fidl::encoding::Encoder<'_, D>,
3132 offset: usize,
3133 _depth: fidl::encoding::Depth,
3134 ) -> fidl::Result<()> {
3135 encoder.debug_check_bounds::<FrameSetPermissionStateRequest>(offset);
3136 fidl::encoding::Encode::<FrameSetPermissionStateRequest, D>::encode(
3138 (
3139 <PermissionDescriptor as fidl::encoding::ValueTypeMarker>::borrow(&self.permission),
3140 <fidl::encoding::BoundedString<65536> as fidl::encoding::ValueTypeMarker>::borrow(&self.web_origin),
3141 <PermissionState as fidl::encoding::ValueTypeMarker>::borrow(&self.state),
3142 ),
3143 encoder, offset, _depth
3144 )
3145 }
3146 }
3147 unsafe impl<
3148 D: fidl::encoding::ResourceDialect,
3149 T0: fidl::encoding::Encode<PermissionDescriptor, D>,
3150 T1: fidl::encoding::Encode<fidl::encoding::BoundedString<65536>, D>,
3151 T2: fidl::encoding::Encode<PermissionState, D>,
3152 > fidl::encoding::Encode<FrameSetPermissionStateRequest, D> for (T0, T1, T2)
3153 {
3154 #[inline]
3155 unsafe fn encode(
3156 self,
3157 encoder: &mut fidl::encoding::Encoder<'_, D>,
3158 offset: usize,
3159 depth: fidl::encoding::Depth,
3160 ) -> fidl::Result<()> {
3161 encoder.debug_check_bounds::<FrameSetPermissionStateRequest>(offset);
3162 unsafe {
3165 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
3166 (ptr as *mut u64).write_unaligned(0);
3167 }
3168 self.0.encode(encoder, offset + 0, depth)?;
3170 self.1.encode(encoder, offset + 16, depth)?;
3171 self.2.encode(encoder, offset + 32, depth)?;
3172 Ok(())
3173 }
3174 }
3175
3176 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3177 for FrameSetPermissionStateRequest
3178 {
3179 #[inline(always)]
3180 fn new_empty() -> Self {
3181 Self {
3182 permission: fidl::new_empty!(PermissionDescriptor, D),
3183 web_origin: fidl::new_empty!(fidl::encoding::BoundedString<65536>, D),
3184 state: fidl::new_empty!(PermissionState, D),
3185 }
3186 }
3187
3188 #[inline]
3189 unsafe fn decode(
3190 &mut self,
3191 decoder: &mut fidl::encoding::Decoder<'_, D>,
3192 offset: usize,
3193 _depth: fidl::encoding::Depth,
3194 ) -> fidl::Result<()> {
3195 decoder.debug_check_bounds::<Self>(offset);
3196 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
3198 let padval = unsafe { (ptr as *const u64).read_unaligned() };
3199 let mask = 0xffffffffffffff00u64;
3200 let maskedval = padval & mask;
3201 if maskedval != 0 {
3202 return Err(fidl::Error::NonZeroPadding {
3203 padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
3204 });
3205 }
3206 fidl::decode!(
3207 PermissionDescriptor,
3208 D,
3209 &mut self.permission,
3210 decoder,
3211 offset + 0,
3212 _depth
3213 )?;
3214 fidl::decode!(
3215 fidl::encoding::BoundedString<65536>,
3216 D,
3217 &mut self.web_origin,
3218 decoder,
3219 offset + 16,
3220 _depth
3221 )?;
3222 fidl::decode!(PermissionState, D, &mut self.state, decoder, offset + 32, _depth)?;
3223 Ok(())
3224 }
3225 }
3226
3227 impl fidl::encoding::ValueTypeMarker for FrameSetUrlRequestRewriteRulesRequest {
3228 type Borrowed<'a> = &'a Self;
3229 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3230 value
3231 }
3232 }
3233
3234 unsafe impl fidl::encoding::TypeMarker for FrameSetUrlRequestRewriteRulesRequest {
3235 type Owned = Self;
3236
3237 #[inline(always)]
3238 fn inline_align(_context: fidl::encoding::Context) -> usize {
3239 8
3240 }
3241
3242 #[inline(always)]
3243 fn inline_size(_context: fidl::encoding::Context) -> usize {
3244 16
3245 }
3246 }
3247
3248 unsafe impl<D: fidl::encoding::ResourceDialect>
3249 fidl::encoding::Encode<FrameSetUrlRequestRewriteRulesRequest, D>
3250 for &FrameSetUrlRequestRewriteRulesRequest
3251 {
3252 #[inline]
3253 unsafe fn encode(
3254 self,
3255 encoder: &mut fidl::encoding::Encoder<'_, D>,
3256 offset: usize,
3257 _depth: fidl::encoding::Depth,
3258 ) -> fidl::Result<()> {
3259 encoder.debug_check_bounds::<FrameSetUrlRequestRewriteRulesRequest>(offset);
3260 fidl::encoding::Encode::<FrameSetUrlRequestRewriteRulesRequest, D>::encode(
3262 (
3263 <fidl::encoding::Vector<UrlRequestRewriteRule, 4096> as fidl::encoding::ValueTypeMarker>::borrow(&self.rules),
3264 ),
3265 encoder, offset, _depth
3266 )
3267 }
3268 }
3269 unsafe impl<
3270 D: fidl::encoding::ResourceDialect,
3271 T0: fidl::encoding::Encode<fidl::encoding::Vector<UrlRequestRewriteRule, 4096>, D>,
3272 > fidl::encoding::Encode<FrameSetUrlRequestRewriteRulesRequest, D> for (T0,)
3273 {
3274 #[inline]
3275 unsafe fn encode(
3276 self,
3277 encoder: &mut fidl::encoding::Encoder<'_, D>,
3278 offset: usize,
3279 depth: fidl::encoding::Depth,
3280 ) -> fidl::Result<()> {
3281 encoder.debug_check_bounds::<FrameSetUrlRequestRewriteRulesRequest>(offset);
3282 self.0.encode(encoder, offset + 0, depth)?;
3286 Ok(())
3287 }
3288 }
3289
3290 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3291 for FrameSetUrlRequestRewriteRulesRequest
3292 {
3293 #[inline(always)]
3294 fn new_empty() -> Self {
3295 Self { rules: fidl::new_empty!(fidl::encoding::Vector<UrlRequestRewriteRule, 4096>, D) }
3296 }
3297
3298 #[inline]
3299 unsafe fn decode(
3300 &mut self,
3301 decoder: &mut fidl::encoding::Decoder<'_, D>,
3302 offset: usize,
3303 _depth: fidl::encoding::Depth,
3304 ) -> fidl::Result<()> {
3305 decoder.debug_check_bounds::<Self>(offset);
3306 fidl::decode!(fidl::encoding::Vector<UrlRequestRewriteRule, 4096>, D, &mut self.rules, decoder, offset + 0, _depth)?;
3308 Ok(())
3309 }
3310 }
3311
3312 impl fidl::encoding::ValueTypeMarker for NavigationControllerReloadRequest {
3313 type Borrowed<'a> = &'a Self;
3314 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3315 value
3316 }
3317 }
3318
3319 unsafe impl fidl::encoding::TypeMarker for NavigationControllerReloadRequest {
3320 type Owned = Self;
3321
3322 #[inline(always)]
3323 fn inline_align(_context: fidl::encoding::Context) -> usize {
3324 4
3325 }
3326
3327 #[inline(always)]
3328 fn inline_size(_context: fidl::encoding::Context) -> usize {
3329 4
3330 }
3331 }
3332
3333 unsafe impl<D: fidl::encoding::ResourceDialect>
3334 fidl::encoding::Encode<NavigationControllerReloadRequest, D>
3335 for &NavigationControllerReloadRequest
3336 {
3337 #[inline]
3338 unsafe fn encode(
3339 self,
3340 encoder: &mut fidl::encoding::Encoder<'_, D>,
3341 offset: usize,
3342 _depth: fidl::encoding::Depth,
3343 ) -> fidl::Result<()> {
3344 encoder.debug_check_bounds::<NavigationControllerReloadRequest>(offset);
3345 fidl::encoding::Encode::<NavigationControllerReloadRequest, D>::encode(
3347 (<ReloadType as fidl::encoding::ValueTypeMarker>::borrow(&self.type_),),
3348 encoder,
3349 offset,
3350 _depth,
3351 )
3352 }
3353 }
3354 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<ReloadType, D>>
3355 fidl::encoding::Encode<NavigationControllerReloadRequest, D> for (T0,)
3356 {
3357 #[inline]
3358 unsafe fn encode(
3359 self,
3360 encoder: &mut fidl::encoding::Encoder<'_, D>,
3361 offset: usize,
3362 depth: fidl::encoding::Depth,
3363 ) -> fidl::Result<()> {
3364 encoder.debug_check_bounds::<NavigationControllerReloadRequest>(offset);
3365 self.0.encode(encoder, offset + 0, depth)?;
3369 Ok(())
3370 }
3371 }
3372
3373 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3374 for NavigationControllerReloadRequest
3375 {
3376 #[inline(always)]
3377 fn new_empty() -> Self {
3378 Self { type_: fidl::new_empty!(ReloadType, D) }
3379 }
3380
3381 #[inline]
3382 unsafe fn decode(
3383 &mut self,
3384 decoder: &mut fidl::encoding::Decoder<'_, D>,
3385 offset: usize,
3386 _depth: fidl::encoding::Depth,
3387 ) -> fidl::Result<()> {
3388 decoder.debug_check_bounds::<Self>(offset);
3389 fidl::decode!(ReloadType, D, &mut self.type_, decoder, offset + 0, _depth)?;
3391 Ok(())
3392 }
3393 }
3394
3395 impl fidl::encoding::ValueTypeMarker
3396 for NavigationPolicyProviderEvaluateRequestedNavigationRequest
3397 {
3398 type Borrowed<'a> = &'a Self;
3399 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3400 value
3401 }
3402 }
3403
3404 unsafe impl fidl::encoding::TypeMarker
3405 for NavigationPolicyProviderEvaluateRequestedNavigationRequest
3406 {
3407 type Owned = Self;
3408
3409 #[inline(always)]
3410 fn inline_align(_context: fidl::encoding::Context) -> usize {
3411 8
3412 }
3413
3414 #[inline(always)]
3415 fn inline_size(_context: fidl::encoding::Context) -> usize {
3416 16
3417 }
3418 }
3419
3420 unsafe impl<D: fidl::encoding::ResourceDialect>
3421 fidl::encoding::Encode<NavigationPolicyProviderEvaluateRequestedNavigationRequest, D>
3422 for &NavigationPolicyProviderEvaluateRequestedNavigationRequest
3423 {
3424 #[inline]
3425 unsafe fn encode(
3426 self,
3427 encoder: &mut fidl::encoding::Encoder<'_, D>,
3428 offset: usize,
3429 _depth: fidl::encoding::Depth,
3430 ) -> fidl::Result<()> {
3431 encoder
3432 .debug_check_bounds::<NavigationPolicyProviderEvaluateRequestedNavigationRequest>(
3433 offset,
3434 );
3435 fidl::encoding::Encode::<NavigationPolicyProviderEvaluateRequestedNavigationRequest, D>::encode(
3437 (
3438 <RequestedNavigation as fidl::encoding::ValueTypeMarker>::borrow(&self.requested_navigation),
3439 ),
3440 encoder, offset, _depth
3441 )
3442 }
3443 }
3444 unsafe impl<
3445 D: fidl::encoding::ResourceDialect,
3446 T0: fidl::encoding::Encode<RequestedNavigation, D>,
3447 > fidl::encoding::Encode<NavigationPolicyProviderEvaluateRequestedNavigationRequest, D>
3448 for (T0,)
3449 {
3450 #[inline]
3451 unsafe fn encode(
3452 self,
3453 encoder: &mut fidl::encoding::Encoder<'_, D>,
3454 offset: usize,
3455 depth: fidl::encoding::Depth,
3456 ) -> fidl::Result<()> {
3457 encoder
3458 .debug_check_bounds::<NavigationPolicyProviderEvaluateRequestedNavigationRequest>(
3459 offset,
3460 );
3461 self.0.encode(encoder, offset + 0, depth)?;
3465 Ok(())
3466 }
3467 }
3468
3469 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3470 for NavigationPolicyProviderEvaluateRequestedNavigationRequest
3471 {
3472 #[inline(always)]
3473 fn new_empty() -> Self {
3474 Self { requested_navigation: fidl::new_empty!(RequestedNavigation, D) }
3475 }
3476
3477 #[inline]
3478 unsafe fn decode(
3479 &mut self,
3480 decoder: &mut fidl::encoding::Decoder<'_, D>,
3481 offset: usize,
3482 _depth: fidl::encoding::Depth,
3483 ) -> fidl::Result<()> {
3484 decoder.debug_check_bounds::<Self>(offset);
3485 fidl::decode!(
3487 RequestedNavigation,
3488 D,
3489 &mut self.requested_navigation,
3490 decoder,
3491 offset + 0,
3492 _depth
3493 )?;
3494 Ok(())
3495 }
3496 }
3497
3498 impl fidl::encoding::ValueTypeMarker for NoArgumentsAction {
3499 type Borrowed<'a> = &'a Self;
3500 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3501 value
3502 }
3503 }
3504
3505 unsafe impl fidl::encoding::TypeMarker for NoArgumentsAction {
3506 type Owned = Self;
3507
3508 #[inline(always)]
3509 fn inline_align(_context: fidl::encoding::Context) -> usize {
3510 1
3511 }
3512
3513 #[inline(always)]
3514 fn inline_size(_context: fidl::encoding::Context) -> usize {
3515 1
3516 }
3517 }
3518
3519 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<NoArgumentsAction, D>
3520 for &NoArgumentsAction
3521 {
3522 #[inline]
3523 unsafe fn encode(
3524 self,
3525 encoder: &mut fidl::encoding::Encoder<'_, D>,
3526 offset: usize,
3527 _depth: fidl::encoding::Depth,
3528 ) -> fidl::Result<()> {
3529 encoder.debug_check_bounds::<NoArgumentsAction>(offset);
3530 encoder.write_num(0u8, offset);
3531 Ok(())
3532 }
3533 }
3534
3535 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for NoArgumentsAction {
3536 #[inline(always)]
3537 fn new_empty() -> Self {
3538 Self
3539 }
3540
3541 #[inline]
3542 unsafe fn decode(
3543 &mut self,
3544 decoder: &mut fidl::encoding::Decoder<'_, D>,
3545 offset: usize,
3546 _depth: fidl::encoding::Depth,
3547 ) -> fidl::Result<()> {
3548 decoder.debug_check_bounds::<Self>(offset);
3549 match decoder.read_num::<u8>(offset) {
3550 0 => Ok(()),
3551 _ => Err(fidl::Error::Invalid),
3552 }
3553 }
3554 }
3555
3556 impl ContentAreaSettings {
3557 #[inline(always)]
3558 fn max_ordinal_present(&self) -> u64 {
3559 if let Some(_) = self.page_scale {
3560 return 4;
3561 }
3562 if let Some(_) = self.theme {
3563 return 3;
3564 }
3565 if let Some(_) = self.autoplay_policy {
3566 return 2;
3567 }
3568 if let Some(_) = self.hide_scrollbars {
3569 return 1;
3570 }
3571 0
3572 }
3573 }
3574
3575 impl fidl::encoding::ValueTypeMarker for ContentAreaSettings {
3576 type Borrowed<'a> = &'a Self;
3577 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3578 value
3579 }
3580 }
3581
3582 unsafe impl fidl::encoding::TypeMarker for ContentAreaSettings {
3583 type Owned = Self;
3584
3585 #[inline(always)]
3586 fn inline_align(_context: fidl::encoding::Context) -> usize {
3587 8
3588 }
3589
3590 #[inline(always)]
3591 fn inline_size(_context: fidl::encoding::Context) -> usize {
3592 16
3593 }
3594 }
3595
3596 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ContentAreaSettings, D>
3597 for &ContentAreaSettings
3598 {
3599 unsafe fn encode(
3600 self,
3601 encoder: &mut fidl::encoding::Encoder<'_, D>,
3602 offset: usize,
3603 mut depth: fidl::encoding::Depth,
3604 ) -> fidl::Result<()> {
3605 encoder.debug_check_bounds::<ContentAreaSettings>(offset);
3606 let max_ordinal: u64 = self.max_ordinal_present();
3608 encoder.write_num(max_ordinal, offset);
3609 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3610 if max_ordinal == 0 {
3612 return Ok(());
3613 }
3614 depth.increment()?;
3615 let envelope_size = 8;
3616 let bytes_len = max_ordinal as usize * envelope_size;
3617 #[allow(unused_variables)]
3618 let offset = encoder.out_of_line_offset(bytes_len);
3619 let mut _prev_end_offset: usize = 0;
3620 if 1 > max_ordinal {
3621 return Ok(());
3622 }
3623
3624 let cur_offset: usize = (1 - 1) * envelope_size;
3627
3628 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3630
3631 fidl::encoding::encode_in_envelope_optional::<bool, D>(
3636 self.hide_scrollbars
3637 .as_ref()
3638 .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
3639 encoder,
3640 offset + cur_offset,
3641 depth,
3642 )?;
3643
3644 _prev_end_offset = cur_offset + envelope_size;
3645 if 2 > max_ordinal {
3646 return Ok(());
3647 }
3648
3649 let cur_offset: usize = (2 - 1) * envelope_size;
3652
3653 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3655
3656 fidl::encoding::encode_in_envelope_optional::<AutoplayPolicy, D>(
3661 self.autoplay_policy
3662 .as_ref()
3663 .map(<AutoplayPolicy as fidl::encoding::ValueTypeMarker>::borrow),
3664 encoder,
3665 offset + cur_offset,
3666 depth,
3667 )?;
3668
3669 _prev_end_offset = cur_offset + envelope_size;
3670 if 3 > max_ordinal {
3671 return Ok(());
3672 }
3673
3674 let cur_offset: usize = (3 - 1) * envelope_size;
3677
3678 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3680
3681 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_settings::ThemeType, D>(
3686 self.theme.as_ref().map(
3687 <fidl_fuchsia_settings::ThemeType as fidl::encoding::ValueTypeMarker>::borrow,
3688 ),
3689 encoder,
3690 offset + cur_offset,
3691 depth,
3692 )?;
3693
3694 _prev_end_offset = cur_offset + envelope_size;
3695 if 4 > max_ordinal {
3696 return Ok(());
3697 }
3698
3699 let cur_offset: usize = (4 - 1) * envelope_size;
3702
3703 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3705
3706 fidl::encoding::encode_in_envelope_optional::<f32, D>(
3711 self.page_scale.as_ref().map(<f32 as fidl::encoding::ValueTypeMarker>::borrow),
3712 encoder,
3713 offset + cur_offset,
3714 depth,
3715 )?;
3716
3717 _prev_end_offset = cur_offset + envelope_size;
3718
3719 Ok(())
3720 }
3721 }
3722
3723 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ContentAreaSettings {
3724 #[inline(always)]
3725 fn new_empty() -> Self {
3726 Self::default()
3727 }
3728
3729 unsafe fn decode(
3730 &mut self,
3731 decoder: &mut fidl::encoding::Decoder<'_, D>,
3732 offset: usize,
3733 mut depth: fidl::encoding::Depth,
3734 ) -> fidl::Result<()> {
3735 decoder.debug_check_bounds::<Self>(offset);
3736 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3737 None => return Err(fidl::Error::NotNullable),
3738 Some(len) => len,
3739 };
3740 if len == 0 {
3742 return Ok(());
3743 };
3744 depth.increment()?;
3745 let envelope_size = 8;
3746 let bytes_len = len * envelope_size;
3747 let offset = decoder.out_of_line_offset(bytes_len)?;
3748 let mut _next_ordinal_to_read = 0;
3750 let mut next_offset = offset;
3751 let end_offset = offset + bytes_len;
3752 _next_ordinal_to_read += 1;
3753 if next_offset >= end_offset {
3754 return Ok(());
3755 }
3756
3757 while _next_ordinal_to_read < 1 {
3759 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3760 _next_ordinal_to_read += 1;
3761 next_offset += envelope_size;
3762 }
3763
3764 let next_out_of_line = decoder.next_out_of_line();
3765 let handles_before = decoder.remaining_handles();
3766 if let Some((inlined, num_bytes, num_handles)) =
3767 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3768 {
3769 let member_inline_size =
3770 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3771 if inlined != (member_inline_size <= 4) {
3772 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3773 }
3774 let inner_offset;
3775 let mut inner_depth = depth.clone();
3776 if inlined {
3777 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3778 inner_offset = next_offset;
3779 } else {
3780 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3781 inner_depth.increment()?;
3782 }
3783 let val_ref = self.hide_scrollbars.get_or_insert_with(|| fidl::new_empty!(bool, D));
3784 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
3785 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3786 {
3787 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3788 }
3789 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3790 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3791 }
3792 }
3793
3794 next_offset += envelope_size;
3795 _next_ordinal_to_read += 1;
3796 if next_offset >= end_offset {
3797 return Ok(());
3798 }
3799
3800 while _next_ordinal_to_read < 2 {
3802 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3803 _next_ordinal_to_read += 1;
3804 next_offset += envelope_size;
3805 }
3806
3807 let next_out_of_line = decoder.next_out_of_line();
3808 let handles_before = decoder.remaining_handles();
3809 if let Some((inlined, num_bytes, num_handles)) =
3810 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3811 {
3812 let member_inline_size =
3813 <AutoplayPolicy as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3814 if inlined != (member_inline_size <= 4) {
3815 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3816 }
3817 let inner_offset;
3818 let mut inner_depth = depth.clone();
3819 if inlined {
3820 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3821 inner_offset = next_offset;
3822 } else {
3823 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3824 inner_depth.increment()?;
3825 }
3826 let val_ref =
3827 self.autoplay_policy.get_or_insert_with(|| fidl::new_empty!(AutoplayPolicy, D));
3828 fidl::decode!(AutoplayPolicy, D, val_ref, decoder, inner_offset, inner_depth)?;
3829 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3830 {
3831 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3832 }
3833 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3834 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3835 }
3836 }
3837
3838 next_offset += envelope_size;
3839 _next_ordinal_to_read += 1;
3840 if next_offset >= end_offset {
3841 return Ok(());
3842 }
3843
3844 while _next_ordinal_to_read < 3 {
3846 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3847 _next_ordinal_to_read += 1;
3848 next_offset += envelope_size;
3849 }
3850
3851 let next_out_of_line = decoder.next_out_of_line();
3852 let handles_before = decoder.remaining_handles();
3853 if let Some((inlined, num_bytes, num_handles)) =
3854 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3855 {
3856 let member_inline_size =
3857 <fidl_fuchsia_settings::ThemeType as fidl::encoding::TypeMarker>::inline_size(
3858 decoder.context,
3859 );
3860 if inlined != (member_inline_size <= 4) {
3861 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3862 }
3863 let inner_offset;
3864 let mut inner_depth = depth.clone();
3865 if inlined {
3866 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3867 inner_offset = next_offset;
3868 } else {
3869 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3870 inner_depth.increment()?;
3871 }
3872 let val_ref = self
3873 .theme
3874 .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_settings::ThemeType, D));
3875 fidl::decode!(
3876 fidl_fuchsia_settings::ThemeType,
3877 D,
3878 val_ref,
3879 decoder,
3880 inner_offset,
3881 inner_depth
3882 )?;
3883 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3884 {
3885 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3886 }
3887 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3888 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3889 }
3890 }
3891
3892 next_offset += envelope_size;
3893 _next_ordinal_to_read += 1;
3894 if next_offset >= end_offset {
3895 return Ok(());
3896 }
3897
3898 while _next_ordinal_to_read < 4 {
3900 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3901 _next_ordinal_to_read += 1;
3902 next_offset += envelope_size;
3903 }
3904
3905 let next_out_of_line = decoder.next_out_of_line();
3906 let handles_before = decoder.remaining_handles();
3907 if let Some((inlined, num_bytes, num_handles)) =
3908 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3909 {
3910 let member_inline_size =
3911 <f32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3912 if inlined != (member_inline_size <= 4) {
3913 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3914 }
3915 let inner_offset;
3916 let mut inner_depth = depth.clone();
3917 if inlined {
3918 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3919 inner_offset = next_offset;
3920 } else {
3921 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3922 inner_depth.increment()?;
3923 }
3924 let val_ref = self.page_scale.get_or_insert_with(|| fidl::new_empty!(f32, D));
3925 fidl::decode!(f32, D, val_ref, decoder, inner_offset, inner_depth)?;
3926 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3927 {
3928 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3929 }
3930 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3931 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3932 }
3933 }
3934
3935 next_offset += envelope_size;
3936
3937 while next_offset < end_offset {
3939 _next_ordinal_to_read += 1;
3940 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3941 next_offset += envelope_size;
3942 }
3943
3944 Ok(())
3945 }
3946 }
3947
3948 impl CookieId {
3949 #[inline(always)]
3950 fn max_ordinal_present(&self) -> u64 {
3951 if let Some(_) = self.path {
3952 return 3;
3953 }
3954 if let Some(_) = self.domain {
3955 return 2;
3956 }
3957 if let Some(_) = self.name {
3958 return 1;
3959 }
3960 0
3961 }
3962 }
3963
3964 impl fidl::encoding::ValueTypeMarker for CookieId {
3965 type Borrowed<'a> = &'a Self;
3966 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3967 value
3968 }
3969 }
3970
3971 unsafe impl fidl::encoding::TypeMarker for CookieId {
3972 type Owned = Self;
3973
3974 #[inline(always)]
3975 fn inline_align(_context: fidl::encoding::Context) -> usize {
3976 8
3977 }
3978
3979 #[inline(always)]
3980 fn inline_size(_context: fidl::encoding::Context) -> usize {
3981 16
3982 }
3983 }
3984
3985 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CookieId, D> for &CookieId {
3986 unsafe fn encode(
3987 self,
3988 encoder: &mut fidl::encoding::Encoder<'_, D>,
3989 offset: usize,
3990 mut depth: fidl::encoding::Depth,
3991 ) -> fidl::Result<()> {
3992 encoder.debug_check_bounds::<CookieId>(offset);
3993 let max_ordinal: u64 = self.max_ordinal_present();
3995 encoder.write_num(max_ordinal, offset);
3996 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3997 if max_ordinal == 0 {
3999 return Ok(());
4000 }
4001 depth.increment()?;
4002 let envelope_size = 8;
4003 let bytes_len = max_ordinal as usize * envelope_size;
4004 #[allow(unused_variables)]
4005 let offset = encoder.out_of_line_offset(bytes_len);
4006 let mut _prev_end_offset: usize = 0;
4007 if 1 > max_ordinal {
4008 return Ok(());
4009 }
4010
4011 let cur_offset: usize = (1 - 1) * envelope_size;
4014
4015 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4017
4018 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedString, D>(
4023 self.name.as_ref().map(
4024 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
4025 ),
4026 encoder,
4027 offset + cur_offset,
4028 depth,
4029 )?;
4030
4031 _prev_end_offset = cur_offset + envelope_size;
4032 if 2 > max_ordinal {
4033 return Ok(());
4034 }
4035
4036 let cur_offset: usize = (2 - 1) * envelope_size;
4039
4040 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4042
4043 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<255>, D>(
4048 self.domain.as_ref().map(
4049 <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow,
4050 ),
4051 encoder,
4052 offset + cur_offset,
4053 depth,
4054 )?;
4055
4056 _prev_end_offset = cur_offset + envelope_size;
4057 if 3 > max_ordinal {
4058 return Ok(());
4059 }
4060
4061 let cur_offset: usize = (3 - 1) * envelope_size;
4064
4065 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4067
4068 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<65536>, D>(
4073 self.path.as_ref().map(<fidl::encoding::BoundedString<65536> as fidl::encoding::ValueTypeMarker>::borrow),
4074 encoder, offset + cur_offset, depth
4075 )?;
4076
4077 _prev_end_offset = cur_offset + envelope_size;
4078
4079 Ok(())
4080 }
4081 }
4082
4083 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CookieId {
4084 #[inline(always)]
4085 fn new_empty() -> Self {
4086 Self::default()
4087 }
4088
4089 unsafe fn decode(
4090 &mut self,
4091 decoder: &mut fidl::encoding::Decoder<'_, D>,
4092 offset: usize,
4093 mut depth: fidl::encoding::Depth,
4094 ) -> fidl::Result<()> {
4095 decoder.debug_check_bounds::<Self>(offset);
4096 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4097 None => return Err(fidl::Error::NotNullable),
4098 Some(len) => len,
4099 };
4100 if len == 0 {
4102 return Ok(());
4103 };
4104 depth.increment()?;
4105 let envelope_size = 8;
4106 let bytes_len = len * envelope_size;
4107 let offset = decoder.out_of_line_offset(bytes_len)?;
4108 let mut _next_ordinal_to_read = 0;
4110 let mut next_offset = offset;
4111 let end_offset = offset + bytes_len;
4112 _next_ordinal_to_read += 1;
4113 if next_offset >= end_offset {
4114 return Ok(());
4115 }
4116
4117 while _next_ordinal_to_read < 1 {
4119 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4120 _next_ordinal_to_read += 1;
4121 next_offset += envelope_size;
4122 }
4123
4124 let next_out_of_line = decoder.next_out_of_line();
4125 let handles_before = decoder.remaining_handles();
4126 if let Some((inlined, num_bytes, num_handles)) =
4127 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4128 {
4129 let member_inline_size =
4130 <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
4131 decoder.context,
4132 );
4133 if inlined != (member_inline_size <= 4) {
4134 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4135 }
4136 let inner_offset;
4137 let mut inner_depth = depth.clone();
4138 if inlined {
4139 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4140 inner_offset = next_offset;
4141 } else {
4142 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4143 inner_depth.increment()?;
4144 }
4145 let val_ref = self
4146 .name
4147 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::UnboundedString, D));
4148 fidl::decode!(
4149 fidl::encoding::UnboundedString,
4150 D,
4151 val_ref,
4152 decoder,
4153 inner_offset,
4154 inner_depth
4155 )?;
4156 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4157 {
4158 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4159 }
4160 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4161 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4162 }
4163 }
4164
4165 next_offset += envelope_size;
4166 _next_ordinal_to_read += 1;
4167 if next_offset >= end_offset {
4168 return Ok(());
4169 }
4170
4171 while _next_ordinal_to_read < 2 {
4173 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4174 _next_ordinal_to_read += 1;
4175 next_offset += envelope_size;
4176 }
4177
4178 let next_out_of_line = decoder.next_out_of_line();
4179 let handles_before = decoder.remaining_handles();
4180 if let Some((inlined, num_bytes, num_handles)) =
4181 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4182 {
4183 let member_inline_size =
4184 <fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
4185 decoder.context,
4186 );
4187 if inlined != (member_inline_size <= 4) {
4188 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4189 }
4190 let inner_offset;
4191 let mut inner_depth = depth.clone();
4192 if inlined {
4193 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4194 inner_offset = next_offset;
4195 } else {
4196 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4197 inner_depth.increment()?;
4198 }
4199 let val_ref = self
4200 .domain
4201 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<255>, D));
4202 fidl::decode!(
4203 fidl::encoding::BoundedString<255>,
4204 D,
4205 val_ref,
4206 decoder,
4207 inner_offset,
4208 inner_depth
4209 )?;
4210 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4211 {
4212 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4213 }
4214 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4215 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4216 }
4217 }
4218
4219 next_offset += envelope_size;
4220 _next_ordinal_to_read += 1;
4221 if next_offset >= end_offset {
4222 return Ok(());
4223 }
4224
4225 while _next_ordinal_to_read < 3 {
4227 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4228 _next_ordinal_to_read += 1;
4229 next_offset += envelope_size;
4230 }
4231
4232 let next_out_of_line = decoder.next_out_of_line();
4233 let handles_before = decoder.remaining_handles();
4234 if let Some((inlined, num_bytes, num_handles)) =
4235 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4236 {
4237 let member_inline_size = <fidl::encoding::BoundedString<65536> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4238 if inlined != (member_inline_size <= 4) {
4239 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4240 }
4241 let inner_offset;
4242 let mut inner_depth = depth.clone();
4243 if inlined {
4244 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4245 inner_offset = next_offset;
4246 } else {
4247 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4248 inner_depth.increment()?;
4249 }
4250 let val_ref = self.path.get_or_insert_with(|| {
4251 fidl::new_empty!(fidl::encoding::BoundedString<65536>, D)
4252 });
4253 fidl::decode!(
4254 fidl::encoding::BoundedString<65536>,
4255 D,
4256 val_ref,
4257 decoder,
4258 inner_offset,
4259 inner_depth
4260 )?;
4261 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4262 {
4263 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4264 }
4265 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4266 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4267 }
4268 }
4269
4270 next_offset += envelope_size;
4271
4272 while next_offset < end_offset {
4274 _next_ordinal_to_read += 1;
4275 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4276 next_offset += envelope_size;
4277 }
4278
4279 Ok(())
4280 }
4281 }
4282
4283 impl FrameCloseRequest {
4284 #[inline(always)]
4285 fn max_ordinal_present(&self) -> u64 {
4286 if let Some(_) = self.timeout {
4287 return 1;
4288 }
4289 0
4290 }
4291 }
4292
4293 impl fidl::encoding::ValueTypeMarker for FrameCloseRequest {
4294 type Borrowed<'a> = &'a Self;
4295 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4296 value
4297 }
4298 }
4299
4300 unsafe impl fidl::encoding::TypeMarker for FrameCloseRequest {
4301 type Owned = Self;
4302
4303 #[inline(always)]
4304 fn inline_align(_context: fidl::encoding::Context) -> usize {
4305 8
4306 }
4307
4308 #[inline(always)]
4309 fn inline_size(_context: fidl::encoding::Context) -> usize {
4310 16
4311 }
4312 }
4313
4314 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<FrameCloseRequest, D>
4315 for &FrameCloseRequest
4316 {
4317 unsafe fn encode(
4318 self,
4319 encoder: &mut fidl::encoding::Encoder<'_, D>,
4320 offset: usize,
4321 mut depth: fidl::encoding::Depth,
4322 ) -> fidl::Result<()> {
4323 encoder.debug_check_bounds::<FrameCloseRequest>(offset);
4324 let max_ordinal: u64 = self.max_ordinal_present();
4326 encoder.write_num(max_ordinal, offset);
4327 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4328 if max_ordinal == 0 {
4330 return Ok(());
4331 }
4332 depth.increment()?;
4333 let envelope_size = 8;
4334 let bytes_len = max_ordinal as usize * envelope_size;
4335 #[allow(unused_variables)]
4336 let offset = encoder.out_of_line_offset(bytes_len);
4337 let mut _prev_end_offset: usize = 0;
4338 if 1 > max_ordinal {
4339 return Ok(());
4340 }
4341
4342 let cur_offset: usize = (1 - 1) * envelope_size;
4345
4346 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4348
4349 fidl::encoding::encode_in_envelope_optional::<i64, D>(
4354 self.timeout.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
4355 encoder,
4356 offset + cur_offset,
4357 depth,
4358 )?;
4359
4360 _prev_end_offset = cur_offset + envelope_size;
4361
4362 Ok(())
4363 }
4364 }
4365
4366 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for FrameCloseRequest {
4367 #[inline(always)]
4368 fn new_empty() -> Self {
4369 Self::default()
4370 }
4371
4372 unsafe fn decode(
4373 &mut self,
4374 decoder: &mut fidl::encoding::Decoder<'_, D>,
4375 offset: usize,
4376 mut depth: fidl::encoding::Depth,
4377 ) -> fidl::Result<()> {
4378 decoder.debug_check_bounds::<Self>(offset);
4379 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4380 None => return Err(fidl::Error::NotNullable),
4381 Some(len) => len,
4382 };
4383 if len == 0 {
4385 return Ok(());
4386 };
4387 depth.increment()?;
4388 let envelope_size = 8;
4389 let bytes_len = len * envelope_size;
4390 let offset = decoder.out_of_line_offset(bytes_len)?;
4391 let mut _next_ordinal_to_read = 0;
4393 let mut next_offset = offset;
4394 let end_offset = offset + bytes_len;
4395 _next_ordinal_to_read += 1;
4396 if next_offset >= end_offset {
4397 return Ok(());
4398 }
4399
4400 while _next_ordinal_to_read < 1 {
4402 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4403 _next_ordinal_to_read += 1;
4404 next_offset += envelope_size;
4405 }
4406
4407 let next_out_of_line = decoder.next_out_of_line();
4408 let handles_before = decoder.remaining_handles();
4409 if let Some((inlined, num_bytes, num_handles)) =
4410 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4411 {
4412 let member_inline_size =
4413 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4414 if inlined != (member_inline_size <= 4) {
4415 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4416 }
4417 let inner_offset;
4418 let mut inner_depth = depth.clone();
4419 if inlined {
4420 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4421 inner_offset = next_offset;
4422 } else {
4423 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4424 inner_depth.increment()?;
4425 }
4426 let val_ref = self.timeout.get_or_insert_with(|| fidl::new_empty!(i64, D));
4427 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
4428 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4429 {
4430 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4431 }
4432 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4433 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4434 }
4435 }
4436
4437 next_offset += envelope_size;
4438
4439 while next_offset < end_offset {
4441 _next_ordinal_to_read += 1;
4442 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4443 next_offset += envelope_size;
4444 }
4445
4446 Ok(())
4447 }
4448 }
4449
4450 impl FrameMediaSettings {
4451 #[inline(always)]
4452 fn max_ordinal_present(&self) -> u64 {
4453 if let Some(_) = self.renderer_usage2 {
4454 return 3;
4455 }
4456 if let Some(_) = self.audio_consumer_session_id {
4457 return 2;
4458 }
4459 if let Some(_) = self.renderer_usage {
4460 return 1;
4461 }
4462 0
4463 }
4464 }
4465
4466 impl fidl::encoding::ValueTypeMarker for FrameMediaSettings {
4467 type Borrowed<'a> = &'a Self;
4468 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4469 value
4470 }
4471 }
4472
4473 unsafe impl fidl::encoding::TypeMarker for FrameMediaSettings {
4474 type Owned = Self;
4475
4476 #[inline(always)]
4477 fn inline_align(_context: fidl::encoding::Context) -> usize {
4478 8
4479 }
4480
4481 #[inline(always)]
4482 fn inline_size(_context: fidl::encoding::Context) -> usize {
4483 16
4484 }
4485 }
4486
4487 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<FrameMediaSettings, D>
4488 for &FrameMediaSettings
4489 {
4490 unsafe fn encode(
4491 self,
4492 encoder: &mut fidl::encoding::Encoder<'_, D>,
4493 offset: usize,
4494 mut depth: fidl::encoding::Depth,
4495 ) -> fidl::Result<()> {
4496 encoder.debug_check_bounds::<FrameMediaSettings>(offset);
4497 let max_ordinal: u64 = self.max_ordinal_present();
4499 encoder.write_num(max_ordinal, offset);
4500 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4501 if max_ordinal == 0 {
4503 return Ok(());
4504 }
4505 depth.increment()?;
4506 let envelope_size = 8;
4507 let bytes_len = max_ordinal as usize * envelope_size;
4508 #[allow(unused_variables)]
4509 let offset = encoder.out_of_line_offset(bytes_len);
4510 let mut _prev_end_offset: usize = 0;
4511 if 1 > max_ordinal {
4512 return Ok(());
4513 }
4514
4515 let cur_offset: usize = (1 - 1) * envelope_size;
4518
4519 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4521
4522 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_media::AudioRenderUsage, D>(
4527 self.renderer_usage.as_ref().map(<fidl_fuchsia_media::AudioRenderUsage as fidl::encoding::ValueTypeMarker>::borrow),
4528 encoder, offset + cur_offset, depth
4529 )?;
4530
4531 _prev_end_offset = cur_offset + envelope_size;
4532 if 2 > max_ordinal {
4533 return Ok(());
4534 }
4535
4536 let cur_offset: usize = (2 - 1) * envelope_size;
4539
4540 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4542
4543 fidl::encoding::encode_in_envelope_optional::<u64, D>(
4548 self.audio_consumer_session_id
4549 .as_ref()
4550 .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
4551 encoder,
4552 offset + cur_offset,
4553 depth,
4554 )?;
4555
4556 _prev_end_offset = cur_offset + envelope_size;
4557 if 3 > max_ordinal {
4558 return Ok(());
4559 }
4560
4561 let cur_offset: usize = (3 - 1) * envelope_size;
4564
4565 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4567
4568 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_media::AudioRenderUsage2, D>(
4573 self.renderer_usage2.as_ref().map(<fidl_fuchsia_media::AudioRenderUsage2 as fidl::encoding::ValueTypeMarker>::borrow),
4574 encoder, offset + cur_offset, depth
4575 )?;
4576
4577 _prev_end_offset = cur_offset + envelope_size;
4578
4579 Ok(())
4580 }
4581 }
4582
4583 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for FrameMediaSettings {
4584 #[inline(always)]
4585 fn new_empty() -> Self {
4586 Self::default()
4587 }
4588
4589 unsafe fn decode(
4590 &mut self,
4591 decoder: &mut fidl::encoding::Decoder<'_, D>,
4592 offset: usize,
4593 mut depth: fidl::encoding::Depth,
4594 ) -> fidl::Result<()> {
4595 decoder.debug_check_bounds::<Self>(offset);
4596 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4597 None => return Err(fidl::Error::NotNullable),
4598 Some(len) => len,
4599 };
4600 if len == 0 {
4602 return Ok(());
4603 };
4604 depth.increment()?;
4605 let envelope_size = 8;
4606 let bytes_len = len * envelope_size;
4607 let offset = decoder.out_of_line_offset(bytes_len)?;
4608 let mut _next_ordinal_to_read = 0;
4610 let mut next_offset = offset;
4611 let end_offset = offset + bytes_len;
4612 _next_ordinal_to_read += 1;
4613 if next_offset >= end_offset {
4614 return Ok(());
4615 }
4616
4617 while _next_ordinal_to_read < 1 {
4619 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4620 _next_ordinal_to_read += 1;
4621 next_offset += envelope_size;
4622 }
4623
4624 let next_out_of_line = decoder.next_out_of_line();
4625 let handles_before = decoder.remaining_handles();
4626 if let Some((inlined, num_bytes, num_handles)) =
4627 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4628 {
4629 let member_inline_size = <fidl_fuchsia_media::AudioRenderUsage as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4630 if inlined != (member_inline_size <= 4) {
4631 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4632 }
4633 let inner_offset;
4634 let mut inner_depth = depth.clone();
4635 if inlined {
4636 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4637 inner_offset = next_offset;
4638 } else {
4639 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4640 inner_depth.increment()?;
4641 }
4642 let val_ref = self.renderer_usage.get_or_insert_with(|| {
4643 fidl::new_empty!(fidl_fuchsia_media::AudioRenderUsage, D)
4644 });
4645 fidl::decode!(
4646 fidl_fuchsia_media::AudioRenderUsage,
4647 D,
4648 val_ref,
4649 decoder,
4650 inner_offset,
4651 inner_depth
4652 )?;
4653 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4654 {
4655 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4656 }
4657 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4658 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4659 }
4660 }
4661
4662 next_offset += envelope_size;
4663 _next_ordinal_to_read += 1;
4664 if next_offset >= end_offset {
4665 return Ok(());
4666 }
4667
4668 while _next_ordinal_to_read < 2 {
4670 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4671 _next_ordinal_to_read += 1;
4672 next_offset += envelope_size;
4673 }
4674
4675 let next_out_of_line = decoder.next_out_of_line();
4676 let handles_before = decoder.remaining_handles();
4677 if let Some((inlined, num_bytes, num_handles)) =
4678 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4679 {
4680 let member_inline_size =
4681 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4682 if inlined != (member_inline_size <= 4) {
4683 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4684 }
4685 let inner_offset;
4686 let mut inner_depth = depth.clone();
4687 if inlined {
4688 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4689 inner_offset = next_offset;
4690 } else {
4691 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4692 inner_depth.increment()?;
4693 }
4694 let val_ref =
4695 self.audio_consumer_session_id.get_or_insert_with(|| fidl::new_empty!(u64, D));
4696 fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
4697 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4698 {
4699 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4700 }
4701 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4702 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4703 }
4704 }
4705
4706 next_offset += envelope_size;
4707 _next_ordinal_to_read += 1;
4708 if next_offset >= end_offset {
4709 return Ok(());
4710 }
4711
4712 while _next_ordinal_to_read < 3 {
4714 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4715 _next_ordinal_to_read += 1;
4716 next_offset += envelope_size;
4717 }
4718
4719 let next_out_of_line = decoder.next_out_of_line();
4720 let handles_before = decoder.remaining_handles();
4721 if let Some((inlined, num_bytes, num_handles)) =
4722 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4723 {
4724 let member_inline_size = <fidl_fuchsia_media::AudioRenderUsage2 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4725 if inlined != (member_inline_size <= 4) {
4726 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4727 }
4728 let inner_offset;
4729 let mut inner_depth = depth.clone();
4730 if inlined {
4731 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4732 inner_offset = next_offset;
4733 } else {
4734 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4735 inner_depth.increment()?;
4736 }
4737 let val_ref = self.renderer_usage2.get_or_insert_with(|| {
4738 fidl::new_empty!(fidl_fuchsia_media::AudioRenderUsage2, D)
4739 });
4740 fidl::decode!(
4741 fidl_fuchsia_media::AudioRenderUsage2,
4742 D,
4743 val_ref,
4744 decoder,
4745 inner_offset,
4746 inner_depth
4747 )?;
4748 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4749 {
4750 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4751 }
4752 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4753 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4754 }
4755 }
4756
4757 next_offset += envelope_size;
4758
4759 while next_offset < end_offset {
4761 _next_ordinal_to_read += 1;
4762 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4763 next_offset += envelope_size;
4764 }
4765
4766 Ok(())
4767 }
4768 }
4769
4770 impl NavigationPolicyProviderParams {
4771 #[inline(always)]
4772 fn max_ordinal_present(&self) -> u64 {
4773 if let Some(_) = self.subframe_phases {
4774 return 2;
4775 }
4776 if let Some(_) = self.main_frame_phases {
4777 return 1;
4778 }
4779 0
4780 }
4781 }
4782
4783 impl fidl::encoding::ValueTypeMarker for NavigationPolicyProviderParams {
4784 type Borrowed<'a> = &'a Self;
4785 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4786 value
4787 }
4788 }
4789
4790 unsafe impl fidl::encoding::TypeMarker for NavigationPolicyProviderParams {
4791 type Owned = Self;
4792
4793 #[inline(always)]
4794 fn inline_align(_context: fidl::encoding::Context) -> usize {
4795 8
4796 }
4797
4798 #[inline(always)]
4799 fn inline_size(_context: fidl::encoding::Context) -> usize {
4800 16
4801 }
4802 }
4803
4804 unsafe impl<D: fidl::encoding::ResourceDialect>
4805 fidl::encoding::Encode<NavigationPolicyProviderParams, D>
4806 for &NavigationPolicyProviderParams
4807 {
4808 unsafe fn encode(
4809 self,
4810 encoder: &mut fidl::encoding::Encoder<'_, D>,
4811 offset: usize,
4812 mut depth: fidl::encoding::Depth,
4813 ) -> fidl::Result<()> {
4814 encoder.debug_check_bounds::<NavigationPolicyProviderParams>(offset);
4815 let max_ordinal: u64 = self.max_ordinal_present();
4817 encoder.write_num(max_ordinal, offset);
4818 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4819 if max_ordinal == 0 {
4821 return Ok(());
4822 }
4823 depth.increment()?;
4824 let envelope_size = 8;
4825 let bytes_len = max_ordinal as usize * envelope_size;
4826 #[allow(unused_variables)]
4827 let offset = encoder.out_of_line_offset(bytes_len);
4828 let mut _prev_end_offset: usize = 0;
4829 if 1 > max_ordinal {
4830 return Ok(());
4831 }
4832
4833 let cur_offset: usize = (1 - 1) * envelope_size;
4836
4837 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4839
4840 fidl::encoding::encode_in_envelope_optional::<NavigationPhase, D>(
4845 self.main_frame_phases
4846 .as_ref()
4847 .map(<NavigationPhase as fidl::encoding::ValueTypeMarker>::borrow),
4848 encoder,
4849 offset + cur_offset,
4850 depth,
4851 )?;
4852
4853 _prev_end_offset = cur_offset + envelope_size;
4854 if 2 > max_ordinal {
4855 return Ok(());
4856 }
4857
4858 let cur_offset: usize = (2 - 1) * envelope_size;
4861
4862 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4864
4865 fidl::encoding::encode_in_envelope_optional::<NavigationPhase, D>(
4870 self.subframe_phases
4871 .as_ref()
4872 .map(<NavigationPhase as fidl::encoding::ValueTypeMarker>::borrow),
4873 encoder,
4874 offset + cur_offset,
4875 depth,
4876 )?;
4877
4878 _prev_end_offset = cur_offset + envelope_size;
4879
4880 Ok(())
4881 }
4882 }
4883
4884 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4885 for NavigationPolicyProviderParams
4886 {
4887 #[inline(always)]
4888 fn new_empty() -> Self {
4889 Self::default()
4890 }
4891
4892 unsafe fn decode(
4893 &mut self,
4894 decoder: &mut fidl::encoding::Decoder<'_, D>,
4895 offset: usize,
4896 mut depth: fidl::encoding::Depth,
4897 ) -> fidl::Result<()> {
4898 decoder.debug_check_bounds::<Self>(offset);
4899 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4900 None => return Err(fidl::Error::NotNullable),
4901 Some(len) => len,
4902 };
4903 if len == 0 {
4905 return Ok(());
4906 };
4907 depth.increment()?;
4908 let envelope_size = 8;
4909 let bytes_len = len * envelope_size;
4910 let offset = decoder.out_of_line_offset(bytes_len)?;
4911 let mut _next_ordinal_to_read = 0;
4913 let mut next_offset = offset;
4914 let end_offset = offset + bytes_len;
4915 _next_ordinal_to_read += 1;
4916 if next_offset >= end_offset {
4917 return Ok(());
4918 }
4919
4920 while _next_ordinal_to_read < 1 {
4922 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4923 _next_ordinal_to_read += 1;
4924 next_offset += envelope_size;
4925 }
4926
4927 let next_out_of_line = decoder.next_out_of_line();
4928 let handles_before = decoder.remaining_handles();
4929 if let Some((inlined, num_bytes, num_handles)) =
4930 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4931 {
4932 let member_inline_size =
4933 <NavigationPhase as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4934 if inlined != (member_inline_size <= 4) {
4935 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4936 }
4937 let inner_offset;
4938 let mut inner_depth = depth.clone();
4939 if inlined {
4940 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4941 inner_offset = next_offset;
4942 } else {
4943 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4944 inner_depth.increment()?;
4945 }
4946 let val_ref = self
4947 .main_frame_phases
4948 .get_or_insert_with(|| fidl::new_empty!(NavigationPhase, D));
4949 fidl::decode!(NavigationPhase, D, val_ref, decoder, inner_offset, inner_depth)?;
4950 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4951 {
4952 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4953 }
4954 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4955 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4956 }
4957 }
4958
4959 next_offset += envelope_size;
4960 _next_ordinal_to_read += 1;
4961 if next_offset >= end_offset {
4962 return Ok(());
4963 }
4964
4965 while _next_ordinal_to_read < 2 {
4967 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4968 _next_ordinal_to_read += 1;
4969 next_offset += envelope_size;
4970 }
4971
4972 let next_out_of_line = decoder.next_out_of_line();
4973 let handles_before = decoder.remaining_handles();
4974 if let Some((inlined, num_bytes, num_handles)) =
4975 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4976 {
4977 let member_inline_size =
4978 <NavigationPhase as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4979 if inlined != (member_inline_size <= 4) {
4980 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4981 }
4982 let inner_offset;
4983 let mut inner_depth = depth.clone();
4984 if inlined {
4985 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4986 inner_offset = next_offset;
4987 } else {
4988 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4989 inner_depth.increment()?;
4990 }
4991 let val_ref = self
4992 .subframe_phases
4993 .get_or_insert_with(|| fidl::new_empty!(NavigationPhase, D));
4994 fidl::decode!(NavigationPhase, D, val_ref, decoder, inner_offset, inner_depth)?;
4995 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4996 {
4997 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4998 }
4999 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5000 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5001 }
5002 }
5003
5004 next_offset += envelope_size;
5005
5006 while next_offset < end_offset {
5008 _next_ordinal_to_read += 1;
5009 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5010 next_offset += envelope_size;
5011 }
5012
5013 Ok(())
5014 }
5015 }
5016
5017 impl PermissionDescriptor {
5018 #[inline(always)]
5019 fn max_ordinal_present(&self) -> u64 {
5020 if let Some(_) = self.type_ {
5021 return 1;
5022 }
5023 0
5024 }
5025 }
5026
5027 impl fidl::encoding::ValueTypeMarker for PermissionDescriptor {
5028 type Borrowed<'a> = &'a Self;
5029 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5030 value
5031 }
5032 }
5033
5034 unsafe impl fidl::encoding::TypeMarker for PermissionDescriptor {
5035 type Owned = Self;
5036
5037 #[inline(always)]
5038 fn inline_align(_context: fidl::encoding::Context) -> usize {
5039 8
5040 }
5041
5042 #[inline(always)]
5043 fn inline_size(_context: fidl::encoding::Context) -> usize {
5044 16
5045 }
5046 }
5047
5048 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PermissionDescriptor, D>
5049 for &PermissionDescriptor
5050 {
5051 unsafe fn encode(
5052 self,
5053 encoder: &mut fidl::encoding::Encoder<'_, D>,
5054 offset: usize,
5055 mut depth: fidl::encoding::Depth,
5056 ) -> fidl::Result<()> {
5057 encoder.debug_check_bounds::<PermissionDescriptor>(offset);
5058 let max_ordinal: u64 = self.max_ordinal_present();
5060 encoder.write_num(max_ordinal, offset);
5061 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5062 if max_ordinal == 0 {
5064 return Ok(());
5065 }
5066 depth.increment()?;
5067 let envelope_size = 8;
5068 let bytes_len = max_ordinal as usize * envelope_size;
5069 #[allow(unused_variables)]
5070 let offset = encoder.out_of_line_offset(bytes_len);
5071 let mut _prev_end_offset: usize = 0;
5072 if 1 > max_ordinal {
5073 return Ok(());
5074 }
5075
5076 let cur_offset: usize = (1 - 1) * envelope_size;
5079
5080 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5082
5083 fidl::encoding::encode_in_envelope_optional::<PermissionType, D>(
5088 self.type_
5089 .as_ref()
5090 .map(<PermissionType as fidl::encoding::ValueTypeMarker>::borrow),
5091 encoder,
5092 offset + cur_offset,
5093 depth,
5094 )?;
5095
5096 _prev_end_offset = cur_offset + envelope_size;
5097
5098 Ok(())
5099 }
5100 }
5101
5102 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PermissionDescriptor {
5103 #[inline(always)]
5104 fn new_empty() -> Self {
5105 Self::default()
5106 }
5107
5108 unsafe fn decode(
5109 &mut self,
5110 decoder: &mut fidl::encoding::Decoder<'_, D>,
5111 offset: usize,
5112 mut depth: fidl::encoding::Depth,
5113 ) -> fidl::Result<()> {
5114 decoder.debug_check_bounds::<Self>(offset);
5115 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5116 None => return Err(fidl::Error::NotNullable),
5117 Some(len) => len,
5118 };
5119 if len == 0 {
5121 return Ok(());
5122 };
5123 depth.increment()?;
5124 let envelope_size = 8;
5125 let bytes_len = len * envelope_size;
5126 let offset = decoder.out_of_line_offset(bytes_len)?;
5127 let mut _next_ordinal_to_read = 0;
5129 let mut next_offset = offset;
5130 let end_offset = offset + bytes_len;
5131 _next_ordinal_to_read += 1;
5132 if next_offset >= end_offset {
5133 return Ok(());
5134 }
5135
5136 while _next_ordinal_to_read < 1 {
5138 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5139 _next_ordinal_to_read += 1;
5140 next_offset += envelope_size;
5141 }
5142
5143 let next_out_of_line = decoder.next_out_of_line();
5144 let handles_before = decoder.remaining_handles();
5145 if let Some((inlined, num_bytes, num_handles)) =
5146 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5147 {
5148 let member_inline_size =
5149 <PermissionType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5150 if inlined != (member_inline_size <= 4) {
5151 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5152 }
5153 let inner_offset;
5154 let mut inner_depth = depth.clone();
5155 if inlined {
5156 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5157 inner_offset = next_offset;
5158 } else {
5159 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5160 inner_depth.increment()?;
5161 }
5162 let val_ref = self.type_.get_or_insert_with(|| fidl::new_empty!(PermissionType, D));
5163 fidl::decode!(PermissionType, D, val_ref, decoder, inner_offset, inner_depth)?;
5164 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5165 {
5166 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5167 }
5168 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5169 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5170 }
5171 }
5172
5173 next_offset += envelope_size;
5174
5175 while next_offset < end_offset {
5177 _next_ordinal_to_read += 1;
5178 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5179 next_offset += envelope_size;
5180 }
5181
5182 Ok(())
5183 }
5184 }
5185
5186 impl RequestedNavigation {
5187 #[inline(always)]
5188 fn max_ordinal_present(&self) -> u64 {
5189 if let Some(_) = self.was_server_redirect {
5190 return 8;
5191 }
5192 if let Some(_) = self.has_gesture {
5193 return 7;
5194 }
5195 if let Some(_) = self.url {
5196 return 6;
5197 }
5198 if let Some(_) = self.is_http_post {
5199 return 5;
5200 }
5201 if let Some(_) = self.is_same_document {
5202 return 4;
5203 }
5204 if let Some(_) = self.is_main_frame {
5205 return 3;
5206 }
5207 if let Some(_) = self.phase {
5208 return 2;
5209 }
5210 if let Some(_) = self.id {
5211 return 1;
5212 }
5213 0
5214 }
5215 }
5216
5217 impl fidl::encoding::ValueTypeMarker for RequestedNavigation {
5218 type Borrowed<'a> = &'a Self;
5219 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5220 value
5221 }
5222 }
5223
5224 unsafe impl fidl::encoding::TypeMarker for RequestedNavigation {
5225 type Owned = Self;
5226
5227 #[inline(always)]
5228 fn inline_align(_context: fidl::encoding::Context) -> usize {
5229 8
5230 }
5231
5232 #[inline(always)]
5233 fn inline_size(_context: fidl::encoding::Context) -> usize {
5234 16
5235 }
5236 }
5237
5238 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<RequestedNavigation, D>
5239 for &RequestedNavigation
5240 {
5241 unsafe fn encode(
5242 self,
5243 encoder: &mut fidl::encoding::Encoder<'_, D>,
5244 offset: usize,
5245 mut depth: fidl::encoding::Depth,
5246 ) -> fidl::Result<()> {
5247 encoder.debug_check_bounds::<RequestedNavigation>(offset);
5248 let max_ordinal: u64 = self.max_ordinal_present();
5250 encoder.write_num(max_ordinal, offset);
5251 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5252 if max_ordinal == 0 {
5254 return Ok(());
5255 }
5256 depth.increment()?;
5257 let envelope_size = 8;
5258 let bytes_len = max_ordinal as usize * envelope_size;
5259 #[allow(unused_variables)]
5260 let offset = encoder.out_of_line_offset(bytes_len);
5261 let mut _prev_end_offset: usize = 0;
5262 if 1 > max_ordinal {
5263 return Ok(());
5264 }
5265
5266 let cur_offset: usize = (1 - 1) * envelope_size;
5269
5270 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5272
5273 fidl::encoding::encode_in_envelope_optional::<u64, D>(
5278 self.id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
5279 encoder,
5280 offset + cur_offset,
5281 depth,
5282 )?;
5283
5284 _prev_end_offset = cur_offset + envelope_size;
5285 if 2 > max_ordinal {
5286 return Ok(());
5287 }
5288
5289 let cur_offset: usize = (2 - 1) * envelope_size;
5292
5293 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5295
5296 fidl::encoding::encode_in_envelope_optional::<NavigationPhase, D>(
5301 self.phase
5302 .as_ref()
5303 .map(<NavigationPhase as fidl::encoding::ValueTypeMarker>::borrow),
5304 encoder,
5305 offset + cur_offset,
5306 depth,
5307 )?;
5308
5309 _prev_end_offset = cur_offset + envelope_size;
5310 if 3 > max_ordinal {
5311 return Ok(());
5312 }
5313
5314 let cur_offset: usize = (3 - 1) * envelope_size;
5317
5318 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5320
5321 fidl::encoding::encode_in_envelope_optional::<bool, D>(
5326 self.is_main_frame.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
5327 encoder,
5328 offset + cur_offset,
5329 depth,
5330 )?;
5331
5332 _prev_end_offset = cur_offset + envelope_size;
5333 if 4 > max_ordinal {
5334 return Ok(());
5335 }
5336
5337 let cur_offset: usize = (4 - 1) * envelope_size;
5340
5341 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5343
5344 fidl::encoding::encode_in_envelope_optional::<bool, D>(
5349 self.is_same_document
5350 .as_ref()
5351 .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
5352 encoder,
5353 offset + cur_offset,
5354 depth,
5355 )?;
5356
5357 _prev_end_offset = cur_offset + envelope_size;
5358 if 5 > max_ordinal {
5359 return Ok(());
5360 }
5361
5362 let cur_offset: usize = (5 - 1) * envelope_size;
5365
5366 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5368
5369 fidl::encoding::encode_in_envelope_optional::<bool, D>(
5374 self.is_http_post.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
5375 encoder,
5376 offset + cur_offset,
5377 depth,
5378 )?;
5379
5380 _prev_end_offset = cur_offset + envelope_size;
5381 if 6 > max_ordinal {
5382 return Ok(());
5383 }
5384
5385 let cur_offset: usize = (6 - 1) * envelope_size;
5388
5389 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5391
5392 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<65536>, D>(
5397 self.url.as_ref().map(<fidl::encoding::BoundedString<65536> as fidl::encoding::ValueTypeMarker>::borrow),
5398 encoder, offset + cur_offset, depth
5399 )?;
5400
5401 _prev_end_offset = cur_offset + envelope_size;
5402 if 7 > max_ordinal {
5403 return Ok(());
5404 }
5405
5406 let cur_offset: usize = (7 - 1) * envelope_size;
5409
5410 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5412
5413 fidl::encoding::encode_in_envelope_optional::<bool, D>(
5418 self.has_gesture.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
5419 encoder,
5420 offset + cur_offset,
5421 depth,
5422 )?;
5423
5424 _prev_end_offset = cur_offset + envelope_size;
5425 if 8 > max_ordinal {
5426 return Ok(());
5427 }
5428
5429 let cur_offset: usize = (8 - 1) * envelope_size;
5432
5433 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5435
5436 fidl::encoding::encode_in_envelope_optional::<bool, D>(
5441 self.was_server_redirect
5442 .as_ref()
5443 .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
5444 encoder,
5445 offset + cur_offset,
5446 depth,
5447 )?;
5448
5449 _prev_end_offset = cur_offset + envelope_size;
5450
5451 Ok(())
5452 }
5453 }
5454
5455 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RequestedNavigation {
5456 #[inline(always)]
5457 fn new_empty() -> Self {
5458 Self::default()
5459 }
5460
5461 unsafe fn decode(
5462 &mut self,
5463 decoder: &mut fidl::encoding::Decoder<'_, D>,
5464 offset: usize,
5465 mut depth: fidl::encoding::Depth,
5466 ) -> fidl::Result<()> {
5467 decoder.debug_check_bounds::<Self>(offset);
5468 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5469 None => return Err(fidl::Error::NotNullable),
5470 Some(len) => len,
5471 };
5472 if len == 0 {
5474 return Ok(());
5475 };
5476 depth.increment()?;
5477 let envelope_size = 8;
5478 let bytes_len = len * envelope_size;
5479 let offset = decoder.out_of_line_offset(bytes_len)?;
5480 let mut _next_ordinal_to_read = 0;
5482 let mut next_offset = offset;
5483 let end_offset = offset + bytes_len;
5484 _next_ordinal_to_read += 1;
5485 if next_offset >= end_offset {
5486 return Ok(());
5487 }
5488
5489 while _next_ordinal_to_read < 1 {
5491 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5492 _next_ordinal_to_read += 1;
5493 next_offset += envelope_size;
5494 }
5495
5496 let next_out_of_line = decoder.next_out_of_line();
5497 let handles_before = decoder.remaining_handles();
5498 if let Some((inlined, num_bytes, num_handles)) =
5499 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5500 {
5501 let member_inline_size =
5502 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5503 if inlined != (member_inline_size <= 4) {
5504 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5505 }
5506 let inner_offset;
5507 let mut inner_depth = depth.clone();
5508 if inlined {
5509 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5510 inner_offset = next_offset;
5511 } else {
5512 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5513 inner_depth.increment()?;
5514 }
5515 let val_ref = self.id.get_or_insert_with(|| fidl::new_empty!(u64, D));
5516 fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
5517 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5518 {
5519 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5520 }
5521 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5522 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5523 }
5524 }
5525
5526 next_offset += envelope_size;
5527 _next_ordinal_to_read += 1;
5528 if next_offset >= end_offset {
5529 return Ok(());
5530 }
5531
5532 while _next_ordinal_to_read < 2 {
5534 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5535 _next_ordinal_to_read += 1;
5536 next_offset += envelope_size;
5537 }
5538
5539 let next_out_of_line = decoder.next_out_of_line();
5540 let handles_before = decoder.remaining_handles();
5541 if let Some((inlined, num_bytes, num_handles)) =
5542 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5543 {
5544 let member_inline_size =
5545 <NavigationPhase as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5546 if inlined != (member_inline_size <= 4) {
5547 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5548 }
5549 let inner_offset;
5550 let mut inner_depth = depth.clone();
5551 if inlined {
5552 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5553 inner_offset = next_offset;
5554 } else {
5555 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5556 inner_depth.increment()?;
5557 }
5558 let val_ref =
5559 self.phase.get_or_insert_with(|| fidl::new_empty!(NavigationPhase, D));
5560 fidl::decode!(NavigationPhase, D, val_ref, decoder, inner_offset, inner_depth)?;
5561 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5562 {
5563 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5564 }
5565 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5566 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5567 }
5568 }
5569
5570 next_offset += envelope_size;
5571 _next_ordinal_to_read += 1;
5572 if next_offset >= end_offset {
5573 return Ok(());
5574 }
5575
5576 while _next_ordinal_to_read < 3 {
5578 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5579 _next_ordinal_to_read += 1;
5580 next_offset += envelope_size;
5581 }
5582
5583 let next_out_of_line = decoder.next_out_of_line();
5584 let handles_before = decoder.remaining_handles();
5585 if let Some((inlined, num_bytes, num_handles)) =
5586 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5587 {
5588 let member_inline_size =
5589 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5590 if inlined != (member_inline_size <= 4) {
5591 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5592 }
5593 let inner_offset;
5594 let mut inner_depth = depth.clone();
5595 if inlined {
5596 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5597 inner_offset = next_offset;
5598 } else {
5599 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5600 inner_depth.increment()?;
5601 }
5602 let val_ref = self.is_main_frame.get_or_insert_with(|| fidl::new_empty!(bool, D));
5603 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
5604 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5605 {
5606 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5607 }
5608 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5609 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5610 }
5611 }
5612
5613 next_offset += envelope_size;
5614 _next_ordinal_to_read += 1;
5615 if next_offset >= end_offset {
5616 return Ok(());
5617 }
5618
5619 while _next_ordinal_to_read < 4 {
5621 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5622 _next_ordinal_to_read += 1;
5623 next_offset += envelope_size;
5624 }
5625
5626 let next_out_of_line = decoder.next_out_of_line();
5627 let handles_before = decoder.remaining_handles();
5628 if let Some((inlined, num_bytes, num_handles)) =
5629 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5630 {
5631 let member_inline_size =
5632 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5633 if inlined != (member_inline_size <= 4) {
5634 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5635 }
5636 let inner_offset;
5637 let mut inner_depth = depth.clone();
5638 if inlined {
5639 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5640 inner_offset = next_offset;
5641 } else {
5642 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5643 inner_depth.increment()?;
5644 }
5645 let val_ref =
5646 self.is_same_document.get_or_insert_with(|| fidl::new_empty!(bool, D));
5647 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
5648 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5649 {
5650 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5651 }
5652 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5653 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5654 }
5655 }
5656
5657 next_offset += envelope_size;
5658 _next_ordinal_to_read += 1;
5659 if next_offset >= end_offset {
5660 return Ok(());
5661 }
5662
5663 while _next_ordinal_to_read < 5 {
5665 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5666 _next_ordinal_to_read += 1;
5667 next_offset += envelope_size;
5668 }
5669
5670 let next_out_of_line = decoder.next_out_of_line();
5671 let handles_before = decoder.remaining_handles();
5672 if let Some((inlined, num_bytes, num_handles)) =
5673 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5674 {
5675 let member_inline_size =
5676 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5677 if inlined != (member_inline_size <= 4) {
5678 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5679 }
5680 let inner_offset;
5681 let mut inner_depth = depth.clone();
5682 if inlined {
5683 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5684 inner_offset = next_offset;
5685 } else {
5686 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5687 inner_depth.increment()?;
5688 }
5689 let val_ref = self.is_http_post.get_or_insert_with(|| fidl::new_empty!(bool, D));
5690 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
5691 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5692 {
5693 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5694 }
5695 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5696 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5697 }
5698 }
5699
5700 next_offset += envelope_size;
5701 _next_ordinal_to_read += 1;
5702 if next_offset >= end_offset {
5703 return Ok(());
5704 }
5705
5706 while _next_ordinal_to_read < 6 {
5708 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5709 _next_ordinal_to_read += 1;
5710 next_offset += envelope_size;
5711 }
5712
5713 let next_out_of_line = decoder.next_out_of_line();
5714 let handles_before = decoder.remaining_handles();
5715 if let Some((inlined, num_bytes, num_handles)) =
5716 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5717 {
5718 let member_inline_size = <fidl::encoding::BoundedString<65536> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5719 if inlined != (member_inline_size <= 4) {
5720 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5721 }
5722 let inner_offset;
5723 let mut inner_depth = depth.clone();
5724 if inlined {
5725 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5726 inner_offset = next_offset;
5727 } else {
5728 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5729 inner_depth.increment()?;
5730 }
5731 let val_ref = self.url.get_or_insert_with(|| {
5732 fidl::new_empty!(fidl::encoding::BoundedString<65536>, D)
5733 });
5734 fidl::decode!(
5735 fidl::encoding::BoundedString<65536>,
5736 D,
5737 val_ref,
5738 decoder,
5739 inner_offset,
5740 inner_depth
5741 )?;
5742 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5743 {
5744 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5745 }
5746 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5747 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5748 }
5749 }
5750
5751 next_offset += envelope_size;
5752 _next_ordinal_to_read += 1;
5753 if next_offset >= end_offset {
5754 return Ok(());
5755 }
5756
5757 while _next_ordinal_to_read < 7 {
5759 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5760 _next_ordinal_to_read += 1;
5761 next_offset += envelope_size;
5762 }
5763
5764 let next_out_of_line = decoder.next_out_of_line();
5765 let handles_before = decoder.remaining_handles();
5766 if let Some((inlined, num_bytes, num_handles)) =
5767 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5768 {
5769 let member_inline_size =
5770 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5771 if inlined != (member_inline_size <= 4) {
5772 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5773 }
5774 let inner_offset;
5775 let mut inner_depth = depth.clone();
5776 if inlined {
5777 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5778 inner_offset = next_offset;
5779 } else {
5780 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5781 inner_depth.increment()?;
5782 }
5783 let val_ref = self.has_gesture.get_or_insert_with(|| fidl::new_empty!(bool, D));
5784 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
5785 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5786 {
5787 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5788 }
5789 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5790 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5791 }
5792 }
5793
5794 next_offset += envelope_size;
5795 _next_ordinal_to_read += 1;
5796 if next_offset >= end_offset {
5797 return Ok(());
5798 }
5799
5800 while _next_ordinal_to_read < 8 {
5802 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5803 _next_ordinal_to_read += 1;
5804 next_offset += envelope_size;
5805 }
5806
5807 let next_out_of_line = decoder.next_out_of_line();
5808 let handles_before = decoder.remaining_handles();
5809 if let Some((inlined, num_bytes, num_handles)) =
5810 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5811 {
5812 let member_inline_size =
5813 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5814 if inlined != (member_inline_size <= 4) {
5815 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5816 }
5817 let inner_offset;
5818 let mut inner_depth = depth.clone();
5819 if inlined {
5820 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5821 inner_offset = next_offset;
5822 } else {
5823 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5824 inner_depth.increment()?;
5825 }
5826 let val_ref =
5827 self.was_server_redirect.get_or_insert_with(|| fidl::new_empty!(bool, D));
5828 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
5829 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5830 {
5831 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5832 }
5833 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5834 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5835 }
5836 }
5837
5838 next_offset += envelope_size;
5839
5840 while next_offset < end_offset {
5842 _next_ordinal_to_read += 1;
5843 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5844 next_offset += envelope_size;
5845 }
5846
5847 Ok(())
5848 }
5849 }
5850
5851 impl UrlRequestRewriteAddHeaders {
5852 #[inline(always)]
5853 fn max_ordinal_present(&self) -> u64 {
5854 if let Some(_) = self.headers {
5855 return 1;
5856 }
5857 0
5858 }
5859 }
5860
5861 impl fidl::encoding::ValueTypeMarker for UrlRequestRewriteAddHeaders {
5862 type Borrowed<'a> = &'a Self;
5863 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5864 value
5865 }
5866 }
5867
5868 unsafe impl fidl::encoding::TypeMarker for UrlRequestRewriteAddHeaders {
5869 type Owned = Self;
5870
5871 #[inline(always)]
5872 fn inline_align(_context: fidl::encoding::Context) -> usize {
5873 8
5874 }
5875
5876 #[inline(always)]
5877 fn inline_size(_context: fidl::encoding::Context) -> usize {
5878 16
5879 }
5880 }
5881
5882 unsafe impl<D: fidl::encoding::ResourceDialect>
5883 fidl::encoding::Encode<UrlRequestRewriteAddHeaders, D> for &UrlRequestRewriteAddHeaders
5884 {
5885 unsafe fn encode(
5886 self,
5887 encoder: &mut fidl::encoding::Encoder<'_, D>,
5888 offset: usize,
5889 mut depth: fidl::encoding::Depth,
5890 ) -> fidl::Result<()> {
5891 encoder.debug_check_bounds::<UrlRequestRewriteAddHeaders>(offset);
5892 let max_ordinal: u64 = self.max_ordinal_present();
5894 encoder.write_num(max_ordinal, offset);
5895 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5896 if max_ordinal == 0 {
5898 return Ok(());
5899 }
5900 depth.increment()?;
5901 let envelope_size = 8;
5902 let bytes_len = max_ordinal as usize * envelope_size;
5903 #[allow(unused_variables)]
5904 let offset = encoder.out_of_line_offset(bytes_len);
5905 let mut _prev_end_offset: usize = 0;
5906 if 1 > max_ordinal {
5907 return Ok(());
5908 }
5909
5910 let cur_offset: usize = (1 - 1) * envelope_size;
5913
5914 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5916
5917 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_net_http::Header, 4096>, D>(
5922 self.headers.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_net_http::Header, 4096> as fidl::encoding::ValueTypeMarker>::borrow),
5923 encoder, offset + cur_offset, depth
5924 )?;
5925
5926 _prev_end_offset = cur_offset + envelope_size;
5927
5928 Ok(())
5929 }
5930 }
5931
5932 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
5933 for UrlRequestRewriteAddHeaders
5934 {
5935 #[inline(always)]
5936 fn new_empty() -> Self {
5937 Self::default()
5938 }
5939
5940 unsafe fn decode(
5941 &mut self,
5942 decoder: &mut fidl::encoding::Decoder<'_, D>,
5943 offset: usize,
5944 mut depth: fidl::encoding::Depth,
5945 ) -> fidl::Result<()> {
5946 decoder.debug_check_bounds::<Self>(offset);
5947 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5948 None => return Err(fidl::Error::NotNullable),
5949 Some(len) => len,
5950 };
5951 if len == 0 {
5953 return Ok(());
5954 };
5955 depth.increment()?;
5956 let envelope_size = 8;
5957 let bytes_len = len * envelope_size;
5958 let offset = decoder.out_of_line_offset(bytes_len)?;
5959 let mut _next_ordinal_to_read = 0;
5961 let mut next_offset = offset;
5962 let end_offset = offset + bytes_len;
5963 _next_ordinal_to_read += 1;
5964 if next_offset >= end_offset {
5965 return Ok(());
5966 }
5967
5968 while _next_ordinal_to_read < 1 {
5970 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5971 _next_ordinal_to_read += 1;
5972 next_offset += envelope_size;
5973 }
5974
5975 let next_out_of_line = decoder.next_out_of_line();
5976 let handles_before = decoder.remaining_handles();
5977 if let Some((inlined, num_bytes, num_handles)) =
5978 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5979 {
5980 let member_inline_size = <fidl::encoding::Vector<
5981 fidl_fuchsia_net_http::Header,
5982 4096,
5983 > as fidl::encoding::TypeMarker>::inline_size(
5984 decoder.context
5985 );
5986 if inlined != (member_inline_size <= 4) {
5987 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5988 }
5989 let inner_offset;
5990 let mut inner_depth = depth.clone();
5991 if inlined {
5992 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5993 inner_offset = next_offset;
5994 } else {
5995 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5996 inner_depth.increment()?;
5997 }
5998 let val_ref =
5999 self.headers.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_net_http::Header, 4096>, D));
6000 fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_net_http::Header, 4096>, D, val_ref, decoder, inner_offset, inner_depth)?;
6001 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6002 {
6003 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6004 }
6005 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6006 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6007 }
6008 }
6009
6010 next_offset += envelope_size;
6011
6012 while next_offset < end_offset {
6014 _next_ordinal_to_read += 1;
6015 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6016 next_offset += envelope_size;
6017 }
6018
6019 Ok(())
6020 }
6021 }
6022
6023 impl UrlRequestRewriteAppendToQuery {
6024 #[inline(always)]
6025 fn max_ordinal_present(&self) -> u64 {
6026 if let Some(_) = self.query {
6027 return 1;
6028 }
6029 0
6030 }
6031 }
6032
6033 impl fidl::encoding::ValueTypeMarker for UrlRequestRewriteAppendToQuery {
6034 type Borrowed<'a> = &'a Self;
6035 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6036 value
6037 }
6038 }
6039
6040 unsafe impl fidl::encoding::TypeMarker for UrlRequestRewriteAppendToQuery {
6041 type Owned = Self;
6042
6043 #[inline(always)]
6044 fn inline_align(_context: fidl::encoding::Context) -> usize {
6045 8
6046 }
6047
6048 #[inline(always)]
6049 fn inline_size(_context: fidl::encoding::Context) -> usize {
6050 16
6051 }
6052 }
6053
6054 unsafe impl<D: fidl::encoding::ResourceDialect>
6055 fidl::encoding::Encode<UrlRequestRewriteAppendToQuery, D>
6056 for &UrlRequestRewriteAppendToQuery
6057 {
6058 unsafe fn encode(
6059 self,
6060 encoder: &mut fidl::encoding::Encoder<'_, D>,
6061 offset: usize,
6062 mut depth: fidl::encoding::Depth,
6063 ) -> fidl::Result<()> {
6064 encoder.debug_check_bounds::<UrlRequestRewriteAppendToQuery>(offset);
6065 let max_ordinal: u64 = self.max_ordinal_present();
6067 encoder.write_num(max_ordinal, offset);
6068 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6069 if max_ordinal == 0 {
6071 return Ok(());
6072 }
6073 depth.increment()?;
6074 let envelope_size = 8;
6075 let bytes_len = max_ordinal as usize * envelope_size;
6076 #[allow(unused_variables)]
6077 let offset = encoder.out_of_line_offset(bytes_len);
6078 let mut _prev_end_offset: usize = 0;
6079 if 1 > max_ordinal {
6080 return Ok(());
6081 }
6082
6083 let cur_offset: usize = (1 - 1) * envelope_size;
6086
6087 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6089
6090 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<65536>, D>(
6095 self.query.as_ref().map(<fidl::encoding::BoundedString<65536> as fidl::encoding::ValueTypeMarker>::borrow),
6096 encoder, offset + cur_offset, depth
6097 )?;
6098
6099 _prev_end_offset = cur_offset + envelope_size;
6100
6101 Ok(())
6102 }
6103 }
6104
6105 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
6106 for UrlRequestRewriteAppendToQuery
6107 {
6108 #[inline(always)]
6109 fn new_empty() -> Self {
6110 Self::default()
6111 }
6112
6113 unsafe fn decode(
6114 &mut self,
6115 decoder: &mut fidl::encoding::Decoder<'_, D>,
6116 offset: usize,
6117 mut depth: fidl::encoding::Depth,
6118 ) -> fidl::Result<()> {
6119 decoder.debug_check_bounds::<Self>(offset);
6120 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6121 None => return Err(fidl::Error::NotNullable),
6122 Some(len) => len,
6123 };
6124 if len == 0 {
6126 return Ok(());
6127 };
6128 depth.increment()?;
6129 let envelope_size = 8;
6130 let bytes_len = len * envelope_size;
6131 let offset = decoder.out_of_line_offset(bytes_len)?;
6132 let mut _next_ordinal_to_read = 0;
6134 let mut next_offset = offset;
6135 let end_offset = offset + bytes_len;
6136 _next_ordinal_to_read += 1;
6137 if next_offset >= end_offset {
6138 return Ok(());
6139 }
6140
6141 while _next_ordinal_to_read < 1 {
6143 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6144 _next_ordinal_to_read += 1;
6145 next_offset += envelope_size;
6146 }
6147
6148 let next_out_of_line = decoder.next_out_of_line();
6149 let handles_before = decoder.remaining_handles();
6150 if let Some((inlined, num_bytes, num_handles)) =
6151 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6152 {
6153 let member_inline_size = <fidl::encoding::BoundedString<65536> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6154 if inlined != (member_inline_size <= 4) {
6155 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6156 }
6157 let inner_offset;
6158 let mut inner_depth = depth.clone();
6159 if inlined {
6160 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6161 inner_offset = next_offset;
6162 } else {
6163 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6164 inner_depth.increment()?;
6165 }
6166 let val_ref = self.query.get_or_insert_with(|| {
6167 fidl::new_empty!(fidl::encoding::BoundedString<65536>, D)
6168 });
6169 fidl::decode!(
6170 fidl::encoding::BoundedString<65536>,
6171 D,
6172 val_ref,
6173 decoder,
6174 inner_offset,
6175 inner_depth
6176 )?;
6177 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6178 {
6179 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6180 }
6181 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6182 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6183 }
6184 }
6185
6186 next_offset += envelope_size;
6187
6188 while next_offset < end_offset {
6190 _next_ordinal_to_read += 1;
6191 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6192 next_offset += envelope_size;
6193 }
6194
6195 Ok(())
6196 }
6197 }
6198
6199 impl UrlRequestRewriteRemoveHeader {
6200 #[inline(always)]
6201 fn max_ordinal_present(&self) -> u64 {
6202 if let Some(_) = self.header_name {
6203 return 2;
6204 }
6205 if let Some(_) = self.query_pattern {
6206 return 1;
6207 }
6208 0
6209 }
6210 }
6211
6212 impl fidl::encoding::ValueTypeMarker for UrlRequestRewriteRemoveHeader {
6213 type Borrowed<'a> = &'a Self;
6214 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6215 value
6216 }
6217 }
6218
6219 unsafe impl fidl::encoding::TypeMarker for UrlRequestRewriteRemoveHeader {
6220 type Owned = Self;
6221
6222 #[inline(always)]
6223 fn inline_align(_context: fidl::encoding::Context) -> usize {
6224 8
6225 }
6226
6227 #[inline(always)]
6228 fn inline_size(_context: fidl::encoding::Context) -> usize {
6229 16
6230 }
6231 }
6232
6233 unsafe impl<D: fidl::encoding::ResourceDialect>
6234 fidl::encoding::Encode<UrlRequestRewriteRemoveHeader, D>
6235 for &UrlRequestRewriteRemoveHeader
6236 {
6237 unsafe fn encode(
6238 self,
6239 encoder: &mut fidl::encoding::Encoder<'_, D>,
6240 offset: usize,
6241 mut depth: fidl::encoding::Depth,
6242 ) -> fidl::Result<()> {
6243 encoder.debug_check_bounds::<UrlRequestRewriteRemoveHeader>(offset);
6244 let max_ordinal: u64 = self.max_ordinal_present();
6246 encoder.write_num(max_ordinal, offset);
6247 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6248 if max_ordinal == 0 {
6250 return Ok(());
6251 }
6252 depth.increment()?;
6253 let envelope_size = 8;
6254 let bytes_len = max_ordinal as usize * envelope_size;
6255 #[allow(unused_variables)]
6256 let offset = encoder.out_of_line_offset(bytes_len);
6257 let mut _prev_end_offset: usize = 0;
6258 if 1 > max_ordinal {
6259 return Ok(());
6260 }
6261
6262 let cur_offset: usize = (1 - 1) * envelope_size;
6265
6266 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6268
6269 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<65536>, D>(
6274 self.query_pattern.as_ref().map(<fidl::encoding::BoundedString<65536> as fidl::encoding::ValueTypeMarker>::borrow),
6275 encoder, offset + cur_offset, depth
6276 )?;
6277
6278 _prev_end_offset = cur_offset + envelope_size;
6279 if 2 > max_ordinal {
6280 return Ok(());
6281 }
6282
6283 let cur_offset: usize = (2 - 1) * envelope_size;
6286
6287 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6289
6290 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<u8>, D>(
6295 self.header_name.as_ref().map(<fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow),
6296 encoder, offset + cur_offset, depth
6297 )?;
6298
6299 _prev_end_offset = cur_offset + envelope_size;
6300
6301 Ok(())
6302 }
6303 }
6304
6305 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
6306 for UrlRequestRewriteRemoveHeader
6307 {
6308 #[inline(always)]
6309 fn new_empty() -> Self {
6310 Self::default()
6311 }
6312
6313 unsafe fn decode(
6314 &mut self,
6315 decoder: &mut fidl::encoding::Decoder<'_, D>,
6316 offset: usize,
6317 mut depth: fidl::encoding::Depth,
6318 ) -> fidl::Result<()> {
6319 decoder.debug_check_bounds::<Self>(offset);
6320 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6321 None => return Err(fidl::Error::NotNullable),
6322 Some(len) => len,
6323 };
6324 if len == 0 {
6326 return Ok(());
6327 };
6328 depth.increment()?;
6329 let envelope_size = 8;
6330 let bytes_len = len * envelope_size;
6331 let offset = decoder.out_of_line_offset(bytes_len)?;
6332 let mut _next_ordinal_to_read = 0;
6334 let mut next_offset = offset;
6335 let end_offset = offset + bytes_len;
6336 _next_ordinal_to_read += 1;
6337 if next_offset >= end_offset {
6338 return Ok(());
6339 }
6340
6341 while _next_ordinal_to_read < 1 {
6343 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6344 _next_ordinal_to_read += 1;
6345 next_offset += envelope_size;
6346 }
6347
6348 let next_out_of_line = decoder.next_out_of_line();
6349 let handles_before = decoder.remaining_handles();
6350 if let Some((inlined, num_bytes, num_handles)) =
6351 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6352 {
6353 let member_inline_size = <fidl::encoding::BoundedString<65536> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6354 if inlined != (member_inline_size <= 4) {
6355 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6356 }
6357 let inner_offset;
6358 let mut inner_depth = depth.clone();
6359 if inlined {
6360 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6361 inner_offset = next_offset;
6362 } else {
6363 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6364 inner_depth.increment()?;
6365 }
6366 let val_ref = self.query_pattern.get_or_insert_with(|| {
6367 fidl::new_empty!(fidl::encoding::BoundedString<65536>, D)
6368 });
6369 fidl::decode!(
6370 fidl::encoding::BoundedString<65536>,
6371 D,
6372 val_ref,
6373 decoder,
6374 inner_offset,
6375 inner_depth
6376 )?;
6377 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6378 {
6379 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6380 }
6381 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6382 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6383 }
6384 }
6385
6386 next_offset += envelope_size;
6387 _next_ordinal_to_read += 1;
6388 if next_offset >= end_offset {
6389 return Ok(());
6390 }
6391
6392 while _next_ordinal_to_read < 2 {
6394 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6395 _next_ordinal_to_read += 1;
6396 next_offset += envelope_size;
6397 }
6398
6399 let next_out_of_line = decoder.next_out_of_line();
6400 let handles_before = decoder.remaining_handles();
6401 if let Some((inlined, num_bytes, num_handles)) =
6402 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6403 {
6404 let member_inline_size = <fidl::encoding::UnboundedVector<u8> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6405 if inlined != (member_inline_size <= 4) {
6406 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6407 }
6408 let inner_offset;
6409 let mut inner_depth = depth.clone();
6410 if inlined {
6411 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6412 inner_offset = next_offset;
6413 } else {
6414 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6415 inner_depth.increment()?;
6416 }
6417 let val_ref = self.header_name.get_or_insert_with(|| {
6418 fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D)
6419 });
6420 fidl::decode!(
6421 fidl::encoding::UnboundedVector<u8>,
6422 D,
6423 val_ref,
6424 decoder,
6425 inner_offset,
6426 inner_depth
6427 )?;
6428 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6429 {
6430 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6431 }
6432 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6433 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6434 }
6435 }
6436
6437 next_offset += envelope_size;
6438
6439 while next_offset < end_offset {
6441 _next_ordinal_to_read += 1;
6442 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6443 next_offset += envelope_size;
6444 }
6445
6446 Ok(())
6447 }
6448 }
6449
6450 impl UrlRequestRewriteReplaceUrl {
6451 #[inline(always)]
6452 fn max_ordinal_present(&self) -> u64 {
6453 if let Some(_) = self.new_url {
6454 return 2;
6455 }
6456 if let Some(_) = self.url_ends_with {
6457 return 1;
6458 }
6459 0
6460 }
6461 }
6462
6463 impl fidl::encoding::ValueTypeMarker for UrlRequestRewriteReplaceUrl {
6464 type Borrowed<'a> = &'a Self;
6465 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6466 value
6467 }
6468 }
6469
6470 unsafe impl fidl::encoding::TypeMarker for UrlRequestRewriteReplaceUrl {
6471 type Owned = Self;
6472
6473 #[inline(always)]
6474 fn inline_align(_context: fidl::encoding::Context) -> usize {
6475 8
6476 }
6477
6478 #[inline(always)]
6479 fn inline_size(_context: fidl::encoding::Context) -> usize {
6480 16
6481 }
6482 }
6483
6484 unsafe impl<D: fidl::encoding::ResourceDialect>
6485 fidl::encoding::Encode<UrlRequestRewriteReplaceUrl, D> for &UrlRequestRewriteReplaceUrl
6486 {
6487 unsafe fn encode(
6488 self,
6489 encoder: &mut fidl::encoding::Encoder<'_, D>,
6490 offset: usize,
6491 mut depth: fidl::encoding::Depth,
6492 ) -> fidl::Result<()> {
6493 encoder.debug_check_bounds::<UrlRequestRewriteReplaceUrl>(offset);
6494 let max_ordinal: u64 = self.max_ordinal_present();
6496 encoder.write_num(max_ordinal, offset);
6497 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6498 if max_ordinal == 0 {
6500 return Ok(());
6501 }
6502 depth.increment()?;
6503 let envelope_size = 8;
6504 let bytes_len = max_ordinal as usize * envelope_size;
6505 #[allow(unused_variables)]
6506 let offset = encoder.out_of_line_offset(bytes_len);
6507 let mut _prev_end_offset: usize = 0;
6508 if 1 > max_ordinal {
6509 return Ok(());
6510 }
6511
6512 let cur_offset: usize = (1 - 1) * envelope_size;
6515
6516 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6518
6519 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<65536>, D>(
6524 self.url_ends_with.as_ref().map(<fidl::encoding::BoundedString<65536> as fidl::encoding::ValueTypeMarker>::borrow),
6525 encoder, offset + cur_offset, depth
6526 )?;
6527
6528 _prev_end_offset = cur_offset + envelope_size;
6529 if 2 > max_ordinal {
6530 return Ok(());
6531 }
6532
6533 let cur_offset: usize = (2 - 1) * envelope_size;
6536
6537 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6539
6540 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<65536>, D>(
6545 self.new_url.as_ref().map(<fidl::encoding::BoundedString<65536> as fidl::encoding::ValueTypeMarker>::borrow),
6546 encoder, offset + cur_offset, depth
6547 )?;
6548
6549 _prev_end_offset = cur_offset + envelope_size;
6550
6551 Ok(())
6552 }
6553 }
6554
6555 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
6556 for UrlRequestRewriteReplaceUrl
6557 {
6558 #[inline(always)]
6559 fn new_empty() -> Self {
6560 Self::default()
6561 }
6562
6563 unsafe fn decode(
6564 &mut self,
6565 decoder: &mut fidl::encoding::Decoder<'_, D>,
6566 offset: usize,
6567 mut depth: fidl::encoding::Depth,
6568 ) -> fidl::Result<()> {
6569 decoder.debug_check_bounds::<Self>(offset);
6570 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6571 None => return Err(fidl::Error::NotNullable),
6572 Some(len) => len,
6573 };
6574 if len == 0 {
6576 return Ok(());
6577 };
6578 depth.increment()?;
6579 let envelope_size = 8;
6580 let bytes_len = len * envelope_size;
6581 let offset = decoder.out_of_line_offset(bytes_len)?;
6582 let mut _next_ordinal_to_read = 0;
6584 let mut next_offset = offset;
6585 let end_offset = offset + bytes_len;
6586 _next_ordinal_to_read += 1;
6587 if next_offset >= end_offset {
6588 return Ok(());
6589 }
6590
6591 while _next_ordinal_to_read < 1 {
6593 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6594 _next_ordinal_to_read += 1;
6595 next_offset += envelope_size;
6596 }
6597
6598 let next_out_of_line = decoder.next_out_of_line();
6599 let handles_before = decoder.remaining_handles();
6600 if let Some((inlined, num_bytes, num_handles)) =
6601 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6602 {
6603 let member_inline_size = <fidl::encoding::BoundedString<65536> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6604 if inlined != (member_inline_size <= 4) {
6605 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6606 }
6607 let inner_offset;
6608 let mut inner_depth = depth.clone();
6609 if inlined {
6610 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6611 inner_offset = next_offset;
6612 } else {
6613 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6614 inner_depth.increment()?;
6615 }
6616 let val_ref = self.url_ends_with.get_or_insert_with(|| {
6617 fidl::new_empty!(fidl::encoding::BoundedString<65536>, D)
6618 });
6619 fidl::decode!(
6620 fidl::encoding::BoundedString<65536>,
6621 D,
6622 val_ref,
6623 decoder,
6624 inner_offset,
6625 inner_depth
6626 )?;
6627 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6628 {
6629 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6630 }
6631 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6632 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6633 }
6634 }
6635
6636 next_offset += envelope_size;
6637 _next_ordinal_to_read += 1;
6638 if next_offset >= end_offset {
6639 return Ok(());
6640 }
6641
6642 while _next_ordinal_to_read < 2 {
6644 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6645 _next_ordinal_to_read += 1;
6646 next_offset += envelope_size;
6647 }
6648
6649 let next_out_of_line = decoder.next_out_of_line();
6650 let handles_before = decoder.remaining_handles();
6651 if let Some((inlined, num_bytes, num_handles)) =
6652 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6653 {
6654 let member_inline_size = <fidl::encoding::BoundedString<65536> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6655 if inlined != (member_inline_size <= 4) {
6656 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6657 }
6658 let inner_offset;
6659 let mut inner_depth = depth.clone();
6660 if inlined {
6661 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6662 inner_offset = next_offset;
6663 } else {
6664 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6665 inner_depth.increment()?;
6666 }
6667 let val_ref = self.new_url.get_or_insert_with(|| {
6668 fidl::new_empty!(fidl::encoding::BoundedString<65536>, D)
6669 });
6670 fidl::decode!(
6671 fidl::encoding::BoundedString<65536>,
6672 D,
6673 val_ref,
6674 decoder,
6675 inner_offset,
6676 inner_depth
6677 )?;
6678 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6679 {
6680 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6681 }
6682 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6683 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6684 }
6685 }
6686
6687 next_offset += envelope_size;
6688
6689 while next_offset < end_offset {
6691 _next_ordinal_to_read += 1;
6692 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6693 next_offset += envelope_size;
6694 }
6695
6696 Ok(())
6697 }
6698 }
6699
6700 impl UrlRequestRewriteRule {
6701 #[inline(always)]
6702 fn max_ordinal_present(&self) -> u64 {
6703 if let Some(_) = self.action {
6704 return 4;
6705 }
6706 if let Some(_) = self.rewrites {
6707 return 3;
6708 }
6709 if let Some(_) = self.schemes_filter {
6710 return 2;
6711 }
6712 if let Some(_) = self.hosts_filter {
6713 return 1;
6714 }
6715 0
6716 }
6717 }
6718
6719 impl fidl::encoding::ValueTypeMarker for UrlRequestRewriteRule {
6720 type Borrowed<'a> = &'a Self;
6721 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6722 value
6723 }
6724 }
6725
6726 unsafe impl fidl::encoding::TypeMarker for UrlRequestRewriteRule {
6727 type Owned = Self;
6728
6729 #[inline(always)]
6730 fn inline_align(_context: fidl::encoding::Context) -> usize {
6731 8
6732 }
6733
6734 #[inline(always)]
6735 fn inline_size(_context: fidl::encoding::Context) -> usize {
6736 16
6737 }
6738 }
6739
6740 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<UrlRequestRewriteRule, D>
6741 for &UrlRequestRewriteRule
6742 {
6743 unsafe fn encode(
6744 self,
6745 encoder: &mut fidl::encoding::Encoder<'_, D>,
6746 offset: usize,
6747 mut depth: fidl::encoding::Depth,
6748 ) -> fidl::Result<()> {
6749 encoder.debug_check_bounds::<UrlRequestRewriteRule>(offset);
6750 let max_ordinal: u64 = self.max_ordinal_present();
6752 encoder.write_num(max_ordinal, offset);
6753 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6754 if max_ordinal == 0 {
6756 return Ok(());
6757 }
6758 depth.increment()?;
6759 let envelope_size = 8;
6760 let bytes_len = max_ordinal as usize * envelope_size;
6761 #[allow(unused_variables)]
6762 let offset = encoder.out_of_line_offset(bytes_len);
6763 let mut _prev_end_offset: usize = 0;
6764 if 1 > max_ordinal {
6765 return Ok(());
6766 }
6767
6768 let cur_offset: usize = (1 - 1) * envelope_size;
6771
6772 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6774
6775 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl::encoding::BoundedString<255>, 4096>, D>(
6780 self.hosts_filter.as_ref().map(<fidl::encoding::Vector<fidl::encoding::BoundedString<255>, 4096> as fidl::encoding::ValueTypeMarker>::borrow),
6781 encoder, offset + cur_offset, depth
6782 )?;
6783
6784 _prev_end_offset = cur_offset + envelope_size;
6785 if 2 > max_ordinal {
6786 return Ok(());
6787 }
6788
6789 let cur_offset: usize = (2 - 1) * envelope_size;
6792
6793 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6795
6796 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl::encoding::BoundedString<255>, 4096>, D>(
6801 self.schemes_filter.as_ref().map(<fidl::encoding::Vector<fidl::encoding::BoundedString<255>, 4096> as fidl::encoding::ValueTypeMarker>::borrow),
6802 encoder, offset + cur_offset, depth
6803 )?;
6804
6805 _prev_end_offset = cur_offset + envelope_size;
6806 if 3 > max_ordinal {
6807 return Ok(());
6808 }
6809
6810 let cur_offset: usize = (3 - 1) * envelope_size;
6813
6814 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6816
6817 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<UrlRequestRewrite, 4096>, D>(
6822 self.rewrites.as_ref().map(<fidl::encoding::Vector<UrlRequestRewrite, 4096> as fidl::encoding::ValueTypeMarker>::borrow),
6823 encoder, offset + cur_offset, depth
6824 )?;
6825
6826 _prev_end_offset = cur_offset + envelope_size;
6827 if 4 > max_ordinal {
6828 return Ok(());
6829 }
6830
6831 let cur_offset: usize = (4 - 1) * envelope_size;
6834
6835 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6837
6838 fidl::encoding::encode_in_envelope_optional::<UrlRequestAction, D>(
6843 self.action
6844 .as_ref()
6845 .map(<UrlRequestAction as fidl::encoding::ValueTypeMarker>::borrow),
6846 encoder,
6847 offset + cur_offset,
6848 depth,
6849 )?;
6850
6851 _prev_end_offset = cur_offset + envelope_size;
6852
6853 Ok(())
6854 }
6855 }
6856
6857 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for UrlRequestRewriteRule {
6858 #[inline(always)]
6859 fn new_empty() -> Self {
6860 Self::default()
6861 }
6862
6863 unsafe fn decode(
6864 &mut self,
6865 decoder: &mut fidl::encoding::Decoder<'_, D>,
6866 offset: usize,
6867 mut depth: fidl::encoding::Depth,
6868 ) -> fidl::Result<()> {
6869 decoder.debug_check_bounds::<Self>(offset);
6870 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6871 None => return Err(fidl::Error::NotNullable),
6872 Some(len) => len,
6873 };
6874 if len == 0 {
6876 return Ok(());
6877 };
6878 depth.increment()?;
6879 let envelope_size = 8;
6880 let bytes_len = len * envelope_size;
6881 let offset = decoder.out_of_line_offset(bytes_len)?;
6882 let mut _next_ordinal_to_read = 0;
6884 let mut next_offset = offset;
6885 let end_offset = offset + bytes_len;
6886 _next_ordinal_to_read += 1;
6887 if next_offset >= end_offset {
6888 return Ok(());
6889 }
6890
6891 while _next_ordinal_to_read < 1 {
6893 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6894 _next_ordinal_to_read += 1;
6895 next_offset += envelope_size;
6896 }
6897
6898 let next_out_of_line = decoder.next_out_of_line();
6899 let handles_before = decoder.remaining_handles();
6900 if let Some((inlined, num_bytes, num_handles)) =
6901 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6902 {
6903 let member_inline_size = <fidl::encoding::Vector<
6904 fidl::encoding::BoundedString<255>,
6905 4096,
6906 > as fidl::encoding::TypeMarker>::inline_size(
6907 decoder.context
6908 );
6909 if inlined != (member_inline_size <= 4) {
6910 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6911 }
6912 let inner_offset;
6913 let mut inner_depth = depth.clone();
6914 if inlined {
6915 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6916 inner_offset = next_offset;
6917 } else {
6918 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6919 inner_depth.increment()?;
6920 }
6921 let val_ref = self.hosts_filter.get_or_insert_with(|| {
6922 fidl::new_empty!(
6923 fidl::encoding::Vector<fidl::encoding::BoundedString<255>, 4096>,
6924 D
6925 )
6926 });
6927 fidl::decode!(
6928 fidl::encoding::Vector<fidl::encoding::BoundedString<255>, 4096>,
6929 D,
6930 val_ref,
6931 decoder,
6932 inner_offset,
6933 inner_depth
6934 )?;
6935 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6936 {
6937 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6938 }
6939 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6940 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6941 }
6942 }
6943
6944 next_offset += envelope_size;
6945 _next_ordinal_to_read += 1;
6946 if next_offset >= end_offset {
6947 return Ok(());
6948 }
6949
6950 while _next_ordinal_to_read < 2 {
6952 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6953 _next_ordinal_to_read += 1;
6954 next_offset += envelope_size;
6955 }
6956
6957 let next_out_of_line = decoder.next_out_of_line();
6958 let handles_before = decoder.remaining_handles();
6959 if let Some((inlined, num_bytes, num_handles)) =
6960 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6961 {
6962 let member_inline_size = <fidl::encoding::Vector<
6963 fidl::encoding::BoundedString<255>,
6964 4096,
6965 > as fidl::encoding::TypeMarker>::inline_size(
6966 decoder.context
6967 );
6968 if inlined != (member_inline_size <= 4) {
6969 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6970 }
6971 let inner_offset;
6972 let mut inner_depth = depth.clone();
6973 if inlined {
6974 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6975 inner_offset = next_offset;
6976 } else {
6977 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6978 inner_depth.increment()?;
6979 }
6980 let val_ref = self.schemes_filter.get_or_insert_with(|| {
6981 fidl::new_empty!(
6982 fidl::encoding::Vector<fidl::encoding::BoundedString<255>, 4096>,
6983 D
6984 )
6985 });
6986 fidl::decode!(
6987 fidl::encoding::Vector<fidl::encoding::BoundedString<255>, 4096>,
6988 D,
6989 val_ref,
6990 decoder,
6991 inner_offset,
6992 inner_depth
6993 )?;
6994 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6995 {
6996 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6997 }
6998 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6999 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7000 }
7001 }
7002
7003 next_offset += envelope_size;
7004 _next_ordinal_to_read += 1;
7005 if next_offset >= end_offset {
7006 return Ok(());
7007 }
7008
7009 while _next_ordinal_to_read < 3 {
7011 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7012 _next_ordinal_to_read += 1;
7013 next_offset += envelope_size;
7014 }
7015
7016 let next_out_of_line = decoder.next_out_of_line();
7017 let handles_before = decoder.remaining_handles();
7018 if let Some((inlined, num_bytes, num_handles)) =
7019 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7020 {
7021 let member_inline_size = <fidl::encoding::Vector<UrlRequestRewrite, 4096> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7022 if inlined != (member_inline_size <= 4) {
7023 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7024 }
7025 let inner_offset;
7026 let mut inner_depth = depth.clone();
7027 if inlined {
7028 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7029 inner_offset = next_offset;
7030 } else {
7031 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7032 inner_depth.increment()?;
7033 }
7034 let val_ref = self.rewrites.get_or_insert_with(
7035 || fidl::new_empty!(fidl::encoding::Vector<UrlRequestRewrite, 4096>, D),
7036 );
7037 fidl::decode!(fidl::encoding::Vector<UrlRequestRewrite, 4096>, D, val_ref, decoder, inner_offset, inner_depth)?;
7038 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7039 {
7040 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7041 }
7042 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7043 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7044 }
7045 }
7046
7047 next_offset += envelope_size;
7048 _next_ordinal_to_read += 1;
7049 if next_offset >= end_offset {
7050 return Ok(());
7051 }
7052
7053 while _next_ordinal_to_read < 4 {
7055 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7056 _next_ordinal_to_read += 1;
7057 next_offset += envelope_size;
7058 }
7059
7060 let next_out_of_line = decoder.next_out_of_line();
7061 let handles_before = decoder.remaining_handles();
7062 if let Some((inlined, num_bytes, num_handles)) =
7063 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7064 {
7065 let member_inline_size =
7066 <UrlRequestAction as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7067 if inlined != (member_inline_size <= 4) {
7068 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7069 }
7070 let inner_offset;
7071 let mut inner_depth = depth.clone();
7072 if inlined {
7073 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7074 inner_offset = next_offset;
7075 } else {
7076 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7077 inner_depth.increment()?;
7078 }
7079 let val_ref =
7080 self.action.get_or_insert_with(|| fidl::new_empty!(UrlRequestAction, D));
7081 fidl::decode!(UrlRequestAction, D, val_ref, decoder, inner_offset, inner_depth)?;
7082 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7083 {
7084 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7085 }
7086 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7087 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7088 }
7089 }
7090
7091 next_offset += envelope_size;
7092
7093 while next_offset < end_offset {
7095 _next_ordinal_to_read += 1;
7096 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7097 next_offset += envelope_size;
7098 }
7099
7100 Ok(())
7101 }
7102 }
7103
7104 impl UrlRequestRewriteSubstituteQueryPattern {
7105 #[inline(always)]
7106 fn max_ordinal_present(&self) -> u64 {
7107 if let Some(_) = self.substitution {
7108 return 2;
7109 }
7110 if let Some(_) = self.pattern {
7111 return 1;
7112 }
7113 0
7114 }
7115 }
7116
7117 impl fidl::encoding::ValueTypeMarker for UrlRequestRewriteSubstituteQueryPattern {
7118 type Borrowed<'a> = &'a Self;
7119 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7120 value
7121 }
7122 }
7123
7124 unsafe impl fidl::encoding::TypeMarker for UrlRequestRewriteSubstituteQueryPattern {
7125 type Owned = Self;
7126
7127 #[inline(always)]
7128 fn inline_align(_context: fidl::encoding::Context) -> usize {
7129 8
7130 }
7131
7132 #[inline(always)]
7133 fn inline_size(_context: fidl::encoding::Context) -> usize {
7134 16
7135 }
7136 }
7137
7138 unsafe impl<D: fidl::encoding::ResourceDialect>
7139 fidl::encoding::Encode<UrlRequestRewriteSubstituteQueryPattern, D>
7140 for &UrlRequestRewriteSubstituteQueryPattern
7141 {
7142 unsafe fn encode(
7143 self,
7144 encoder: &mut fidl::encoding::Encoder<'_, D>,
7145 offset: usize,
7146 mut depth: fidl::encoding::Depth,
7147 ) -> fidl::Result<()> {
7148 encoder.debug_check_bounds::<UrlRequestRewriteSubstituteQueryPattern>(offset);
7149 let max_ordinal: u64 = self.max_ordinal_present();
7151 encoder.write_num(max_ordinal, offset);
7152 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7153 if max_ordinal == 0 {
7155 return Ok(());
7156 }
7157 depth.increment()?;
7158 let envelope_size = 8;
7159 let bytes_len = max_ordinal as usize * envelope_size;
7160 #[allow(unused_variables)]
7161 let offset = encoder.out_of_line_offset(bytes_len);
7162 let mut _prev_end_offset: usize = 0;
7163 if 1 > max_ordinal {
7164 return Ok(());
7165 }
7166
7167 let cur_offset: usize = (1 - 1) * envelope_size;
7170
7171 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7173
7174 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<65536>, D>(
7179 self.pattern.as_ref().map(<fidl::encoding::BoundedString<65536> as fidl::encoding::ValueTypeMarker>::borrow),
7180 encoder, offset + cur_offset, depth
7181 )?;
7182
7183 _prev_end_offset = cur_offset + envelope_size;
7184 if 2 > max_ordinal {
7185 return Ok(());
7186 }
7187
7188 let cur_offset: usize = (2 - 1) * envelope_size;
7191
7192 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7194
7195 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<65536>, D>(
7200 self.substitution.as_ref().map(<fidl::encoding::BoundedString<65536> as fidl::encoding::ValueTypeMarker>::borrow),
7201 encoder, offset + cur_offset, depth
7202 )?;
7203
7204 _prev_end_offset = cur_offset + envelope_size;
7205
7206 Ok(())
7207 }
7208 }
7209
7210 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
7211 for UrlRequestRewriteSubstituteQueryPattern
7212 {
7213 #[inline(always)]
7214 fn new_empty() -> Self {
7215 Self::default()
7216 }
7217
7218 unsafe fn decode(
7219 &mut self,
7220 decoder: &mut fidl::encoding::Decoder<'_, D>,
7221 offset: usize,
7222 mut depth: fidl::encoding::Depth,
7223 ) -> fidl::Result<()> {
7224 decoder.debug_check_bounds::<Self>(offset);
7225 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7226 None => return Err(fidl::Error::NotNullable),
7227 Some(len) => len,
7228 };
7229 if len == 0 {
7231 return Ok(());
7232 };
7233 depth.increment()?;
7234 let envelope_size = 8;
7235 let bytes_len = len * envelope_size;
7236 let offset = decoder.out_of_line_offset(bytes_len)?;
7237 let mut _next_ordinal_to_read = 0;
7239 let mut next_offset = offset;
7240 let end_offset = offset + bytes_len;
7241 _next_ordinal_to_read += 1;
7242 if next_offset >= end_offset {
7243 return Ok(());
7244 }
7245
7246 while _next_ordinal_to_read < 1 {
7248 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7249 _next_ordinal_to_read += 1;
7250 next_offset += envelope_size;
7251 }
7252
7253 let next_out_of_line = decoder.next_out_of_line();
7254 let handles_before = decoder.remaining_handles();
7255 if let Some((inlined, num_bytes, num_handles)) =
7256 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7257 {
7258 let member_inline_size = <fidl::encoding::BoundedString<65536> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7259 if inlined != (member_inline_size <= 4) {
7260 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7261 }
7262 let inner_offset;
7263 let mut inner_depth = depth.clone();
7264 if inlined {
7265 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7266 inner_offset = next_offset;
7267 } else {
7268 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7269 inner_depth.increment()?;
7270 }
7271 let val_ref = self.pattern.get_or_insert_with(|| {
7272 fidl::new_empty!(fidl::encoding::BoundedString<65536>, D)
7273 });
7274 fidl::decode!(
7275 fidl::encoding::BoundedString<65536>,
7276 D,
7277 val_ref,
7278 decoder,
7279 inner_offset,
7280 inner_depth
7281 )?;
7282 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7283 {
7284 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7285 }
7286 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7287 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7288 }
7289 }
7290
7291 next_offset += envelope_size;
7292 _next_ordinal_to_read += 1;
7293 if next_offset >= end_offset {
7294 return Ok(());
7295 }
7296
7297 while _next_ordinal_to_read < 2 {
7299 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7300 _next_ordinal_to_read += 1;
7301 next_offset += envelope_size;
7302 }
7303
7304 let next_out_of_line = decoder.next_out_of_line();
7305 let handles_before = decoder.remaining_handles();
7306 if let Some((inlined, num_bytes, num_handles)) =
7307 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7308 {
7309 let member_inline_size = <fidl::encoding::BoundedString<65536> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7310 if inlined != (member_inline_size <= 4) {
7311 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7312 }
7313 let inner_offset;
7314 let mut inner_depth = depth.clone();
7315 if inlined {
7316 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7317 inner_offset = next_offset;
7318 } else {
7319 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7320 inner_depth.increment()?;
7321 }
7322 let val_ref = self.substitution.get_or_insert_with(|| {
7323 fidl::new_empty!(fidl::encoding::BoundedString<65536>, D)
7324 });
7325 fidl::decode!(
7326 fidl::encoding::BoundedString<65536>,
7327 D,
7328 val_ref,
7329 decoder,
7330 inner_offset,
7331 inner_depth
7332 )?;
7333 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7334 {
7335 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7336 }
7337 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7338 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7339 }
7340 }
7341
7342 next_offset += envelope_size;
7343
7344 while next_offset < end_offset {
7346 _next_ordinal_to_read += 1;
7347 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7348 next_offset += envelope_size;
7349 }
7350
7351 Ok(())
7352 }
7353 }
7354
7355 impl fidl::encoding::ValueTypeMarker for UrlRequestRewrite {
7356 type Borrowed<'a> = &'a Self;
7357 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7358 value
7359 }
7360 }
7361
7362 unsafe impl fidl::encoding::TypeMarker for UrlRequestRewrite {
7363 type Owned = Self;
7364
7365 #[inline(always)]
7366 fn inline_align(_context: fidl::encoding::Context) -> usize {
7367 8
7368 }
7369
7370 #[inline(always)]
7371 fn inline_size(_context: fidl::encoding::Context) -> usize {
7372 16
7373 }
7374 }
7375
7376 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<UrlRequestRewrite, D>
7377 for &UrlRequestRewrite
7378 {
7379 #[inline]
7380 unsafe fn encode(
7381 self,
7382 encoder: &mut fidl::encoding::Encoder<'_, D>,
7383 offset: usize,
7384 _depth: fidl::encoding::Depth,
7385 ) -> fidl::Result<()> {
7386 encoder.debug_check_bounds::<UrlRequestRewrite>(offset);
7387 encoder.write_num::<u64>(self.ordinal(), offset);
7388 match self {
7389 UrlRequestRewrite::AddHeaders(ref val) => {
7390 fidl::encoding::encode_in_envelope::<UrlRequestRewriteAddHeaders, D>(
7391 <UrlRequestRewriteAddHeaders as fidl::encoding::ValueTypeMarker>::borrow(val),
7392 encoder, offset + 8, _depth
7393 )
7394 }
7395 UrlRequestRewrite::RemoveHeader(ref val) => {
7396 fidl::encoding::encode_in_envelope::<UrlRequestRewriteRemoveHeader, D>(
7397 <UrlRequestRewriteRemoveHeader as fidl::encoding::ValueTypeMarker>::borrow(val),
7398 encoder, offset + 8, _depth
7399 )
7400 }
7401 UrlRequestRewrite::SubstituteQueryPattern(ref val) => {
7402 fidl::encoding::encode_in_envelope::<UrlRequestRewriteSubstituteQueryPattern, D>(
7403 <UrlRequestRewriteSubstituteQueryPattern as fidl::encoding::ValueTypeMarker>::borrow(val),
7404 encoder, offset + 8, _depth
7405 )
7406 }
7407 UrlRequestRewrite::ReplaceUrl(ref val) => {
7408 fidl::encoding::encode_in_envelope::<UrlRequestRewriteReplaceUrl, D>(
7409 <UrlRequestRewriteReplaceUrl as fidl::encoding::ValueTypeMarker>::borrow(val),
7410 encoder, offset + 8, _depth
7411 )
7412 }
7413 UrlRequestRewrite::AppendToQuery(ref val) => {
7414 fidl::encoding::encode_in_envelope::<UrlRequestRewriteAppendToQuery, D>(
7415 <UrlRequestRewriteAppendToQuery as fidl::encoding::ValueTypeMarker>::borrow(val),
7416 encoder, offset + 8, _depth
7417 )
7418 }
7419 UrlRequestRewrite::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
7420 }
7421 }
7422 }
7423
7424 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for UrlRequestRewrite {
7425 #[inline(always)]
7426 fn new_empty() -> Self {
7427 Self::__SourceBreaking { unknown_ordinal: 0 }
7428 }
7429
7430 #[inline]
7431 unsafe fn decode(
7432 &mut self,
7433 decoder: &mut fidl::encoding::Decoder<'_, D>,
7434 offset: usize,
7435 mut depth: fidl::encoding::Depth,
7436 ) -> fidl::Result<()> {
7437 decoder.debug_check_bounds::<Self>(offset);
7438 #[allow(unused_variables)]
7439 let next_out_of_line = decoder.next_out_of_line();
7440 let handles_before = decoder.remaining_handles();
7441 let (ordinal, inlined, num_bytes, num_handles) =
7442 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
7443
7444 let member_inline_size = match ordinal {
7445 1 => <UrlRequestRewriteAddHeaders as fidl::encoding::TypeMarker>::inline_size(decoder.context),
7446 2 => <UrlRequestRewriteRemoveHeader as fidl::encoding::TypeMarker>::inline_size(decoder.context),
7447 3 => <UrlRequestRewriteSubstituteQueryPattern as fidl::encoding::TypeMarker>::inline_size(decoder.context),
7448 4 => <UrlRequestRewriteReplaceUrl as fidl::encoding::TypeMarker>::inline_size(decoder.context),
7449 5 => <UrlRequestRewriteAppendToQuery as fidl::encoding::TypeMarker>::inline_size(decoder.context),
7450 0 => return Err(fidl::Error::UnknownUnionTag),
7451 _ => num_bytes as usize,
7452 };
7453
7454 if inlined != (member_inline_size <= 4) {
7455 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7456 }
7457 let _inner_offset;
7458 if inlined {
7459 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
7460 _inner_offset = offset + 8;
7461 } else {
7462 depth.increment()?;
7463 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7464 }
7465 match ordinal {
7466 1 => {
7467 #[allow(irrefutable_let_patterns)]
7468 if let UrlRequestRewrite::AddHeaders(_) = self {
7469 } else {
7471 *self = UrlRequestRewrite::AddHeaders(fidl::new_empty!(
7473 UrlRequestRewriteAddHeaders,
7474 D
7475 ));
7476 }
7477 #[allow(irrefutable_let_patterns)]
7478 if let UrlRequestRewrite::AddHeaders(ref mut val) = self {
7479 fidl::decode!(
7480 UrlRequestRewriteAddHeaders,
7481 D,
7482 val,
7483 decoder,
7484 _inner_offset,
7485 depth
7486 )?;
7487 } else {
7488 unreachable!()
7489 }
7490 }
7491 2 => {
7492 #[allow(irrefutable_let_patterns)]
7493 if let UrlRequestRewrite::RemoveHeader(_) = self {
7494 } else {
7496 *self = UrlRequestRewrite::RemoveHeader(fidl::new_empty!(
7498 UrlRequestRewriteRemoveHeader,
7499 D
7500 ));
7501 }
7502 #[allow(irrefutable_let_patterns)]
7503 if let UrlRequestRewrite::RemoveHeader(ref mut val) = self {
7504 fidl::decode!(
7505 UrlRequestRewriteRemoveHeader,
7506 D,
7507 val,
7508 decoder,
7509 _inner_offset,
7510 depth
7511 )?;
7512 } else {
7513 unreachable!()
7514 }
7515 }
7516 3 => {
7517 #[allow(irrefutable_let_patterns)]
7518 if let UrlRequestRewrite::SubstituteQueryPattern(_) = self {
7519 } else {
7521 *self = UrlRequestRewrite::SubstituteQueryPattern(fidl::new_empty!(
7523 UrlRequestRewriteSubstituteQueryPattern,
7524 D
7525 ));
7526 }
7527 #[allow(irrefutable_let_patterns)]
7528 if let UrlRequestRewrite::SubstituteQueryPattern(ref mut val) = self {
7529 fidl::decode!(
7530 UrlRequestRewriteSubstituteQueryPattern,
7531 D,
7532 val,
7533 decoder,
7534 _inner_offset,
7535 depth
7536 )?;
7537 } else {
7538 unreachable!()
7539 }
7540 }
7541 4 => {
7542 #[allow(irrefutable_let_patterns)]
7543 if let UrlRequestRewrite::ReplaceUrl(_) = self {
7544 } else {
7546 *self = UrlRequestRewrite::ReplaceUrl(fidl::new_empty!(
7548 UrlRequestRewriteReplaceUrl,
7549 D
7550 ));
7551 }
7552 #[allow(irrefutable_let_patterns)]
7553 if let UrlRequestRewrite::ReplaceUrl(ref mut val) = self {
7554 fidl::decode!(
7555 UrlRequestRewriteReplaceUrl,
7556 D,
7557 val,
7558 decoder,
7559 _inner_offset,
7560 depth
7561 )?;
7562 } else {
7563 unreachable!()
7564 }
7565 }
7566 5 => {
7567 #[allow(irrefutable_let_patterns)]
7568 if let UrlRequestRewrite::AppendToQuery(_) = self {
7569 } else {
7571 *self = UrlRequestRewrite::AppendToQuery(fidl::new_empty!(
7573 UrlRequestRewriteAppendToQuery,
7574 D
7575 ));
7576 }
7577 #[allow(irrefutable_let_patterns)]
7578 if let UrlRequestRewrite::AppendToQuery(ref mut val) = self {
7579 fidl::decode!(
7580 UrlRequestRewriteAppendToQuery,
7581 D,
7582 val,
7583 decoder,
7584 _inner_offset,
7585 depth
7586 )?;
7587 } else {
7588 unreachable!()
7589 }
7590 }
7591 #[allow(deprecated)]
7592 ordinal => {
7593 for _ in 0..num_handles {
7594 decoder.drop_next_handle()?;
7595 }
7596 *self = UrlRequestRewrite::__SourceBreaking { unknown_ordinal: ordinal };
7597 }
7598 }
7599 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
7600 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7601 }
7602 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7603 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7604 }
7605 Ok(())
7606 }
7607 }
7608}