fidl_fuchsia_web/
fidl_fuchsia_web.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10pub use fidl_fuchsia_web__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct ContextCreateFrameRequest {
16    pub frame: fidl::endpoints::ServerEnd<FrameMarker>,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ContextCreateFrameRequest {}
20
21#[derive(Debug, PartialEq)]
22pub struct ContextCreateFrameWithParamsRequest {
23    pub params: CreateFrameParams,
24    pub frame: fidl::endpoints::ServerEnd<FrameMarker>,
25}
26
27impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
28    for ContextCreateFrameWithParamsRequest
29{
30}
31
32#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
33pub struct ContextGetCookieManagerRequest {
34    pub manager: fidl::endpoints::ServerEnd<CookieManagerMarker>,
35}
36
37impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
38    for ContextGetCookieManagerRequest
39{
40}
41
42#[derive(Debug, PartialEq)]
43pub struct ContextProviderCreateRequest {
44    pub params: CreateContextParams,
45    pub context: fidl::endpoints::ServerEnd<ContextMarker>,
46}
47
48impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
49    for ContextProviderCreateRequest
50{
51}
52
53#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
54pub struct CookieManagerGetCookieListRequest {
55    pub url: Option<String>,
56    pub name: Option<String>,
57    pub cookies: fidl::endpoints::ServerEnd<CookiesIteratorMarker>,
58}
59
60impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
61    for CookieManagerGetCookieListRequest
62{
63}
64
65#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
66pub struct CookieManagerObserveCookieChangesRequest {
67    pub url: Option<String>,
68    pub name: Option<String>,
69    pub changes: fidl::endpoints::ServerEnd<CookiesIteratorMarker>,
70}
71
72impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
73    for CookieManagerObserveCookieChangesRequest
74{
75}
76
77#[derive(Debug, PartialEq)]
78pub struct CookiesIteratorGetNextResponse {
79    pub changed_cookies: Vec<Cookie>,
80}
81
82impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
83    for CookiesIteratorGetNextResponse
84{
85}
86
87#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
88pub struct DebugEnableDevToolsRequest {
89    pub listener: fidl::endpoints::ClientEnd<DevToolsListenerMarker>,
90}
91
92impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
93    for DebugEnableDevToolsRequest
94{
95}
96
97#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
98pub struct DevToolsListenerOnContextDevToolsAvailableRequest {
99    pub listener: fidl::endpoints::ServerEnd<DevToolsPerContextListenerMarker>,
100}
101
102impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
103    for DevToolsListenerOnContextDevToolsAvailableRequest
104{
105}
106
107#[derive(Debug, PartialEq)]
108pub struct FrameAddBeforeLoadJavaScriptRequest {
109    pub id: u64,
110    pub origins: Vec<String>,
111    pub script: fidl_fuchsia_mem::Buffer,
112}
113
114impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
115    for FrameAddBeforeLoadJavaScriptRequest
116{
117}
118
119#[derive(Debug, PartialEq)]
120pub struct FrameCreateView2Request {
121    pub args: CreateView2Args,
122}
123
124impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for FrameCreateView2Request {}
125
126#[derive(Debug, PartialEq)]
127pub struct FrameCreateViewRequest {
128    pub view_token: fidl_fuchsia_ui_views::ViewToken,
129}
130
131impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for FrameCreateViewRequest {}
132
133#[derive(Debug, PartialEq)]
134pub struct FrameCreateViewWithViewRefRequest {
135    pub view_token: fidl_fuchsia_ui_views::ViewToken,
136    pub view_ref_control: fidl_fuchsia_ui_views::ViewRefControl,
137    pub view_ref: fidl_fuchsia_ui_views::ViewRef,
138}
139
140impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
141    for FrameCreateViewWithViewRefRequest
142{
143}
144
145#[derive(Debug, PartialEq)]
146pub struct FrameExecuteJavaScriptNoResultRequest {
147    pub origins: Vec<String>,
148    pub script: fidl_fuchsia_mem::Buffer,
149}
150
151impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
152    for FrameExecuteJavaScriptNoResultRequest
153{
154}
155
156#[derive(Debug, PartialEq)]
157pub struct FrameExecuteJavaScriptRequest {
158    pub origins: Vec<String>,
159    pub script: fidl_fuchsia_mem::Buffer,
160}
161
162impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
163    for FrameExecuteJavaScriptRequest
164{
165}
166
167#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
168pub struct FrameGetMediaPlayerRequest {
169    pub player: fidl::endpoints::ServerEnd<fidl_fuchsia_media_sessions2::PlayerMarker>,
170}
171
172impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
173    for FrameGetMediaPlayerRequest
174{
175}
176
177#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
178pub struct FrameGetNavigationControllerRequest {
179    pub controller: fidl::endpoints::ServerEnd<NavigationControllerMarker>,
180}
181
182impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
183    for FrameGetNavigationControllerRequest
184{
185}
186
187#[derive(Debug, PartialEq)]
188pub struct FrameHostCreateFrameWithParamsRequest {
189    pub params: CreateFrameParams,
190    pub frame: fidl::endpoints::ServerEnd<FrameMarker>,
191}
192
193impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
194    for FrameHostCreateFrameWithParamsRequest
195{
196}
197
198#[derive(Debug, PartialEq)]
199pub struct FramePostMessageRequest {
200    pub target_origin: String,
201    pub message: WebMessage,
202}
203
204impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for FramePostMessageRequest {}
205
206#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
207pub struct FrameSetConsoleLogSinkRequest {
208    pub sink: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_logger::LogSinkMarker>>,
209}
210
211impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
212    for FrameSetConsoleLogSinkRequest
213{
214}
215
216#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
217pub struct FrameSetNavigationEventListener2Request {
218    pub listener: Option<fidl::endpoints::ClientEnd<NavigationEventListenerMarker>>,
219    pub flags: NavigationEventListenerFlags,
220}
221
222impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
223    for FrameSetNavigationEventListener2Request
224{
225}
226
227#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
228pub struct FrameSetNavigationEventListenerRequest {
229    pub listener: Option<fidl::endpoints::ClientEnd<NavigationEventListenerMarker>>,
230}
231
232impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
233    for FrameSetNavigationEventListenerRequest
234{
235}
236
237#[derive(Debug, PartialEq)]
238pub struct FrameSetNavigationPolicyProviderRequest {
239    pub params: NavigationPolicyProviderParams,
240    pub provider: fidl::endpoints::ClientEnd<NavigationPolicyProviderMarker>,
241}
242
243impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
244    for FrameSetNavigationPolicyProviderRequest
245{
246}
247
248#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
249pub struct FrameSetPopupFrameCreationListenerRequest {
250    pub listener: Option<fidl::endpoints::ClientEnd<PopupFrameCreationListenerMarker>>,
251}
252
253impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
254    for FrameSetPopupFrameCreationListenerRequest
255{
256}
257
258#[derive(Debug, PartialEq)]
259pub struct FrameExecuteJavaScriptResponse {
260    pub result: fidl_fuchsia_mem::Buffer,
261}
262
263impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
264    for FrameExecuteJavaScriptResponse
265{
266}
267
268#[derive(Debug, PartialEq)]
269pub struct MessagePortPostMessageRequest {
270    pub message: WebMessage,
271}
272
273impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
274    for MessagePortPostMessageRequest
275{
276}
277
278#[derive(Debug, PartialEq)]
279pub struct MessagePortReceiveMessageResponse {
280    pub message: WebMessage,
281}
282
283impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
284    for MessagePortReceiveMessageResponse
285{
286}
287
288#[derive(Debug, PartialEq)]
289pub struct NavigationControllerLoadUrlRequest {
290    pub url: String,
291    pub params: LoadUrlParams,
292}
293
294impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
295    for NavigationControllerLoadUrlRequest
296{
297}
298
299#[derive(Debug, PartialEq)]
300pub struct NavigationEventListenerOnNavigationStateChangedRequest {
301    pub change: NavigationState,
302}
303
304impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
305    for NavigationEventListenerOnNavigationStateChangedRequest
306{
307}
308
309#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
310pub struct NavigationPolicyProviderEvaluateRequestedNavigationResponse {
311    pub decision: NavigationDecision,
312}
313
314impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
315    for NavigationPolicyProviderEvaluateRequestedNavigationResponse
316{
317}
318
319#[derive(Debug, PartialEq)]
320pub struct PopupFrameCreationListenerOnPopupFrameCreatedRequest {
321    pub frame: fidl::endpoints::ClientEnd<FrameMarker>,
322    pub info: PopupFrameCreationInfo,
323}
324
325impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
326    for PopupFrameCreationListenerOnPopupFrameCreatedRequest
327{
328}
329
330/// Defines a provider which hosts resources from a [`fuchsia.io/Directory`]. Content can `GET`
331/// resource files via the provider, but not enumerate directories. Resources can be accessed by
332/// their URLs: `fuchsia-dir://<provider-name>/<path/to/resource>`
333///
334/// By default the MIME types of files are determined automatically by "sniffing" the contents of
335/// the files. No content encoding will be declared, which browsers will interpret as meaning
336/// `"text/plain"`.
337///
338/// Content type and encoding metadata may optionally be specified explicitly by metadata files,
339/// which reside alongside the file. Metadata is expressed in JSON files, named after the files
340/// they describe with a `"._metadata"` suffix.
341///
342/// For example, the file `"index.html"` would have the a metadata file called
343/// `"index.html._metadata"`, with the following contents:
344/// ```
345/// {
346///   "charset": "utf-8",
347///   "mime": "text/html"
348/// }
349/// ```
350#[derive(Debug, Default, PartialEq)]
351pub struct ContentDirectoryProvider {
352    /// Name of the provider. Must be non-empty and composed solely of alphanumerics, dots, and
353    /// dashes.
354    pub name: Option<String>,
355    /// Directory containing the files served by this provider.
356    pub directory: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>>,
357    #[doc(hidden)]
358    pub __source_breaking: fidl::marker::SourceBreaking,
359}
360
361impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ContentDirectoryProvider {}
362
363#[derive(Debug, Default, PartialEq)]
364pub struct Cookie {
365    /// A table with fields to identify a cookie.
366    pub id: Option<CookieId>,
367    /// The cookie value.
368    /// RFC6265 does not specify an upper limit on cookie size, but recommends
369    /// that at least 4096 bytes are supported.
370    pub value: Option<String>,
371    #[doc(hidden)]
372    pub __source_breaking: fidl::marker::SourceBreaking,
373}
374
375impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Cookie {}
376
377/// Parameters specifying the configuration for a new [`Context`].
378#[derive(Debug, Default, PartialEq)]
379pub struct CreateContextParams {
380    /// Service directory to be used by the context.
381    ///
382    /// The following services must be present in the service directory:
383    ///
384    /// - [`fuchsia.buildinfo/Provider`]
385    /// - [`fuchsia.device/NameProvider`]
386    /// - [`fuchsia.fonts/Provider`]
387    /// - [`fuchsia.hwinfo.Product`]
388    /// - [`fuchsia.intl/PropertyProvider`]
389    /// - [`fuchsia.kernel/VmexResource`] (unless [`ContextFeatureFlags.DISABLE_DYNAMIC_CODE_GENERATION`] is set)
390    /// - [`fuchsia.logger/LogSink`]
391    /// - [`fuchsia.memorypressure/Provider`]
392    /// - [`fuchsia.process/Launcher`]
393    /// - [`fuchsia.sysmem/Allocator`]
394    ///
395    /// The following services are recommended to be present in order to allow CPU scheduling
396    /// profiles to be applied to threads to tune their performance, especially for media rendering.
397    /// - [`fuchsia.media.ProfileProvider`] (requirement will be removed in 2025)
398    /// - [`fuchsia.scheduler.RoleManager`]
399    ///
400    /// The following services must be present in order to render web content in a Scenic view
401    /// using [`Frame.CreateView`], [`Frame.CreateViewWithViewRef`] or [`Frame.CreateView2`]]:
402    /// - [`fuchsia.accessibility.semantics/SemanticsManager`]
403    /// - [`fuchsia.ui.composition/Allocator`]
404    /// - [`fuchsia.ui.composition/Flatland`]
405    /// - [`fuchsia.ui.scenic/Scenic`]
406    ///
407    /// The following service must be present in order to collect diagnostic tracing data.
408    /// - [`fuchsia.tracing.perfetto.ProducerConnector`]
409    pub service_directory: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>>,
410    /// Handle to the directory that will contain the [`Context`]'s persistent data. If it is left
411    /// unset, then the created [`Context`] will be stateless, with all of its data discarded upon
412    /// [`Context`] destruction.
413    ///
414    /// If set, `data_directory` must not be shared with any other [`Context`].
415    pub data_directory: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>>,
416    /// Optional string describing the embedding product to append to the User-Agent string.
417    /// See the specification for the
418    /// [HTTP User-Agent header](https://tools.ietf.org/html/rfc7231#section-5.5.3).
419    /// Requires that `user_agent_version` is also specified.
420    pub user_agent_product: Option<String>,
421    /// Optional version for the embedding product to append to the User-Agent string.
422    ///
423    /// Requires that `user_agent_product` is also specified.
424    pub user_agent_version: Option<String>,
425    /// Enables Frames to be created with remote debugging enabled using the DevTools protocol. If
426    /// `port` is 0, then an ephemeral port will be used, which can be queried via the
427    /// [`Context.GetRemoteDebuggingPort`] API.
428    ///
429    /// Because remote debugging uses TCP, it is not valid to set a remote
430    /// debugging port without having also set [`ContextFeatureFlags.NETWORK`]
431    /// for the context.
432    pub remote_debugging_port: Option<u16>,
433    /// List of providers whose contents will be served by `fuchsia-dir://` URLs.
434    pub content_directories: Option<Vec<ContentDirectoryProvider>>,
435    /// Optional features that should be enabled for this context. Some features may also require
436    /// additional services in `service_directory`.
437    pub features: Option<ContextFeatureFlags>,
438    /// Enables PlayReady CDM for the Context using the specified string as a key system
439    /// string. The string should be a reverse domain name, as required by
440    /// [EME API](https://www.w3.org/TR/encrypted-media/#key-system).
441    ///
442    /// - Requires [`fuchsia.media.drm/PlayReady`] service.
443    /// - Requires that a `cdm_data_directory` be specified in [`CreateContextParams`].
444    pub playready_key_system: Option<String>,
445    /// Treat given insecure origins as secure origins. For the definition of secure contexts, see
446    /// [Secure Contexts](https://w3c.github.io/webappsec-secure-contexts/) and
447    /// [origin trustworthiness](https://www.w3.org/TR/powerful-features/#is-origin-trustworthy).
448    ///
449    /// Example value: `{"http://a.com", "http://b.com"}`.
450    pub unsafely_treat_insecure_origins_as_secure: Option<Vec<String>>,
451    /// Specifies a set of header names for which [Cross-Origin Resource Sharing
452    /// (CORS)](https://www.w3.org/TR/cors/) checks should not be enforced.
453    pub cors_exempt_headers: Option<Vec<Vec<u8>>>,
454    /// Specifies the storage to use to persistent content licensing related data (e.g.
455    /// provisioning data, persistent session data). By default these data will be placed under the
456    /// `data_directory`, if specified.
457    ///
458    /// If neither `data_directory` nor `cdm_data_directory` are specified, then content licensing
459    /// features requiring persistent storage (e.g. persistent licensing sessions) will not be
460    /// available to the [`Context`].
461    ///
462    /// Note that not all content licensing systems support persistent sessions, regardless of
463    /// whether persistent storage is provided.
464    pub cdm_data_directory: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>>,
465    /// Specifies a target maximum size for `cdm_data_directory` contents, in bytes. If the amount
466    /// of persisted CDM data exceeds this threshold, then the [`Context`] will attempt to purge
467    /// some data to meet the specified quota.
468    pub cdm_data_quota_bytes: Option<u64>,
469    /// Specifies a target maximum size for `data_directory` contents, in bytes.
470    /// The [`Context`] will attempt to limit browsing state (e.g. cookies, LocalStorage) to
471    /// not exceed the specified size.
472    pub data_quota_bytes: Option<u64>,
473    #[doc(hidden)]
474    pub __source_breaking: fidl::marker::SourceBreaking,
475}
476
477impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for CreateContextParams {}
478
479/// Parameters specifying the configuration for a new [`Frame`].
480#[derive(Debug, Default, PartialEq)]
481pub struct CreateFrameParams {
482    /// Set to true to enable remote debugging. The [`Frame`] will be closed with
483    /// `ERR_INVALID_ARGS` if `remote_debugging_port` was not set in
484    /// [`CreateContextParams`].
485    pub enable_remote_debugging: Option<bool>,
486    /// Set to give the Frame a name to help distinguish it in debug contexts , such as system log
487    /// output. For example, the name may be added to messages from web content when they are logged
488    /// to the system logger. The name does not affect user- or web-visible behavior.
489    /// Popup Frames created by the Frame will have a name derived from the parent Frame's name.
490    pub debug_name: Option<String>,
491    /// Enables automatic blocking of navigations to explicit sites, and specifies the error page
492    /// content, in HTML, to be loaded in the Frame when a navigation is canceled by the filter.
493    /// Applies to navigations in all frames within the Frame.
494    /// When navigation of the main document is canceled, the Frame's [`NavigationState.PageType`]
495    /// is `ERROR`.
496    /// If set to an empty buffer, a default error message will be displayed.
497    /// If set and such filtering is not supported, the [`Frame`] will disconnect with
498    /// `ZX_ERR_NOT_SUPPORTED`.
499    pub explicit_sites_filter_error_page: Option<fidl_fuchsia_mem::Data>,
500    #[doc(hidden)]
501    pub __source_breaking: fidl::marker::SourceBreaking,
502}
503
504impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for CreateFrameParams {}
505
506/// Args for Frame.CreateView2(), see above.
507#[derive(Debug, Default, PartialEq)]
508pub struct CreateView2Args {
509    /// Non-optional. This token is provided to attach the client's Flatland view to the parent's
510    /// viewport.
511    pub view_creation_token: Option<fidl_fuchsia_ui_views::ViewCreationToken>,
512    #[doc(hidden)]
513    pub __source_breaking: fidl::marker::SourceBreaking,
514}
515
516impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for CreateView2Args {}
517
518/// Used to represent a favicon for a page. An empty table (all fields are unset) is used to indicate
519/// that the page doesn't have a favicon.
520#[derive(Debug, Default, PartialEq)]
521pub struct Favicon {
522    /// The image content encoded as an RGBA bitmap with premultiplied alpha channel. The data is
523    /// densely packed, so the stride is always `4 * width` and the total size is
524    /// `4 * width * height`.
525    pub data: Option<fidl_fuchsia_mem::Buffer>,
526    /// The width of the image.
527    pub width: Option<u32>,
528    /// The height of the image.
529    pub height: Option<u32>,
530    #[doc(hidden)]
531    pub __source_breaking: fidl::marker::SourceBreaking,
532}
533
534impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Favicon {}
535
536/// Additional parameters for modifying the behavior of [`NavigationController.LoadUrl`].
537#[derive(Debug, Default, PartialEq)]
538pub struct LoadUrlParams {
539    /// Provides a hint to the browser UI about how [`NavigationController.LoadUrl`] was triggered.
540    pub type_: Option<LoadUrlReason>,
541    /// The URL that linked to the resource being requested.
542    pub referrer_url: Option<String>,
543    /// Should be set to true to propagate user activation to the frame. User activation implies
544    /// that the user is interacting with the web frame. It enables some web features that are not
545    /// available otherwise. For example, autoplay will work only when this flag is set to true.
546    pub was_user_activated: Option<bool>,
547    /// Custom HTTP headers. RFC7540 does not specify a limit on the number nor
548    /// size of headers.
549    pub headers: Option<Vec<fidl_fuchsia_net_http::Header>>,
550    #[doc(hidden)]
551    pub __source_breaking: fidl::marker::SourceBreaking,
552}
553
554impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for LoadUrlParams {}
555
556/// Contains information about the [`Frame`]'s navigation state.
557#[derive(Debug, Default, PartialEq)]
558pub struct NavigationState {
559    /// The page's URL.
560    pub url: Option<String>,
561    /// The user-visible page title. While W3C style recommendation is that HTML
562    /// TITLE tags not exceed 64 characters in length, there is no actual limit.
563    pub title: Option<String>,
564    /// Indicates whether this was a navigation to an error page.
565    pub page_type: Option<PageType>,
566    /// Indicates if there is a following navigation.
567    pub can_go_forward: Option<bool>,
568    /// Indicates if there is a previous navigation.
569    pub can_go_back: Option<bool>,
570    /// Indicates that the main document's statically declared resources have been loaded.
571    pub is_main_document_loaded: Option<bool>,
572    /// Current favicon for the page. The field is set only when the `FAVICON` flag is set for the
573    /// `NavigationEventListener` and the favicon has changed.
574    pub favicon: Option<Favicon>,
575    /// Indicates type of the error when `page_type` is set to `ERROR`.
576    pub error_detail: Option<ErrorDetail>,
577    #[doc(hidden)]
578    pub __source_breaking: fidl::marker::SourceBreaking,
579}
580
581impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for NavigationState {}
582
583/// Specifies additional information about a newly created popup frame.
584#[derive(Debug, Default, PartialEq)]
585pub struct PopupFrameCreationInfo {
586    /// The URL to which the popup frame was initially navigated.
587    pub initial_url: Option<String>,
588    /// Set if the popup frame was created in response to UI interaction from the user (e.g. a
589    /// link was clicked).
590    pub initiated_by_user: Option<bool>,
591    #[doc(hidden)]
592    pub __source_breaking: fidl::marker::SourceBreaking,
593}
594
595impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for PopupFrameCreationInfo {}
596
597#[derive(Debug, Default, PartialEq)]
598pub struct WebMessage {
599    /// The message payload, encoded as an UTF-8 string. This is a required property.
600    pub data: Option<fidl_fuchsia_mem::Buffer>,
601    /// Optional list of objects transferred into the [`MessagePort`] from the FIDL client.
602    pub incoming_transfer: Option<Vec<IncomingTransferable>>,
603    /// Optional list of objects transferred out of the [`MessagePort`] to the FIDL client.
604    pub outgoing_transfer: Option<Vec<OutgoingTransferable>>,
605    #[doc(hidden)]
606    pub __source_breaking: fidl::marker::SourceBreaking,
607}
608
609impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for WebMessage {}
610
611#[derive(Debug)]
612pub enum IncomingTransferable {
613    MessagePort(fidl::endpoints::ClientEnd<MessagePortMarker>),
614    #[doc(hidden)]
615    __SourceBreaking {
616        unknown_ordinal: u64,
617    },
618}
619
620/// Pattern that matches an unknown `IncomingTransferable` member.
621#[macro_export]
622macro_rules! IncomingTransferableUnknown {
623    () => {
624        _
625    };
626}
627
628// Custom PartialEq so that unknown variants are not equal to themselves.
629impl PartialEq for IncomingTransferable {
630    fn eq(&self, other: &Self) -> bool {
631        match (self, other) {
632            (Self::MessagePort(x), Self::MessagePort(y)) => *x == *y,
633            _ => false,
634        }
635    }
636}
637
638impl IncomingTransferable {
639    #[inline]
640    pub fn ordinal(&self) -> u64 {
641        match *self {
642            Self::MessagePort(_) => 1,
643            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
644        }
645    }
646
647    #[inline]
648    pub fn unknown_variant_for_testing() -> Self {
649        Self::__SourceBreaking { unknown_ordinal: 0 }
650    }
651
652    #[inline]
653    pub fn is_unknown(&self) -> bool {
654        match self {
655            Self::__SourceBreaking { .. } => true,
656            _ => false,
657        }
658    }
659}
660
661impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for IncomingTransferable {}
662
663/// Navigation action that should be taken in response to a navigation request. Returned from
664/// [`NavigationPolicyProvider.EvaluateRequestedNavigation`].
665#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
666pub enum NavigationDecision {
667    /// Navigation should proceed normally.
668    Proceed(NoArgumentsAction),
669    /// Navigation should be aborted. The frame should stay on the current page.
670    Abort(NoArgumentsAction),
671}
672
673impl NavigationDecision {
674    #[inline]
675    pub fn ordinal(&self) -> u64 {
676        match *self {
677            Self::Proceed(_) => 1,
678            Self::Abort(_) => 2,
679        }
680    }
681}
682
683impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for NavigationDecision {}
684
685#[derive(Debug)]
686pub enum OutgoingTransferable {
687    MessagePort(fidl::endpoints::ServerEnd<MessagePortMarker>),
688    #[doc(hidden)]
689    __SourceBreaking {
690        unknown_ordinal: u64,
691    },
692}
693
694/// Pattern that matches an unknown `OutgoingTransferable` member.
695#[macro_export]
696macro_rules! OutgoingTransferableUnknown {
697    () => {
698        _
699    };
700}
701
702// Custom PartialEq so that unknown variants are not equal to themselves.
703impl PartialEq for OutgoingTransferable {
704    fn eq(&self, other: &Self) -> bool {
705        match (self, other) {
706            (Self::MessagePort(x), Self::MessagePort(y)) => *x == *y,
707            _ => false,
708        }
709    }
710}
711
712impl OutgoingTransferable {
713    #[inline]
714    pub fn ordinal(&self) -> u64 {
715        match *self {
716            Self::MessagePort(_) => 1,
717            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
718        }
719    }
720
721    #[inline]
722    pub fn unknown_variant_for_testing() -> Self {
723        Self::__SourceBreaking { unknown_ordinal: 0 }
724    }
725
726    #[inline]
727    pub fn is_unknown(&self) -> bool {
728        match self {
729            Self::__SourceBreaking { .. } => true,
730            _ => false,
731        }
732    }
733}
734
735impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for OutgoingTransferable {}
736
737#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
738pub struct ContextMarker;
739
740impl fidl::endpoints::ProtocolMarker for ContextMarker {
741    type Proxy = ContextProxy;
742    type RequestStream = ContextRequestStream;
743    #[cfg(target_os = "fuchsia")]
744    type SynchronousProxy = ContextSynchronousProxy;
745
746    const DEBUG_NAME: &'static str = "fuchsia.web.Context";
747}
748impl fidl::endpoints::DiscoverableProtocolMarker for ContextMarker {}
749pub type ContextGetRemoteDebuggingPortResult = Result<u16, ContextError>;
750
751pub trait ContextProxyInterface: Send + Sync {
752    fn r#create_frame(
753        &self,
754        frame: fidl::endpoints::ServerEnd<FrameMarker>,
755    ) -> Result<(), fidl::Error>;
756    fn r#create_frame_with_params(
757        &self,
758        params: CreateFrameParams,
759        frame: fidl::endpoints::ServerEnd<FrameMarker>,
760    ) -> Result<(), fidl::Error>;
761    fn r#get_cookie_manager(
762        &self,
763        manager: fidl::endpoints::ServerEnd<CookieManagerMarker>,
764    ) -> Result<(), fidl::Error>;
765    type GetRemoteDebuggingPortResponseFut: std::future::Future<Output = Result<ContextGetRemoteDebuggingPortResult, fidl::Error>>
766        + Send;
767    fn r#get_remote_debugging_port(&self) -> Self::GetRemoteDebuggingPortResponseFut;
768}
769#[derive(Debug)]
770#[cfg(target_os = "fuchsia")]
771pub struct ContextSynchronousProxy {
772    client: fidl::client::sync::Client,
773}
774
775#[cfg(target_os = "fuchsia")]
776impl fidl::endpoints::SynchronousProxy for ContextSynchronousProxy {
777    type Proxy = ContextProxy;
778    type Protocol = ContextMarker;
779
780    fn from_channel(inner: fidl::Channel) -> Self {
781        Self::new(inner)
782    }
783
784    fn into_channel(self) -> fidl::Channel {
785        self.client.into_channel()
786    }
787
788    fn as_channel(&self) -> &fidl::Channel {
789        self.client.as_channel()
790    }
791}
792
793#[cfg(target_os = "fuchsia")]
794impl ContextSynchronousProxy {
795    pub fn new(channel: fidl::Channel) -> Self {
796        let protocol_name = <ContextMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
797        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
798    }
799
800    pub fn into_channel(self) -> fidl::Channel {
801        self.client.into_channel()
802    }
803
804    /// Waits until an event arrives and returns it. It is safe for other
805    /// threads to make concurrent requests while waiting for an event.
806    pub fn wait_for_event(
807        &self,
808        deadline: zx::MonotonicInstant,
809    ) -> Result<ContextEvent, fidl::Error> {
810        ContextEvent::decode(self.client.wait_for_event(deadline)?)
811    }
812
813    /// Creates a new [`Frame`] under this [`Context`]. Destruction of a [`Context`] triggers the
814    /// destruction of all of its associated [`Frame`]. [`Frame`] can be transferred to another
815    /// component but cannot be shared across multiple components.
816    ///
817    /// - `frame`: An interface request that will be bound to the created [`Frame`].
818    pub fn r#create_frame(
819        &self,
820        mut frame: fidl::endpoints::ServerEnd<FrameMarker>,
821    ) -> Result<(), fidl::Error> {
822        self.client.send::<ContextCreateFrameRequest>(
823            (frame,),
824            0x5440a38db7cd7d8f,
825            fidl::encoding::DynamicFlags::empty(),
826        )
827    }
828
829    /// Similar to [`Context.CreateFrame`], with extra parameters.
830    ///
831    /// - `params`: The configuration used to create the [`Frame`].
832    ///   This method will fail with `ZX_ERR_INVALID_ARGS` if the table is not clonable.
833    /// - `frame`: An interface request that will be bound to the created [`Frame`].
834    pub fn r#create_frame_with_params(
835        &self,
836        mut params: CreateFrameParams,
837        mut frame: fidl::endpoints::ServerEnd<FrameMarker>,
838    ) -> Result<(), fidl::Error> {
839        self.client.send::<ContextCreateFrameWithParamsRequest>(
840            (&mut params, frame),
841            0x2c968a330787be96,
842            fidl::encoding::DynamicFlags::empty(),
843        )
844    }
845
846    /// Used to observe cookies for sites hosted under this Context.
847    pub fn r#get_cookie_manager(
848        &self,
849        mut manager: fidl::endpoints::ServerEnd<CookieManagerMarker>,
850    ) -> Result<(), fidl::Error> {
851        self.client.send::<ContextGetCookieManagerRequest>(
852            (manager,),
853            0x7396cda568e3fca,
854            fidl::encoding::DynamicFlags::empty(),
855        )
856    }
857
858    /// Waits until debugging is available on one or more Frames, and returns the DevTools port
859    /// number. Multiple calls may be queued to received the port number.
860    ///
861    /// If an error occurred, the [`ContextError`] will be set to this value:
862    /// - `REMOTE_DEBUGGING_PORT_NOT_OPENED`: `remote_debugging_port` was not set in
863    ///   [`CreateContextParams`] or the remote debugging service failed to start.
864    pub fn r#get_remote_debugging_port(
865        &self,
866        ___deadline: zx::MonotonicInstant,
867    ) -> Result<ContextGetRemoteDebuggingPortResult, fidl::Error> {
868        let _response =
869            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
870                ContextGetRemoteDebuggingPortResponse,
871                ContextError,
872            >>(
873                (),
874                0x4ac6a26fe972f29,
875                fidl::encoding::DynamicFlags::empty(),
876                ___deadline,
877            )?;
878        Ok(_response.map(|x| x.port))
879    }
880}
881
882#[cfg(target_os = "fuchsia")]
883impl From<ContextSynchronousProxy> for zx::Handle {
884    fn from(value: ContextSynchronousProxy) -> Self {
885        value.into_channel().into()
886    }
887}
888
889#[cfg(target_os = "fuchsia")]
890impl From<fidl::Channel> for ContextSynchronousProxy {
891    fn from(value: fidl::Channel) -> Self {
892        Self::new(value)
893    }
894}
895
896#[cfg(target_os = "fuchsia")]
897impl fidl::endpoints::FromClient for ContextSynchronousProxy {
898    type Protocol = ContextMarker;
899
900    fn from_client(value: fidl::endpoints::ClientEnd<ContextMarker>) -> Self {
901        Self::new(value.into_channel())
902    }
903}
904
905#[derive(Debug, Clone)]
906pub struct ContextProxy {
907    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
908}
909
910impl fidl::endpoints::Proxy for ContextProxy {
911    type Protocol = ContextMarker;
912
913    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
914        Self::new(inner)
915    }
916
917    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
918        self.client.into_channel().map_err(|client| Self { client })
919    }
920
921    fn as_channel(&self) -> &::fidl::AsyncChannel {
922        self.client.as_channel()
923    }
924}
925
926impl ContextProxy {
927    /// Create a new Proxy for fuchsia.web/Context.
928    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
929        let protocol_name = <ContextMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
930        Self { client: fidl::client::Client::new(channel, protocol_name) }
931    }
932
933    /// Get a Stream of events from the remote end of the protocol.
934    ///
935    /// # Panics
936    ///
937    /// Panics if the event stream was already taken.
938    pub fn take_event_stream(&self) -> ContextEventStream {
939        ContextEventStream { event_receiver: self.client.take_event_receiver() }
940    }
941
942    /// Creates a new [`Frame`] under this [`Context`]. Destruction of a [`Context`] triggers the
943    /// destruction of all of its associated [`Frame`]. [`Frame`] can be transferred to another
944    /// component but cannot be shared across multiple components.
945    ///
946    /// - `frame`: An interface request that will be bound to the created [`Frame`].
947    pub fn r#create_frame(
948        &self,
949        mut frame: fidl::endpoints::ServerEnd<FrameMarker>,
950    ) -> Result<(), fidl::Error> {
951        ContextProxyInterface::r#create_frame(self, frame)
952    }
953
954    /// Similar to [`Context.CreateFrame`], with extra parameters.
955    ///
956    /// - `params`: The configuration used to create the [`Frame`].
957    ///   This method will fail with `ZX_ERR_INVALID_ARGS` if the table is not clonable.
958    /// - `frame`: An interface request that will be bound to the created [`Frame`].
959    pub fn r#create_frame_with_params(
960        &self,
961        mut params: CreateFrameParams,
962        mut frame: fidl::endpoints::ServerEnd<FrameMarker>,
963    ) -> Result<(), fidl::Error> {
964        ContextProxyInterface::r#create_frame_with_params(self, params, frame)
965    }
966
967    /// Used to observe cookies for sites hosted under this Context.
968    pub fn r#get_cookie_manager(
969        &self,
970        mut manager: fidl::endpoints::ServerEnd<CookieManagerMarker>,
971    ) -> Result<(), fidl::Error> {
972        ContextProxyInterface::r#get_cookie_manager(self, manager)
973    }
974
975    /// Waits until debugging is available on one or more Frames, and returns the DevTools port
976    /// number. Multiple calls may be queued to received the port number.
977    ///
978    /// If an error occurred, the [`ContextError`] will be set to this value:
979    /// - `REMOTE_DEBUGGING_PORT_NOT_OPENED`: `remote_debugging_port` was not set in
980    ///   [`CreateContextParams`] or the remote debugging service failed to start.
981    pub fn r#get_remote_debugging_port(
982        &self,
983    ) -> fidl::client::QueryResponseFut<
984        ContextGetRemoteDebuggingPortResult,
985        fidl::encoding::DefaultFuchsiaResourceDialect,
986    > {
987        ContextProxyInterface::r#get_remote_debugging_port(self)
988    }
989}
990
991impl ContextProxyInterface for ContextProxy {
992    fn r#create_frame(
993        &self,
994        mut frame: fidl::endpoints::ServerEnd<FrameMarker>,
995    ) -> Result<(), fidl::Error> {
996        self.client.send::<ContextCreateFrameRequest>(
997            (frame,),
998            0x5440a38db7cd7d8f,
999            fidl::encoding::DynamicFlags::empty(),
1000        )
1001    }
1002
1003    fn r#create_frame_with_params(
1004        &self,
1005        mut params: CreateFrameParams,
1006        mut frame: fidl::endpoints::ServerEnd<FrameMarker>,
1007    ) -> Result<(), fidl::Error> {
1008        self.client.send::<ContextCreateFrameWithParamsRequest>(
1009            (&mut params, frame),
1010            0x2c968a330787be96,
1011            fidl::encoding::DynamicFlags::empty(),
1012        )
1013    }
1014
1015    fn r#get_cookie_manager(
1016        &self,
1017        mut manager: fidl::endpoints::ServerEnd<CookieManagerMarker>,
1018    ) -> Result<(), fidl::Error> {
1019        self.client.send::<ContextGetCookieManagerRequest>(
1020            (manager,),
1021            0x7396cda568e3fca,
1022            fidl::encoding::DynamicFlags::empty(),
1023        )
1024    }
1025
1026    type GetRemoteDebuggingPortResponseFut = fidl::client::QueryResponseFut<
1027        ContextGetRemoteDebuggingPortResult,
1028        fidl::encoding::DefaultFuchsiaResourceDialect,
1029    >;
1030    fn r#get_remote_debugging_port(&self) -> Self::GetRemoteDebuggingPortResponseFut {
1031        fn _decode(
1032            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1033        ) -> Result<ContextGetRemoteDebuggingPortResult, fidl::Error> {
1034            let _response = fidl::client::decode_transaction_body::<
1035                fidl::encoding::ResultType<ContextGetRemoteDebuggingPortResponse, ContextError>,
1036                fidl::encoding::DefaultFuchsiaResourceDialect,
1037                0x4ac6a26fe972f29,
1038            >(_buf?)?;
1039            Ok(_response.map(|x| x.port))
1040        }
1041        self.client.send_query_and_decode::<
1042            fidl::encoding::EmptyPayload,
1043            ContextGetRemoteDebuggingPortResult,
1044        >(
1045            (),
1046            0x4ac6a26fe972f29,
1047            fidl::encoding::DynamicFlags::empty(),
1048            _decode,
1049        )
1050    }
1051}
1052
1053pub struct ContextEventStream {
1054    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1055}
1056
1057impl std::marker::Unpin for ContextEventStream {}
1058
1059impl futures::stream::FusedStream for ContextEventStream {
1060    fn is_terminated(&self) -> bool {
1061        self.event_receiver.is_terminated()
1062    }
1063}
1064
1065impl futures::Stream for ContextEventStream {
1066    type Item = Result<ContextEvent, fidl::Error>;
1067
1068    fn poll_next(
1069        mut self: std::pin::Pin<&mut Self>,
1070        cx: &mut std::task::Context<'_>,
1071    ) -> std::task::Poll<Option<Self::Item>> {
1072        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1073            &mut self.event_receiver,
1074            cx
1075        )?) {
1076            Some(buf) => std::task::Poll::Ready(Some(ContextEvent::decode(buf))),
1077            None => std::task::Poll::Ready(None),
1078        }
1079    }
1080}
1081
1082#[derive(Debug)]
1083pub enum ContextEvent {}
1084
1085impl ContextEvent {
1086    /// Decodes a message buffer as a [`ContextEvent`].
1087    fn decode(
1088        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1089    ) -> Result<ContextEvent, fidl::Error> {
1090        let (bytes, _handles) = buf.split_mut();
1091        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1092        debug_assert_eq!(tx_header.tx_id, 0);
1093        match tx_header.ordinal {
1094            _ => Err(fidl::Error::UnknownOrdinal {
1095                ordinal: tx_header.ordinal,
1096                protocol_name: <ContextMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1097            }),
1098        }
1099    }
1100}
1101
1102/// A Stream of incoming requests for fuchsia.web/Context.
1103pub struct ContextRequestStream {
1104    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1105    is_terminated: bool,
1106}
1107
1108impl std::marker::Unpin for ContextRequestStream {}
1109
1110impl futures::stream::FusedStream for ContextRequestStream {
1111    fn is_terminated(&self) -> bool {
1112        self.is_terminated
1113    }
1114}
1115
1116impl fidl::endpoints::RequestStream for ContextRequestStream {
1117    type Protocol = ContextMarker;
1118    type ControlHandle = ContextControlHandle;
1119
1120    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1121        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1122    }
1123
1124    fn control_handle(&self) -> Self::ControlHandle {
1125        ContextControlHandle { inner: self.inner.clone() }
1126    }
1127
1128    fn into_inner(
1129        self,
1130    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1131    {
1132        (self.inner, self.is_terminated)
1133    }
1134
1135    fn from_inner(
1136        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1137        is_terminated: bool,
1138    ) -> Self {
1139        Self { inner, is_terminated }
1140    }
1141}
1142
1143impl futures::Stream for ContextRequestStream {
1144    type Item = Result<ContextRequest, fidl::Error>;
1145
1146    fn poll_next(
1147        mut self: std::pin::Pin<&mut Self>,
1148        cx: &mut std::task::Context<'_>,
1149    ) -> std::task::Poll<Option<Self::Item>> {
1150        let this = &mut *self;
1151        if this.inner.check_shutdown(cx) {
1152            this.is_terminated = true;
1153            return std::task::Poll::Ready(None);
1154        }
1155        if this.is_terminated {
1156            panic!("polled ContextRequestStream after completion");
1157        }
1158        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1159            |bytes, handles| {
1160                match this.inner.channel().read_etc(cx, bytes, handles) {
1161                    std::task::Poll::Ready(Ok(())) => {}
1162                    std::task::Poll::Pending => return std::task::Poll::Pending,
1163                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1164                        this.is_terminated = true;
1165                        return std::task::Poll::Ready(None);
1166                    }
1167                    std::task::Poll::Ready(Err(e)) => {
1168                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1169                            e.into(),
1170                        ))));
1171                    }
1172                }
1173
1174                // A message has been received from the channel
1175                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1176
1177                std::task::Poll::Ready(Some(match header.ordinal {
1178                    0x5440a38db7cd7d8f => {
1179                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1180                        let mut req = fidl::new_empty!(
1181                            ContextCreateFrameRequest,
1182                            fidl::encoding::DefaultFuchsiaResourceDialect
1183                        );
1184                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ContextCreateFrameRequest>(&header, _body_bytes, handles, &mut req)?;
1185                        let control_handle = ContextControlHandle { inner: this.inner.clone() };
1186                        Ok(ContextRequest::CreateFrame { frame: req.frame, control_handle })
1187                    }
1188                    0x2c968a330787be96 => {
1189                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1190                        let mut req = fidl::new_empty!(
1191                            ContextCreateFrameWithParamsRequest,
1192                            fidl::encoding::DefaultFuchsiaResourceDialect
1193                        );
1194                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ContextCreateFrameWithParamsRequest>(&header, _body_bytes, handles, &mut req)?;
1195                        let control_handle = ContextControlHandle { inner: this.inner.clone() };
1196                        Ok(ContextRequest::CreateFrameWithParams {
1197                            params: req.params,
1198                            frame: req.frame,
1199
1200                            control_handle,
1201                        })
1202                    }
1203                    0x7396cda568e3fca => {
1204                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1205                        let mut req = fidl::new_empty!(
1206                            ContextGetCookieManagerRequest,
1207                            fidl::encoding::DefaultFuchsiaResourceDialect
1208                        );
1209                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ContextGetCookieManagerRequest>(&header, _body_bytes, handles, &mut req)?;
1210                        let control_handle = ContextControlHandle { inner: this.inner.clone() };
1211                        Ok(ContextRequest::GetCookieManager {
1212                            manager: req.manager,
1213
1214                            control_handle,
1215                        })
1216                    }
1217                    0x4ac6a26fe972f29 => {
1218                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1219                        let mut req = fidl::new_empty!(
1220                            fidl::encoding::EmptyPayload,
1221                            fidl::encoding::DefaultFuchsiaResourceDialect
1222                        );
1223                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1224                        let control_handle = ContextControlHandle { inner: this.inner.clone() };
1225                        Ok(ContextRequest::GetRemoteDebuggingPort {
1226                            responder: ContextGetRemoteDebuggingPortResponder {
1227                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1228                                tx_id: header.tx_id,
1229                            },
1230                        })
1231                    }
1232                    _ => Err(fidl::Error::UnknownOrdinal {
1233                        ordinal: header.ordinal,
1234                        protocol_name:
1235                            <ContextMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1236                    }),
1237                }))
1238            },
1239        )
1240    }
1241}
1242
1243/// Manages browsing state (e.g. LocalStorage, cookies, etc) associated with a set of [`Frame`].
1244#[derive(Debug)]
1245pub enum ContextRequest {
1246    /// Creates a new [`Frame`] under this [`Context`]. Destruction of a [`Context`] triggers the
1247    /// destruction of all of its associated [`Frame`]. [`Frame`] can be transferred to another
1248    /// component but cannot be shared across multiple components.
1249    ///
1250    /// - `frame`: An interface request that will be bound to the created [`Frame`].
1251    CreateFrame {
1252        frame: fidl::endpoints::ServerEnd<FrameMarker>,
1253        control_handle: ContextControlHandle,
1254    },
1255    /// Similar to [`Context.CreateFrame`], with extra parameters.
1256    ///
1257    /// - `params`: The configuration used to create the [`Frame`].
1258    ///   This method will fail with `ZX_ERR_INVALID_ARGS` if the table is not clonable.
1259    /// - `frame`: An interface request that will be bound to the created [`Frame`].
1260    CreateFrameWithParams {
1261        params: CreateFrameParams,
1262        frame: fidl::endpoints::ServerEnd<FrameMarker>,
1263        control_handle: ContextControlHandle,
1264    },
1265    /// Used to observe cookies for sites hosted under this Context.
1266    GetCookieManager {
1267        manager: fidl::endpoints::ServerEnd<CookieManagerMarker>,
1268        control_handle: ContextControlHandle,
1269    },
1270    /// Waits until debugging is available on one or more Frames, and returns the DevTools port
1271    /// number. Multiple calls may be queued to received the port number.
1272    ///
1273    /// If an error occurred, the [`ContextError`] will be set to this value:
1274    /// - `REMOTE_DEBUGGING_PORT_NOT_OPENED`: `remote_debugging_port` was not set in
1275    ///   [`CreateContextParams`] or the remote debugging service failed to start.
1276    GetRemoteDebuggingPort { responder: ContextGetRemoteDebuggingPortResponder },
1277}
1278
1279impl ContextRequest {
1280    #[allow(irrefutable_let_patterns)]
1281    pub fn into_create_frame(
1282        self,
1283    ) -> Option<(fidl::endpoints::ServerEnd<FrameMarker>, ContextControlHandle)> {
1284        if let ContextRequest::CreateFrame { frame, control_handle } = self {
1285            Some((frame, control_handle))
1286        } else {
1287            None
1288        }
1289    }
1290
1291    #[allow(irrefutable_let_patterns)]
1292    pub fn into_create_frame_with_params(
1293        self,
1294    ) -> Option<(CreateFrameParams, fidl::endpoints::ServerEnd<FrameMarker>, ContextControlHandle)>
1295    {
1296        if let ContextRequest::CreateFrameWithParams { params, frame, control_handle } = self {
1297            Some((params, frame, control_handle))
1298        } else {
1299            None
1300        }
1301    }
1302
1303    #[allow(irrefutable_let_patterns)]
1304    pub fn into_get_cookie_manager(
1305        self,
1306    ) -> Option<(fidl::endpoints::ServerEnd<CookieManagerMarker>, ContextControlHandle)> {
1307        if let ContextRequest::GetCookieManager { manager, control_handle } = self {
1308            Some((manager, control_handle))
1309        } else {
1310            None
1311        }
1312    }
1313
1314    #[allow(irrefutable_let_patterns)]
1315    pub fn into_get_remote_debugging_port(
1316        self,
1317    ) -> Option<(ContextGetRemoteDebuggingPortResponder)> {
1318        if let ContextRequest::GetRemoteDebuggingPort { responder } = self {
1319            Some((responder))
1320        } else {
1321            None
1322        }
1323    }
1324
1325    /// Name of the method defined in FIDL
1326    pub fn method_name(&self) -> &'static str {
1327        match *self {
1328            ContextRequest::CreateFrame { .. } => "create_frame",
1329            ContextRequest::CreateFrameWithParams { .. } => "create_frame_with_params",
1330            ContextRequest::GetCookieManager { .. } => "get_cookie_manager",
1331            ContextRequest::GetRemoteDebuggingPort { .. } => "get_remote_debugging_port",
1332        }
1333    }
1334}
1335
1336#[derive(Debug, Clone)]
1337pub struct ContextControlHandle {
1338    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1339}
1340
1341impl fidl::endpoints::ControlHandle for ContextControlHandle {
1342    fn shutdown(&self) {
1343        self.inner.shutdown()
1344    }
1345    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1346        self.inner.shutdown_with_epitaph(status)
1347    }
1348
1349    fn is_closed(&self) -> bool {
1350        self.inner.channel().is_closed()
1351    }
1352    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1353        self.inner.channel().on_closed()
1354    }
1355
1356    #[cfg(target_os = "fuchsia")]
1357    fn signal_peer(
1358        &self,
1359        clear_mask: zx::Signals,
1360        set_mask: zx::Signals,
1361    ) -> Result<(), zx_status::Status> {
1362        use fidl::Peered;
1363        self.inner.channel().signal_peer(clear_mask, set_mask)
1364    }
1365}
1366
1367impl ContextControlHandle {}
1368
1369#[must_use = "FIDL methods require a response to be sent"]
1370#[derive(Debug)]
1371pub struct ContextGetRemoteDebuggingPortResponder {
1372    control_handle: std::mem::ManuallyDrop<ContextControlHandle>,
1373    tx_id: u32,
1374}
1375
1376/// Set the the channel to be shutdown (see [`ContextControlHandle::shutdown`])
1377/// if the responder is dropped without sending a response, so that the client
1378/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1379impl std::ops::Drop for ContextGetRemoteDebuggingPortResponder {
1380    fn drop(&mut self) {
1381        self.control_handle.shutdown();
1382        // Safety: drops once, never accessed again
1383        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1384    }
1385}
1386
1387impl fidl::endpoints::Responder for ContextGetRemoteDebuggingPortResponder {
1388    type ControlHandle = ContextControlHandle;
1389
1390    fn control_handle(&self) -> &ContextControlHandle {
1391        &self.control_handle
1392    }
1393
1394    fn drop_without_shutdown(mut self) {
1395        // Safety: drops once, never accessed again due to mem::forget
1396        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1397        // Prevent Drop from running (which would shut down the channel)
1398        std::mem::forget(self);
1399    }
1400}
1401
1402impl ContextGetRemoteDebuggingPortResponder {
1403    /// Sends a response to the FIDL transaction.
1404    ///
1405    /// Sets the channel to shutdown if an error occurs.
1406    pub fn send(self, mut result: Result<u16, ContextError>) -> Result<(), fidl::Error> {
1407        let _result = self.send_raw(result);
1408        if _result.is_err() {
1409            self.control_handle.shutdown();
1410        }
1411        self.drop_without_shutdown();
1412        _result
1413    }
1414
1415    /// Similar to "send" but does not shutdown the channel if an error occurs.
1416    pub fn send_no_shutdown_on_err(
1417        self,
1418        mut result: Result<u16, ContextError>,
1419    ) -> Result<(), fidl::Error> {
1420        let _result = self.send_raw(result);
1421        self.drop_without_shutdown();
1422        _result
1423    }
1424
1425    fn send_raw(&self, mut result: Result<u16, ContextError>) -> Result<(), fidl::Error> {
1426        self.control_handle.inner.send::<fidl::encoding::ResultType<
1427            ContextGetRemoteDebuggingPortResponse,
1428            ContextError,
1429        >>(
1430            result.map(|port| (port,)),
1431            self.tx_id,
1432            0x4ac6a26fe972f29,
1433            fidl::encoding::DynamicFlags::empty(),
1434        )
1435    }
1436}
1437
1438#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1439pub struct ContextProviderMarker;
1440
1441impl fidl::endpoints::ProtocolMarker for ContextProviderMarker {
1442    type Proxy = ContextProviderProxy;
1443    type RequestStream = ContextProviderRequestStream;
1444    #[cfg(target_os = "fuchsia")]
1445    type SynchronousProxy = ContextProviderSynchronousProxy;
1446
1447    const DEBUG_NAME: &'static str = "fuchsia.web.ContextProvider";
1448}
1449impl fidl::endpoints::DiscoverableProtocolMarker for ContextProviderMarker {}
1450
1451pub trait ContextProviderProxyInterface: Send + Sync {
1452    fn r#create(
1453        &self,
1454        params: CreateContextParams,
1455        context: fidl::endpoints::ServerEnd<ContextMarker>,
1456    ) -> Result<(), fidl::Error>;
1457}
1458#[derive(Debug)]
1459#[cfg(target_os = "fuchsia")]
1460pub struct ContextProviderSynchronousProxy {
1461    client: fidl::client::sync::Client,
1462}
1463
1464#[cfg(target_os = "fuchsia")]
1465impl fidl::endpoints::SynchronousProxy for ContextProviderSynchronousProxy {
1466    type Proxy = ContextProviderProxy;
1467    type Protocol = ContextProviderMarker;
1468
1469    fn from_channel(inner: fidl::Channel) -> Self {
1470        Self::new(inner)
1471    }
1472
1473    fn into_channel(self) -> fidl::Channel {
1474        self.client.into_channel()
1475    }
1476
1477    fn as_channel(&self) -> &fidl::Channel {
1478        self.client.as_channel()
1479    }
1480}
1481
1482#[cfg(target_os = "fuchsia")]
1483impl ContextProviderSynchronousProxy {
1484    pub fn new(channel: fidl::Channel) -> Self {
1485        let protocol_name = <ContextProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1486        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1487    }
1488
1489    pub fn into_channel(self) -> fidl::Channel {
1490        self.client.into_channel()
1491    }
1492
1493    /// Waits until an event arrives and returns it. It is safe for other
1494    /// threads to make concurrent requests while waiting for an event.
1495    pub fn wait_for_event(
1496        &self,
1497        deadline: zx::MonotonicInstant,
1498    ) -> Result<ContextProviderEvent, fidl::Error> {
1499        ContextProviderEvent::decode(self.client.wait_for_event(deadline)?)
1500    }
1501
1502    /// Creates a new browser [`Context`] whose state is wholly independent and isolated from other
1503    /// [`Context`](`Contexts`).
1504    ///
1505    /// - `params`: The configuration used to create the [`Context`].
1506    /// - `context`: An interface request which will receive a bound [`Context`]
1507    ///   service.
1508    pub fn r#create(
1509        &self,
1510        mut params: CreateContextParams,
1511        mut context: fidl::endpoints::ServerEnd<ContextMarker>,
1512    ) -> Result<(), fidl::Error> {
1513        self.client.send::<ContextProviderCreateRequest>(
1514            (&mut params, context),
1515            0x6ee6fa35978eb98d,
1516            fidl::encoding::DynamicFlags::empty(),
1517        )
1518    }
1519}
1520
1521#[cfg(target_os = "fuchsia")]
1522impl From<ContextProviderSynchronousProxy> for zx::Handle {
1523    fn from(value: ContextProviderSynchronousProxy) -> Self {
1524        value.into_channel().into()
1525    }
1526}
1527
1528#[cfg(target_os = "fuchsia")]
1529impl From<fidl::Channel> for ContextProviderSynchronousProxy {
1530    fn from(value: fidl::Channel) -> Self {
1531        Self::new(value)
1532    }
1533}
1534
1535#[cfg(target_os = "fuchsia")]
1536impl fidl::endpoints::FromClient for ContextProviderSynchronousProxy {
1537    type Protocol = ContextProviderMarker;
1538
1539    fn from_client(value: fidl::endpoints::ClientEnd<ContextProviderMarker>) -> Self {
1540        Self::new(value.into_channel())
1541    }
1542}
1543
1544#[derive(Debug, Clone)]
1545pub struct ContextProviderProxy {
1546    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1547}
1548
1549impl fidl::endpoints::Proxy for ContextProviderProxy {
1550    type Protocol = ContextProviderMarker;
1551
1552    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1553        Self::new(inner)
1554    }
1555
1556    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1557        self.client.into_channel().map_err(|client| Self { client })
1558    }
1559
1560    fn as_channel(&self) -> &::fidl::AsyncChannel {
1561        self.client.as_channel()
1562    }
1563}
1564
1565impl ContextProviderProxy {
1566    /// Create a new Proxy for fuchsia.web/ContextProvider.
1567    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1568        let protocol_name = <ContextProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1569        Self { client: fidl::client::Client::new(channel, protocol_name) }
1570    }
1571
1572    /// Get a Stream of events from the remote end of the protocol.
1573    ///
1574    /// # Panics
1575    ///
1576    /// Panics if the event stream was already taken.
1577    pub fn take_event_stream(&self) -> ContextProviderEventStream {
1578        ContextProviderEventStream { event_receiver: self.client.take_event_receiver() }
1579    }
1580
1581    /// Creates a new browser [`Context`] whose state is wholly independent and isolated from other
1582    /// [`Context`](`Contexts`).
1583    ///
1584    /// - `params`: The configuration used to create the [`Context`].
1585    /// - `context`: An interface request which will receive a bound [`Context`]
1586    ///   service.
1587    pub fn r#create(
1588        &self,
1589        mut params: CreateContextParams,
1590        mut context: fidl::endpoints::ServerEnd<ContextMarker>,
1591    ) -> Result<(), fidl::Error> {
1592        ContextProviderProxyInterface::r#create(self, params, context)
1593    }
1594}
1595
1596impl ContextProviderProxyInterface for ContextProviderProxy {
1597    fn r#create(
1598        &self,
1599        mut params: CreateContextParams,
1600        mut context: fidl::endpoints::ServerEnd<ContextMarker>,
1601    ) -> Result<(), fidl::Error> {
1602        self.client.send::<ContextProviderCreateRequest>(
1603            (&mut params, context),
1604            0x6ee6fa35978eb98d,
1605            fidl::encoding::DynamicFlags::empty(),
1606        )
1607    }
1608}
1609
1610pub struct ContextProviderEventStream {
1611    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1612}
1613
1614impl std::marker::Unpin for ContextProviderEventStream {}
1615
1616impl futures::stream::FusedStream for ContextProviderEventStream {
1617    fn is_terminated(&self) -> bool {
1618        self.event_receiver.is_terminated()
1619    }
1620}
1621
1622impl futures::Stream for ContextProviderEventStream {
1623    type Item = Result<ContextProviderEvent, fidl::Error>;
1624
1625    fn poll_next(
1626        mut self: std::pin::Pin<&mut Self>,
1627        cx: &mut std::task::Context<'_>,
1628    ) -> std::task::Poll<Option<Self::Item>> {
1629        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1630            &mut self.event_receiver,
1631            cx
1632        )?) {
1633            Some(buf) => std::task::Poll::Ready(Some(ContextProviderEvent::decode(buf))),
1634            None => std::task::Poll::Ready(None),
1635        }
1636    }
1637}
1638
1639#[derive(Debug)]
1640pub enum ContextProviderEvent {}
1641
1642impl ContextProviderEvent {
1643    /// Decodes a message buffer as a [`ContextProviderEvent`].
1644    fn decode(
1645        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1646    ) -> Result<ContextProviderEvent, fidl::Error> {
1647        let (bytes, _handles) = buf.split_mut();
1648        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1649        debug_assert_eq!(tx_header.tx_id, 0);
1650        match tx_header.ordinal {
1651            _ => Err(fidl::Error::UnknownOrdinal {
1652                ordinal: tx_header.ordinal,
1653                protocol_name:
1654                    <ContextProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1655            }),
1656        }
1657    }
1658}
1659
1660/// A Stream of incoming requests for fuchsia.web/ContextProvider.
1661pub struct ContextProviderRequestStream {
1662    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1663    is_terminated: bool,
1664}
1665
1666impl std::marker::Unpin for ContextProviderRequestStream {}
1667
1668impl futures::stream::FusedStream for ContextProviderRequestStream {
1669    fn is_terminated(&self) -> bool {
1670        self.is_terminated
1671    }
1672}
1673
1674impl fidl::endpoints::RequestStream for ContextProviderRequestStream {
1675    type Protocol = ContextProviderMarker;
1676    type ControlHandle = ContextProviderControlHandle;
1677
1678    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1679        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1680    }
1681
1682    fn control_handle(&self) -> Self::ControlHandle {
1683        ContextProviderControlHandle { inner: self.inner.clone() }
1684    }
1685
1686    fn into_inner(
1687        self,
1688    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1689    {
1690        (self.inner, self.is_terminated)
1691    }
1692
1693    fn from_inner(
1694        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1695        is_terminated: bool,
1696    ) -> Self {
1697        Self { inner, is_terminated }
1698    }
1699}
1700
1701impl futures::Stream for ContextProviderRequestStream {
1702    type Item = Result<ContextProviderRequest, fidl::Error>;
1703
1704    fn poll_next(
1705        mut self: std::pin::Pin<&mut Self>,
1706        cx: &mut std::task::Context<'_>,
1707    ) -> std::task::Poll<Option<Self::Item>> {
1708        let this = &mut *self;
1709        if this.inner.check_shutdown(cx) {
1710            this.is_terminated = true;
1711            return std::task::Poll::Ready(None);
1712        }
1713        if this.is_terminated {
1714            panic!("polled ContextProviderRequestStream after completion");
1715        }
1716        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1717            |bytes, handles| {
1718                match this.inner.channel().read_etc(cx, bytes, handles) {
1719                    std::task::Poll::Ready(Ok(())) => {}
1720                    std::task::Poll::Pending => return std::task::Poll::Pending,
1721                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1722                        this.is_terminated = true;
1723                        return std::task::Poll::Ready(None);
1724                    }
1725                    std::task::Poll::Ready(Err(e)) => {
1726                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1727                            e.into(),
1728                        ))));
1729                    }
1730                }
1731
1732                // A message has been received from the channel
1733                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1734
1735                std::task::Poll::Ready(Some(match header.ordinal {
1736                    0x6ee6fa35978eb98d => {
1737                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1738                        let mut req = fidl::new_empty!(
1739                            ContextProviderCreateRequest,
1740                            fidl::encoding::DefaultFuchsiaResourceDialect
1741                        );
1742                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ContextProviderCreateRequest>(&header, _body_bytes, handles, &mut req)?;
1743                        let control_handle =
1744                            ContextProviderControlHandle { inner: this.inner.clone() };
1745                        Ok(ContextProviderRequest::Create {
1746                            params: req.params,
1747                            context: req.context,
1748
1749                            control_handle,
1750                        })
1751                    }
1752                    _ => Err(fidl::Error::UnknownOrdinal {
1753                        ordinal: header.ordinal,
1754                        protocol_name:
1755                            <ContextProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1756                    }),
1757                }))
1758            },
1759        )
1760    }
1761}
1762
1763/// The top-level service interface which allows for the creation of Context resources.
1764#[derive(Debug)]
1765pub enum ContextProviderRequest {
1766    /// Creates a new browser [`Context`] whose state is wholly independent and isolated from other
1767    /// [`Context`](`Contexts`).
1768    ///
1769    /// - `params`: The configuration used to create the [`Context`].
1770    /// - `context`: An interface request which will receive a bound [`Context`]
1771    ///   service.
1772    Create {
1773        params: CreateContextParams,
1774        context: fidl::endpoints::ServerEnd<ContextMarker>,
1775        control_handle: ContextProviderControlHandle,
1776    },
1777}
1778
1779impl ContextProviderRequest {
1780    #[allow(irrefutable_let_patterns)]
1781    pub fn into_create(
1782        self,
1783    ) -> Option<(
1784        CreateContextParams,
1785        fidl::endpoints::ServerEnd<ContextMarker>,
1786        ContextProviderControlHandle,
1787    )> {
1788        if let ContextProviderRequest::Create { params, context, control_handle } = self {
1789            Some((params, context, control_handle))
1790        } else {
1791            None
1792        }
1793    }
1794
1795    /// Name of the method defined in FIDL
1796    pub fn method_name(&self) -> &'static str {
1797        match *self {
1798            ContextProviderRequest::Create { .. } => "create",
1799        }
1800    }
1801}
1802
1803#[derive(Debug, Clone)]
1804pub struct ContextProviderControlHandle {
1805    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1806}
1807
1808impl fidl::endpoints::ControlHandle for ContextProviderControlHandle {
1809    fn shutdown(&self) {
1810        self.inner.shutdown()
1811    }
1812    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1813        self.inner.shutdown_with_epitaph(status)
1814    }
1815
1816    fn is_closed(&self) -> bool {
1817        self.inner.channel().is_closed()
1818    }
1819    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1820        self.inner.channel().on_closed()
1821    }
1822
1823    #[cfg(target_os = "fuchsia")]
1824    fn signal_peer(
1825        &self,
1826        clear_mask: zx::Signals,
1827        set_mask: zx::Signals,
1828    ) -> Result<(), zx_status::Status> {
1829        use fidl::Peered;
1830        self.inner.channel().signal_peer(clear_mask, set_mask)
1831    }
1832}
1833
1834impl ContextProviderControlHandle {}
1835
1836#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1837pub struct CookieManagerMarker;
1838
1839impl fidl::endpoints::ProtocolMarker for CookieManagerMarker {
1840    type Proxy = CookieManagerProxy;
1841    type RequestStream = CookieManagerRequestStream;
1842    #[cfg(target_os = "fuchsia")]
1843    type SynchronousProxy = CookieManagerSynchronousProxy;
1844
1845    const DEBUG_NAME: &'static str = "(anonymous) CookieManager";
1846}
1847
1848pub trait CookieManagerProxyInterface: Send + Sync {
1849    fn r#observe_cookie_changes(
1850        &self,
1851        url: Option<&str>,
1852        name: Option<&str>,
1853        changes: fidl::endpoints::ServerEnd<CookiesIteratorMarker>,
1854    ) -> Result<(), fidl::Error>;
1855    fn r#get_cookie_list(
1856        &self,
1857        url: Option<&str>,
1858        name: Option<&str>,
1859        cookies: fidl::endpoints::ServerEnd<CookiesIteratorMarker>,
1860    ) -> Result<(), fidl::Error>;
1861}
1862#[derive(Debug)]
1863#[cfg(target_os = "fuchsia")]
1864pub struct CookieManagerSynchronousProxy {
1865    client: fidl::client::sync::Client,
1866}
1867
1868#[cfg(target_os = "fuchsia")]
1869impl fidl::endpoints::SynchronousProxy for CookieManagerSynchronousProxy {
1870    type Proxy = CookieManagerProxy;
1871    type Protocol = CookieManagerMarker;
1872
1873    fn from_channel(inner: fidl::Channel) -> Self {
1874        Self::new(inner)
1875    }
1876
1877    fn into_channel(self) -> fidl::Channel {
1878        self.client.into_channel()
1879    }
1880
1881    fn as_channel(&self) -> &fidl::Channel {
1882        self.client.as_channel()
1883    }
1884}
1885
1886#[cfg(target_os = "fuchsia")]
1887impl CookieManagerSynchronousProxy {
1888    pub fn new(channel: fidl::Channel) -> Self {
1889        let protocol_name = <CookieManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1890        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1891    }
1892
1893    pub fn into_channel(self) -> fidl::Channel {
1894        self.client.into_channel()
1895    }
1896
1897    /// Waits until an event arrives and returns it. It is safe for other
1898    /// threads to make concurrent requests while waiting for an event.
1899    pub fn wait_for_event(
1900        &self,
1901        deadline: zx::MonotonicInstant,
1902    ) -> Result<CookieManagerEvent, fidl::Error> {
1903        CookieManagerEvent::decode(self.client.wait_for_event(deadline)?)
1904    }
1905
1906    /// Observe changes to all cookies named `name` that would be sent in a request to `url`.
1907    ///
1908    /// If neither `url` nor `name` are set then all cookies are observed. If only `url` is set
1909    /// then all cookies for that URL are observed. If both are set then only cookies matching both
1910    /// fields are observed.
1911    ///
1912    /// `changes` iterates over a stream of cookie changes. Additions or updates are expressed as
1913    /// complete cookies, while deletions are expressed as cookies with no `value` set.
1914    pub fn r#observe_cookie_changes(
1915        &self,
1916        mut url: Option<&str>,
1917        mut name: Option<&str>,
1918        mut changes: fidl::endpoints::ServerEnd<CookiesIteratorMarker>,
1919    ) -> Result<(), fidl::Error> {
1920        self.client.send::<CookieManagerObserveCookieChangesRequest>(
1921            (url, name, changes),
1922            0x49d8259726088b2,
1923            fidl::encoding::DynamicFlags::empty(),
1924        )
1925    }
1926
1927    /// Returns a list of Cookies, optionally limited to those matching `url`, and optionally
1928    /// `name`. `cookies` iterates over the matching cookies, including their `value`s.
1929    pub fn r#get_cookie_list(
1930        &self,
1931        mut url: Option<&str>,
1932        mut name: Option<&str>,
1933        mut cookies: fidl::endpoints::ServerEnd<CookiesIteratorMarker>,
1934    ) -> Result<(), fidl::Error> {
1935        self.client.send::<CookieManagerGetCookieListRequest>(
1936            (url, name, cookies),
1937            0x391d79f54044f334,
1938            fidl::encoding::DynamicFlags::empty(),
1939        )
1940    }
1941}
1942
1943#[cfg(target_os = "fuchsia")]
1944impl From<CookieManagerSynchronousProxy> for zx::Handle {
1945    fn from(value: CookieManagerSynchronousProxy) -> Self {
1946        value.into_channel().into()
1947    }
1948}
1949
1950#[cfg(target_os = "fuchsia")]
1951impl From<fidl::Channel> for CookieManagerSynchronousProxy {
1952    fn from(value: fidl::Channel) -> Self {
1953        Self::new(value)
1954    }
1955}
1956
1957#[cfg(target_os = "fuchsia")]
1958impl fidl::endpoints::FromClient for CookieManagerSynchronousProxy {
1959    type Protocol = CookieManagerMarker;
1960
1961    fn from_client(value: fidl::endpoints::ClientEnd<CookieManagerMarker>) -> Self {
1962        Self::new(value.into_channel())
1963    }
1964}
1965
1966#[derive(Debug, Clone)]
1967pub struct CookieManagerProxy {
1968    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1969}
1970
1971impl fidl::endpoints::Proxy for CookieManagerProxy {
1972    type Protocol = CookieManagerMarker;
1973
1974    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1975        Self::new(inner)
1976    }
1977
1978    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1979        self.client.into_channel().map_err(|client| Self { client })
1980    }
1981
1982    fn as_channel(&self) -> &::fidl::AsyncChannel {
1983        self.client.as_channel()
1984    }
1985}
1986
1987impl CookieManagerProxy {
1988    /// Create a new Proxy for fuchsia.web/CookieManager.
1989    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1990        let protocol_name = <CookieManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1991        Self { client: fidl::client::Client::new(channel, protocol_name) }
1992    }
1993
1994    /// Get a Stream of events from the remote end of the protocol.
1995    ///
1996    /// # Panics
1997    ///
1998    /// Panics if the event stream was already taken.
1999    pub fn take_event_stream(&self) -> CookieManagerEventStream {
2000        CookieManagerEventStream { event_receiver: self.client.take_event_receiver() }
2001    }
2002
2003    /// Observe changes to all cookies named `name` that would be sent in a request to `url`.
2004    ///
2005    /// If neither `url` nor `name` are set then all cookies are observed. If only `url` is set
2006    /// then all cookies for that URL are observed. If both are set then only cookies matching both
2007    /// fields are observed.
2008    ///
2009    /// `changes` iterates over a stream of cookie changes. Additions or updates are expressed as
2010    /// complete cookies, while deletions are expressed as cookies with no `value` set.
2011    pub fn r#observe_cookie_changes(
2012        &self,
2013        mut url: Option<&str>,
2014        mut name: Option<&str>,
2015        mut changes: fidl::endpoints::ServerEnd<CookiesIteratorMarker>,
2016    ) -> Result<(), fidl::Error> {
2017        CookieManagerProxyInterface::r#observe_cookie_changes(self, url, name, changes)
2018    }
2019
2020    /// Returns a list of Cookies, optionally limited to those matching `url`, and optionally
2021    /// `name`. `cookies` iterates over the matching cookies, including their `value`s.
2022    pub fn r#get_cookie_list(
2023        &self,
2024        mut url: Option<&str>,
2025        mut name: Option<&str>,
2026        mut cookies: fidl::endpoints::ServerEnd<CookiesIteratorMarker>,
2027    ) -> Result<(), fidl::Error> {
2028        CookieManagerProxyInterface::r#get_cookie_list(self, url, name, cookies)
2029    }
2030}
2031
2032impl CookieManagerProxyInterface for CookieManagerProxy {
2033    fn r#observe_cookie_changes(
2034        &self,
2035        mut url: Option<&str>,
2036        mut name: Option<&str>,
2037        mut changes: fidl::endpoints::ServerEnd<CookiesIteratorMarker>,
2038    ) -> Result<(), fidl::Error> {
2039        self.client.send::<CookieManagerObserveCookieChangesRequest>(
2040            (url, name, changes),
2041            0x49d8259726088b2,
2042            fidl::encoding::DynamicFlags::empty(),
2043        )
2044    }
2045
2046    fn r#get_cookie_list(
2047        &self,
2048        mut url: Option<&str>,
2049        mut name: Option<&str>,
2050        mut cookies: fidl::endpoints::ServerEnd<CookiesIteratorMarker>,
2051    ) -> Result<(), fidl::Error> {
2052        self.client.send::<CookieManagerGetCookieListRequest>(
2053            (url, name, cookies),
2054            0x391d79f54044f334,
2055            fidl::encoding::DynamicFlags::empty(),
2056        )
2057    }
2058}
2059
2060pub struct CookieManagerEventStream {
2061    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2062}
2063
2064impl std::marker::Unpin for CookieManagerEventStream {}
2065
2066impl futures::stream::FusedStream for CookieManagerEventStream {
2067    fn is_terminated(&self) -> bool {
2068        self.event_receiver.is_terminated()
2069    }
2070}
2071
2072impl futures::Stream for CookieManagerEventStream {
2073    type Item = Result<CookieManagerEvent, fidl::Error>;
2074
2075    fn poll_next(
2076        mut self: std::pin::Pin<&mut Self>,
2077        cx: &mut std::task::Context<'_>,
2078    ) -> std::task::Poll<Option<Self::Item>> {
2079        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2080            &mut self.event_receiver,
2081            cx
2082        )?) {
2083            Some(buf) => std::task::Poll::Ready(Some(CookieManagerEvent::decode(buf))),
2084            None => std::task::Poll::Ready(None),
2085        }
2086    }
2087}
2088
2089#[derive(Debug)]
2090pub enum CookieManagerEvent {}
2091
2092impl CookieManagerEvent {
2093    /// Decodes a message buffer as a [`CookieManagerEvent`].
2094    fn decode(
2095        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2096    ) -> Result<CookieManagerEvent, fidl::Error> {
2097        let (bytes, _handles) = buf.split_mut();
2098        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2099        debug_assert_eq!(tx_header.tx_id, 0);
2100        match tx_header.ordinal {
2101            _ => Err(fidl::Error::UnknownOrdinal {
2102                ordinal: tx_header.ordinal,
2103                protocol_name: <CookieManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2104            }),
2105        }
2106    }
2107}
2108
2109/// A Stream of incoming requests for fuchsia.web/CookieManager.
2110pub struct CookieManagerRequestStream {
2111    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2112    is_terminated: bool,
2113}
2114
2115impl std::marker::Unpin for CookieManagerRequestStream {}
2116
2117impl futures::stream::FusedStream for CookieManagerRequestStream {
2118    fn is_terminated(&self) -> bool {
2119        self.is_terminated
2120    }
2121}
2122
2123impl fidl::endpoints::RequestStream for CookieManagerRequestStream {
2124    type Protocol = CookieManagerMarker;
2125    type ControlHandle = CookieManagerControlHandle;
2126
2127    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2128        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2129    }
2130
2131    fn control_handle(&self) -> Self::ControlHandle {
2132        CookieManagerControlHandle { inner: self.inner.clone() }
2133    }
2134
2135    fn into_inner(
2136        self,
2137    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2138    {
2139        (self.inner, self.is_terminated)
2140    }
2141
2142    fn from_inner(
2143        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2144        is_terminated: bool,
2145    ) -> Self {
2146        Self { inner, is_terminated }
2147    }
2148}
2149
2150impl futures::Stream for CookieManagerRequestStream {
2151    type Item = Result<CookieManagerRequest, fidl::Error>;
2152
2153    fn poll_next(
2154        mut self: std::pin::Pin<&mut Self>,
2155        cx: &mut std::task::Context<'_>,
2156    ) -> std::task::Poll<Option<Self::Item>> {
2157        let this = &mut *self;
2158        if this.inner.check_shutdown(cx) {
2159            this.is_terminated = true;
2160            return std::task::Poll::Ready(None);
2161        }
2162        if this.is_terminated {
2163            panic!("polled CookieManagerRequestStream after completion");
2164        }
2165        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2166            |bytes, handles| {
2167                match this.inner.channel().read_etc(cx, bytes, handles) {
2168                    std::task::Poll::Ready(Ok(())) => {}
2169                    std::task::Poll::Pending => return std::task::Poll::Pending,
2170                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2171                        this.is_terminated = true;
2172                        return std::task::Poll::Ready(None);
2173                    }
2174                    std::task::Poll::Ready(Err(e)) => {
2175                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2176                            e.into(),
2177                        ))));
2178                    }
2179                }
2180
2181                // A message has been received from the channel
2182                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2183
2184                std::task::Poll::Ready(Some(match header.ordinal {
2185                    0x49d8259726088b2 => {
2186                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2187                        let mut req = fidl::new_empty!(
2188                            CookieManagerObserveCookieChangesRequest,
2189                            fidl::encoding::DefaultFuchsiaResourceDialect
2190                        );
2191                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CookieManagerObserveCookieChangesRequest>(&header, _body_bytes, handles, &mut req)?;
2192                        let control_handle =
2193                            CookieManagerControlHandle { inner: this.inner.clone() };
2194                        Ok(CookieManagerRequest::ObserveCookieChanges {
2195                            url: req.url,
2196                            name: req.name,
2197                            changes: req.changes,
2198
2199                            control_handle,
2200                        })
2201                    }
2202                    0x391d79f54044f334 => {
2203                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2204                        let mut req = fidl::new_empty!(
2205                            CookieManagerGetCookieListRequest,
2206                            fidl::encoding::DefaultFuchsiaResourceDialect
2207                        );
2208                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CookieManagerGetCookieListRequest>(&header, _body_bytes, handles, &mut req)?;
2209                        let control_handle =
2210                            CookieManagerControlHandle { inner: this.inner.clone() };
2211                        Ok(CookieManagerRequest::GetCookieList {
2212                            url: req.url,
2213                            name: req.name,
2214                            cookies: req.cookies,
2215
2216                            control_handle,
2217                        })
2218                    }
2219                    _ => Err(fidl::Error::UnknownOrdinal {
2220                        ordinal: header.ordinal,
2221                        protocol_name:
2222                            <CookieManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2223                    }),
2224                }))
2225            },
2226        )
2227    }
2228}
2229
2230/// Provides methods for monitoring and accessing browser cookie state.
2231#[derive(Debug)]
2232pub enum CookieManagerRequest {
2233    /// Observe changes to all cookies named `name` that would be sent in a request to `url`.
2234    ///
2235    /// If neither `url` nor `name` are set then all cookies are observed. If only `url` is set
2236    /// then all cookies for that URL are observed. If both are set then only cookies matching both
2237    /// fields are observed.
2238    ///
2239    /// `changes` iterates over a stream of cookie changes. Additions or updates are expressed as
2240    /// complete cookies, while deletions are expressed as cookies with no `value` set.
2241    ObserveCookieChanges {
2242        url: Option<String>,
2243        name: Option<String>,
2244        changes: fidl::endpoints::ServerEnd<CookiesIteratorMarker>,
2245        control_handle: CookieManagerControlHandle,
2246    },
2247    /// Returns a list of Cookies, optionally limited to those matching `url`, and optionally
2248    /// `name`. `cookies` iterates over the matching cookies, including their `value`s.
2249    GetCookieList {
2250        url: Option<String>,
2251        name: Option<String>,
2252        cookies: fidl::endpoints::ServerEnd<CookiesIteratorMarker>,
2253        control_handle: CookieManagerControlHandle,
2254    },
2255}
2256
2257impl CookieManagerRequest {
2258    #[allow(irrefutable_let_patterns)]
2259    pub fn into_observe_cookie_changes(
2260        self,
2261    ) -> Option<(
2262        Option<String>,
2263        Option<String>,
2264        fidl::endpoints::ServerEnd<CookiesIteratorMarker>,
2265        CookieManagerControlHandle,
2266    )> {
2267        if let CookieManagerRequest::ObserveCookieChanges { url, name, changes, control_handle } =
2268            self
2269        {
2270            Some((url, name, changes, control_handle))
2271        } else {
2272            None
2273        }
2274    }
2275
2276    #[allow(irrefutable_let_patterns)]
2277    pub fn into_get_cookie_list(
2278        self,
2279    ) -> Option<(
2280        Option<String>,
2281        Option<String>,
2282        fidl::endpoints::ServerEnd<CookiesIteratorMarker>,
2283        CookieManagerControlHandle,
2284    )> {
2285        if let CookieManagerRequest::GetCookieList { url, name, cookies, control_handle } = self {
2286            Some((url, name, cookies, control_handle))
2287        } else {
2288            None
2289        }
2290    }
2291
2292    /// Name of the method defined in FIDL
2293    pub fn method_name(&self) -> &'static str {
2294        match *self {
2295            CookieManagerRequest::ObserveCookieChanges { .. } => "observe_cookie_changes",
2296            CookieManagerRequest::GetCookieList { .. } => "get_cookie_list",
2297        }
2298    }
2299}
2300
2301#[derive(Debug, Clone)]
2302pub struct CookieManagerControlHandle {
2303    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2304}
2305
2306impl fidl::endpoints::ControlHandle for CookieManagerControlHandle {
2307    fn shutdown(&self) {
2308        self.inner.shutdown()
2309    }
2310    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2311        self.inner.shutdown_with_epitaph(status)
2312    }
2313
2314    fn is_closed(&self) -> bool {
2315        self.inner.channel().is_closed()
2316    }
2317    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2318        self.inner.channel().on_closed()
2319    }
2320
2321    #[cfg(target_os = "fuchsia")]
2322    fn signal_peer(
2323        &self,
2324        clear_mask: zx::Signals,
2325        set_mask: zx::Signals,
2326    ) -> Result<(), zx_status::Status> {
2327        use fidl::Peered;
2328        self.inner.channel().signal_peer(clear_mask, set_mask)
2329    }
2330}
2331
2332impl CookieManagerControlHandle {}
2333
2334#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2335pub struct CookiesIteratorMarker;
2336
2337impl fidl::endpoints::ProtocolMarker for CookiesIteratorMarker {
2338    type Proxy = CookiesIteratorProxy;
2339    type RequestStream = CookiesIteratorRequestStream;
2340    #[cfg(target_os = "fuchsia")]
2341    type SynchronousProxy = CookiesIteratorSynchronousProxy;
2342
2343    const DEBUG_NAME: &'static str = "(anonymous) CookiesIterator";
2344}
2345
2346pub trait CookiesIteratorProxyInterface: Send + Sync {
2347    type GetNextResponseFut: std::future::Future<Output = Result<Vec<Cookie>, fidl::Error>> + Send;
2348    fn r#get_next(&self) -> Self::GetNextResponseFut;
2349}
2350#[derive(Debug)]
2351#[cfg(target_os = "fuchsia")]
2352pub struct CookiesIteratorSynchronousProxy {
2353    client: fidl::client::sync::Client,
2354}
2355
2356#[cfg(target_os = "fuchsia")]
2357impl fidl::endpoints::SynchronousProxy for CookiesIteratorSynchronousProxy {
2358    type Proxy = CookiesIteratorProxy;
2359    type Protocol = CookiesIteratorMarker;
2360
2361    fn from_channel(inner: fidl::Channel) -> Self {
2362        Self::new(inner)
2363    }
2364
2365    fn into_channel(self) -> fidl::Channel {
2366        self.client.into_channel()
2367    }
2368
2369    fn as_channel(&self) -> &fidl::Channel {
2370        self.client.as_channel()
2371    }
2372}
2373
2374#[cfg(target_os = "fuchsia")]
2375impl CookiesIteratorSynchronousProxy {
2376    pub fn new(channel: fidl::Channel) -> Self {
2377        let protocol_name = <CookiesIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2378        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2379    }
2380
2381    pub fn into_channel(self) -> fidl::Channel {
2382        self.client.into_channel()
2383    }
2384
2385    /// Waits until an event arrives and returns it. It is safe for other
2386    /// threads to make concurrent requests while waiting for an event.
2387    pub fn wait_for_event(
2388        &self,
2389        deadline: zx::MonotonicInstant,
2390    ) -> Result<CookiesIteratorEvent, fidl::Error> {
2391        CookiesIteratorEvent::decode(self.client.wait_for_event(deadline)?)
2392    }
2393
2394    /// Fetches the next batch of cookies, or of changes to cookies.
2395    /// RFC6265 does not specify an upper-bound on the number of cookies which
2396    /// may be stored.
2397    pub fn r#get_next(
2398        &self,
2399        ___deadline: zx::MonotonicInstant,
2400    ) -> Result<Vec<Cookie>, fidl::Error> {
2401        let _response = self
2402            .client
2403            .send_query::<fidl::encoding::EmptyPayload, CookiesIteratorGetNextResponse>(
2404                (),
2405                0x61b55ebf67ec457d,
2406                fidl::encoding::DynamicFlags::empty(),
2407                ___deadline,
2408            )?;
2409        Ok(_response.changed_cookies)
2410    }
2411}
2412
2413#[cfg(target_os = "fuchsia")]
2414impl From<CookiesIteratorSynchronousProxy> for zx::Handle {
2415    fn from(value: CookiesIteratorSynchronousProxy) -> Self {
2416        value.into_channel().into()
2417    }
2418}
2419
2420#[cfg(target_os = "fuchsia")]
2421impl From<fidl::Channel> for CookiesIteratorSynchronousProxy {
2422    fn from(value: fidl::Channel) -> Self {
2423        Self::new(value)
2424    }
2425}
2426
2427#[cfg(target_os = "fuchsia")]
2428impl fidl::endpoints::FromClient for CookiesIteratorSynchronousProxy {
2429    type Protocol = CookiesIteratorMarker;
2430
2431    fn from_client(value: fidl::endpoints::ClientEnd<CookiesIteratorMarker>) -> Self {
2432        Self::new(value.into_channel())
2433    }
2434}
2435
2436#[derive(Debug, Clone)]
2437pub struct CookiesIteratorProxy {
2438    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2439}
2440
2441impl fidl::endpoints::Proxy for CookiesIteratorProxy {
2442    type Protocol = CookiesIteratorMarker;
2443
2444    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2445        Self::new(inner)
2446    }
2447
2448    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2449        self.client.into_channel().map_err(|client| Self { client })
2450    }
2451
2452    fn as_channel(&self) -> &::fidl::AsyncChannel {
2453        self.client.as_channel()
2454    }
2455}
2456
2457impl CookiesIteratorProxy {
2458    /// Create a new Proxy for fuchsia.web/CookiesIterator.
2459    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2460        let protocol_name = <CookiesIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2461        Self { client: fidl::client::Client::new(channel, protocol_name) }
2462    }
2463
2464    /// Get a Stream of events from the remote end of the protocol.
2465    ///
2466    /// # Panics
2467    ///
2468    /// Panics if the event stream was already taken.
2469    pub fn take_event_stream(&self) -> CookiesIteratorEventStream {
2470        CookiesIteratorEventStream { event_receiver: self.client.take_event_receiver() }
2471    }
2472
2473    /// Fetches the next batch of cookies, or of changes to cookies.
2474    /// RFC6265 does not specify an upper-bound on the number of cookies which
2475    /// may be stored.
2476    pub fn r#get_next(
2477        &self,
2478    ) -> fidl::client::QueryResponseFut<Vec<Cookie>, fidl::encoding::DefaultFuchsiaResourceDialect>
2479    {
2480        CookiesIteratorProxyInterface::r#get_next(self)
2481    }
2482}
2483
2484impl CookiesIteratorProxyInterface for CookiesIteratorProxy {
2485    type GetNextResponseFut =
2486        fidl::client::QueryResponseFut<Vec<Cookie>, fidl::encoding::DefaultFuchsiaResourceDialect>;
2487    fn r#get_next(&self) -> Self::GetNextResponseFut {
2488        fn _decode(
2489            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2490        ) -> Result<Vec<Cookie>, fidl::Error> {
2491            let _response = fidl::client::decode_transaction_body::<
2492                CookiesIteratorGetNextResponse,
2493                fidl::encoding::DefaultFuchsiaResourceDialect,
2494                0x61b55ebf67ec457d,
2495            >(_buf?)?;
2496            Ok(_response.changed_cookies)
2497        }
2498        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<Cookie>>(
2499            (),
2500            0x61b55ebf67ec457d,
2501            fidl::encoding::DynamicFlags::empty(),
2502            _decode,
2503        )
2504    }
2505}
2506
2507pub struct CookiesIteratorEventStream {
2508    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2509}
2510
2511impl std::marker::Unpin for CookiesIteratorEventStream {}
2512
2513impl futures::stream::FusedStream for CookiesIteratorEventStream {
2514    fn is_terminated(&self) -> bool {
2515        self.event_receiver.is_terminated()
2516    }
2517}
2518
2519impl futures::Stream for CookiesIteratorEventStream {
2520    type Item = Result<CookiesIteratorEvent, fidl::Error>;
2521
2522    fn poll_next(
2523        mut self: std::pin::Pin<&mut Self>,
2524        cx: &mut std::task::Context<'_>,
2525    ) -> std::task::Poll<Option<Self::Item>> {
2526        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2527            &mut self.event_receiver,
2528            cx
2529        )?) {
2530            Some(buf) => std::task::Poll::Ready(Some(CookiesIteratorEvent::decode(buf))),
2531            None => std::task::Poll::Ready(None),
2532        }
2533    }
2534}
2535
2536#[derive(Debug)]
2537pub enum CookiesIteratorEvent {}
2538
2539impl CookiesIteratorEvent {
2540    /// Decodes a message buffer as a [`CookiesIteratorEvent`].
2541    fn decode(
2542        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2543    ) -> Result<CookiesIteratorEvent, fidl::Error> {
2544        let (bytes, _handles) = buf.split_mut();
2545        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2546        debug_assert_eq!(tx_header.tx_id, 0);
2547        match tx_header.ordinal {
2548            _ => Err(fidl::Error::UnknownOrdinal {
2549                ordinal: tx_header.ordinal,
2550                protocol_name:
2551                    <CookiesIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2552            }),
2553        }
2554    }
2555}
2556
2557/// A Stream of incoming requests for fuchsia.web/CookiesIterator.
2558pub struct CookiesIteratorRequestStream {
2559    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2560    is_terminated: bool,
2561}
2562
2563impl std::marker::Unpin for CookiesIteratorRequestStream {}
2564
2565impl futures::stream::FusedStream for CookiesIteratorRequestStream {
2566    fn is_terminated(&self) -> bool {
2567        self.is_terminated
2568    }
2569}
2570
2571impl fidl::endpoints::RequestStream for CookiesIteratorRequestStream {
2572    type Protocol = CookiesIteratorMarker;
2573    type ControlHandle = CookiesIteratorControlHandle;
2574
2575    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2576        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2577    }
2578
2579    fn control_handle(&self) -> Self::ControlHandle {
2580        CookiesIteratorControlHandle { inner: self.inner.clone() }
2581    }
2582
2583    fn into_inner(
2584        self,
2585    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2586    {
2587        (self.inner, self.is_terminated)
2588    }
2589
2590    fn from_inner(
2591        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2592        is_terminated: bool,
2593    ) -> Self {
2594        Self { inner, is_terminated }
2595    }
2596}
2597
2598impl futures::Stream for CookiesIteratorRequestStream {
2599    type Item = Result<CookiesIteratorRequest, fidl::Error>;
2600
2601    fn poll_next(
2602        mut self: std::pin::Pin<&mut Self>,
2603        cx: &mut std::task::Context<'_>,
2604    ) -> std::task::Poll<Option<Self::Item>> {
2605        let this = &mut *self;
2606        if this.inner.check_shutdown(cx) {
2607            this.is_terminated = true;
2608            return std::task::Poll::Ready(None);
2609        }
2610        if this.is_terminated {
2611            panic!("polled CookiesIteratorRequestStream after completion");
2612        }
2613        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2614            |bytes, handles| {
2615                match this.inner.channel().read_etc(cx, bytes, handles) {
2616                    std::task::Poll::Ready(Ok(())) => {}
2617                    std::task::Poll::Pending => return std::task::Poll::Pending,
2618                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2619                        this.is_terminated = true;
2620                        return std::task::Poll::Ready(None);
2621                    }
2622                    std::task::Poll::Ready(Err(e)) => {
2623                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2624                            e.into(),
2625                        ))));
2626                    }
2627                }
2628
2629                // A message has been received from the channel
2630                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2631
2632                std::task::Poll::Ready(Some(match header.ordinal {
2633                    0x61b55ebf67ec457d => {
2634                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2635                        let mut req = fidl::new_empty!(
2636                            fidl::encoding::EmptyPayload,
2637                            fidl::encoding::DefaultFuchsiaResourceDialect
2638                        );
2639                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2640                        let control_handle =
2641                            CookiesIteratorControlHandle { inner: this.inner.clone() };
2642                        Ok(CookiesIteratorRequest::GetNext {
2643                            responder: CookiesIteratorGetNextResponder {
2644                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2645                                tx_id: header.tx_id,
2646                            },
2647                        })
2648                    }
2649                    _ => Err(fidl::Error::UnknownOrdinal {
2650                        ordinal: header.ordinal,
2651                        protocol_name:
2652                            <CookiesIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2653                    }),
2654                }))
2655            },
2656        )
2657    }
2658}
2659
2660/// Used to iterator over a set of cookies, or a stream of changes to cookies.
2661#[derive(Debug)]
2662pub enum CookiesIteratorRequest {
2663    /// Fetches the next batch of cookies, or of changes to cookies.
2664    /// RFC6265 does not specify an upper-bound on the number of cookies which
2665    /// may be stored.
2666    GetNext { responder: CookiesIteratorGetNextResponder },
2667}
2668
2669impl CookiesIteratorRequest {
2670    #[allow(irrefutable_let_patterns)]
2671    pub fn into_get_next(self) -> Option<(CookiesIteratorGetNextResponder)> {
2672        if let CookiesIteratorRequest::GetNext { responder } = self {
2673            Some((responder))
2674        } else {
2675            None
2676        }
2677    }
2678
2679    /// Name of the method defined in FIDL
2680    pub fn method_name(&self) -> &'static str {
2681        match *self {
2682            CookiesIteratorRequest::GetNext { .. } => "get_next",
2683        }
2684    }
2685}
2686
2687#[derive(Debug, Clone)]
2688pub struct CookiesIteratorControlHandle {
2689    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2690}
2691
2692impl fidl::endpoints::ControlHandle for CookiesIteratorControlHandle {
2693    fn shutdown(&self) {
2694        self.inner.shutdown()
2695    }
2696    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2697        self.inner.shutdown_with_epitaph(status)
2698    }
2699
2700    fn is_closed(&self) -> bool {
2701        self.inner.channel().is_closed()
2702    }
2703    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2704        self.inner.channel().on_closed()
2705    }
2706
2707    #[cfg(target_os = "fuchsia")]
2708    fn signal_peer(
2709        &self,
2710        clear_mask: zx::Signals,
2711        set_mask: zx::Signals,
2712    ) -> Result<(), zx_status::Status> {
2713        use fidl::Peered;
2714        self.inner.channel().signal_peer(clear_mask, set_mask)
2715    }
2716}
2717
2718impl CookiesIteratorControlHandle {}
2719
2720#[must_use = "FIDL methods require a response to be sent"]
2721#[derive(Debug)]
2722pub struct CookiesIteratorGetNextResponder {
2723    control_handle: std::mem::ManuallyDrop<CookiesIteratorControlHandle>,
2724    tx_id: u32,
2725}
2726
2727/// Set the the channel to be shutdown (see [`CookiesIteratorControlHandle::shutdown`])
2728/// if the responder is dropped without sending a response, so that the client
2729/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2730impl std::ops::Drop for CookiesIteratorGetNextResponder {
2731    fn drop(&mut self) {
2732        self.control_handle.shutdown();
2733        // Safety: drops once, never accessed again
2734        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2735    }
2736}
2737
2738impl fidl::endpoints::Responder for CookiesIteratorGetNextResponder {
2739    type ControlHandle = CookiesIteratorControlHandle;
2740
2741    fn control_handle(&self) -> &CookiesIteratorControlHandle {
2742        &self.control_handle
2743    }
2744
2745    fn drop_without_shutdown(mut self) {
2746        // Safety: drops once, never accessed again due to mem::forget
2747        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2748        // Prevent Drop from running (which would shut down the channel)
2749        std::mem::forget(self);
2750    }
2751}
2752
2753impl CookiesIteratorGetNextResponder {
2754    /// Sends a response to the FIDL transaction.
2755    ///
2756    /// Sets the channel to shutdown if an error occurs.
2757    pub fn send(self, mut changed_cookies: Vec<Cookie>) -> Result<(), fidl::Error> {
2758        let _result = self.send_raw(changed_cookies);
2759        if _result.is_err() {
2760            self.control_handle.shutdown();
2761        }
2762        self.drop_without_shutdown();
2763        _result
2764    }
2765
2766    /// Similar to "send" but does not shutdown the channel if an error occurs.
2767    pub fn send_no_shutdown_on_err(
2768        self,
2769        mut changed_cookies: Vec<Cookie>,
2770    ) -> Result<(), fidl::Error> {
2771        let _result = self.send_raw(changed_cookies);
2772        self.drop_without_shutdown();
2773        _result
2774    }
2775
2776    fn send_raw(&self, mut changed_cookies: Vec<Cookie>) -> Result<(), fidl::Error> {
2777        self.control_handle.inner.send::<CookiesIteratorGetNextResponse>(
2778            (changed_cookies.as_mut(),),
2779            self.tx_id,
2780            0x61b55ebf67ec457d,
2781            fidl::encoding::DynamicFlags::empty(),
2782        )
2783    }
2784}
2785
2786#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2787pub struct DebugMarker;
2788
2789impl fidl::endpoints::ProtocolMarker for DebugMarker {
2790    type Proxy = DebugProxy;
2791    type RequestStream = DebugRequestStream;
2792    #[cfg(target_os = "fuchsia")]
2793    type SynchronousProxy = DebugSynchronousProxy;
2794
2795    const DEBUG_NAME: &'static str = "fuchsia.web.Debug";
2796}
2797impl fidl::endpoints::DiscoverableProtocolMarker for DebugMarker {}
2798
2799pub trait DebugProxyInterface: Send + Sync {
2800    type EnableDevToolsResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
2801    fn r#enable_dev_tools(
2802        &self,
2803        listener: fidl::endpoints::ClientEnd<DevToolsListenerMarker>,
2804    ) -> Self::EnableDevToolsResponseFut;
2805}
2806#[derive(Debug)]
2807#[cfg(target_os = "fuchsia")]
2808pub struct DebugSynchronousProxy {
2809    client: fidl::client::sync::Client,
2810}
2811
2812#[cfg(target_os = "fuchsia")]
2813impl fidl::endpoints::SynchronousProxy for DebugSynchronousProxy {
2814    type Proxy = DebugProxy;
2815    type Protocol = DebugMarker;
2816
2817    fn from_channel(inner: fidl::Channel) -> Self {
2818        Self::new(inner)
2819    }
2820
2821    fn into_channel(self) -> fidl::Channel {
2822        self.client.into_channel()
2823    }
2824
2825    fn as_channel(&self) -> &fidl::Channel {
2826        self.client.as_channel()
2827    }
2828}
2829
2830#[cfg(target_os = "fuchsia")]
2831impl DebugSynchronousProxy {
2832    pub fn new(channel: fidl::Channel) -> Self {
2833        let protocol_name = <DebugMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2834        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2835    }
2836
2837    pub fn into_channel(self) -> fidl::Channel {
2838        self.client.into_channel()
2839    }
2840
2841    /// Waits until an event arrives and returns it. It is safe for other
2842    /// threads to make concurrent requests while waiting for an event.
2843    pub fn wait_for_event(
2844        &self,
2845        deadline: zx::MonotonicInstant,
2846    ) -> Result<DebugEvent, fidl::Error> {
2847        DebugEvent::decode(self.client.wait_for_event(deadline)?)
2848    }
2849
2850    /// Enables the DevTools service on every subsequent [`Context`] creation and delivers
2851    /// subsequent DevTools events to the supplied `listener`. The callback indicates when the
2852    /// WebEngine is in a debuggable state. Events will be sent to every `listener` registered with
2853    /// this method.
2854    ///
2855    /// Because DevTools debugging is exposed using TCP as its transport, only
2856    /// [`Context`]s created with access to network capabilities will report
2857    /// themselves as available for debugging.
2858    pub fn r#enable_dev_tools(
2859        &self,
2860        mut listener: fidl::endpoints::ClientEnd<DevToolsListenerMarker>,
2861        ___deadline: zx::MonotonicInstant,
2862    ) -> Result<(), fidl::Error> {
2863        let _response =
2864            self.client.send_query::<DebugEnableDevToolsRequest, fidl::encoding::EmptyPayload>(
2865                (listener,),
2866                0x44b5e1f4e4c548e4,
2867                fidl::encoding::DynamicFlags::empty(),
2868                ___deadline,
2869            )?;
2870        Ok(_response)
2871    }
2872}
2873
2874#[cfg(target_os = "fuchsia")]
2875impl From<DebugSynchronousProxy> for zx::Handle {
2876    fn from(value: DebugSynchronousProxy) -> Self {
2877        value.into_channel().into()
2878    }
2879}
2880
2881#[cfg(target_os = "fuchsia")]
2882impl From<fidl::Channel> for DebugSynchronousProxy {
2883    fn from(value: fidl::Channel) -> Self {
2884        Self::new(value)
2885    }
2886}
2887
2888#[cfg(target_os = "fuchsia")]
2889impl fidl::endpoints::FromClient for DebugSynchronousProxy {
2890    type Protocol = DebugMarker;
2891
2892    fn from_client(value: fidl::endpoints::ClientEnd<DebugMarker>) -> Self {
2893        Self::new(value.into_channel())
2894    }
2895}
2896
2897#[derive(Debug, Clone)]
2898pub struct DebugProxy {
2899    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2900}
2901
2902impl fidl::endpoints::Proxy for DebugProxy {
2903    type Protocol = DebugMarker;
2904
2905    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2906        Self::new(inner)
2907    }
2908
2909    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2910        self.client.into_channel().map_err(|client| Self { client })
2911    }
2912
2913    fn as_channel(&self) -> &::fidl::AsyncChannel {
2914        self.client.as_channel()
2915    }
2916}
2917
2918impl DebugProxy {
2919    /// Create a new Proxy for fuchsia.web/Debug.
2920    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2921        let protocol_name = <DebugMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2922        Self { client: fidl::client::Client::new(channel, protocol_name) }
2923    }
2924
2925    /// Get a Stream of events from the remote end of the protocol.
2926    ///
2927    /// # Panics
2928    ///
2929    /// Panics if the event stream was already taken.
2930    pub fn take_event_stream(&self) -> DebugEventStream {
2931        DebugEventStream { event_receiver: self.client.take_event_receiver() }
2932    }
2933
2934    /// Enables the DevTools service on every subsequent [`Context`] creation and delivers
2935    /// subsequent DevTools events to the supplied `listener`. The callback indicates when the
2936    /// WebEngine is in a debuggable state. Events will be sent to every `listener` registered with
2937    /// this method.
2938    ///
2939    /// Because DevTools debugging is exposed using TCP as its transport, only
2940    /// [`Context`]s created with access to network capabilities will report
2941    /// themselves as available for debugging.
2942    pub fn r#enable_dev_tools(
2943        &self,
2944        mut listener: fidl::endpoints::ClientEnd<DevToolsListenerMarker>,
2945    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
2946        DebugProxyInterface::r#enable_dev_tools(self, listener)
2947    }
2948}
2949
2950impl DebugProxyInterface for DebugProxy {
2951    type EnableDevToolsResponseFut =
2952        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
2953    fn r#enable_dev_tools(
2954        &self,
2955        mut listener: fidl::endpoints::ClientEnd<DevToolsListenerMarker>,
2956    ) -> Self::EnableDevToolsResponseFut {
2957        fn _decode(
2958            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2959        ) -> Result<(), fidl::Error> {
2960            let _response = fidl::client::decode_transaction_body::<
2961                fidl::encoding::EmptyPayload,
2962                fidl::encoding::DefaultFuchsiaResourceDialect,
2963                0x44b5e1f4e4c548e4,
2964            >(_buf?)?;
2965            Ok(_response)
2966        }
2967        self.client.send_query_and_decode::<DebugEnableDevToolsRequest, ()>(
2968            (listener,),
2969            0x44b5e1f4e4c548e4,
2970            fidl::encoding::DynamicFlags::empty(),
2971            _decode,
2972        )
2973    }
2974}
2975
2976pub struct DebugEventStream {
2977    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2978}
2979
2980impl std::marker::Unpin for DebugEventStream {}
2981
2982impl futures::stream::FusedStream for DebugEventStream {
2983    fn is_terminated(&self) -> bool {
2984        self.event_receiver.is_terminated()
2985    }
2986}
2987
2988impl futures::Stream for DebugEventStream {
2989    type Item = Result<DebugEvent, fidl::Error>;
2990
2991    fn poll_next(
2992        mut self: std::pin::Pin<&mut Self>,
2993        cx: &mut std::task::Context<'_>,
2994    ) -> std::task::Poll<Option<Self::Item>> {
2995        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2996            &mut self.event_receiver,
2997            cx
2998        )?) {
2999            Some(buf) => std::task::Poll::Ready(Some(DebugEvent::decode(buf))),
3000            None => std::task::Poll::Ready(None),
3001        }
3002    }
3003}
3004
3005#[derive(Debug)]
3006pub enum DebugEvent {}
3007
3008impl DebugEvent {
3009    /// Decodes a message buffer as a [`DebugEvent`].
3010    fn decode(
3011        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3012    ) -> Result<DebugEvent, fidl::Error> {
3013        let (bytes, _handles) = buf.split_mut();
3014        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3015        debug_assert_eq!(tx_header.tx_id, 0);
3016        match tx_header.ordinal {
3017            _ => Err(fidl::Error::UnknownOrdinal {
3018                ordinal: tx_header.ordinal,
3019                protocol_name: <DebugMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3020            }),
3021        }
3022    }
3023}
3024
3025/// A Stream of incoming requests for fuchsia.web/Debug.
3026pub struct DebugRequestStream {
3027    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3028    is_terminated: bool,
3029}
3030
3031impl std::marker::Unpin for DebugRequestStream {}
3032
3033impl futures::stream::FusedStream for DebugRequestStream {
3034    fn is_terminated(&self) -> bool {
3035        self.is_terminated
3036    }
3037}
3038
3039impl fidl::endpoints::RequestStream for DebugRequestStream {
3040    type Protocol = DebugMarker;
3041    type ControlHandle = DebugControlHandle;
3042
3043    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3044        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3045    }
3046
3047    fn control_handle(&self) -> Self::ControlHandle {
3048        DebugControlHandle { inner: self.inner.clone() }
3049    }
3050
3051    fn into_inner(
3052        self,
3053    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3054    {
3055        (self.inner, self.is_terminated)
3056    }
3057
3058    fn from_inner(
3059        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3060        is_terminated: bool,
3061    ) -> Self {
3062        Self { inner, is_terminated }
3063    }
3064}
3065
3066impl futures::Stream for DebugRequestStream {
3067    type Item = Result<DebugRequest, fidl::Error>;
3068
3069    fn poll_next(
3070        mut self: std::pin::Pin<&mut Self>,
3071        cx: &mut std::task::Context<'_>,
3072    ) -> std::task::Poll<Option<Self::Item>> {
3073        let this = &mut *self;
3074        if this.inner.check_shutdown(cx) {
3075            this.is_terminated = true;
3076            return std::task::Poll::Ready(None);
3077        }
3078        if this.is_terminated {
3079            panic!("polled DebugRequestStream after completion");
3080        }
3081        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3082            |bytes, handles| {
3083                match this.inner.channel().read_etc(cx, bytes, handles) {
3084                    std::task::Poll::Ready(Ok(())) => {}
3085                    std::task::Poll::Pending => return std::task::Poll::Pending,
3086                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3087                        this.is_terminated = true;
3088                        return std::task::Poll::Ready(None);
3089                    }
3090                    std::task::Poll::Ready(Err(e)) => {
3091                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3092                            e.into(),
3093                        ))));
3094                    }
3095                }
3096
3097                // A message has been received from the channel
3098                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3099
3100                std::task::Poll::Ready(Some(match header.ordinal {
3101                    0x44b5e1f4e4c548e4 => {
3102                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3103                        let mut req = fidl::new_empty!(
3104                            DebugEnableDevToolsRequest,
3105                            fidl::encoding::DefaultFuchsiaResourceDialect
3106                        );
3107                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DebugEnableDevToolsRequest>(&header, _body_bytes, handles, &mut req)?;
3108                        let control_handle = DebugControlHandle { inner: this.inner.clone() };
3109                        Ok(DebugRequest::EnableDevTools {
3110                            listener: req.listener,
3111
3112                            responder: DebugEnableDevToolsResponder {
3113                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3114                                tx_id: header.tx_id,
3115                            },
3116                        })
3117                    }
3118                    _ => Err(fidl::Error::UnknownOrdinal {
3119                        ordinal: header.ordinal,
3120                        protocol_name: <DebugMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3121                    }),
3122                }))
3123            },
3124        )
3125    }
3126}
3127
3128/// The debug service which allows to enable the DevTools service on Contexts.
3129#[derive(Debug)]
3130pub enum DebugRequest {
3131    /// Enables the DevTools service on every subsequent [`Context`] creation and delivers
3132    /// subsequent DevTools events to the supplied `listener`. The callback indicates when the
3133    /// WebEngine is in a debuggable state. Events will be sent to every `listener` registered with
3134    /// this method.
3135    ///
3136    /// Because DevTools debugging is exposed using TCP as its transport, only
3137    /// [`Context`]s created with access to network capabilities will report
3138    /// themselves as available for debugging.
3139    EnableDevTools {
3140        listener: fidl::endpoints::ClientEnd<DevToolsListenerMarker>,
3141        responder: DebugEnableDevToolsResponder,
3142    },
3143}
3144
3145impl DebugRequest {
3146    #[allow(irrefutable_let_patterns)]
3147    pub fn into_enable_dev_tools(
3148        self,
3149    ) -> Option<(fidl::endpoints::ClientEnd<DevToolsListenerMarker>, DebugEnableDevToolsResponder)>
3150    {
3151        if let DebugRequest::EnableDevTools { listener, responder } = self {
3152            Some((listener, responder))
3153        } else {
3154            None
3155        }
3156    }
3157
3158    /// Name of the method defined in FIDL
3159    pub fn method_name(&self) -> &'static str {
3160        match *self {
3161            DebugRequest::EnableDevTools { .. } => "enable_dev_tools",
3162        }
3163    }
3164}
3165
3166#[derive(Debug, Clone)]
3167pub struct DebugControlHandle {
3168    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3169}
3170
3171impl fidl::endpoints::ControlHandle for DebugControlHandle {
3172    fn shutdown(&self) {
3173        self.inner.shutdown()
3174    }
3175    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3176        self.inner.shutdown_with_epitaph(status)
3177    }
3178
3179    fn is_closed(&self) -> bool {
3180        self.inner.channel().is_closed()
3181    }
3182    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3183        self.inner.channel().on_closed()
3184    }
3185
3186    #[cfg(target_os = "fuchsia")]
3187    fn signal_peer(
3188        &self,
3189        clear_mask: zx::Signals,
3190        set_mask: zx::Signals,
3191    ) -> Result<(), zx_status::Status> {
3192        use fidl::Peered;
3193        self.inner.channel().signal_peer(clear_mask, set_mask)
3194    }
3195}
3196
3197impl DebugControlHandle {}
3198
3199#[must_use = "FIDL methods require a response to be sent"]
3200#[derive(Debug)]
3201pub struct DebugEnableDevToolsResponder {
3202    control_handle: std::mem::ManuallyDrop<DebugControlHandle>,
3203    tx_id: u32,
3204}
3205
3206/// Set the the channel to be shutdown (see [`DebugControlHandle::shutdown`])
3207/// if the responder is dropped without sending a response, so that the client
3208/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3209impl std::ops::Drop for DebugEnableDevToolsResponder {
3210    fn drop(&mut self) {
3211        self.control_handle.shutdown();
3212        // Safety: drops once, never accessed again
3213        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3214    }
3215}
3216
3217impl fidl::endpoints::Responder for DebugEnableDevToolsResponder {
3218    type ControlHandle = DebugControlHandle;
3219
3220    fn control_handle(&self) -> &DebugControlHandle {
3221        &self.control_handle
3222    }
3223
3224    fn drop_without_shutdown(mut self) {
3225        // Safety: drops once, never accessed again due to mem::forget
3226        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3227        // Prevent Drop from running (which would shut down the channel)
3228        std::mem::forget(self);
3229    }
3230}
3231
3232impl DebugEnableDevToolsResponder {
3233    /// Sends a response to the FIDL transaction.
3234    ///
3235    /// Sets the channel to shutdown if an error occurs.
3236    pub fn send(self) -> Result<(), fidl::Error> {
3237        let _result = self.send_raw();
3238        if _result.is_err() {
3239            self.control_handle.shutdown();
3240        }
3241        self.drop_without_shutdown();
3242        _result
3243    }
3244
3245    /// Similar to "send" but does not shutdown the channel if an error occurs.
3246    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
3247        let _result = self.send_raw();
3248        self.drop_without_shutdown();
3249        _result
3250    }
3251
3252    fn send_raw(&self) -> Result<(), fidl::Error> {
3253        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
3254            (),
3255            self.tx_id,
3256            0x44b5e1f4e4c548e4,
3257            fidl::encoding::DynamicFlags::empty(),
3258        )
3259    }
3260}
3261
3262#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3263pub struct DevToolsListenerMarker;
3264
3265impl fidl::endpoints::ProtocolMarker for DevToolsListenerMarker {
3266    type Proxy = DevToolsListenerProxy;
3267    type RequestStream = DevToolsListenerRequestStream;
3268    #[cfg(target_os = "fuchsia")]
3269    type SynchronousProxy = DevToolsListenerSynchronousProxy;
3270
3271    const DEBUG_NAME: &'static str = "(anonymous) DevToolsListener";
3272}
3273
3274pub trait DevToolsListenerProxyInterface: Send + Sync {
3275    fn r#on_context_dev_tools_available(
3276        &self,
3277        listener: fidl::endpoints::ServerEnd<DevToolsPerContextListenerMarker>,
3278    ) -> Result<(), fidl::Error>;
3279}
3280#[derive(Debug)]
3281#[cfg(target_os = "fuchsia")]
3282pub struct DevToolsListenerSynchronousProxy {
3283    client: fidl::client::sync::Client,
3284}
3285
3286#[cfg(target_os = "fuchsia")]
3287impl fidl::endpoints::SynchronousProxy for DevToolsListenerSynchronousProxy {
3288    type Proxy = DevToolsListenerProxy;
3289    type Protocol = DevToolsListenerMarker;
3290
3291    fn from_channel(inner: fidl::Channel) -> Self {
3292        Self::new(inner)
3293    }
3294
3295    fn into_channel(self) -> fidl::Channel {
3296        self.client.into_channel()
3297    }
3298
3299    fn as_channel(&self) -> &fidl::Channel {
3300        self.client.as_channel()
3301    }
3302}
3303
3304#[cfg(target_os = "fuchsia")]
3305impl DevToolsListenerSynchronousProxy {
3306    pub fn new(channel: fidl::Channel) -> Self {
3307        let protocol_name = <DevToolsListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3308        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3309    }
3310
3311    pub fn into_channel(self) -> fidl::Channel {
3312        self.client.into_channel()
3313    }
3314
3315    /// Waits until an event arrives and returns it. It is safe for other
3316    /// threads to make concurrent requests while waiting for an event.
3317    pub fn wait_for_event(
3318        &self,
3319        deadline: zx::MonotonicInstant,
3320    ) -> Result<DevToolsListenerEvent, fidl::Error> {
3321        DevToolsListenerEvent::decode(self.client.wait_for_event(deadline)?)
3322    }
3323
3324    /// Called when the DevTools service is available on a new [`Context`].
3325    ///
3326    /// - `listener`: Channel over which DevTools events for the new [`Context`] will
3327    ///   be delivered. This channel will disconnect when the [`Context`] is destroyed.
3328    pub fn r#on_context_dev_tools_available(
3329        &self,
3330        mut listener: fidl::endpoints::ServerEnd<DevToolsPerContextListenerMarker>,
3331    ) -> Result<(), fidl::Error> {
3332        self.client.send::<DevToolsListenerOnContextDevToolsAvailableRequest>(
3333            (listener,),
3334            0x4b259fb4d7e49e87,
3335            fidl::encoding::DynamicFlags::empty(),
3336        )
3337    }
3338}
3339
3340#[cfg(target_os = "fuchsia")]
3341impl From<DevToolsListenerSynchronousProxy> for zx::Handle {
3342    fn from(value: DevToolsListenerSynchronousProxy) -> Self {
3343        value.into_channel().into()
3344    }
3345}
3346
3347#[cfg(target_os = "fuchsia")]
3348impl From<fidl::Channel> for DevToolsListenerSynchronousProxy {
3349    fn from(value: fidl::Channel) -> Self {
3350        Self::new(value)
3351    }
3352}
3353
3354#[cfg(target_os = "fuchsia")]
3355impl fidl::endpoints::FromClient for DevToolsListenerSynchronousProxy {
3356    type Protocol = DevToolsListenerMarker;
3357
3358    fn from_client(value: fidl::endpoints::ClientEnd<DevToolsListenerMarker>) -> Self {
3359        Self::new(value.into_channel())
3360    }
3361}
3362
3363#[derive(Debug, Clone)]
3364pub struct DevToolsListenerProxy {
3365    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3366}
3367
3368impl fidl::endpoints::Proxy for DevToolsListenerProxy {
3369    type Protocol = DevToolsListenerMarker;
3370
3371    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3372        Self::new(inner)
3373    }
3374
3375    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3376        self.client.into_channel().map_err(|client| Self { client })
3377    }
3378
3379    fn as_channel(&self) -> &::fidl::AsyncChannel {
3380        self.client.as_channel()
3381    }
3382}
3383
3384impl DevToolsListenerProxy {
3385    /// Create a new Proxy for fuchsia.web/DevToolsListener.
3386    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3387        let protocol_name = <DevToolsListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3388        Self { client: fidl::client::Client::new(channel, protocol_name) }
3389    }
3390
3391    /// Get a Stream of events from the remote end of the protocol.
3392    ///
3393    /// # Panics
3394    ///
3395    /// Panics if the event stream was already taken.
3396    pub fn take_event_stream(&self) -> DevToolsListenerEventStream {
3397        DevToolsListenerEventStream { event_receiver: self.client.take_event_receiver() }
3398    }
3399
3400    /// Called when the DevTools service is available on a new [`Context`].
3401    ///
3402    /// - `listener`: Channel over which DevTools events for the new [`Context`] will
3403    ///   be delivered. This channel will disconnect when the [`Context`] is destroyed.
3404    pub fn r#on_context_dev_tools_available(
3405        &self,
3406        mut listener: fidl::endpoints::ServerEnd<DevToolsPerContextListenerMarker>,
3407    ) -> Result<(), fidl::Error> {
3408        DevToolsListenerProxyInterface::r#on_context_dev_tools_available(self, listener)
3409    }
3410}
3411
3412impl DevToolsListenerProxyInterface for DevToolsListenerProxy {
3413    fn r#on_context_dev_tools_available(
3414        &self,
3415        mut listener: fidl::endpoints::ServerEnd<DevToolsPerContextListenerMarker>,
3416    ) -> Result<(), fidl::Error> {
3417        self.client.send::<DevToolsListenerOnContextDevToolsAvailableRequest>(
3418            (listener,),
3419            0x4b259fb4d7e49e87,
3420            fidl::encoding::DynamicFlags::empty(),
3421        )
3422    }
3423}
3424
3425pub struct DevToolsListenerEventStream {
3426    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3427}
3428
3429impl std::marker::Unpin for DevToolsListenerEventStream {}
3430
3431impl futures::stream::FusedStream for DevToolsListenerEventStream {
3432    fn is_terminated(&self) -> bool {
3433        self.event_receiver.is_terminated()
3434    }
3435}
3436
3437impl futures::Stream for DevToolsListenerEventStream {
3438    type Item = Result<DevToolsListenerEvent, fidl::Error>;
3439
3440    fn poll_next(
3441        mut self: std::pin::Pin<&mut Self>,
3442        cx: &mut std::task::Context<'_>,
3443    ) -> std::task::Poll<Option<Self::Item>> {
3444        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3445            &mut self.event_receiver,
3446            cx
3447        )?) {
3448            Some(buf) => std::task::Poll::Ready(Some(DevToolsListenerEvent::decode(buf))),
3449            None => std::task::Poll::Ready(None),
3450        }
3451    }
3452}
3453
3454#[derive(Debug)]
3455pub enum DevToolsListenerEvent {}
3456
3457impl DevToolsListenerEvent {
3458    /// Decodes a message buffer as a [`DevToolsListenerEvent`].
3459    fn decode(
3460        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3461    ) -> Result<DevToolsListenerEvent, fidl::Error> {
3462        let (bytes, _handles) = buf.split_mut();
3463        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3464        debug_assert_eq!(tx_header.tx_id, 0);
3465        match tx_header.ordinal {
3466            _ => Err(fidl::Error::UnknownOrdinal {
3467                ordinal: tx_header.ordinal,
3468                protocol_name:
3469                    <DevToolsListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3470            }),
3471        }
3472    }
3473}
3474
3475/// A Stream of incoming requests for fuchsia.web/DevToolsListener.
3476pub struct DevToolsListenerRequestStream {
3477    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3478    is_terminated: bool,
3479}
3480
3481impl std::marker::Unpin for DevToolsListenerRequestStream {}
3482
3483impl futures::stream::FusedStream for DevToolsListenerRequestStream {
3484    fn is_terminated(&self) -> bool {
3485        self.is_terminated
3486    }
3487}
3488
3489impl fidl::endpoints::RequestStream for DevToolsListenerRequestStream {
3490    type Protocol = DevToolsListenerMarker;
3491    type ControlHandle = DevToolsListenerControlHandle;
3492
3493    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3494        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3495    }
3496
3497    fn control_handle(&self) -> Self::ControlHandle {
3498        DevToolsListenerControlHandle { inner: self.inner.clone() }
3499    }
3500
3501    fn into_inner(
3502        self,
3503    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3504    {
3505        (self.inner, self.is_terminated)
3506    }
3507
3508    fn from_inner(
3509        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3510        is_terminated: bool,
3511    ) -> Self {
3512        Self { inner, is_terminated }
3513    }
3514}
3515
3516impl futures::Stream for DevToolsListenerRequestStream {
3517    type Item = Result<DevToolsListenerRequest, fidl::Error>;
3518
3519    fn poll_next(
3520        mut self: std::pin::Pin<&mut Self>,
3521        cx: &mut std::task::Context<'_>,
3522    ) -> std::task::Poll<Option<Self::Item>> {
3523        let this = &mut *self;
3524        if this.inner.check_shutdown(cx) {
3525            this.is_terminated = true;
3526            return std::task::Poll::Ready(None);
3527        }
3528        if this.is_terminated {
3529            panic!("polled DevToolsListenerRequestStream after completion");
3530        }
3531        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3532            |bytes, handles| {
3533                match this.inner.channel().read_etc(cx, bytes, handles) {
3534                    std::task::Poll::Ready(Ok(())) => {}
3535                    std::task::Poll::Pending => return std::task::Poll::Pending,
3536                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3537                        this.is_terminated = true;
3538                        return std::task::Poll::Ready(None);
3539                    }
3540                    std::task::Poll::Ready(Err(e)) => {
3541                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3542                            e.into(),
3543                        ))));
3544                    }
3545                }
3546
3547                // A message has been received from the channel
3548                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3549
3550                std::task::Poll::Ready(Some(match header.ordinal {
3551                    0x4b259fb4d7e49e87 => {
3552                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3553                        let mut req = fidl::new_empty!(
3554                            DevToolsListenerOnContextDevToolsAvailableRequest,
3555                            fidl::encoding::DefaultFuchsiaResourceDialect
3556                        );
3557                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DevToolsListenerOnContextDevToolsAvailableRequest>(&header, _body_bytes, handles, &mut req)?;
3558                        let control_handle =
3559                            DevToolsListenerControlHandle { inner: this.inner.clone() };
3560                        Ok(DevToolsListenerRequest::OnContextDevToolsAvailable {
3561                            listener: req.listener,
3562
3563                            control_handle,
3564                        })
3565                    }
3566                    _ => Err(fidl::Error::UnknownOrdinal {
3567                        ordinal: header.ordinal,
3568                        protocol_name:
3569                            <DevToolsListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3570                    }),
3571                }))
3572            },
3573        )
3574    }
3575}
3576
3577/// Interface used to observe DevTools service availability events.
3578#[derive(Debug)]
3579pub enum DevToolsListenerRequest {
3580    /// Called when the DevTools service is available on a new [`Context`].
3581    ///
3582    /// - `listener`: Channel over which DevTools events for the new [`Context`] will
3583    ///   be delivered. This channel will disconnect when the [`Context`] is destroyed.
3584    OnContextDevToolsAvailable {
3585        listener: fidl::endpoints::ServerEnd<DevToolsPerContextListenerMarker>,
3586        control_handle: DevToolsListenerControlHandle,
3587    },
3588}
3589
3590impl DevToolsListenerRequest {
3591    #[allow(irrefutable_let_patterns)]
3592    pub fn into_on_context_dev_tools_available(
3593        self,
3594    ) -> Option<(
3595        fidl::endpoints::ServerEnd<DevToolsPerContextListenerMarker>,
3596        DevToolsListenerControlHandle,
3597    )> {
3598        if let DevToolsListenerRequest::OnContextDevToolsAvailable { listener, control_handle } =
3599            self
3600        {
3601            Some((listener, control_handle))
3602        } else {
3603            None
3604        }
3605    }
3606
3607    /// Name of the method defined in FIDL
3608    pub fn method_name(&self) -> &'static str {
3609        match *self {
3610            DevToolsListenerRequest::OnContextDevToolsAvailable { .. } => {
3611                "on_context_dev_tools_available"
3612            }
3613        }
3614    }
3615}
3616
3617#[derive(Debug, Clone)]
3618pub struct DevToolsListenerControlHandle {
3619    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3620}
3621
3622impl fidl::endpoints::ControlHandle for DevToolsListenerControlHandle {
3623    fn shutdown(&self) {
3624        self.inner.shutdown()
3625    }
3626    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3627        self.inner.shutdown_with_epitaph(status)
3628    }
3629
3630    fn is_closed(&self) -> bool {
3631        self.inner.channel().is_closed()
3632    }
3633    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3634        self.inner.channel().on_closed()
3635    }
3636
3637    #[cfg(target_os = "fuchsia")]
3638    fn signal_peer(
3639        &self,
3640        clear_mask: zx::Signals,
3641        set_mask: zx::Signals,
3642    ) -> Result<(), zx_status::Status> {
3643        use fidl::Peered;
3644        self.inner.channel().signal_peer(clear_mask, set_mask)
3645    }
3646}
3647
3648impl DevToolsListenerControlHandle {}
3649
3650#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3651pub struct DevToolsPerContextListenerMarker;
3652
3653impl fidl::endpoints::ProtocolMarker for DevToolsPerContextListenerMarker {
3654    type Proxy = DevToolsPerContextListenerProxy;
3655    type RequestStream = DevToolsPerContextListenerRequestStream;
3656    #[cfg(target_os = "fuchsia")]
3657    type SynchronousProxy = DevToolsPerContextListenerSynchronousProxy;
3658
3659    const DEBUG_NAME: &'static str = "(anonymous) DevToolsPerContextListener";
3660}
3661
3662pub trait DevToolsPerContextListenerProxyInterface: Send + Sync {
3663    fn r#on_http_port_open(&self, port: u16) -> Result<(), fidl::Error>;
3664}
3665#[derive(Debug)]
3666#[cfg(target_os = "fuchsia")]
3667pub struct DevToolsPerContextListenerSynchronousProxy {
3668    client: fidl::client::sync::Client,
3669}
3670
3671#[cfg(target_os = "fuchsia")]
3672impl fidl::endpoints::SynchronousProxy for DevToolsPerContextListenerSynchronousProxy {
3673    type Proxy = DevToolsPerContextListenerProxy;
3674    type Protocol = DevToolsPerContextListenerMarker;
3675
3676    fn from_channel(inner: fidl::Channel) -> Self {
3677        Self::new(inner)
3678    }
3679
3680    fn into_channel(self) -> fidl::Channel {
3681        self.client.into_channel()
3682    }
3683
3684    fn as_channel(&self) -> &fidl::Channel {
3685        self.client.as_channel()
3686    }
3687}
3688
3689#[cfg(target_os = "fuchsia")]
3690impl DevToolsPerContextListenerSynchronousProxy {
3691    pub fn new(channel: fidl::Channel) -> Self {
3692        let protocol_name =
3693            <DevToolsPerContextListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3694        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3695    }
3696
3697    pub fn into_channel(self) -> fidl::Channel {
3698        self.client.into_channel()
3699    }
3700
3701    /// Waits until an event arrives and returns it. It is safe for other
3702    /// threads to make concurrent requests while waiting for an event.
3703    pub fn wait_for_event(
3704        &self,
3705        deadline: zx::MonotonicInstant,
3706    ) -> Result<DevToolsPerContextListenerEvent, fidl::Error> {
3707        DevToolsPerContextListenerEvent::decode(self.client.wait_for_event(deadline)?)
3708    }
3709
3710    /// Called when the DevTools service starts accepting TCP connections on `port`. `port` will
3711    /// remain open until the [`Context`] is destroyed.
3712    ///
3713    /// - `port`: The port used by the service.
3714    pub fn r#on_http_port_open(&self, mut port: u16) -> Result<(), fidl::Error> {
3715        self.client.send::<DevToolsPerContextListenerOnHttpPortOpenRequest>(
3716            (port,),
3717            0x5e330939b035553b,
3718            fidl::encoding::DynamicFlags::empty(),
3719        )
3720    }
3721}
3722
3723#[cfg(target_os = "fuchsia")]
3724impl From<DevToolsPerContextListenerSynchronousProxy> for zx::Handle {
3725    fn from(value: DevToolsPerContextListenerSynchronousProxy) -> Self {
3726        value.into_channel().into()
3727    }
3728}
3729
3730#[cfg(target_os = "fuchsia")]
3731impl From<fidl::Channel> for DevToolsPerContextListenerSynchronousProxy {
3732    fn from(value: fidl::Channel) -> Self {
3733        Self::new(value)
3734    }
3735}
3736
3737#[cfg(target_os = "fuchsia")]
3738impl fidl::endpoints::FromClient for DevToolsPerContextListenerSynchronousProxy {
3739    type Protocol = DevToolsPerContextListenerMarker;
3740
3741    fn from_client(value: fidl::endpoints::ClientEnd<DevToolsPerContextListenerMarker>) -> Self {
3742        Self::new(value.into_channel())
3743    }
3744}
3745
3746#[derive(Debug, Clone)]
3747pub struct DevToolsPerContextListenerProxy {
3748    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3749}
3750
3751impl fidl::endpoints::Proxy for DevToolsPerContextListenerProxy {
3752    type Protocol = DevToolsPerContextListenerMarker;
3753
3754    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3755        Self::new(inner)
3756    }
3757
3758    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3759        self.client.into_channel().map_err(|client| Self { client })
3760    }
3761
3762    fn as_channel(&self) -> &::fidl::AsyncChannel {
3763        self.client.as_channel()
3764    }
3765}
3766
3767impl DevToolsPerContextListenerProxy {
3768    /// Create a new Proxy for fuchsia.web/DevToolsPerContextListener.
3769    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3770        let protocol_name =
3771            <DevToolsPerContextListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3772        Self { client: fidl::client::Client::new(channel, protocol_name) }
3773    }
3774
3775    /// Get a Stream of events from the remote end of the protocol.
3776    ///
3777    /// # Panics
3778    ///
3779    /// Panics if the event stream was already taken.
3780    pub fn take_event_stream(&self) -> DevToolsPerContextListenerEventStream {
3781        DevToolsPerContextListenerEventStream { event_receiver: self.client.take_event_receiver() }
3782    }
3783
3784    /// Called when the DevTools service starts accepting TCP connections on `port`. `port` will
3785    /// remain open until the [`Context`] is destroyed.
3786    ///
3787    /// - `port`: The port used by the service.
3788    pub fn r#on_http_port_open(&self, mut port: u16) -> Result<(), fidl::Error> {
3789        DevToolsPerContextListenerProxyInterface::r#on_http_port_open(self, port)
3790    }
3791}
3792
3793impl DevToolsPerContextListenerProxyInterface for DevToolsPerContextListenerProxy {
3794    fn r#on_http_port_open(&self, mut port: u16) -> Result<(), fidl::Error> {
3795        self.client.send::<DevToolsPerContextListenerOnHttpPortOpenRequest>(
3796            (port,),
3797            0x5e330939b035553b,
3798            fidl::encoding::DynamicFlags::empty(),
3799        )
3800    }
3801}
3802
3803pub struct DevToolsPerContextListenerEventStream {
3804    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3805}
3806
3807impl std::marker::Unpin for DevToolsPerContextListenerEventStream {}
3808
3809impl futures::stream::FusedStream for DevToolsPerContextListenerEventStream {
3810    fn is_terminated(&self) -> bool {
3811        self.event_receiver.is_terminated()
3812    }
3813}
3814
3815impl futures::Stream for DevToolsPerContextListenerEventStream {
3816    type Item = Result<DevToolsPerContextListenerEvent, fidl::Error>;
3817
3818    fn poll_next(
3819        mut self: std::pin::Pin<&mut Self>,
3820        cx: &mut std::task::Context<'_>,
3821    ) -> std::task::Poll<Option<Self::Item>> {
3822        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3823            &mut self.event_receiver,
3824            cx
3825        )?) {
3826            Some(buf) => std::task::Poll::Ready(Some(DevToolsPerContextListenerEvent::decode(buf))),
3827            None => std::task::Poll::Ready(None),
3828        }
3829    }
3830}
3831
3832#[derive(Debug)]
3833pub enum DevToolsPerContextListenerEvent {}
3834
3835impl DevToolsPerContextListenerEvent {
3836    /// Decodes a message buffer as a [`DevToolsPerContextListenerEvent`].
3837    fn decode(
3838        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3839    ) -> Result<DevToolsPerContextListenerEvent, fidl::Error> {
3840        let (bytes, _handles) = buf.split_mut();
3841        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3842        debug_assert_eq!(tx_header.tx_id, 0);
3843        match tx_header.ordinal {
3844            _ => Err(fidl::Error::UnknownOrdinal {
3845                ordinal: tx_header.ordinal,
3846                protocol_name: <DevToolsPerContextListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3847            })
3848        }
3849    }
3850}
3851
3852/// A Stream of incoming requests for fuchsia.web/DevToolsPerContextListener.
3853pub struct DevToolsPerContextListenerRequestStream {
3854    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3855    is_terminated: bool,
3856}
3857
3858impl std::marker::Unpin for DevToolsPerContextListenerRequestStream {}
3859
3860impl futures::stream::FusedStream for DevToolsPerContextListenerRequestStream {
3861    fn is_terminated(&self) -> bool {
3862        self.is_terminated
3863    }
3864}
3865
3866impl fidl::endpoints::RequestStream for DevToolsPerContextListenerRequestStream {
3867    type Protocol = DevToolsPerContextListenerMarker;
3868    type ControlHandle = DevToolsPerContextListenerControlHandle;
3869
3870    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3871        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3872    }
3873
3874    fn control_handle(&self) -> Self::ControlHandle {
3875        DevToolsPerContextListenerControlHandle { inner: self.inner.clone() }
3876    }
3877
3878    fn into_inner(
3879        self,
3880    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3881    {
3882        (self.inner, self.is_terminated)
3883    }
3884
3885    fn from_inner(
3886        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3887        is_terminated: bool,
3888    ) -> Self {
3889        Self { inner, is_terminated }
3890    }
3891}
3892
3893impl futures::Stream for DevToolsPerContextListenerRequestStream {
3894    type Item = Result<DevToolsPerContextListenerRequest, fidl::Error>;
3895
3896    fn poll_next(
3897        mut self: std::pin::Pin<&mut Self>,
3898        cx: &mut std::task::Context<'_>,
3899    ) -> std::task::Poll<Option<Self::Item>> {
3900        let this = &mut *self;
3901        if this.inner.check_shutdown(cx) {
3902            this.is_terminated = true;
3903            return std::task::Poll::Ready(None);
3904        }
3905        if this.is_terminated {
3906            panic!("polled DevToolsPerContextListenerRequestStream after completion");
3907        }
3908        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3909            |bytes, handles| {
3910                match this.inner.channel().read_etc(cx, bytes, handles) {
3911                    std::task::Poll::Ready(Ok(())) => {}
3912                    std::task::Poll::Pending => return std::task::Poll::Pending,
3913                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3914                        this.is_terminated = true;
3915                        return std::task::Poll::Ready(None);
3916                    }
3917                    std::task::Poll::Ready(Err(e)) => {
3918                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3919                            e.into(),
3920                        ))));
3921                    }
3922                }
3923
3924                // A message has been received from the channel
3925                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3926
3927                std::task::Poll::Ready(Some(match header.ordinal {
3928                0x5e330939b035553b => {
3929                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3930                    let mut req = fidl::new_empty!(DevToolsPerContextListenerOnHttpPortOpenRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
3931                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DevToolsPerContextListenerOnHttpPortOpenRequest>(&header, _body_bytes, handles, &mut req)?;
3932                    let control_handle = DevToolsPerContextListenerControlHandle {
3933                        inner: this.inner.clone(),
3934                    };
3935                    Ok(DevToolsPerContextListenerRequest::OnHttpPortOpen {port: req.port,
3936
3937                        control_handle,
3938                    })
3939                }
3940                _ => Err(fidl::Error::UnknownOrdinal {
3941                    ordinal: header.ordinal,
3942                    protocol_name: <DevToolsPerContextListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3943                }),
3944            }))
3945            },
3946        )
3947    }
3948}
3949
3950/// Interface supplied by the debugging component to observe the DevTools service opening event.
3951#[derive(Debug)]
3952pub enum DevToolsPerContextListenerRequest {
3953    /// Called when the DevTools service starts accepting TCP connections on `port`. `port` will
3954    /// remain open until the [`Context`] is destroyed.
3955    ///
3956    /// - `port`: The port used by the service.
3957    OnHttpPortOpen { port: u16, control_handle: DevToolsPerContextListenerControlHandle },
3958}
3959
3960impl DevToolsPerContextListenerRequest {
3961    #[allow(irrefutable_let_patterns)]
3962    pub fn into_on_http_port_open(self) -> Option<(u16, DevToolsPerContextListenerControlHandle)> {
3963        if let DevToolsPerContextListenerRequest::OnHttpPortOpen { port, control_handle } = self {
3964            Some((port, control_handle))
3965        } else {
3966            None
3967        }
3968    }
3969
3970    /// Name of the method defined in FIDL
3971    pub fn method_name(&self) -> &'static str {
3972        match *self {
3973            DevToolsPerContextListenerRequest::OnHttpPortOpen { .. } => "on_http_port_open",
3974        }
3975    }
3976}
3977
3978#[derive(Debug, Clone)]
3979pub struct DevToolsPerContextListenerControlHandle {
3980    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3981}
3982
3983impl fidl::endpoints::ControlHandle for DevToolsPerContextListenerControlHandle {
3984    fn shutdown(&self) {
3985        self.inner.shutdown()
3986    }
3987    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3988        self.inner.shutdown_with_epitaph(status)
3989    }
3990
3991    fn is_closed(&self) -> bool {
3992        self.inner.channel().is_closed()
3993    }
3994    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3995        self.inner.channel().on_closed()
3996    }
3997
3998    #[cfg(target_os = "fuchsia")]
3999    fn signal_peer(
4000        &self,
4001        clear_mask: zx::Signals,
4002        set_mask: zx::Signals,
4003    ) -> Result<(), zx_status::Status> {
4004        use fidl::Peered;
4005        self.inner.channel().signal_peer(clear_mask, set_mask)
4006    }
4007}
4008
4009impl DevToolsPerContextListenerControlHandle {}
4010
4011#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4012pub struct FrameMarker;
4013
4014impl fidl::endpoints::ProtocolMarker for FrameMarker {
4015    type Proxy = FrameProxy;
4016    type RequestStream = FrameRequestStream;
4017    #[cfg(target_os = "fuchsia")]
4018    type SynchronousProxy = FrameSynchronousProxy;
4019
4020    const DEBUG_NAME: &'static str = "(anonymous) Frame";
4021}
4022pub type FrameExecuteJavaScriptResult = Result<fidl_fuchsia_mem::Buffer, FrameError>;
4023pub type FrameExecuteJavaScriptNoResultResult = Result<(), FrameError>;
4024pub type FrameAddBeforeLoadJavaScriptResult = Result<(), FrameError>;
4025pub type FramePostMessageResult = Result<(), FrameError>;
4026
4027pub trait FrameProxyInterface: Send + Sync {
4028    fn r#create_view(
4029        &self,
4030        view_token: fidl_fuchsia_ui_views::ViewToken,
4031    ) -> Result<(), fidl::Error>;
4032    fn r#create_view_with_view_ref(
4033        &self,
4034        view_token: fidl_fuchsia_ui_views::ViewToken,
4035        view_ref_control: fidl_fuchsia_ui_views::ViewRefControl,
4036        view_ref: fidl_fuchsia_ui_views::ViewRef,
4037    ) -> Result<(), fidl::Error>;
4038    fn r#create_view2(&self, args: CreateView2Args) -> Result<(), fidl::Error>;
4039    fn r#enable_headless_rendering(&self) -> Result<(), fidl::Error>;
4040    fn r#disable_headless_rendering(&self) -> Result<(), fidl::Error>;
4041    fn r#get_media_player(
4042        &self,
4043        player: fidl::endpoints::ServerEnd<fidl_fuchsia_media_sessions2::PlayerMarker>,
4044    ) -> Result<(), fidl::Error>;
4045    fn r#get_navigation_controller(
4046        &self,
4047        controller: fidl::endpoints::ServerEnd<NavigationControllerMarker>,
4048    ) -> Result<(), fidl::Error>;
4049    type ExecuteJavaScriptResponseFut: std::future::Future<Output = Result<FrameExecuteJavaScriptResult, fidl::Error>>
4050        + Send;
4051    fn r#execute_java_script(
4052        &self,
4053        origins: &[String],
4054        script: fidl_fuchsia_mem::Buffer,
4055    ) -> Self::ExecuteJavaScriptResponseFut;
4056    type ExecuteJavaScriptNoResultResponseFut: std::future::Future<Output = Result<FrameExecuteJavaScriptNoResultResult, fidl::Error>>
4057        + Send;
4058    fn r#execute_java_script_no_result(
4059        &self,
4060        origins: &[String],
4061        script: fidl_fuchsia_mem::Buffer,
4062    ) -> Self::ExecuteJavaScriptNoResultResponseFut;
4063    type AddBeforeLoadJavaScriptResponseFut: std::future::Future<Output = Result<FrameAddBeforeLoadJavaScriptResult, fidl::Error>>
4064        + Send;
4065    fn r#add_before_load_java_script(
4066        &self,
4067        id: u64,
4068        origins: &[String],
4069        script: fidl_fuchsia_mem::Buffer,
4070    ) -> Self::AddBeforeLoadJavaScriptResponseFut;
4071    fn r#remove_before_load_java_script(&self, id: u64) -> Result<(), fidl::Error>;
4072    type PostMessageResponseFut: std::future::Future<Output = Result<FramePostMessageResult, fidl::Error>>
4073        + Send;
4074    fn r#post_message(
4075        &self,
4076        target_origin: &str,
4077        message: WebMessage,
4078    ) -> Self::PostMessageResponseFut;
4079    fn r#set_navigation_event_listener(
4080        &self,
4081        listener: Option<fidl::endpoints::ClientEnd<NavigationEventListenerMarker>>,
4082    ) -> Result<(), fidl::Error>;
4083    fn r#set_navigation_event_listener2(
4084        &self,
4085        listener: Option<fidl::endpoints::ClientEnd<NavigationEventListenerMarker>>,
4086        flags: NavigationEventListenerFlags,
4087    ) -> Result<(), fidl::Error>;
4088    fn r#set_java_script_log_level(&self, level: ConsoleLogLevel) -> Result<(), fidl::Error>;
4089    fn r#set_console_log_sink(
4090        &self,
4091        sink: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_logger::LogSinkMarker>>,
4092    ) -> Result<(), fidl::Error>;
4093    fn r#configure_input_types(
4094        &self,
4095        types: InputTypes,
4096        allow: AllowInputState,
4097    ) -> Result<(), fidl::Error>;
4098    fn r#set_popup_frame_creation_listener(
4099        &self,
4100        listener: Option<fidl::endpoints::ClientEnd<PopupFrameCreationListenerMarker>>,
4101    ) -> Result<(), fidl::Error>;
4102    type SetUrlRequestRewriteRulesResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
4103        + Send;
4104    fn r#set_url_request_rewrite_rules(
4105        &self,
4106        rules: &[UrlRequestRewriteRule],
4107    ) -> Self::SetUrlRequestRewriteRulesResponseFut;
4108    fn r#set_media_settings(&self, settings: &FrameMediaSettings) -> Result<(), fidl::Error>;
4109    fn r#force_content_dimensions(
4110        &self,
4111        web_dips: Option<&fidl_fuchsia_ui_gfx::Vec2>,
4112    ) -> Result<(), fidl::Error>;
4113    fn r#set_permission_state(
4114        &self,
4115        permission: &PermissionDescriptor,
4116        web_origin: &str,
4117        state: PermissionState,
4118    ) -> Result<(), fidl::Error>;
4119    fn r#set_block_media_loading(&self, blocked: bool) -> Result<(), fidl::Error>;
4120    type GetPrivateMemorySizeResponseFut: std::future::Future<Output = Result<u64, fidl::Error>>
4121        + Send;
4122    fn r#get_private_memory_size(&self) -> Self::GetPrivateMemorySizeResponseFut;
4123    fn r#set_navigation_policy_provider(
4124        &self,
4125        params: &NavigationPolicyProviderParams,
4126        provider: fidl::endpoints::ClientEnd<NavigationPolicyProviderMarker>,
4127    ) -> Result<(), fidl::Error>;
4128    fn r#set_content_area_settings(
4129        &self,
4130        settings: &ContentAreaSettings,
4131    ) -> Result<(), fidl::Error>;
4132    fn r#reset_content_area_settings(&self) -> Result<(), fidl::Error>;
4133    fn r#close(&self, payload: &FrameCloseRequest) -> Result<(), fidl::Error>;
4134}
4135#[derive(Debug)]
4136#[cfg(target_os = "fuchsia")]
4137pub struct FrameSynchronousProxy {
4138    client: fidl::client::sync::Client,
4139}
4140
4141#[cfg(target_os = "fuchsia")]
4142impl fidl::endpoints::SynchronousProxy for FrameSynchronousProxy {
4143    type Proxy = FrameProxy;
4144    type Protocol = FrameMarker;
4145
4146    fn from_channel(inner: fidl::Channel) -> Self {
4147        Self::new(inner)
4148    }
4149
4150    fn into_channel(self) -> fidl::Channel {
4151        self.client.into_channel()
4152    }
4153
4154    fn as_channel(&self) -> &fidl::Channel {
4155        self.client.as_channel()
4156    }
4157}
4158
4159#[cfg(target_os = "fuchsia")]
4160impl FrameSynchronousProxy {
4161    pub fn new(channel: fidl::Channel) -> Self {
4162        let protocol_name = <FrameMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4163        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4164    }
4165
4166    pub fn into_channel(self) -> fidl::Channel {
4167        self.client.into_channel()
4168    }
4169
4170    /// Waits until an event arrives and returns it. It is safe for other
4171    /// threads to make concurrent requests while waiting for an event.
4172    pub fn wait_for_event(
4173        &self,
4174        deadline: zx::MonotonicInstant,
4175    ) -> Result<FrameEvent, fidl::Error> {
4176        FrameEvent::decode(self.client.wait_for_event(deadline)?)
4177    }
4178
4179    /// Creates a new view using the specified `view_token`. Caller should pass the other end of
4180    /// the token to [`fuchsia.ui.gfx/ViewHolderArgs`] to attach the new view to a view tree.
4181    ///
4182    /// See the description of [`CreateContextParams.service_directory`] for additional services
4183    /// that must be present when using this method.
4184    pub fn r#create_view(
4185        &self,
4186        mut view_token: fidl_fuchsia_ui_views::ViewToken,
4187    ) -> Result<(), fidl::Error> {
4188        self.client.send::<FrameCreateViewRequest>(
4189            (&mut view_token,),
4190            0x6a27859439133264,
4191            fidl::encoding::DynamicFlags::empty(),
4192        )
4193    }
4194
4195    /// Creates a new view using the specified `view_token`. Caller should pass the other end of
4196    /// the token to [`fuchsia.ui.gfx/ViewHolderArgs`] to attach the new view to a view tree.
4197    /// `view_ref` can be cloned before passing it to this method, which will allow clients to
4198    /// track the view.
4199    ///
4200    /// `view_ref_control` must not have the `ZX_RIGHT_DUPLICATE` set, or view creation will fail
4201    /// and `view_token` will be closed.
4202    ///
4203    /// See the description of [`CreateContextParams.service_directory`] for additional services
4204    /// that must be present when using this method.
4205    pub fn r#create_view_with_view_ref(
4206        &self,
4207        mut view_token: fidl_fuchsia_ui_views::ViewToken,
4208        mut view_ref_control: fidl_fuchsia_ui_views::ViewRefControl,
4209        mut view_ref: fidl_fuchsia_ui_views::ViewRef,
4210    ) -> Result<(), fidl::Error> {
4211        self.client.send::<FrameCreateViewWithViewRefRequest>(
4212            (&mut view_token, &mut view_ref_control, &mut view_ref),
4213            0x1eb17ab2442326ac,
4214            fidl::encoding::DynamicFlags::empty(),
4215        )
4216    }
4217
4218    /// Creates a new Flatland view using the specified `view_creation_token` defined under `args`.
4219    /// Caller should pass the other end of the token to
4220    /// [`fuchsia.ui.composition/Flatland.CreateViewport`] to attach the new Flatland view to its
4221    /// graph.
4222    pub fn r#create_view2(&self, mut args: CreateView2Args) -> Result<(), fidl::Error> {
4223        self.client.send::<FrameCreateView2Request>(
4224            (&mut args,),
4225            0x1be7e9512962eb37,
4226            fidl::encoding::DynamicFlags::empty(),
4227        )
4228    }
4229
4230    /// Enables headless rendering of the Frame.
4231    ///
4232    /// This is used when content depends on layout and/or animation events firing normally.
4233    /// May only be used on a Context created with [`ContextFeatureFlags.HEADLESS`].
4234    pub fn r#enable_headless_rendering(&self) -> Result<(), fidl::Error> {
4235        self.client.send::<fidl::encoding::EmptyPayload>(
4236            (),
4237            0x72a81aaae7a80d2b,
4238            fidl::encoding::DynamicFlags::empty(),
4239        )
4240    }
4241
4242    /// Stops headless rendering of the Frame.
4243    ///
4244    /// May only be used on a Context created with [`ContextFeatureFlags.HEADLESS`].
4245    pub fn r#disable_headless_rendering(&self) -> Result<(), fidl::Error> {
4246        self.client.send::<fidl::encoding::EmptyPayload>(
4247            (),
4248            0x5ca38a3d1f7f543a,
4249            fidl::encoding::DynamicFlags::empty(),
4250        )
4251    }
4252
4253    /// Returns a [`fuchsia.media.sessions2/Player`] interface through which media (i.e.
4254    /// video/audio) playback in the frame may be observed, and/or controlled. Only one
4255    /// [`fuchsia.media.sessions2/Player`] may be active at a time, for each [`Frame`].
4256    pub fn r#get_media_player(
4257        &self,
4258        mut player: fidl::endpoints::ServerEnd<fidl_fuchsia_media_sessions2::PlayerMarker>,
4259    ) -> Result<(), fidl::Error> {
4260        self.client.send::<FrameGetMediaPlayerRequest>(
4261            (player,),
4262            0xaafb639fc0b9eb9,
4263            fidl::encoding::DynamicFlags::empty(),
4264        )
4265    }
4266
4267    /// Returns an interface through which the [`Frame`] may be navigated to a desired URL,
4268    /// reloaded, etc.
4269    ///
4270    /// - `controller`: An asynchronous interface request for the [`Frame`]'s
4271    ///   [`NavigationController`].
4272    pub fn r#get_navigation_controller(
4273        &self,
4274        mut controller: fidl::endpoints::ServerEnd<NavigationControllerMarker>,
4275    ) -> Result<(), fidl::Error> {
4276        self.client.send::<FrameGetNavigationControllerRequest>(
4277            (controller,),
4278            0x4521cfe95217a688,
4279            fidl::encoding::DynamicFlags::empty(),
4280        )
4281    }
4282
4283    /// Executes a UTF-8 encoded `script` in the [`Frame`] if the [`Frame`]'s URL has an origin
4284    /// which matches entries in `origins`.
4285    ///
4286    /// At least one `origins` entry must be specified. If a wildcard `"*"` is specified in
4287    /// `origins`, then the script will be evaluated unconditionally.
4288    ///
4289    /// Returns the result of executing `script`, as a JSON-encoded string.
4290    ///
4291    /// Note that scripts share the same execution context as the document,
4292    /// meaning that document may modify variables, classes, or objects set by
4293    /// the script in arbitrary or unpredictable ways.
4294    ///
4295    /// If an error occurred, the FrameError will be set to one of these values:
4296    /// - `BUFFER_NOT_UTF8`: `script` is not UTF-8 encoded.
4297    /// - `INVALID_ORIGIN`: The [`Frame`]'s current URL does not match any of the values in
4298    ///   `origins` or `origins` is an empty vector.
4299    pub fn r#execute_java_script(
4300        &self,
4301        mut origins: &[String],
4302        mut script: fidl_fuchsia_mem::Buffer,
4303        ___deadline: zx::MonotonicInstant,
4304    ) -> Result<FrameExecuteJavaScriptResult, fidl::Error> {
4305        let _response = self.client.send_query::<
4306            FrameExecuteJavaScriptRequest,
4307            fidl::encoding::ResultType<FrameExecuteJavaScriptResponse, FrameError>,
4308        >(
4309            (origins, &mut script,),
4310            0x79abdd4907000542,
4311            fidl::encoding::DynamicFlags::empty(),
4312            ___deadline,
4313        )?;
4314        Ok(_response.map(|x| x.result))
4315    }
4316
4317    /// Variant of [`Frame.ExecuteJavaScript`] which executes the supplied script without returning
4318    /// a result.
4319    pub fn r#execute_java_script_no_result(
4320        &self,
4321        mut origins: &[String],
4322        mut script: fidl_fuchsia_mem::Buffer,
4323        ___deadline: zx::MonotonicInstant,
4324    ) -> Result<FrameExecuteJavaScriptNoResultResult, fidl::Error> {
4325        let _response = self.client.send_query::<
4326            FrameExecuteJavaScriptNoResultRequest,
4327            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FrameError>,
4328        >(
4329            (origins, &mut script,),
4330            0x16b8491520cbcd63,
4331            fidl::encoding::DynamicFlags::empty(),
4332            ___deadline,
4333        )?;
4334        Ok(_response.map(|x| x))
4335    }
4336
4337    /// Executes a UTF-8 encoded `script` for every subsequent page load where the [`Frame`]'s URL
4338    /// has an origin reflected in `origins`. The script is executed early, prior to the execution
4339    /// of the document's scripts.
4340    ///
4341    /// Scripts are identified by a client-managed identifier `id`. Any script previously injected
4342    /// using the same `id` will be replaced.
4343    ///
4344    /// The order in which multiple bindings are executed is the same as the order in which the
4345    /// bindings were added. If a script is added which clobbers an existing script of the same
4346    /// `id`, the previous script's precedence in the injection order will be preserved.
4347    ///
4348    /// At least one `origins` entry must be specified. If a wildcard `"*"` is specified in
4349    /// `origins`, then the script will be evaluated unconditionally.
4350    ///
4351    /// If an error occurred, the [`FrameError`] will be set to one of these values:
4352    /// - `BUFFER_NOT_UTF8`: `script` is not UTF-8 encoded.
4353    /// - `INVALID_ORIGIN`: `origins` is an empty vector.
4354    pub fn r#add_before_load_java_script(
4355        &self,
4356        mut id: u64,
4357        mut origins: &[String],
4358        mut script: fidl_fuchsia_mem::Buffer,
4359        ___deadline: zx::MonotonicInstant,
4360    ) -> Result<FrameAddBeforeLoadJavaScriptResult, fidl::Error> {
4361        let _response = self.client.send_query::<
4362            FrameAddBeforeLoadJavaScriptRequest,
4363            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FrameError>,
4364        >(
4365            (id, origins, &mut script,),
4366            0x540ac0da59d823e,
4367            fidl::encoding::DynamicFlags::empty(),
4368            ___deadline,
4369        )?;
4370        Ok(_response.map(|x| x))
4371    }
4372
4373    /// Removes a previously added JavaScript snippet identified by `id`. This is a no-op if there
4374    /// is no JavaScript snippet identified by `id`.
4375    pub fn r#remove_before_load_java_script(&self, mut id: u64) -> Result<(), fidl::Error> {
4376        self.client.send::<FrameRemoveBeforeLoadJavaScriptRequest>(
4377            (id,),
4378            0x17d92b855b61d23a,
4379            fidl::encoding::DynamicFlags::empty(),
4380        )
4381    }
4382
4383    /// Posts a message to the frame's onMessage handler.
4384    ///
4385    /// `target_origin` restricts message delivery to the specified origin. If `target_origin` is
4386    /// `"*"`, then the message will be sent to the document regardless of its origin.
4387    /// See the
4388    /// [HTML spec](https://html.spec.whatwg.org/multipage/web-messaging.html#posting-messages)
4389    /// section 9.4.3 for more details on how the target origin policy is applied.
4390    ///
4391    /// If an error occurred, the [`FrameError`] will be set to one of these values:
4392    /// - `INTERNAL_ERROR`: The WebEngine failed to create a message pipe.
4393    /// - `BUFFER_NOT_UTF8`: The script in `message`'s `data` property is not UTF-8 encoded.
4394    /// - `INVALID_ORIGIN`: `origins` is an empty vector.
4395    /// - `NO_DATA_IN_MESSAGE`: The `data` property is missing in `message`.
4396    pub fn r#post_message(
4397        &self,
4398        mut target_origin: &str,
4399        mut message: WebMessage,
4400        ___deadline: zx::MonotonicInstant,
4401    ) -> Result<FramePostMessageResult, fidl::Error> {
4402        let _response = self.client.send_query::<
4403            FramePostMessageRequest,
4404            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FrameError>,
4405        >(
4406            (target_origin, &mut message,),
4407            0x751d686eb7caa341,
4408            fidl::encoding::DynamicFlags::empty(),
4409            ___deadline,
4410        )?;
4411        Ok(_response.map(|x| x))
4412    }
4413
4414    /// Sets the listener for handling page navigation events.
4415    ///
4416    /// - `listener`: The observer to use. Unregisters any existing listener if null.
4417    pub fn r#set_navigation_event_listener(
4418        &self,
4419        mut listener: Option<fidl::endpoints::ClientEnd<NavigationEventListenerMarker>>,
4420    ) -> Result<(), fidl::Error> {
4421        self.client.send::<FrameSetNavigationEventListenerRequest>(
4422            (listener,),
4423            0x965ba0fa20e0a56,
4424            fidl::encoding::DynamicFlags::empty(),
4425        )
4426    }
4427
4428    /// Sets the listener for handling page navigation events. The listener will receive the
4429    /// current navigation state immediately. After that, it's notified whenever the state changes.
4430    ///
4431    /// - `listener`: The observer to use. Unregisters any existing listener if null.
4432    /// - `flags`: Flags for optional features that should be enabled for the listener.
4433    pub fn r#set_navigation_event_listener2(
4434        &self,
4435        mut listener: Option<fidl::endpoints::ClientEnd<NavigationEventListenerMarker>>,
4436        mut flags: NavigationEventListenerFlags,
4437    ) -> Result<(), fidl::Error> {
4438        self.client.send::<FrameSetNavigationEventListener2Request>(
4439            (listener, flags),
4440            0x5f8b40607f1f578f,
4441            fidl::encoding::DynamicFlags::empty(),
4442        )
4443    }
4444
4445    /// If set to a value other than [`ConsoleLogLevel.NONE`], allows web content to log messages
4446    /// to the [`fuchsia.logger/LogSink`] configured for this [`Frame`], via the
4447    /// `console` object (e.g. using `debug()`, `log()`, `info()`, `warn()` and
4448    /// `error()`).
4449    /// The default value is [`ConsoleLogLevel.NONE`].
4450    ///
4451    /// As the system log may be persisted, it is recommended that [`ConsoleLogLevel.NONE`] be used
4452    /// in Incognito and other private browsing modes.
4453    ///
4454    /// Log lines are written to the [`fuchsia.logger/LogsSink`] configured
4455    /// for this [`fuchsia.web/Frame`], with severities mapped as follows:
4456    /// - `debug()`, `log()` and `info()` are logged at [`fuchsia.logger/LogLevelFilter.INFO`]
4457    ///   severity.
4458    /// - `warn()` is logged at [`fuchsia.logger/LogLevelFilter.WARN`] severity.
4459    /// - `error()` is logged at [`fuchsia.logger/LogLevelFilter.ERROR`] severity.
4460    pub fn r#set_java_script_log_level(
4461        &self,
4462        mut level: ConsoleLogLevel,
4463    ) -> Result<(), fidl::Error> {
4464        self.client.send::<FrameSetJavaScriptLogLevelRequest>(
4465            (level,),
4466            0x74824b11a71c4b5b,
4467            fidl::encoding::DynamicFlags::empty(),
4468        )
4469    }
4470
4471    /// Specifies where to emit `console` log output to. By default log output will be routed to a
4472    /// [`fuchsia.logger/LogSink`] obtained via the [`fuchsia.web/Context`]'s service directory.
4473    ///
4474    /// - `sink`: The [`fuchsia.logger/LogSink`] to use to emit logs. Passing a `null` handle
4475    ///   resets logging to use the default [`fuchsia.logger/LogSink`].
4476    pub fn r#set_console_log_sink(
4477        &self,
4478        mut sink: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_logger::LogSinkMarker>>,
4479    ) -> Result<(), fidl::Error> {
4480        self.client.send::<FrameSetConsoleLogSinkRequest>(
4481            (sink,),
4482            0x18f5cbc19fa4687b,
4483            fidl::encoding::DynamicFlags::empty(),
4484        )
4485    }
4486
4487    /// Enables or disables the processing of the specified `types` of user inputs.
4488    /// `allow` specifies whether to enable or disable the specified `types`.
4489    /// All input types are enabled by default.
4490    pub fn r#configure_input_types(
4491        &self,
4492        mut types: InputTypes,
4493        mut allow: AllowInputState,
4494    ) -> Result<(), fidl::Error> {
4495        self.client.send::<FrameConfigureInputTypesRequest>(
4496            (types, allow),
4497            0x38e08fe763c6bef6,
4498            fidl::encoding::DynamicFlags::empty(),
4499        )
4500    }
4501
4502    /// Sets the listener for handling popup frame opened by web content. If no listener is
4503    /// present, then any new popup frame will be blocked.
4504    ///
4505    /// - `listener`: The listener to use. Unregisters any existing listener if null.
4506    pub fn r#set_popup_frame_creation_listener(
4507        &self,
4508        mut listener: Option<fidl::endpoints::ClientEnd<PopupFrameCreationListenerMarker>>,
4509    ) -> Result<(), fidl::Error> {
4510        self.client.send::<FrameSetPopupFrameCreationListenerRequest>(
4511            (listener,),
4512            0x34ddec4e9f11e2aa,
4513            fidl::encoding::DynamicFlags::empty(),
4514        )
4515    }
4516
4517    /// Supplies a set of [`UrlRequestRewriteRule`] to apply on every subsequent URL request.
4518    /// - `rules` are cumulative and applied in order.
4519    /// - `rules` are only applied on the first URL request in a redirect chain.
4520    /// - `rules` will be validated before being applied. If `rules` are invalid, the [`Frame`]
4521    ///   will be closed with `ERR_INVALID_ARGS`.
4522    /// - [`Frame.SetUrlRequestRewriteRules`] must not be called again until its acknowledgement
4523    ///   callback has been processed. If this happens, the [`Frame`] will be closed with
4524    ///   `ERR_BAD_STATE`.
4525    pub fn r#set_url_request_rewrite_rules(
4526        &self,
4527        mut rules: &[UrlRequestRewriteRule],
4528        ___deadline: zx::MonotonicInstant,
4529    ) -> Result<(), fidl::Error> {
4530        let _response = self
4531            .client
4532            .send_query::<FrameSetUrlRequestRewriteRulesRequest, fidl::encoding::EmptyPayload>(
4533                (rules,),
4534                0x2e3f797350ab3281,
4535                fidl::encoding::DynamicFlags::empty(),
4536                ___deadline,
4537            )?;
4538        Ok(_response)
4539    }
4540
4541    /// Sets [`fuchsia.media/FrameMediaSettings`] for the frame. The specified parameters are
4542    /// applied to audio streams that started after this message is processed. Should be called
4543    /// before the Frame is navigated to content in order to ensure that the settings applied to
4544    /// all media streams. Due to request pipelining, this means doing so before calling
4545    /// [`Frame.GetNavigationController()`] and [`NavigationController.LoadUrl()`].
4546    pub fn r#set_media_settings(
4547        &self,
4548        mut settings: &FrameMediaSettings,
4549    ) -> Result<(), fidl::Error> {
4550        self.client.send::<FrameSetMediaSettingsRequest>(
4551            (settings,),
4552            0x7da879b6d284c143,
4553            fidl::encoding::DynamicFlags::empty(),
4554        )
4555    }
4556
4557    /// Overrides the dimensions reported to web content. The devicePixelRatio reported to
4558    /// web content will be adjusted in response to changes in the pixel size of the View,
4559    /// rather than changing the size reported to the content. Call with null `web_dips` to
4560    /// remove any prior forced content dimensions.
4561    pub fn r#force_content_dimensions(
4562        &self,
4563        mut web_dips: Option<&fidl_fuchsia_ui_gfx::Vec2>,
4564    ) -> Result<(), fidl::Error> {
4565        self.client.send::<FrameForceContentDimensionsRequest>(
4566            (web_dips,),
4567            0x8c7024c7149c901,
4568            fidl::encoding::DynamicFlags::empty(),
4569        )
4570    }
4571
4572    /// Sets the permission state for the specified `permission` and `web_origin`. By default, all
4573    /// permissions are denied.
4574    pub fn r#set_permission_state(
4575        &self,
4576        mut permission: &PermissionDescriptor,
4577        mut web_origin: &str,
4578        mut state: PermissionState,
4579    ) -> Result<(), fidl::Error> {
4580        self.client.send::<FrameSetPermissionStateRequest>(
4581            (permission, web_origin, state),
4582            0x19574e92a7033f4f,
4583            fidl::encoding::DynamicFlags::empty(),
4584        )
4585    }
4586
4587    /// Sets whether to block all HTMLMediaElements in the frame from fetching and loading media
4588    /// resources.
4589    ///
4590    /// May be used, for example, to prevent loading media in frames that are not visible.
4591    ///
4592    /// While media loading is blocked, elements with `autoplay` set to `true` will not start
4593    /// playback. The promises returned by calls to `play()` will remain unresolved until loading is
4594    /// unblocked by a call to this method.
4595    ///
4596    /// When media loading is unblocked, elements will begin fetching, resource, loading, and
4597    /// playing as appropriate.
4598    ///
4599    /// Any elements that have begun fetching or loading media resources for the current source
4600    /// before media loading was blocked will continue to fetch, load, and start playback as
4601    /// appropriate. This includes calls to `play()` even after media loading is blocked.
4602    pub fn r#set_block_media_loading(&self, mut blocked: bool) -> Result<(), fidl::Error> {
4603        self.client.send::<FrameSetBlockMediaLoadingRequest>(
4604            (blocked,),
4605            0x211071458fc9cf4f,
4606            fidl::encoding::DynamicFlags::empty(),
4607        )
4608    }
4609
4610    /// Returns the amount of private (non-shared) physical memory used by the Frame's main
4611    /// document. The returned size might not reflect the memory usage of embedded iframes.
4612    pub fn r#get_private_memory_size(
4613        &self,
4614        ___deadline: zx::MonotonicInstant,
4615    ) -> Result<u64, fidl::Error> {
4616        let _response = self
4617            .client
4618            .send_query::<fidl::encoding::EmptyPayload, FrameGetPrivateMemorySizeResponse>(
4619                (),
4620                0x6ad4d43da6c129b0,
4621                fidl::encoding::DynamicFlags::empty(),
4622                ___deadline,
4623            )?;
4624        Ok(_response.size_bytes)
4625    }
4626
4627    /// Sets the navigation policy provider for the [`Frame`]. When set, the [`Frame`] sends
4628    /// [`NavigationPolicyProvider.EvaluateRequestedNavigation`] when processing navigation
4629    /// requests. `params` defines when the message is sent. After sending the
4630    /// `EvaluateRequestedNavigation` message, the [`Frame`] blocks the corresponding navigation
4631    /// until it receives a response.
4632    ///
4633    /// Should be called before `GetNavigationController` to ensure that it is applied to all
4634    /// navigations including the first [`NavigationController.LoadURL`] request.
4635    pub fn r#set_navigation_policy_provider(
4636        &self,
4637        mut params: &NavigationPolicyProviderParams,
4638        mut provider: fidl::endpoints::ClientEnd<NavigationPolicyProviderMarker>,
4639    ) -> Result<(), fidl::Error> {
4640        self.client.send::<FrameSetNavigationPolicyProviderRequest>(
4641            (params, provider),
4642            0x602ce35195d66654,
4643            fidl::encoding::DynamicFlags::empty(),
4644        )
4645    }
4646
4647    /// Sets various settings for how web content should be run in the Frame. May be called at any
4648    /// time, including after the URL has loaded. Each call changes only the specified fields,
4649    /// overwriting any prior value.
4650    ///
4651    /// This method will fail with `ZX_ERR_NOT_SUPPORTED` if any value in [`ContentAreaSettings`]
4652    /// is not supported by the Frame.
4653    pub fn r#set_content_area_settings(
4654        &self,
4655        mut settings: &ContentAreaSettings,
4656    ) -> Result<(), fidl::Error> {
4657        self.client.send::<FrameSetContentAreaSettingsRequest>(
4658            (settings,),
4659            0x851f4de50c3c27e,
4660            fidl::encoding::DynamicFlags::empty(),
4661        )
4662    }
4663
4664    /// Reset the Frame's [`ContentAreaSettings`] to default values.
4665    pub fn r#reset_content_area_settings(&self) -> Result<(), fidl::Error> {
4666        self.client.send::<fidl::encoding::EmptyPayload>(
4667            (),
4668            0x6807e04f16f8ee5d,
4669            fidl::encoding::DynamicFlags::empty(),
4670        )
4671    }
4672
4673    /// Request graceful or immediate teardown of the Frame content and notification of completion
4674    /// via Frame epitaph.
4675    ///
4676    /// Graceful teardown allows unload and cleanup tasks in the implementation and web content
4677    /// (e.g., `unload` event handlers) to run for up to the specified period of time. Immediate
4678    /// teardown only runs the minimum cleanup tasks in the implementation and does not allow web
4679    /// content to run event handlers.
4680    ///
4681    /// * If `timeout` is zero, an immediate teardown is initiated. The channel will close with
4682    ///   `ZX_OK`. This is equivalent to the caller closing the Frame channel.
4683    ///
4684    /// * If `timeout` is non-zero, a graceful teardown is initiated. The channel will close with
4685    ///   `ZX_OK` if the Frame closes within the specified `timeout` and with `ZX_ERR_TIMED_OUT`
4686    ///   otherwise.
4687    ///
4688    /// * If `timeout` is not specified, a reasonable implementation-specific timeout is applied.
4689    ///
4690    /// Subsequent calls to `Close()` will override any previously specified `Close()` timeout.
4691    pub fn r#close(&self, mut payload: &FrameCloseRequest) -> Result<(), fidl::Error> {
4692        self.client.send::<FrameCloseRequest>(
4693            payload,
4694            0x442e84138e65351,
4695            fidl::encoding::DynamicFlags::empty(),
4696        )
4697    }
4698}
4699
4700#[cfg(target_os = "fuchsia")]
4701impl From<FrameSynchronousProxy> for zx::Handle {
4702    fn from(value: FrameSynchronousProxy) -> Self {
4703        value.into_channel().into()
4704    }
4705}
4706
4707#[cfg(target_os = "fuchsia")]
4708impl From<fidl::Channel> for FrameSynchronousProxy {
4709    fn from(value: fidl::Channel) -> Self {
4710        Self::new(value)
4711    }
4712}
4713
4714#[cfg(target_os = "fuchsia")]
4715impl fidl::endpoints::FromClient for FrameSynchronousProxy {
4716    type Protocol = FrameMarker;
4717
4718    fn from_client(value: fidl::endpoints::ClientEnd<FrameMarker>) -> Self {
4719        Self::new(value.into_channel())
4720    }
4721}
4722
4723#[derive(Debug, Clone)]
4724pub struct FrameProxy {
4725    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4726}
4727
4728impl fidl::endpoints::Proxy for FrameProxy {
4729    type Protocol = FrameMarker;
4730
4731    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4732        Self::new(inner)
4733    }
4734
4735    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4736        self.client.into_channel().map_err(|client| Self { client })
4737    }
4738
4739    fn as_channel(&self) -> &::fidl::AsyncChannel {
4740        self.client.as_channel()
4741    }
4742}
4743
4744impl FrameProxy {
4745    /// Create a new Proxy for fuchsia.web/Frame.
4746    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4747        let protocol_name = <FrameMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4748        Self { client: fidl::client::Client::new(channel, protocol_name) }
4749    }
4750
4751    /// Get a Stream of events from the remote end of the protocol.
4752    ///
4753    /// # Panics
4754    ///
4755    /// Panics if the event stream was already taken.
4756    pub fn take_event_stream(&self) -> FrameEventStream {
4757        FrameEventStream { event_receiver: self.client.take_event_receiver() }
4758    }
4759
4760    /// Creates a new view using the specified `view_token`. Caller should pass the other end of
4761    /// the token to [`fuchsia.ui.gfx/ViewHolderArgs`] to attach the new view to a view tree.
4762    ///
4763    /// See the description of [`CreateContextParams.service_directory`] for additional services
4764    /// that must be present when using this method.
4765    pub fn r#create_view(
4766        &self,
4767        mut view_token: fidl_fuchsia_ui_views::ViewToken,
4768    ) -> Result<(), fidl::Error> {
4769        FrameProxyInterface::r#create_view(self, view_token)
4770    }
4771
4772    /// Creates a new view using the specified `view_token`. Caller should pass the other end of
4773    /// the token to [`fuchsia.ui.gfx/ViewHolderArgs`] to attach the new view to a view tree.
4774    /// `view_ref` can be cloned before passing it to this method, which will allow clients to
4775    /// track the view.
4776    ///
4777    /// `view_ref_control` must not have the `ZX_RIGHT_DUPLICATE` set, or view creation will fail
4778    /// and `view_token` will be closed.
4779    ///
4780    /// See the description of [`CreateContextParams.service_directory`] for additional services
4781    /// that must be present when using this method.
4782    pub fn r#create_view_with_view_ref(
4783        &self,
4784        mut view_token: fidl_fuchsia_ui_views::ViewToken,
4785        mut view_ref_control: fidl_fuchsia_ui_views::ViewRefControl,
4786        mut view_ref: fidl_fuchsia_ui_views::ViewRef,
4787    ) -> Result<(), fidl::Error> {
4788        FrameProxyInterface::r#create_view_with_view_ref(
4789            self,
4790            view_token,
4791            view_ref_control,
4792            view_ref,
4793        )
4794    }
4795
4796    /// Creates a new Flatland view using the specified `view_creation_token` defined under `args`.
4797    /// Caller should pass the other end of the token to
4798    /// [`fuchsia.ui.composition/Flatland.CreateViewport`] to attach the new Flatland view to its
4799    /// graph.
4800    pub fn r#create_view2(&self, mut args: CreateView2Args) -> Result<(), fidl::Error> {
4801        FrameProxyInterface::r#create_view2(self, args)
4802    }
4803
4804    /// Enables headless rendering of the Frame.
4805    ///
4806    /// This is used when content depends on layout and/or animation events firing normally.
4807    /// May only be used on a Context created with [`ContextFeatureFlags.HEADLESS`].
4808    pub fn r#enable_headless_rendering(&self) -> Result<(), fidl::Error> {
4809        FrameProxyInterface::r#enable_headless_rendering(self)
4810    }
4811
4812    /// Stops headless rendering of the Frame.
4813    ///
4814    /// May only be used on a Context created with [`ContextFeatureFlags.HEADLESS`].
4815    pub fn r#disable_headless_rendering(&self) -> Result<(), fidl::Error> {
4816        FrameProxyInterface::r#disable_headless_rendering(self)
4817    }
4818
4819    /// Returns a [`fuchsia.media.sessions2/Player`] interface through which media (i.e.
4820    /// video/audio) playback in the frame may be observed, and/or controlled. Only one
4821    /// [`fuchsia.media.sessions2/Player`] may be active at a time, for each [`Frame`].
4822    pub fn r#get_media_player(
4823        &self,
4824        mut player: fidl::endpoints::ServerEnd<fidl_fuchsia_media_sessions2::PlayerMarker>,
4825    ) -> Result<(), fidl::Error> {
4826        FrameProxyInterface::r#get_media_player(self, player)
4827    }
4828
4829    /// Returns an interface through which the [`Frame`] may be navigated to a desired URL,
4830    /// reloaded, etc.
4831    ///
4832    /// - `controller`: An asynchronous interface request for the [`Frame`]'s
4833    ///   [`NavigationController`].
4834    pub fn r#get_navigation_controller(
4835        &self,
4836        mut controller: fidl::endpoints::ServerEnd<NavigationControllerMarker>,
4837    ) -> Result<(), fidl::Error> {
4838        FrameProxyInterface::r#get_navigation_controller(self, controller)
4839    }
4840
4841    /// Executes a UTF-8 encoded `script` in the [`Frame`] if the [`Frame`]'s URL has an origin
4842    /// which matches entries in `origins`.
4843    ///
4844    /// At least one `origins` entry must be specified. If a wildcard `"*"` is specified in
4845    /// `origins`, then the script will be evaluated unconditionally.
4846    ///
4847    /// Returns the result of executing `script`, as a JSON-encoded string.
4848    ///
4849    /// Note that scripts share the same execution context as the document,
4850    /// meaning that document may modify variables, classes, or objects set by
4851    /// the script in arbitrary or unpredictable ways.
4852    ///
4853    /// If an error occurred, the FrameError will be set to one of these values:
4854    /// - `BUFFER_NOT_UTF8`: `script` is not UTF-8 encoded.
4855    /// - `INVALID_ORIGIN`: The [`Frame`]'s current URL does not match any of the values in
4856    ///   `origins` or `origins` is an empty vector.
4857    pub fn r#execute_java_script(
4858        &self,
4859        mut origins: &[String],
4860        mut script: fidl_fuchsia_mem::Buffer,
4861    ) -> fidl::client::QueryResponseFut<
4862        FrameExecuteJavaScriptResult,
4863        fidl::encoding::DefaultFuchsiaResourceDialect,
4864    > {
4865        FrameProxyInterface::r#execute_java_script(self, origins, script)
4866    }
4867
4868    /// Variant of [`Frame.ExecuteJavaScript`] which executes the supplied script without returning
4869    /// a result.
4870    pub fn r#execute_java_script_no_result(
4871        &self,
4872        mut origins: &[String],
4873        mut script: fidl_fuchsia_mem::Buffer,
4874    ) -> fidl::client::QueryResponseFut<
4875        FrameExecuteJavaScriptNoResultResult,
4876        fidl::encoding::DefaultFuchsiaResourceDialect,
4877    > {
4878        FrameProxyInterface::r#execute_java_script_no_result(self, origins, script)
4879    }
4880
4881    /// Executes a UTF-8 encoded `script` for every subsequent page load where the [`Frame`]'s URL
4882    /// has an origin reflected in `origins`. The script is executed early, prior to the execution
4883    /// of the document's scripts.
4884    ///
4885    /// Scripts are identified by a client-managed identifier `id`. Any script previously injected
4886    /// using the same `id` will be replaced.
4887    ///
4888    /// The order in which multiple bindings are executed is the same as the order in which the
4889    /// bindings were added. If a script is added which clobbers an existing script of the same
4890    /// `id`, the previous script's precedence in the injection order will be preserved.
4891    ///
4892    /// At least one `origins` entry must be specified. If a wildcard `"*"` is specified in
4893    /// `origins`, then the script will be evaluated unconditionally.
4894    ///
4895    /// If an error occurred, the [`FrameError`] will be set to one of these values:
4896    /// - `BUFFER_NOT_UTF8`: `script` is not UTF-8 encoded.
4897    /// - `INVALID_ORIGIN`: `origins` is an empty vector.
4898    pub fn r#add_before_load_java_script(
4899        &self,
4900        mut id: u64,
4901        mut origins: &[String],
4902        mut script: fidl_fuchsia_mem::Buffer,
4903    ) -> fidl::client::QueryResponseFut<
4904        FrameAddBeforeLoadJavaScriptResult,
4905        fidl::encoding::DefaultFuchsiaResourceDialect,
4906    > {
4907        FrameProxyInterface::r#add_before_load_java_script(self, id, origins, script)
4908    }
4909
4910    /// Removes a previously added JavaScript snippet identified by `id`. This is a no-op if there
4911    /// is no JavaScript snippet identified by `id`.
4912    pub fn r#remove_before_load_java_script(&self, mut id: u64) -> Result<(), fidl::Error> {
4913        FrameProxyInterface::r#remove_before_load_java_script(self, id)
4914    }
4915
4916    /// Posts a message to the frame's onMessage handler.
4917    ///
4918    /// `target_origin` restricts message delivery to the specified origin. If `target_origin` is
4919    /// `"*"`, then the message will be sent to the document regardless of its origin.
4920    /// See the
4921    /// [HTML spec](https://html.spec.whatwg.org/multipage/web-messaging.html#posting-messages)
4922    /// section 9.4.3 for more details on how the target origin policy is applied.
4923    ///
4924    /// If an error occurred, the [`FrameError`] will be set to one of these values:
4925    /// - `INTERNAL_ERROR`: The WebEngine failed to create a message pipe.
4926    /// - `BUFFER_NOT_UTF8`: The script in `message`'s `data` property is not UTF-8 encoded.
4927    /// - `INVALID_ORIGIN`: `origins` is an empty vector.
4928    /// - `NO_DATA_IN_MESSAGE`: The `data` property is missing in `message`.
4929    pub fn r#post_message(
4930        &self,
4931        mut target_origin: &str,
4932        mut message: WebMessage,
4933    ) -> fidl::client::QueryResponseFut<
4934        FramePostMessageResult,
4935        fidl::encoding::DefaultFuchsiaResourceDialect,
4936    > {
4937        FrameProxyInterface::r#post_message(self, target_origin, message)
4938    }
4939
4940    /// Sets the listener for handling page navigation events.
4941    ///
4942    /// - `listener`: The observer to use. Unregisters any existing listener if null.
4943    pub fn r#set_navigation_event_listener(
4944        &self,
4945        mut listener: Option<fidl::endpoints::ClientEnd<NavigationEventListenerMarker>>,
4946    ) -> Result<(), fidl::Error> {
4947        FrameProxyInterface::r#set_navigation_event_listener(self, listener)
4948    }
4949
4950    /// Sets the listener for handling page navigation events. The listener will receive the
4951    /// current navigation state immediately. After that, it's notified whenever the state changes.
4952    ///
4953    /// - `listener`: The observer to use. Unregisters any existing listener if null.
4954    /// - `flags`: Flags for optional features that should be enabled for the listener.
4955    pub fn r#set_navigation_event_listener2(
4956        &self,
4957        mut listener: Option<fidl::endpoints::ClientEnd<NavigationEventListenerMarker>>,
4958        mut flags: NavigationEventListenerFlags,
4959    ) -> Result<(), fidl::Error> {
4960        FrameProxyInterface::r#set_navigation_event_listener2(self, listener, flags)
4961    }
4962
4963    /// If set to a value other than [`ConsoleLogLevel.NONE`], allows web content to log messages
4964    /// to the [`fuchsia.logger/LogSink`] configured for this [`Frame`], via the
4965    /// `console` object (e.g. using `debug()`, `log()`, `info()`, `warn()` and
4966    /// `error()`).
4967    /// The default value is [`ConsoleLogLevel.NONE`].
4968    ///
4969    /// As the system log may be persisted, it is recommended that [`ConsoleLogLevel.NONE`] be used
4970    /// in Incognito and other private browsing modes.
4971    ///
4972    /// Log lines are written to the [`fuchsia.logger/LogsSink`] configured
4973    /// for this [`fuchsia.web/Frame`], with severities mapped as follows:
4974    /// - `debug()`, `log()` and `info()` are logged at [`fuchsia.logger/LogLevelFilter.INFO`]
4975    ///   severity.
4976    /// - `warn()` is logged at [`fuchsia.logger/LogLevelFilter.WARN`] severity.
4977    /// - `error()` is logged at [`fuchsia.logger/LogLevelFilter.ERROR`] severity.
4978    pub fn r#set_java_script_log_level(
4979        &self,
4980        mut level: ConsoleLogLevel,
4981    ) -> Result<(), fidl::Error> {
4982        FrameProxyInterface::r#set_java_script_log_level(self, level)
4983    }
4984
4985    /// Specifies where to emit `console` log output to. By default log output will be routed to a
4986    /// [`fuchsia.logger/LogSink`] obtained via the [`fuchsia.web/Context`]'s service directory.
4987    ///
4988    /// - `sink`: The [`fuchsia.logger/LogSink`] to use to emit logs. Passing a `null` handle
4989    ///   resets logging to use the default [`fuchsia.logger/LogSink`].
4990    pub fn r#set_console_log_sink(
4991        &self,
4992        mut sink: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_logger::LogSinkMarker>>,
4993    ) -> Result<(), fidl::Error> {
4994        FrameProxyInterface::r#set_console_log_sink(self, sink)
4995    }
4996
4997    /// Enables or disables the processing of the specified `types` of user inputs.
4998    /// `allow` specifies whether to enable or disable the specified `types`.
4999    /// All input types are enabled by default.
5000    pub fn r#configure_input_types(
5001        &self,
5002        mut types: InputTypes,
5003        mut allow: AllowInputState,
5004    ) -> Result<(), fidl::Error> {
5005        FrameProxyInterface::r#configure_input_types(self, types, allow)
5006    }
5007
5008    /// Sets the listener for handling popup frame opened by web content. If no listener is
5009    /// present, then any new popup frame will be blocked.
5010    ///
5011    /// - `listener`: The listener to use. Unregisters any existing listener if null.
5012    pub fn r#set_popup_frame_creation_listener(
5013        &self,
5014        mut listener: Option<fidl::endpoints::ClientEnd<PopupFrameCreationListenerMarker>>,
5015    ) -> Result<(), fidl::Error> {
5016        FrameProxyInterface::r#set_popup_frame_creation_listener(self, listener)
5017    }
5018
5019    /// Supplies a set of [`UrlRequestRewriteRule`] to apply on every subsequent URL request.
5020    /// - `rules` are cumulative and applied in order.
5021    /// - `rules` are only applied on the first URL request in a redirect chain.
5022    /// - `rules` will be validated before being applied. If `rules` are invalid, the [`Frame`]
5023    ///   will be closed with `ERR_INVALID_ARGS`.
5024    /// - [`Frame.SetUrlRequestRewriteRules`] must not be called again until its acknowledgement
5025    ///   callback has been processed. If this happens, the [`Frame`] will be closed with
5026    ///   `ERR_BAD_STATE`.
5027    pub fn r#set_url_request_rewrite_rules(
5028        &self,
5029        mut rules: &[UrlRequestRewriteRule],
5030    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
5031        FrameProxyInterface::r#set_url_request_rewrite_rules(self, rules)
5032    }
5033
5034    /// Sets [`fuchsia.media/FrameMediaSettings`] for the frame. The specified parameters are
5035    /// applied to audio streams that started after this message is processed. Should be called
5036    /// before the Frame is navigated to content in order to ensure that the settings applied to
5037    /// all media streams. Due to request pipelining, this means doing so before calling
5038    /// [`Frame.GetNavigationController()`] and [`NavigationController.LoadUrl()`].
5039    pub fn r#set_media_settings(
5040        &self,
5041        mut settings: &FrameMediaSettings,
5042    ) -> Result<(), fidl::Error> {
5043        FrameProxyInterface::r#set_media_settings(self, settings)
5044    }
5045
5046    /// Overrides the dimensions reported to web content. The devicePixelRatio reported to
5047    /// web content will be adjusted in response to changes in the pixel size of the View,
5048    /// rather than changing the size reported to the content. Call with null `web_dips` to
5049    /// remove any prior forced content dimensions.
5050    pub fn r#force_content_dimensions(
5051        &self,
5052        mut web_dips: Option<&fidl_fuchsia_ui_gfx::Vec2>,
5053    ) -> Result<(), fidl::Error> {
5054        FrameProxyInterface::r#force_content_dimensions(self, web_dips)
5055    }
5056
5057    /// Sets the permission state for the specified `permission` and `web_origin`. By default, all
5058    /// permissions are denied.
5059    pub fn r#set_permission_state(
5060        &self,
5061        mut permission: &PermissionDescriptor,
5062        mut web_origin: &str,
5063        mut state: PermissionState,
5064    ) -> Result<(), fidl::Error> {
5065        FrameProxyInterface::r#set_permission_state(self, permission, web_origin, state)
5066    }
5067
5068    /// Sets whether to block all HTMLMediaElements in the frame from fetching and loading media
5069    /// resources.
5070    ///
5071    /// May be used, for example, to prevent loading media in frames that are not visible.
5072    ///
5073    /// While media loading is blocked, elements with `autoplay` set to `true` will not start
5074    /// playback. The promises returned by calls to `play()` will remain unresolved until loading is
5075    /// unblocked by a call to this method.
5076    ///
5077    /// When media loading is unblocked, elements will begin fetching, resource, loading, and
5078    /// playing as appropriate.
5079    ///
5080    /// Any elements that have begun fetching or loading media resources for the current source
5081    /// before media loading was blocked will continue to fetch, load, and start playback as
5082    /// appropriate. This includes calls to `play()` even after media loading is blocked.
5083    pub fn r#set_block_media_loading(&self, mut blocked: bool) -> Result<(), fidl::Error> {
5084        FrameProxyInterface::r#set_block_media_loading(self, blocked)
5085    }
5086
5087    /// Returns the amount of private (non-shared) physical memory used by the Frame's main
5088    /// document. The returned size might not reflect the memory usage of embedded iframes.
5089    pub fn r#get_private_memory_size(
5090        &self,
5091    ) -> fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect> {
5092        FrameProxyInterface::r#get_private_memory_size(self)
5093    }
5094
5095    /// Sets the navigation policy provider for the [`Frame`]. When set, the [`Frame`] sends
5096    /// [`NavigationPolicyProvider.EvaluateRequestedNavigation`] when processing navigation
5097    /// requests. `params` defines when the message is sent. After sending the
5098    /// `EvaluateRequestedNavigation` message, the [`Frame`] blocks the corresponding navigation
5099    /// until it receives a response.
5100    ///
5101    /// Should be called before `GetNavigationController` to ensure that it is applied to all
5102    /// navigations including the first [`NavigationController.LoadURL`] request.
5103    pub fn r#set_navigation_policy_provider(
5104        &self,
5105        mut params: &NavigationPolicyProviderParams,
5106        mut provider: fidl::endpoints::ClientEnd<NavigationPolicyProviderMarker>,
5107    ) -> Result<(), fidl::Error> {
5108        FrameProxyInterface::r#set_navigation_policy_provider(self, params, provider)
5109    }
5110
5111    /// Sets various settings for how web content should be run in the Frame. May be called at any
5112    /// time, including after the URL has loaded. Each call changes only the specified fields,
5113    /// overwriting any prior value.
5114    ///
5115    /// This method will fail with `ZX_ERR_NOT_SUPPORTED` if any value in [`ContentAreaSettings`]
5116    /// is not supported by the Frame.
5117    pub fn r#set_content_area_settings(
5118        &self,
5119        mut settings: &ContentAreaSettings,
5120    ) -> Result<(), fidl::Error> {
5121        FrameProxyInterface::r#set_content_area_settings(self, settings)
5122    }
5123
5124    /// Reset the Frame's [`ContentAreaSettings`] to default values.
5125    pub fn r#reset_content_area_settings(&self) -> Result<(), fidl::Error> {
5126        FrameProxyInterface::r#reset_content_area_settings(self)
5127    }
5128
5129    /// Request graceful or immediate teardown of the Frame content and notification of completion
5130    /// via Frame epitaph.
5131    ///
5132    /// Graceful teardown allows unload and cleanup tasks in the implementation and web content
5133    /// (e.g., `unload` event handlers) to run for up to the specified period of time. Immediate
5134    /// teardown only runs the minimum cleanup tasks in the implementation and does not allow web
5135    /// content to run event handlers.
5136    ///
5137    /// * If `timeout` is zero, an immediate teardown is initiated. The channel will close with
5138    ///   `ZX_OK`. This is equivalent to the caller closing the Frame channel.
5139    ///
5140    /// * If `timeout` is non-zero, a graceful teardown is initiated. The channel will close with
5141    ///   `ZX_OK` if the Frame closes within the specified `timeout` and with `ZX_ERR_TIMED_OUT`
5142    ///   otherwise.
5143    ///
5144    /// * If `timeout` is not specified, a reasonable implementation-specific timeout is applied.
5145    ///
5146    /// Subsequent calls to `Close()` will override any previously specified `Close()` timeout.
5147    pub fn r#close(&self, mut payload: &FrameCloseRequest) -> Result<(), fidl::Error> {
5148        FrameProxyInterface::r#close(self, payload)
5149    }
5150}
5151
5152impl FrameProxyInterface for FrameProxy {
5153    fn r#create_view(
5154        &self,
5155        mut view_token: fidl_fuchsia_ui_views::ViewToken,
5156    ) -> Result<(), fidl::Error> {
5157        self.client.send::<FrameCreateViewRequest>(
5158            (&mut view_token,),
5159            0x6a27859439133264,
5160            fidl::encoding::DynamicFlags::empty(),
5161        )
5162    }
5163
5164    fn r#create_view_with_view_ref(
5165        &self,
5166        mut view_token: fidl_fuchsia_ui_views::ViewToken,
5167        mut view_ref_control: fidl_fuchsia_ui_views::ViewRefControl,
5168        mut view_ref: fidl_fuchsia_ui_views::ViewRef,
5169    ) -> Result<(), fidl::Error> {
5170        self.client.send::<FrameCreateViewWithViewRefRequest>(
5171            (&mut view_token, &mut view_ref_control, &mut view_ref),
5172            0x1eb17ab2442326ac,
5173            fidl::encoding::DynamicFlags::empty(),
5174        )
5175    }
5176
5177    fn r#create_view2(&self, mut args: CreateView2Args) -> Result<(), fidl::Error> {
5178        self.client.send::<FrameCreateView2Request>(
5179            (&mut args,),
5180            0x1be7e9512962eb37,
5181            fidl::encoding::DynamicFlags::empty(),
5182        )
5183    }
5184
5185    fn r#enable_headless_rendering(&self) -> Result<(), fidl::Error> {
5186        self.client.send::<fidl::encoding::EmptyPayload>(
5187            (),
5188            0x72a81aaae7a80d2b,
5189            fidl::encoding::DynamicFlags::empty(),
5190        )
5191    }
5192
5193    fn r#disable_headless_rendering(&self) -> Result<(), fidl::Error> {
5194        self.client.send::<fidl::encoding::EmptyPayload>(
5195            (),
5196            0x5ca38a3d1f7f543a,
5197            fidl::encoding::DynamicFlags::empty(),
5198        )
5199    }
5200
5201    fn r#get_media_player(
5202        &self,
5203        mut player: fidl::endpoints::ServerEnd<fidl_fuchsia_media_sessions2::PlayerMarker>,
5204    ) -> Result<(), fidl::Error> {
5205        self.client.send::<FrameGetMediaPlayerRequest>(
5206            (player,),
5207            0xaafb639fc0b9eb9,
5208            fidl::encoding::DynamicFlags::empty(),
5209        )
5210    }
5211
5212    fn r#get_navigation_controller(
5213        &self,
5214        mut controller: fidl::endpoints::ServerEnd<NavigationControllerMarker>,
5215    ) -> Result<(), fidl::Error> {
5216        self.client.send::<FrameGetNavigationControllerRequest>(
5217            (controller,),
5218            0x4521cfe95217a688,
5219            fidl::encoding::DynamicFlags::empty(),
5220        )
5221    }
5222
5223    type ExecuteJavaScriptResponseFut = fidl::client::QueryResponseFut<
5224        FrameExecuteJavaScriptResult,
5225        fidl::encoding::DefaultFuchsiaResourceDialect,
5226    >;
5227    fn r#execute_java_script(
5228        &self,
5229        mut origins: &[String],
5230        mut script: fidl_fuchsia_mem::Buffer,
5231    ) -> Self::ExecuteJavaScriptResponseFut {
5232        fn _decode(
5233            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5234        ) -> Result<FrameExecuteJavaScriptResult, fidl::Error> {
5235            let _response = fidl::client::decode_transaction_body::<
5236                fidl::encoding::ResultType<FrameExecuteJavaScriptResponse, FrameError>,
5237                fidl::encoding::DefaultFuchsiaResourceDialect,
5238                0x79abdd4907000542,
5239            >(_buf?)?;
5240            Ok(_response.map(|x| x.result))
5241        }
5242        self.client
5243            .send_query_and_decode::<FrameExecuteJavaScriptRequest, FrameExecuteJavaScriptResult>(
5244                (origins, &mut script),
5245                0x79abdd4907000542,
5246                fidl::encoding::DynamicFlags::empty(),
5247                _decode,
5248            )
5249    }
5250
5251    type ExecuteJavaScriptNoResultResponseFut = fidl::client::QueryResponseFut<
5252        FrameExecuteJavaScriptNoResultResult,
5253        fidl::encoding::DefaultFuchsiaResourceDialect,
5254    >;
5255    fn r#execute_java_script_no_result(
5256        &self,
5257        mut origins: &[String],
5258        mut script: fidl_fuchsia_mem::Buffer,
5259    ) -> Self::ExecuteJavaScriptNoResultResponseFut {
5260        fn _decode(
5261            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5262        ) -> Result<FrameExecuteJavaScriptNoResultResult, fidl::Error> {
5263            let _response = fidl::client::decode_transaction_body::<
5264                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FrameError>,
5265                fidl::encoding::DefaultFuchsiaResourceDialect,
5266                0x16b8491520cbcd63,
5267            >(_buf?)?;
5268            Ok(_response.map(|x| x))
5269        }
5270        self.client.send_query_and_decode::<
5271            FrameExecuteJavaScriptNoResultRequest,
5272            FrameExecuteJavaScriptNoResultResult,
5273        >(
5274            (origins, &mut script,),
5275            0x16b8491520cbcd63,
5276            fidl::encoding::DynamicFlags::empty(),
5277            _decode,
5278        )
5279    }
5280
5281    type AddBeforeLoadJavaScriptResponseFut = fidl::client::QueryResponseFut<
5282        FrameAddBeforeLoadJavaScriptResult,
5283        fidl::encoding::DefaultFuchsiaResourceDialect,
5284    >;
5285    fn r#add_before_load_java_script(
5286        &self,
5287        mut id: u64,
5288        mut origins: &[String],
5289        mut script: fidl_fuchsia_mem::Buffer,
5290    ) -> Self::AddBeforeLoadJavaScriptResponseFut {
5291        fn _decode(
5292            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5293        ) -> Result<FrameAddBeforeLoadJavaScriptResult, fidl::Error> {
5294            let _response = fidl::client::decode_transaction_body::<
5295                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FrameError>,
5296                fidl::encoding::DefaultFuchsiaResourceDialect,
5297                0x540ac0da59d823e,
5298            >(_buf?)?;
5299            Ok(_response.map(|x| x))
5300        }
5301        self.client.send_query_and_decode::<
5302            FrameAddBeforeLoadJavaScriptRequest,
5303            FrameAddBeforeLoadJavaScriptResult,
5304        >(
5305            (id, origins, &mut script,),
5306            0x540ac0da59d823e,
5307            fidl::encoding::DynamicFlags::empty(),
5308            _decode,
5309        )
5310    }
5311
5312    fn r#remove_before_load_java_script(&self, mut id: u64) -> Result<(), fidl::Error> {
5313        self.client.send::<FrameRemoveBeforeLoadJavaScriptRequest>(
5314            (id,),
5315            0x17d92b855b61d23a,
5316            fidl::encoding::DynamicFlags::empty(),
5317        )
5318    }
5319
5320    type PostMessageResponseFut = fidl::client::QueryResponseFut<
5321        FramePostMessageResult,
5322        fidl::encoding::DefaultFuchsiaResourceDialect,
5323    >;
5324    fn r#post_message(
5325        &self,
5326        mut target_origin: &str,
5327        mut message: WebMessage,
5328    ) -> Self::PostMessageResponseFut {
5329        fn _decode(
5330            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5331        ) -> Result<FramePostMessageResult, fidl::Error> {
5332            let _response = fidl::client::decode_transaction_body::<
5333                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FrameError>,
5334                fidl::encoding::DefaultFuchsiaResourceDialect,
5335                0x751d686eb7caa341,
5336            >(_buf?)?;
5337            Ok(_response.map(|x| x))
5338        }
5339        self.client.send_query_and_decode::<FramePostMessageRequest, FramePostMessageResult>(
5340            (target_origin, &mut message),
5341            0x751d686eb7caa341,
5342            fidl::encoding::DynamicFlags::empty(),
5343            _decode,
5344        )
5345    }
5346
5347    fn r#set_navigation_event_listener(
5348        &self,
5349        mut listener: Option<fidl::endpoints::ClientEnd<NavigationEventListenerMarker>>,
5350    ) -> Result<(), fidl::Error> {
5351        self.client.send::<FrameSetNavigationEventListenerRequest>(
5352            (listener,),
5353            0x965ba0fa20e0a56,
5354            fidl::encoding::DynamicFlags::empty(),
5355        )
5356    }
5357
5358    fn r#set_navigation_event_listener2(
5359        &self,
5360        mut listener: Option<fidl::endpoints::ClientEnd<NavigationEventListenerMarker>>,
5361        mut flags: NavigationEventListenerFlags,
5362    ) -> Result<(), fidl::Error> {
5363        self.client.send::<FrameSetNavigationEventListener2Request>(
5364            (listener, flags),
5365            0x5f8b40607f1f578f,
5366            fidl::encoding::DynamicFlags::empty(),
5367        )
5368    }
5369
5370    fn r#set_java_script_log_level(&self, mut level: ConsoleLogLevel) -> Result<(), fidl::Error> {
5371        self.client.send::<FrameSetJavaScriptLogLevelRequest>(
5372            (level,),
5373            0x74824b11a71c4b5b,
5374            fidl::encoding::DynamicFlags::empty(),
5375        )
5376    }
5377
5378    fn r#set_console_log_sink(
5379        &self,
5380        mut sink: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_logger::LogSinkMarker>>,
5381    ) -> Result<(), fidl::Error> {
5382        self.client.send::<FrameSetConsoleLogSinkRequest>(
5383            (sink,),
5384            0x18f5cbc19fa4687b,
5385            fidl::encoding::DynamicFlags::empty(),
5386        )
5387    }
5388
5389    fn r#configure_input_types(
5390        &self,
5391        mut types: InputTypes,
5392        mut allow: AllowInputState,
5393    ) -> Result<(), fidl::Error> {
5394        self.client.send::<FrameConfigureInputTypesRequest>(
5395            (types, allow),
5396            0x38e08fe763c6bef6,
5397            fidl::encoding::DynamicFlags::empty(),
5398        )
5399    }
5400
5401    fn r#set_popup_frame_creation_listener(
5402        &self,
5403        mut listener: Option<fidl::endpoints::ClientEnd<PopupFrameCreationListenerMarker>>,
5404    ) -> Result<(), fidl::Error> {
5405        self.client.send::<FrameSetPopupFrameCreationListenerRequest>(
5406            (listener,),
5407            0x34ddec4e9f11e2aa,
5408            fidl::encoding::DynamicFlags::empty(),
5409        )
5410    }
5411
5412    type SetUrlRequestRewriteRulesResponseFut =
5413        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
5414    fn r#set_url_request_rewrite_rules(
5415        &self,
5416        mut rules: &[UrlRequestRewriteRule],
5417    ) -> Self::SetUrlRequestRewriteRulesResponseFut {
5418        fn _decode(
5419            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5420        ) -> Result<(), fidl::Error> {
5421            let _response = fidl::client::decode_transaction_body::<
5422                fidl::encoding::EmptyPayload,
5423                fidl::encoding::DefaultFuchsiaResourceDialect,
5424                0x2e3f797350ab3281,
5425            >(_buf?)?;
5426            Ok(_response)
5427        }
5428        self.client.send_query_and_decode::<FrameSetUrlRequestRewriteRulesRequest, ()>(
5429            (rules,),
5430            0x2e3f797350ab3281,
5431            fidl::encoding::DynamicFlags::empty(),
5432            _decode,
5433        )
5434    }
5435
5436    fn r#set_media_settings(&self, mut settings: &FrameMediaSettings) -> Result<(), fidl::Error> {
5437        self.client.send::<FrameSetMediaSettingsRequest>(
5438            (settings,),
5439            0x7da879b6d284c143,
5440            fidl::encoding::DynamicFlags::empty(),
5441        )
5442    }
5443
5444    fn r#force_content_dimensions(
5445        &self,
5446        mut web_dips: Option<&fidl_fuchsia_ui_gfx::Vec2>,
5447    ) -> Result<(), fidl::Error> {
5448        self.client.send::<FrameForceContentDimensionsRequest>(
5449            (web_dips,),
5450            0x8c7024c7149c901,
5451            fidl::encoding::DynamicFlags::empty(),
5452        )
5453    }
5454
5455    fn r#set_permission_state(
5456        &self,
5457        mut permission: &PermissionDescriptor,
5458        mut web_origin: &str,
5459        mut state: PermissionState,
5460    ) -> Result<(), fidl::Error> {
5461        self.client.send::<FrameSetPermissionStateRequest>(
5462            (permission, web_origin, state),
5463            0x19574e92a7033f4f,
5464            fidl::encoding::DynamicFlags::empty(),
5465        )
5466    }
5467
5468    fn r#set_block_media_loading(&self, mut blocked: bool) -> Result<(), fidl::Error> {
5469        self.client.send::<FrameSetBlockMediaLoadingRequest>(
5470            (blocked,),
5471            0x211071458fc9cf4f,
5472            fidl::encoding::DynamicFlags::empty(),
5473        )
5474    }
5475
5476    type GetPrivateMemorySizeResponseFut =
5477        fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect>;
5478    fn r#get_private_memory_size(&self) -> Self::GetPrivateMemorySizeResponseFut {
5479        fn _decode(
5480            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5481        ) -> Result<u64, fidl::Error> {
5482            let _response = fidl::client::decode_transaction_body::<
5483                FrameGetPrivateMemorySizeResponse,
5484                fidl::encoding::DefaultFuchsiaResourceDialect,
5485                0x6ad4d43da6c129b0,
5486            >(_buf?)?;
5487            Ok(_response.size_bytes)
5488        }
5489        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u64>(
5490            (),
5491            0x6ad4d43da6c129b0,
5492            fidl::encoding::DynamicFlags::empty(),
5493            _decode,
5494        )
5495    }
5496
5497    fn r#set_navigation_policy_provider(
5498        &self,
5499        mut params: &NavigationPolicyProviderParams,
5500        mut provider: fidl::endpoints::ClientEnd<NavigationPolicyProviderMarker>,
5501    ) -> Result<(), fidl::Error> {
5502        self.client.send::<FrameSetNavigationPolicyProviderRequest>(
5503            (params, provider),
5504            0x602ce35195d66654,
5505            fidl::encoding::DynamicFlags::empty(),
5506        )
5507    }
5508
5509    fn r#set_content_area_settings(
5510        &self,
5511        mut settings: &ContentAreaSettings,
5512    ) -> Result<(), fidl::Error> {
5513        self.client.send::<FrameSetContentAreaSettingsRequest>(
5514            (settings,),
5515            0x851f4de50c3c27e,
5516            fidl::encoding::DynamicFlags::empty(),
5517        )
5518    }
5519
5520    fn r#reset_content_area_settings(&self) -> Result<(), fidl::Error> {
5521        self.client.send::<fidl::encoding::EmptyPayload>(
5522            (),
5523            0x6807e04f16f8ee5d,
5524            fidl::encoding::DynamicFlags::empty(),
5525        )
5526    }
5527
5528    fn r#close(&self, mut payload: &FrameCloseRequest) -> Result<(), fidl::Error> {
5529        self.client.send::<FrameCloseRequest>(
5530            payload,
5531            0x442e84138e65351,
5532            fidl::encoding::DynamicFlags::empty(),
5533        )
5534    }
5535}
5536
5537pub struct FrameEventStream {
5538    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5539}
5540
5541impl std::marker::Unpin for FrameEventStream {}
5542
5543impl futures::stream::FusedStream for FrameEventStream {
5544    fn is_terminated(&self) -> bool {
5545        self.event_receiver.is_terminated()
5546    }
5547}
5548
5549impl futures::Stream for FrameEventStream {
5550    type Item = Result<FrameEvent, fidl::Error>;
5551
5552    fn poll_next(
5553        mut self: std::pin::Pin<&mut Self>,
5554        cx: &mut std::task::Context<'_>,
5555    ) -> std::task::Poll<Option<Self::Item>> {
5556        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5557            &mut self.event_receiver,
5558            cx
5559        )?) {
5560            Some(buf) => std::task::Poll::Ready(Some(FrameEvent::decode(buf))),
5561            None => std::task::Poll::Ready(None),
5562        }
5563    }
5564}
5565
5566#[derive(Debug)]
5567pub enum FrameEvent {}
5568
5569impl FrameEvent {
5570    /// Decodes a message buffer as a [`FrameEvent`].
5571    fn decode(
5572        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5573    ) -> Result<FrameEvent, fidl::Error> {
5574        let (bytes, _handles) = buf.split_mut();
5575        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5576        debug_assert_eq!(tx_header.tx_id, 0);
5577        match tx_header.ordinal {
5578            _ => Err(fidl::Error::UnknownOrdinal {
5579                ordinal: tx_header.ordinal,
5580                protocol_name: <FrameMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5581            }),
5582        }
5583    }
5584}
5585
5586/// A Stream of incoming requests for fuchsia.web/Frame.
5587pub struct FrameRequestStream {
5588    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5589    is_terminated: bool,
5590}
5591
5592impl std::marker::Unpin for FrameRequestStream {}
5593
5594impl futures::stream::FusedStream for FrameRequestStream {
5595    fn is_terminated(&self) -> bool {
5596        self.is_terminated
5597    }
5598}
5599
5600impl fidl::endpoints::RequestStream for FrameRequestStream {
5601    type Protocol = FrameMarker;
5602    type ControlHandle = FrameControlHandle;
5603
5604    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5605        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5606    }
5607
5608    fn control_handle(&self) -> Self::ControlHandle {
5609        FrameControlHandle { inner: self.inner.clone() }
5610    }
5611
5612    fn into_inner(
5613        self,
5614    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5615    {
5616        (self.inner, self.is_terminated)
5617    }
5618
5619    fn from_inner(
5620        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5621        is_terminated: bool,
5622    ) -> Self {
5623        Self { inner, is_terminated }
5624    }
5625}
5626
5627impl futures::Stream for FrameRequestStream {
5628    type Item = Result<FrameRequest, fidl::Error>;
5629
5630    fn poll_next(
5631        mut self: std::pin::Pin<&mut Self>,
5632        cx: &mut std::task::Context<'_>,
5633    ) -> std::task::Poll<Option<Self::Item>> {
5634        let this = &mut *self;
5635        if this.inner.check_shutdown(cx) {
5636            this.is_terminated = true;
5637            return std::task::Poll::Ready(None);
5638        }
5639        if this.is_terminated {
5640            panic!("polled FrameRequestStream after completion");
5641        }
5642        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5643            |bytes, handles| {
5644                match this.inner.channel().read_etc(cx, bytes, handles) {
5645                    std::task::Poll::Ready(Ok(())) => {}
5646                    std::task::Poll::Pending => return std::task::Poll::Pending,
5647                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5648                        this.is_terminated = true;
5649                        return std::task::Poll::Ready(None);
5650                    }
5651                    std::task::Poll::Ready(Err(e)) => {
5652                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5653                            e.into(),
5654                        ))));
5655                    }
5656                }
5657
5658                // A message has been received from the channel
5659                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5660
5661                std::task::Poll::Ready(Some(match header.ordinal {
5662                    0x6a27859439133264 => {
5663                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5664                        let mut req = fidl::new_empty!(
5665                            FrameCreateViewRequest,
5666                            fidl::encoding::DefaultFuchsiaResourceDialect
5667                        );
5668                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameCreateViewRequest>(&header, _body_bytes, handles, &mut req)?;
5669                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5670                        Ok(FrameRequest::CreateView { view_token: req.view_token, control_handle })
5671                    }
5672                    0x1eb17ab2442326ac => {
5673                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5674                        let mut req = fidl::new_empty!(
5675                            FrameCreateViewWithViewRefRequest,
5676                            fidl::encoding::DefaultFuchsiaResourceDialect
5677                        );
5678                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameCreateViewWithViewRefRequest>(&header, _body_bytes, handles, &mut req)?;
5679                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5680                        Ok(FrameRequest::CreateViewWithViewRef {
5681                            view_token: req.view_token,
5682                            view_ref_control: req.view_ref_control,
5683                            view_ref: req.view_ref,
5684
5685                            control_handle,
5686                        })
5687                    }
5688                    0x1be7e9512962eb37 => {
5689                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5690                        let mut req = fidl::new_empty!(
5691                            FrameCreateView2Request,
5692                            fidl::encoding::DefaultFuchsiaResourceDialect
5693                        );
5694                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameCreateView2Request>(&header, _body_bytes, handles, &mut req)?;
5695                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5696                        Ok(FrameRequest::CreateView2 { args: req.args, control_handle })
5697                    }
5698                    0x72a81aaae7a80d2b => {
5699                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5700                        let mut req = fidl::new_empty!(
5701                            fidl::encoding::EmptyPayload,
5702                            fidl::encoding::DefaultFuchsiaResourceDialect
5703                        );
5704                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5705                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5706                        Ok(FrameRequest::EnableHeadlessRendering { control_handle })
5707                    }
5708                    0x5ca38a3d1f7f543a => {
5709                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5710                        let mut req = fidl::new_empty!(
5711                            fidl::encoding::EmptyPayload,
5712                            fidl::encoding::DefaultFuchsiaResourceDialect
5713                        );
5714                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5715                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5716                        Ok(FrameRequest::DisableHeadlessRendering { control_handle })
5717                    }
5718                    0xaafb639fc0b9eb9 => {
5719                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5720                        let mut req = fidl::new_empty!(
5721                            FrameGetMediaPlayerRequest,
5722                            fidl::encoding::DefaultFuchsiaResourceDialect
5723                        );
5724                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameGetMediaPlayerRequest>(&header, _body_bytes, handles, &mut req)?;
5725                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5726                        Ok(FrameRequest::GetMediaPlayer { player: req.player, control_handle })
5727                    }
5728                    0x4521cfe95217a688 => {
5729                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5730                        let mut req = fidl::new_empty!(
5731                            FrameGetNavigationControllerRequest,
5732                            fidl::encoding::DefaultFuchsiaResourceDialect
5733                        );
5734                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameGetNavigationControllerRequest>(&header, _body_bytes, handles, &mut req)?;
5735                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5736                        Ok(FrameRequest::GetNavigationController {
5737                            controller: req.controller,
5738
5739                            control_handle,
5740                        })
5741                    }
5742                    0x79abdd4907000542 => {
5743                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5744                        let mut req = fidl::new_empty!(
5745                            FrameExecuteJavaScriptRequest,
5746                            fidl::encoding::DefaultFuchsiaResourceDialect
5747                        );
5748                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameExecuteJavaScriptRequest>(&header, _body_bytes, handles, &mut req)?;
5749                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5750                        Ok(FrameRequest::ExecuteJavaScript {
5751                            origins: req.origins,
5752                            script: req.script,
5753
5754                            responder: FrameExecuteJavaScriptResponder {
5755                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5756                                tx_id: header.tx_id,
5757                            },
5758                        })
5759                    }
5760                    0x16b8491520cbcd63 => {
5761                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5762                        let mut req = fidl::new_empty!(
5763                            FrameExecuteJavaScriptNoResultRequest,
5764                            fidl::encoding::DefaultFuchsiaResourceDialect
5765                        );
5766                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameExecuteJavaScriptNoResultRequest>(&header, _body_bytes, handles, &mut req)?;
5767                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5768                        Ok(FrameRequest::ExecuteJavaScriptNoResult {
5769                            origins: req.origins,
5770                            script: req.script,
5771
5772                            responder: FrameExecuteJavaScriptNoResultResponder {
5773                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5774                                tx_id: header.tx_id,
5775                            },
5776                        })
5777                    }
5778                    0x540ac0da59d823e => {
5779                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5780                        let mut req = fidl::new_empty!(
5781                            FrameAddBeforeLoadJavaScriptRequest,
5782                            fidl::encoding::DefaultFuchsiaResourceDialect
5783                        );
5784                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameAddBeforeLoadJavaScriptRequest>(&header, _body_bytes, handles, &mut req)?;
5785                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5786                        Ok(FrameRequest::AddBeforeLoadJavaScript {
5787                            id: req.id,
5788                            origins: req.origins,
5789                            script: req.script,
5790
5791                            responder: FrameAddBeforeLoadJavaScriptResponder {
5792                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5793                                tx_id: header.tx_id,
5794                            },
5795                        })
5796                    }
5797                    0x17d92b855b61d23a => {
5798                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5799                        let mut req = fidl::new_empty!(
5800                            FrameRemoveBeforeLoadJavaScriptRequest,
5801                            fidl::encoding::DefaultFuchsiaResourceDialect
5802                        );
5803                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameRemoveBeforeLoadJavaScriptRequest>(&header, _body_bytes, handles, &mut req)?;
5804                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5805                        Ok(FrameRequest::RemoveBeforeLoadJavaScript { id: req.id, control_handle })
5806                    }
5807                    0x751d686eb7caa341 => {
5808                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5809                        let mut req = fidl::new_empty!(
5810                            FramePostMessageRequest,
5811                            fidl::encoding::DefaultFuchsiaResourceDialect
5812                        );
5813                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FramePostMessageRequest>(&header, _body_bytes, handles, &mut req)?;
5814                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5815                        Ok(FrameRequest::PostMessage {
5816                            target_origin: req.target_origin,
5817                            message: req.message,
5818
5819                            responder: FramePostMessageResponder {
5820                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5821                                tx_id: header.tx_id,
5822                            },
5823                        })
5824                    }
5825                    0x965ba0fa20e0a56 => {
5826                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5827                        let mut req = fidl::new_empty!(
5828                            FrameSetNavigationEventListenerRequest,
5829                            fidl::encoding::DefaultFuchsiaResourceDialect
5830                        );
5831                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameSetNavigationEventListenerRequest>(&header, _body_bytes, handles, &mut req)?;
5832                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5833                        Ok(FrameRequest::SetNavigationEventListener {
5834                            listener: req.listener,
5835
5836                            control_handle,
5837                        })
5838                    }
5839                    0x5f8b40607f1f578f => {
5840                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5841                        let mut req = fidl::new_empty!(
5842                            FrameSetNavigationEventListener2Request,
5843                            fidl::encoding::DefaultFuchsiaResourceDialect
5844                        );
5845                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameSetNavigationEventListener2Request>(&header, _body_bytes, handles, &mut req)?;
5846                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5847                        Ok(FrameRequest::SetNavigationEventListener2 {
5848                            listener: req.listener,
5849                            flags: req.flags,
5850
5851                            control_handle,
5852                        })
5853                    }
5854                    0x74824b11a71c4b5b => {
5855                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5856                        let mut req = fidl::new_empty!(
5857                            FrameSetJavaScriptLogLevelRequest,
5858                            fidl::encoding::DefaultFuchsiaResourceDialect
5859                        );
5860                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameSetJavaScriptLogLevelRequest>(&header, _body_bytes, handles, &mut req)?;
5861                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5862                        Ok(FrameRequest::SetJavaScriptLogLevel { level: req.level, control_handle })
5863                    }
5864                    0x18f5cbc19fa4687b => {
5865                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5866                        let mut req = fidl::new_empty!(
5867                            FrameSetConsoleLogSinkRequest,
5868                            fidl::encoding::DefaultFuchsiaResourceDialect
5869                        );
5870                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameSetConsoleLogSinkRequest>(&header, _body_bytes, handles, &mut req)?;
5871                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5872                        Ok(FrameRequest::SetConsoleLogSink { sink: req.sink, control_handle })
5873                    }
5874                    0x38e08fe763c6bef6 => {
5875                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5876                        let mut req = fidl::new_empty!(
5877                            FrameConfigureInputTypesRequest,
5878                            fidl::encoding::DefaultFuchsiaResourceDialect
5879                        );
5880                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameConfigureInputTypesRequest>(&header, _body_bytes, handles, &mut req)?;
5881                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5882                        Ok(FrameRequest::ConfigureInputTypes {
5883                            types: req.types,
5884                            allow: req.allow,
5885
5886                            control_handle,
5887                        })
5888                    }
5889                    0x34ddec4e9f11e2aa => {
5890                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5891                        let mut req = fidl::new_empty!(
5892                            FrameSetPopupFrameCreationListenerRequest,
5893                            fidl::encoding::DefaultFuchsiaResourceDialect
5894                        );
5895                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameSetPopupFrameCreationListenerRequest>(&header, _body_bytes, handles, &mut req)?;
5896                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5897                        Ok(FrameRequest::SetPopupFrameCreationListener {
5898                            listener: req.listener,
5899
5900                            control_handle,
5901                        })
5902                    }
5903                    0x2e3f797350ab3281 => {
5904                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5905                        let mut req = fidl::new_empty!(
5906                            FrameSetUrlRequestRewriteRulesRequest,
5907                            fidl::encoding::DefaultFuchsiaResourceDialect
5908                        );
5909                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameSetUrlRequestRewriteRulesRequest>(&header, _body_bytes, handles, &mut req)?;
5910                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5911                        Ok(FrameRequest::SetUrlRequestRewriteRules {
5912                            rules: req.rules,
5913
5914                            responder: FrameSetUrlRequestRewriteRulesResponder {
5915                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5916                                tx_id: header.tx_id,
5917                            },
5918                        })
5919                    }
5920                    0x7da879b6d284c143 => {
5921                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5922                        let mut req = fidl::new_empty!(
5923                            FrameSetMediaSettingsRequest,
5924                            fidl::encoding::DefaultFuchsiaResourceDialect
5925                        );
5926                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameSetMediaSettingsRequest>(&header, _body_bytes, handles, &mut req)?;
5927                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5928                        Ok(FrameRequest::SetMediaSettings {
5929                            settings: req.settings,
5930
5931                            control_handle,
5932                        })
5933                    }
5934                    0x8c7024c7149c901 => {
5935                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5936                        let mut req = fidl::new_empty!(
5937                            FrameForceContentDimensionsRequest,
5938                            fidl::encoding::DefaultFuchsiaResourceDialect
5939                        );
5940                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameForceContentDimensionsRequest>(&header, _body_bytes, handles, &mut req)?;
5941                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5942                        Ok(FrameRequest::ForceContentDimensions {
5943                            web_dips: req.web_dips,
5944
5945                            control_handle,
5946                        })
5947                    }
5948                    0x19574e92a7033f4f => {
5949                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5950                        let mut req = fidl::new_empty!(
5951                            FrameSetPermissionStateRequest,
5952                            fidl::encoding::DefaultFuchsiaResourceDialect
5953                        );
5954                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameSetPermissionStateRequest>(&header, _body_bytes, handles, &mut req)?;
5955                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5956                        Ok(FrameRequest::SetPermissionState {
5957                            permission: req.permission,
5958                            web_origin: req.web_origin,
5959                            state: req.state,
5960
5961                            control_handle,
5962                        })
5963                    }
5964                    0x211071458fc9cf4f => {
5965                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5966                        let mut req = fidl::new_empty!(
5967                            FrameSetBlockMediaLoadingRequest,
5968                            fidl::encoding::DefaultFuchsiaResourceDialect
5969                        );
5970                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameSetBlockMediaLoadingRequest>(&header, _body_bytes, handles, &mut req)?;
5971                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5972                        Ok(FrameRequest::SetBlockMediaLoading {
5973                            blocked: req.blocked,
5974
5975                            control_handle,
5976                        })
5977                    }
5978                    0x6ad4d43da6c129b0 => {
5979                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5980                        let mut req = fidl::new_empty!(
5981                            fidl::encoding::EmptyPayload,
5982                            fidl::encoding::DefaultFuchsiaResourceDialect
5983                        );
5984                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5985                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5986                        Ok(FrameRequest::GetPrivateMemorySize {
5987                            responder: FrameGetPrivateMemorySizeResponder {
5988                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5989                                tx_id: header.tx_id,
5990                            },
5991                        })
5992                    }
5993                    0x602ce35195d66654 => {
5994                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5995                        let mut req = fidl::new_empty!(
5996                            FrameSetNavigationPolicyProviderRequest,
5997                            fidl::encoding::DefaultFuchsiaResourceDialect
5998                        );
5999                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameSetNavigationPolicyProviderRequest>(&header, _body_bytes, handles, &mut req)?;
6000                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
6001                        Ok(FrameRequest::SetNavigationPolicyProvider {
6002                            params: req.params,
6003                            provider: req.provider,
6004
6005                            control_handle,
6006                        })
6007                    }
6008                    0x851f4de50c3c27e => {
6009                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6010                        let mut req = fidl::new_empty!(
6011                            FrameSetContentAreaSettingsRequest,
6012                            fidl::encoding::DefaultFuchsiaResourceDialect
6013                        );
6014                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameSetContentAreaSettingsRequest>(&header, _body_bytes, handles, &mut req)?;
6015                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
6016                        Ok(FrameRequest::SetContentAreaSettings {
6017                            settings: req.settings,
6018
6019                            control_handle,
6020                        })
6021                    }
6022                    0x6807e04f16f8ee5d => {
6023                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6024                        let mut req = fidl::new_empty!(
6025                            fidl::encoding::EmptyPayload,
6026                            fidl::encoding::DefaultFuchsiaResourceDialect
6027                        );
6028                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6029                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
6030                        Ok(FrameRequest::ResetContentAreaSettings { control_handle })
6031                    }
6032                    0x442e84138e65351 => {
6033                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6034                        let mut req = fidl::new_empty!(
6035                            FrameCloseRequest,
6036                            fidl::encoding::DefaultFuchsiaResourceDialect
6037                        );
6038                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameCloseRequest>(&header, _body_bytes, handles, &mut req)?;
6039                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
6040                        Ok(FrameRequest::Close { payload: req, control_handle })
6041                    }
6042                    _ => Err(fidl::Error::UnknownOrdinal {
6043                        ordinal: header.ordinal,
6044                        protocol_name: <FrameMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6045                    }),
6046                }))
6047            },
6048        )
6049    }
6050}
6051
6052#[derive(Debug)]
6053pub enum FrameRequest {
6054    /// Creates a new view using the specified `view_token`. Caller should pass the other end of
6055    /// the token to [`fuchsia.ui.gfx/ViewHolderArgs`] to attach the new view to a view tree.
6056    ///
6057    /// See the description of [`CreateContextParams.service_directory`] for additional services
6058    /// that must be present when using this method.
6059    CreateView { view_token: fidl_fuchsia_ui_views::ViewToken, control_handle: FrameControlHandle },
6060    /// Creates a new view using the specified `view_token`. Caller should pass the other end of
6061    /// the token to [`fuchsia.ui.gfx/ViewHolderArgs`] to attach the new view to a view tree.
6062    /// `view_ref` can be cloned before passing it to this method, which will allow clients to
6063    /// track the view.
6064    ///
6065    /// `view_ref_control` must not have the `ZX_RIGHT_DUPLICATE` set, or view creation will fail
6066    /// and `view_token` will be closed.
6067    ///
6068    /// See the description of [`CreateContextParams.service_directory`] for additional services
6069    /// that must be present when using this method.
6070    CreateViewWithViewRef {
6071        view_token: fidl_fuchsia_ui_views::ViewToken,
6072        view_ref_control: fidl_fuchsia_ui_views::ViewRefControl,
6073        view_ref: fidl_fuchsia_ui_views::ViewRef,
6074        control_handle: FrameControlHandle,
6075    },
6076    /// Creates a new Flatland view using the specified `view_creation_token` defined under `args`.
6077    /// Caller should pass the other end of the token to
6078    /// [`fuchsia.ui.composition/Flatland.CreateViewport`] to attach the new Flatland view to its
6079    /// graph.
6080    CreateView2 { args: CreateView2Args, control_handle: FrameControlHandle },
6081    /// Enables headless rendering of the Frame.
6082    ///
6083    /// This is used when content depends on layout and/or animation events firing normally.
6084    /// May only be used on a Context created with [`ContextFeatureFlags.HEADLESS`].
6085    EnableHeadlessRendering { control_handle: FrameControlHandle },
6086    /// Stops headless rendering of the Frame.
6087    ///
6088    /// May only be used on a Context created with [`ContextFeatureFlags.HEADLESS`].
6089    DisableHeadlessRendering { control_handle: FrameControlHandle },
6090    /// Returns a [`fuchsia.media.sessions2/Player`] interface through which media (i.e.
6091    /// video/audio) playback in the frame may be observed, and/or controlled. Only one
6092    /// [`fuchsia.media.sessions2/Player`] may be active at a time, for each [`Frame`].
6093    GetMediaPlayer {
6094        player: fidl::endpoints::ServerEnd<fidl_fuchsia_media_sessions2::PlayerMarker>,
6095        control_handle: FrameControlHandle,
6096    },
6097    /// Returns an interface through which the [`Frame`] may be navigated to a desired URL,
6098    /// reloaded, etc.
6099    ///
6100    /// - `controller`: An asynchronous interface request for the [`Frame`]'s
6101    ///   [`NavigationController`].
6102    GetNavigationController {
6103        controller: fidl::endpoints::ServerEnd<NavigationControllerMarker>,
6104        control_handle: FrameControlHandle,
6105    },
6106    /// Executes a UTF-8 encoded `script` in the [`Frame`] if the [`Frame`]'s URL has an origin
6107    /// which matches entries in `origins`.
6108    ///
6109    /// At least one `origins` entry must be specified. If a wildcard `"*"` is specified in
6110    /// `origins`, then the script will be evaluated unconditionally.
6111    ///
6112    /// Returns the result of executing `script`, as a JSON-encoded string.
6113    ///
6114    /// Note that scripts share the same execution context as the document,
6115    /// meaning that document may modify variables, classes, or objects set by
6116    /// the script in arbitrary or unpredictable ways.
6117    ///
6118    /// If an error occurred, the FrameError will be set to one of these values:
6119    /// - `BUFFER_NOT_UTF8`: `script` is not UTF-8 encoded.
6120    /// - `INVALID_ORIGIN`: The [`Frame`]'s current URL does not match any of the values in
6121    ///   `origins` or `origins` is an empty vector.
6122    ExecuteJavaScript {
6123        origins: Vec<String>,
6124        script: fidl_fuchsia_mem::Buffer,
6125        responder: FrameExecuteJavaScriptResponder,
6126    },
6127    /// Variant of [`Frame.ExecuteJavaScript`] which executes the supplied script without returning
6128    /// a result.
6129    ExecuteJavaScriptNoResult {
6130        origins: Vec<String>,
6131        script: fidl_fuchsia_mem::Buffer,
6132        responder: FrameExecuteJavaScriptNoResultResponder,
6133    },
6134    /// Executes a UTF-8 encoded `script` for every subsequent page load where the [`Frame`]'s URL
6135    /// has an origin reflected in `origins`. The script is executed early, prior to the execution
6136    /// of the document's scripts.
6137    ///
6138    /// Scripts are identified by a client-managed identifier `id`. Any script previously injected
6139    /// using the same `id` will be replaced.
6140    ///
6141    /// The order in which multiple bindings are executed is the same as the order in which the
6142    /// bindings were added. If a script is added which clobbers an existing script of the same
6143    /// `id`, the previous script's precedence in the injection order will be preserved.
6144    ///
6145    /// At least one `origins` entry must be specified. If a wildcard `"*"` is specified in
6146    /// `origins`, then the script will be evaluated unconditionally.
6147    ///
6148    /// If an error occurred, the [`FrameError`] will be set to one of these values:
6149    /// - `BUFFER_NOT_UTF8`: `script` is not UTF-8 encoded.
6150    /// - `INVALID_ORIGIN`: `origins` is an empty vector.
6151    AddBeforeLoadJavaScript {
6152        id: u64,
6153        origins: Vec<String>,
6154        script: fidl_fuchsia_mem::Buffer,
6155        responder: FrameAddBeforeLoadJavaScriptResponder,
6156    },
6157    /// Removes a previously added JavaScript snippet identified by `id`. This is a no-op if there
6158    /// is no JavaScript snippet identified by `id`.
6159    RemoveBeforeLoadJavaScript { id: u64, control_handle: FrameControlHandle },
6160    /// Posts a message to the frame's onMessage handler.
6161    ///
6162    /// `target_origin` restricts message delivery to the specified origin. If `target_origin` is
6163    /// `"*"`, then the message will be sent to the document regardless of its origin.
6164    /// See the
6165    /// [HTML spec](https://html.spec.whatwg.org/multipage/web-messaging.html#posting-messages)
6166    /// section 9.4.3 for more details on how the target origin policy is applied.
6167    ///
6168    /// If an error occurred, the [`FrameError`] will be set to one of these values:
6169    /// - `INTERNAL_ERROR`: The WebEngine failed to create a message pipe.
6170    /// - `BUFFER_NOT_UTF8`: The script in `message`'s `data` property is not UTF-8 encoded.
6171    /// - `INVALID_ORIGIN`: `origins` is an empty vector.
6172    /// - `NO_DATA_IN_MESSAGE`: The `data` property is missing in `message`.
6173    PostMessage { target_origin: String, message: WebMessage, responder: FramePostMessageResponder },
6174    /// Sets the listener for handling page navigation events.
6175    ///
6176    /// - `listener`: The observer to use. Unregisters any existing listener if null.
6177    SetNavigationEventListener {
6178        listener: Option<fidl::endpoints::ClientEnd<NavigationEventListenerMarker>>,
6179        control_handle: FrameControlHandle,
6180    },
6181    /// Sets the listener for handling page navigation events. The listener will receive the
6182    /// current navigation state immediately. After that, it's notified whenever the state changes.
6183    ///
6184    /// - `listener`: The observer to use. Unregisters any existing listener if null.
6185    /// - `flags`: Flags for optional features that should be enabled for the listener.
6186    SetNavigationEventListener2 {
6187        listener: Option<fidl::endpoints::ClientEnd<NavigationEventListenerMarker>>,
6188        flags: NavigationEventListenerFlags,
6189        control_handle: FrameControlHandle,
6190    },
6191    /// If set to a value other than [`ConsoleLogLevel.NONE`], allows web content to log messages
6192    /// to the [`fuchsia.logger/LogSink`] configured for this [`Frame`], via the
6193    /// `console` object (e.g. using `debug()`, `log()`, `info()`, `warn()` and
6194    /// `error()`).
6195    /// The default value is [`ConsoleLogLevel.NONE`].
6196    ///
6197    /// As the system log may be persisted, it is recommended that [`ConsoleLogLevel.NONE`] be used
6198    /// in Incognito and other private browsing modes.
6199    ///
6200    /// Log lines are written to the [`fuchsia.logger/LogsSink`] configured
6201    /// for this [`fuchsia.web/Frame`], with severities mapped as follows:
6202    /// - `debug()`, `log()` and `info()` are logged at [`fuchsia.logger/LogLevelFilter.INFO`]
6203    ///   severity.
6204    /// - `warn()` is logged at [`fuchsia.logger/LogLevelFilter.WARN`] severity.
6205    /// - `error()` is logged at [`fuchsia.logger/LogLevelFilter.ERROR`] severity.
6206    SetJavaScriptLogLevel { level: ConsoleLogLevel, control_handle: FrameControlHandle },
6207    /// Specifies where to emit `console` log output to. By default log output will be routed to a
6208    /// [`fuchsia.logger/LogSink`] obtained via the [`fuchsia.web/Context`]'s service directory.
6209    ///
6210    /// - `sink`: The [`fuchsia.logger/LogSink`] to use to emit logs. Passing a `null` handle
6211    ///   resets logging to use the default [`fuchsia.logger/LogSink`].
6212    SetConsoleLogSink {
6213        sink: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_logger::LogSinkMarker>>,
6214        control_handle: FrameControlHandle,
6215    },
6216    /// Enables or disables the processing of the specified `types` of user inputs.
6217    /// `allow` specifies whether to enable or disable the specified `types`.
6218    /// All input types are enabled by default.
6219    ConfigureInputTypes {
6220        types: InputTypes,
6221        allow: AllowInputState,
6222        control_handle: FrameControlHandle,
6223    },
6224    /// Sets the listener for handling popup frame opened by web content. If no listener is
6225    /// present, then any new popup frame will be blocked.
6226    ///
6227    /// - `listener`: The listener to use. Unregisters any existing listener if null.
6228    SetPopupFrameCreationListener {
6229        listener: Option<fidl::endpoints::ClientEnd<PopupFrameCreationListenerMarker>>,
6230        control_handle: FrameControlHandle,
6231    },
6232    /// Supplies a set of [`UrlRequestRewriteRule`] to apply on every subsequent URL request.
6233    /// - `rules` are cumulative and applied in order.
6234    /// - `rules` are only applied on the first URL request in a redirect chain.
6235    /// - `rules` will be validated before being applied. If `rules` are invalid, the [`Frame`]
6236    ///   will be closed with `ERR_INVALID_ARGS`.
6237    /// - [`Frame.SetUrlRequestRewriteRules`] must not be called again until its acknowledgement
6238    ///   callback has been processed. If this happens, the [`Frame`] will be closed with
6239    ///   `ERR_BAD_STATE`.
6240    SetUrlRequestRewriteRules {
6241        rules: Vec<UrlRequestRewriteRule>,
6242        responder: FrameSetUrlRequestRewriteRulesResponder,
6243    },
6244    /// Sets [`fuchsia.media/FrameMediaSettings`] for the frame. The specified parameters are
6245    /// applied to audio streams that started after this message is processed. Should be called
6246    /// before the Frame is navigated to content in order to ensure that the settings applied to
6247    /// all media streams. Due to request pipelining, this means doing so before calling
6248    /// [`Frame.GetNavigationController()`] and [`NavigationController.LoadUrl()`].
6249    SetMediaSettings { settings: FrameMediaSettings, control_handle: FrameControlHandle },
6250    /// Overrides the dimensions reported to web content. The devicePixelRatio reported to
6251    /// web content will be adjusted in response to changes in the pixel size of the View,
6252    /// rather than changing the size reported to the content. Call with null `web_dips` to
6253    /// remove any prior forced content dimensions.
6254    ForceContentDimensions {
6255        web_dips: Option<Box<fidl_fuchsia_ui_gfx::Vec2>>,
6256        control_handle: FrameControlHandle,
6257    },
6258    /// Sets the permission state for the specified `permission` and `web_origin`. By default, all
6259    /// permissions are denied.
6260    SetPermissionState {
6261        permission: PermissionDescriptor,
6262        web_origin: String,
6263        state: PermissionState,
6264        control_handle: FrameControlHandle,
6265    },
6266    /// Sets whether to block all HTMLMediaElements in the frame from fetching and loading media
6267    /// resources.
6268    ///
6269    /// May be used, for example, to prevent loading media in frames that are not visible.
6270    ///
6271    /// While media loading is blocked, elements with `autoplay` set to `true` will not start
6272    /// playback. The promises returned by calls to `play()` will remain unresolved until loading is
6273    /// unblocked by a call to this method.
6274    ///
6275    /// When media loading is unblocked, elements will begin fetching, resource, loading, and
6276    /// playing as appropriate.
6277    ///
6278    /// Any elements that have begun fetching or loading media resources for the current source
6279    /// before media loading was blocked will continue to fetch, load, and start playback as
6280    /// appropriate. This includes calls to `play()` even after media loading is blocked.
6281    SetBlockMediaLoading { blocked: bool, control_handle: FrameControlHandle },
6282    /// Returns the amount of private (non-shared) physical memory used by the Frame's main
6283    /// document. The returned size might not reflect the memory usage of embedded iframes.
6284    GetPrivateMemorySize { responder: FrameGetPrivateMemorySizeResponder },
6285    /// Sets the navigation policy provider for the [`Frame`]. When set, the [`Frame`] sends
6286    /// [`NavigationPolicyProvider.EvaluateRequestedNavigation`] when processing navigation
6287    /// requests. `params` defines when the message is sent. After sending the
6288    /// `EvaluateRequestedNavigation` message, the [`Frame`] blocks the corresponding navigation
6289    /// until it receives a response.
6290    ///
6291    /// Should be called before `GetNavigationController` to ensure that it is applied to all
6292    /// navigations including the first [`NavigationController.LoadURL`] request.
6293    SetNavigationPolicyProvider {
6294        params: NavigationPolicyProviderParams,
6295        provider: fidl::endpoints::ClientEnd<NavigationPolicyProviderMarker>,
6296        control_handle: FrameControlHandle,
6297    },
6298    /// Sets various settings for how web content should be run in the Frame. May be called at any
6299    /// time, including after the URL has loaded. Each call changes only the specified fields,
6300    /// overwriting any prior value.
6301    ///
6302    /// This method will fail with `ZX_ERR_NOT_SUPPORTED` if any value in [`ContentAreaSettings`]
6303    /// is not supported by the Frame.
6304    SetContentAreaSettings { settings: ContentAreaSettings, control_handle: FrameControlHandle },
6305    /// Reset the Frame's [`ContentAreaSettings`] to default values.
6306    ResetContentAreaSettings { control_handle: FrameControlHandle },
6307    /// Request graceful or immediate teardown of the Frame content and notification of completion
6308    /// via Frame epitaph.
6309    ///
6310    /// Graceful teardown allows unload and cleanup tasks in the implementation and web content
6311    /// (e.g., `unload` event handlers) to run for up to the specified period of time. Immediate
6312    /// teardown only runs the minimum cleanup tasks in the implementation and does not allow web
6313    /// content to run event handlers.
6314    ///
6315    /// * If `timeout` is zero, an immediate teardown is initiated. The channel will close with
6316    ///   `ZX_OK`. This is equivalent to the caller closing the Frame channel.
6317    ///
6318    /// * If `timeout` is non-zero, a graceful teardown is initiated. The channel will close with
6319    ///   `ZX_OK` if the Frame closes within the specified `timeout` and with `ZX_ERR_TIMED_OUT`
6320    ///   otherwise.
6321    ///
6322    /// * If `timeout` is not specified, a reasonable implementation-specific timeout is applied.
6323    ///
6324    /// Subsequent calls to `Close()` will override any previously specified `Close()` timeout.
6325    Close { payload: FrameCloseRequest, control_handle: FrameControlHandle },
6326}
6327
6328impl FrameRequest {
6329    #[allow(irrefutable_let_patterns)]
6330    pub fn into_create_view(
6331        self,
6332    ) -> Option<(fidl_fuchsia_ui_views::ViewToken, FrameControlHandle)> {
6333        if let FrameRequest::CreateView { view_token, control_handle } = self {
6334            Some((view_token, control_handle))
6335        } else {
6336            None
6337        }
6338    }
6339
6340    #[allow(irrefutable_let_patterns)]
6341    pub fn into_create_view_with_view_ref(
6342        self,
6343    ) -> Option<(
6344        fidl_fuchsia_ui_views::ViewToken,
6345        fidl_fuchsia_ui_views::ViewRefControl,
6346        fidl_fuchsia_ui_views::ViewRef,
6347        FrameControlHandle,
6348    )> {
6349        if let FrameRequest::CreateViewWithViewRef {
6350            view_token,
6351            view_ref_control,
6352            view_ref,
6353            control_handle,
6354        } = self
6355        {
6356            Some((view_token, view_ref_control, view_ref, control_handle))
6357        } else {
6358            None
6359        }
6360    }
6361
6362    #[allow(irrefutable_let_patterns)]
6363    pub fn into_create_view2(self) -> Option<(CreateView2Args, FrameControlHandle)> {
6364        if let FrameRequest::CreateView2 { args, control_handle } = self {
6365            Some((args, control_handle))
6366        } else {
6367            None
6368        }
6369    }
6370
6371    #[allow(irrefutable_let_patterns)]
6372    pub fn into_enable_headless_rendering(self) -> Option<(FrameControlHandle)> {
6373        if let FrameRequest::EnableHeadlessRendering { control_handle } = self {
6374            Some((control_handle))
6375        } else {
6376            None
6377        }
6378    }
6379
6380    #[allow(irrefutable_let_patterns)]
6381    pub fn into_disable_headless_rendering(self) -> Option<(FrameControlHandle)> {
6382        if let FrameRequest::DisableHeadlessRendering { control_handle } = self {
6383            Some((control_handle))
6384        } else {
6385            None
6386        }
6387    }
6388
6389    #[allow(irrefutable_let_patterns)]
6390    pub fn into_get_media_player(
6391        self,
6392    ) -> Option<(
6393        fidl::endpoints::ServerEnd<fidl_fuchsia_media_sessions2::PlayerMarker>,
6394        FrameControlHandle,
6395    )> {
6396        if let FrameRequest::GetMediaPlayer { player, control_handle } = self {
6397            Some((player, control_handle))
6398        } else {
6399            None
6400        }
6401    }
6402
6403    #[allow(irrefutable_let_patterns)]
6404    pub fn into_get_navigation_controller(
6405        self,
6406    ) -> Option<(fidl::endpoints::ServerEnd<NavigationControllerMarker>, FrameControlHandle)> {
6407        if let FrameRequest::GetNavigationController { controller, control_handle } = self {
6408            Some((controller, control_handle))
6409        } else {
6410            None
6411        }
6412    }
6413
6414    #[allow(irrefutable_let_patterns)]
6415    pub fn into_execute_java_script(
6416        self,
6417    ) -> Option<(Vec<String>, fidl_fuchsia_mem::Buffer, FrameExecuteJavaScriptResponder)> {
6418        if let FrameRequest::ExecuteJavaScript { origins, script, responder } = self {
6419            Some((origins, script, responder))
6420        } else {
6421            None
6422        }
6423    }
6424
6425    #[allow(irrefutable_let_patterns)]
6426    pub fn into_execute_java_script_no_result(
6427        self,
6428    ) -> Option<(Vec<String>, fidl_fuchsia_mem::Buffer, FrameExecuteJavaScriptNoResultResponder)>
6429    {
6430        if let FrameRequest::ExecuteJavaScriptNoResult { origins, script, responder } = self {
6431            Some((origins, script, responder))
6432        } else {
6433            None
6434        }
6435    }
6436
6437    #[allow(irrefutable_let_patterns)]
6438    pub fn into_add_before_load_java_script(
6439        self,
6440    ) -> Option<(u64, Vec<String>, fidl_fuchsia_mem::Buffer, FrameAddBeforeLoadJavaScriptResponder)>
6441    {
6442        if let FrameRequest::AddBeforeLoadJavaScript { id, origins, script, responder } = self {
6443            Some((id, origins, script, responder))
6444        } else {
6445            None
6446        }
6447    }
6448
6449    #[allow(irrefutable_let_patterns)]
6450    pub fn into_remove_before_load_java_script(self) -> Option<(u64, FrameControlHandle)> {
6451        if let FrameRequest::RemoveBeforeLoadJavaScript { id, control_handle } = self {
6452            Some((id, control_handle))
6453        } else {
6454            None
6455        }
6456    }
6457
6458    #[allow(irrefutable_let_patterns)]
6459    pub fn into_post_message(self) -> Option<(String, WebMessage, FramePostMessageResponder)> {
6460        if let FrameRequest::PostMessage { target_origin, message, responder } = self {
6461            Some((target_origin, message, responder))
6462        } else {
6463            None
6464        }
6465    }
6466
6467    #[allow(irrefutable_let_patterns)]
6468    pub fn into_set_navigation_event_listener(
6469        self,
6470    ) -> Option<(
6471        Option<fidl::endpoints::ClientEnd<NavigationEventListenerMarker>>,
6472        FrameControlHandle,
6473    )> {
6474        if let FrameRequest::SetNavigationEventListener { listener, control_handle } = self {
6475            Some((listener, control_handle))
6476        } else {
6477            None
6478        }
6479    }
6480
6481    #[allow(irrefutable_let_patterns)]
6482    pub fn into_set_navigation_event_listener2(
6483        self,
6484    ) -> Option<(
6485        Option<fidl::endpoints::ClientEnd<NavigationEventListenerMarker>>,
6486        NavigationEventListenerFlags,
6487        FrameControlHandle,
6488    )> {
6489        if let FrameRequest::SetNavigationEventListener2 { listener, flags, control_handle } = self
6490        {
6491            Some((listener, flags, control_handle))
6492        } else {
6493            None
6494        }
6495    }
6496
6497    #[allow(irrefutable_let_patterns)]
6498    pub fn into_set_java_script_log_level(self) -> Option<(ConsoleLogLevel, FrameControlHandle)> {
6499        if let FrameRequest::SetJavaScriptLogLevel { level, control_handle } = self {
6500            Some((level, control_handle))
6501        } else {
6502            None
6503        }
6504    }
6505
6506    #[allow(irrefutable_let_patterns)]
6507    pub fn into_set_console_log_sink(
6508        self,
6509    ) -> Option<(
6510        Option<fidl::endpoints::ClientEnd<fidl_fuchsia_logger::LogSinkMarker>>,
6511        FrameControlHandle,
6512    )> {
6513        if let FrameRequest::SetConsoleLogSink { sink, control_handle } = self {
6514            Some((sink, control_handle))
6515        } else {
6516            None
6517        }
6518    }
6519
6520    #[allow(irrefutable_let_patterns)]
6521    pub fn into_configure_input_types(
6522        self,
6523    ) -> Option<(InputTypes, AllowInputState, FrameControlHandle)> {
6524        if let FrameRequest::ConfigureInputTypes { types, allow, control_handle } = self {
6525            Some((types, allow, control_handle))
6526        } else {
6527            None
6528        }
6529    }
6530
6531    #[allow(irrefutable_let_patterns)]
6532    pub fn into_set_popup_frame_creation_listener(
6533        self,
6534    ) -> Option<(
6535        Option<fidl::endpoints::ClientEnd<PopupFrameCreationListenerMarker>>,
6536        FrameControlHandle,
6537    )> {
6538        if let FrameRequest::SetPopupFrameCreationListener { listener, control_handle } = self {
6539            Some((listener, control_handle))
6540        } else {
6541            None
6542        }
6543    }
6544
6545    #[allow(irrefutable_let_patterns)]
6546    pub fn into_set_url_request_rewrite_rules(
6547        self,
6548    ) -> Option<(Vec<UrlRequestRewriteRule>, FrameSetUrlRequestRewriteRulesResponder)> {
6549        if let FrameRequest::SetUrlRequestRewriteRules { rules, responder } = self {
6550            Some((rules, responder))
6551        } else {
6552            None
6553        }
6554    }
6555
6556    #[allow(irrefutable_let_patterns)]
6557    pub fn into_set_media_settings(self) -> Option<(FrameMediaSettings, FrameControlHandle)> {
6558        if let FrameRequest::SetMediaSettings { settings, control_handle } = self {
6559            Some((settings, control_handle))
6560        } else {
6561            None
6562        }
6563    }
6564
6565    #[allow(irrefutable_let_patterns)]
6566    pub fn into_force_content_dimensions(
6567        self,
6568    ) -> Option<(Option<Box<fidl_fuchsia_ui_gfx::Vec2>>, FrameControlHandle)> {
6569        if let FrameRequest::ForceContentDimensions { web_dips, control_handle } = self {
6570            Some((web_dips, control_handle))
6571        } else {
6572            None
6573        }
6574    }
6575
6576    #[allow(irrefutable_let_patterns)]
6577    pub fn into_set_permission_state(
6578        self,
6579    ) -> Option<(PermissionDescriptor, String, PermissionState, FrameControlHandle)> {
6580        if let FrameRequest::SetPermissionState { permission, web_origin, state, control_handle } =
6581            self
6582        {
6583            Some((permission, web_origin, state, control_handle))
6584        } else {
6585            None
6586        }
6587    }
6588
6589    #[allow(irrefutable_let_patterns)]
6590    pub fn into_set_block_media_loading(self) -> Option<(bool, FrameControlHandle)> {
6591        if let FrameRequest::SetBlockMediaLoading { blocked, control_handle } = self {
6592            Some((blocked, control_handle))
6593        } else {
6594            None
6595        }
6596    }
6597
6598    #[allow(irrefutable_let_patterns)]
6599    pub fn into_get_private_memory_size(self) -> Option<(FrameGetPrivateMemorySizeResponder)> {
6600        if let FrameRequest::GetPrivateMemorySize { responder } = self {
6601            Some((responder))
6602        } else {
6603            None
6604        }
6605    }
6606
6607    #[allow(irrefutable_let_patterns)]
6608    pub fn into_set_navigation_policy_provider(
6609        self,
6610    ) -> Option<(
6611        NavigationPolicyProviderParams,
6612        fidl::endpoints::ClientEnd<NavigationPolicyProviderMarker>,
6613        FrameControlHandle,
6614    )> {
6615        if let FrameRequest::SetNavigationPolicyProvider { params, provider, control_handle } = self
6616        {
6617            Some((params, provider, control_handle))
6618        } else {
6619            None
6620        }
6621    }
6622
6623    #[allow(irrefutable_let_patterns)]
6624    pub fn into_set_content_area_settings(
6625        self,
6626    ) -> Option<(ContentAreaSettings, FrameControlHandle)> {
6627        if let FrameRequest::SetContentAreaSettings { settings, control_handle } = self {
6628            Some((settings, control_handle))
6629        } else {
6630            None
6631        }
6632    }
6633
6634    #[allow(irrefutable_let_patterns)]
6635    pub fn into_reset_content_area_settings(self) -> Option<(FrameControlHandle)> {
6636        if let FrameRequest::ResetContentAreaSettings { control_handle } = self {
6637            Some((control_handle))
6638        } else {
6639            None
6640        }
6641    }
6642
6643    #[allow(irrefutable_let_patterns)]
6644    pub fn into_close(self) -> Option<(FrameCloseRequest, FrameControlHandle)> {
6645        if let FrameRequest::Close { payload, control_handle } = self {
6646            Some((payload, control_handle))
6647        } else {
6648            None
6649        }
6650    }
6651
6652    /// Name of the method defined in FIDL
6653    pub fn method_name(&self) -> &'static str {
6654        match *self {
6655            FrameRequest::CreateView { .. } => "create_view",
6656            FrameRequest::CreateViewWithViewRef { .. } => "create_view_with_view_ref",
6657            FrameRequest::CreateView2 { .. } => "create_view2",
6658            FrameRequest::EnableHeadlessRendering { .. } => "enable_headless_rendering",
6659            FrameRequest::DisableHeadlessRendering { .. } => "disable_headless_rendering",
6660            FrameRequest::GetMediaPlayer { .. } => "get_media_player",
6661            FrameRequest::GetNavigationController { .. } => "get_navigation_controller",
6662            FrameRequest::ExecuteJavaScript { .. } => "execute_java_script",
6663            FrameRequest::ExecuteJavaScriptNoResult { .. } => "execute_java_script_no_result",
6664            FrameRequest::AddBeforeLoadJavaScript { .. } => "add_before_load_java_script",
6665            FrameRequest::RemoveBeforeLoadJavaScript { .. } => "remove_before_load_java_script",
6666            FrameRequest::PostMessage { .. } => "post_message",
6667            FrameRequest::SetNavigationEventListener { .. } => "set_navigation_event_listener",
6668            FrameRequest::SetNavigationEventListener2 { .. } => "set_navigation_event_listener2",
6669            FrameRequest::SetJavaScriptLogLevel { .. } => "set_java_script_log_level",
6670            FrameRequest::SetConsoleLogSink { .. } => "set_console_log_sink",
6671            FrameRequest::ConfigureInputTypes { .. } => "configure_input_types",
6672            FrameRequest::SetPopupFrameCreationListener { .. } => {
6673                "set_popup_frame_creation_listener"
6674            }
6675            FrameRequest::SetUrlRequestRewriteRules { .. } => "set_url_request_rewrite_rules",
6676            FrameRequest::SetMediaSettings { .. } => "set_media_settings",
6677            FrameRequest::ForceContentDimensions { .. } => "force_content_dimensions",
6678            FrameRequest::SetPermissionState { .. } => "set_permission_state",
6679            FrameRequest::SetBlockMediaLoading { .. } => "set_block_media_loading",
6680            FrameRequest::GetPrivateMemorySize { .. } => "get_private_memory_size",
6681            FrameRequest::SetNavigationPolicyProvider { .. } => "set_navigation_policy_provider",
6682            FrameRequest::SetContentAreaSettings { .. } => "set_content_area_settings",
6683            FrameRequest::ResetContentAreaSettings { .. } => "reset_content_area_settings",
6684            FrameRequest::Close { .. } => "close",
6685        }
6686    }
6687}
6688
6689#[derive(Debug, Clone)]
6690pub struct FrameControlHandle {
6691    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6692}
6693
6694impl fidl::endpoints::ControlHandle for FrameControlHandle {
6695    fn shutdown(&self) {
6696        self.inner.shutdown()
6697    }
6698    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6699        self.inner.shutdown_with_epitaph(status)
6700    }
6701
6702    fn is_closed(&self) -> bool {
6703        self.inner.channel().is_closed()
6704    }
6705    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6706        self.inner.channel().on_closed()
6707    }
6708
6709    #[cfg(target_os = "fuchsia")]
6710    fn signal_peer(
6711        &self,
6712        clear_mask: zx::Signals,
6713        set_mask: zx::Signals,
6714    ) -> Result<(), zx_status::Status> {
6715        use fidl::Peered;
6716        self.inner.channel().signal_peer(clear_mask, set_mask)
6717    }
6718}
6719
6720impl FrameControlHandle {}
6721
6722#[must_use = "FIDL methods require a response to be sent"]
6723#[derive(Debug)]
6724pub struct FrameExecuteJavaScriptResponder {
6725    control_handle: std::mem::ManuallyDrop<FrameControlHandle>,
6726    tx_id: u32,
6727}
6728
6729/// Set the the channel to be shutdown (see [`FrameControlHandle::shutdown`])
6730/// if the responder is dropped without sending a response, so that the client
6731/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6732impl std::ops::Drop for FrameExecuteJavaScriptResponder {
6733    fn drop(&mut self) {
6734        self.control_handle.shutdown();
6735        // Safety: drops once, never accessed again
6736        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6737    }
6738}
6739
6740impl fidl::endpoints::Responder for FrameExecuteJavaScriptResponder {
6741    type ControlHandle = FrameControlHandle;
6742
6743    fn control_handle(&self) -> &FrameControlHandle {
6744        &self.control_handle
6745    }
6746
6747    fn drop_without_shutdown(mut self) {
6748        // Safety: drops once, never accessed again due to mem::forget
6749        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6750        // Prevent Drop from running (which would shut down the channel)
6751        std::mem::forget(self);
6752    }
6753}
6754
6755impl FrameExecuteJavaScriptResponder {
6756    /// Sends a response to the FIDL transaction.
6757    ///
6758    /// Sets the channel to shutdown if an error occurs.
6759    pub fn send(
6760        self,
6761        mut result: Result<fidl_fuchsia_mem::Buffer, FrameError>,
6762    ) -> Result<(), fidl::Error> {
6763        let _result = self.send_raw(result);
6764        if _result.is_err() {
6765            self.control_handle.shutdown();
6766        }
6767        self.drop_without_shutdown();
6768        _result
6769    }
6770
6771    /// Similar to "send" but does not shutdown the channel if an error occurs.
6772    pub fn send_no_shutdown_on_err(
6773        self,
6774        mut result: Result<fidl_fuchsia_mem::Buffer, FrameError>,
6775    ) -> Result<(), fidl::Error> {
6776        let _result = self.send_raw(result);
6777        self.drop_without_shutdown();
6778        _result
6779    }
6780
6781    fn send_raw(
6782        &self,
6783        mut result: Result<fidl_fuchsia_mem::Buffer, FrameError>,
6784    ) -> Result<(), fidl::Error> {
6785        self.control_handle.inner.send::<fidl::encoding::ResultType<
6786            FrameExecuteJavaScriptResponse,
6787            FrameError,
6788        >>(
6789            result.as_mut().map_err(|e| *e).map(|result| (result,)),
6790            self.tx_id,
6791            0x79abdd4907000542,
6792            fidl::encoding::DynamicFlags::empty(),
6793        )
6794    }
6795}
6796
6797#[must_use = "FIDL methods require a response to be sent"]
6798#[derive(Debug)]
6799pub struct FrameExecuteJavaScriptNoResultResponder {
6800    control_handle: std::mem::ManuallyDrop<FrameControlHandle>,
6801    tx_id: u32,
6802}
6803
6804/// Set the the channel to be shutdown (see [`FrameControlHandle::shutdown`])
6805/// if the responder is dropped without sending a response, so that the client
6806/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6807impl std::ops::Drop for FrameExecuteJavaScriptNoResultResponder {
6808    fn drop(&mut self) {
6809        self.control_handle.shutdown();
6810        // Safety: drops once, never accessed again
6811        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6812    }
6813}
6814
6815impl fidl::endpoints::Responder for FrameExecuteJavaScriptNoResultResponder {
6816    type ControlHandle = FrameControlHandle;
6817
6818    fn control_handle(&self) -> &FrameControlHandle {
6819        &self.control_handle
6820    }
6821
6822    fn drop_without_shutdown(mut self) {
6823        // Safety: drops once, never accessed again due to mem::forget
6824        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6825        // Prevent Drop from running (which would shut down the channel)
6826        std::mem::forget(self);
6827    }
6828}
6829
6830impl FrameExecuteJavaScriptNoResultResponder {
6831    /// Sends a response to the FIDL transaction.
6832    ///
6833    /// Sets the channel to shutdown if an error occurs.
6834    pub fn send(self, mut result: Result<(), FrameError>) -> Result<(), fidl::Error> {
6835        let _result = self.send_raw(result);
6836        if _result.is_err() {
6837            self.control_handle.shutdown();
6838        }
6839        self.drop_without_shutdown();
6840        _result
6841    }
6842
6843    /// Similar to "send" but does not shutdown the channel if an error occurs.
6844    pub fn send_no_shutdown_on_err(
6845        self,
6846        mut result: Result<(), FrameError>,
6847    ) -> Result<(), fidl::Error> {
6848        let _result = self.send_raw(result);
6849        self.drop_without_shutdown();
6850        _result
6851    }
6852
6853    fn send_raw(&self, mut result: Result<(), FrameError>) -> Result<(), fidl::Error> {
6854        self.control_handle
6855            .inner
6856            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FrameError>>(
6857                result,
6858                self.tx_id,
6859                0x16b8491520cbcd63,
6860                fidl::encoding::DynamicFlags::empty(),
6861            )
6862    }
6863}
6864
6865#[must_use = "FIDL methods require a response to be sent"]
6866#[derive(Debug)]
6867pub struct FrameAddBeforeLoadJavaScriptResponder {
6868    control_handle: std::mem::ManuallyDrop<FrameControlHandle>,
6869    tx_id: u32,
6870}
6871
6872/// Set the the channel to be shutdown (see [`FrameControlHandle::shutdown`])
6873/// if the responder is dropped without sending a response, so that the client
6874/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6875impl std::ops::Drop for FrameAddBeforeLoadJavaScriptResponder {
6876    fn drop(&mut self) {
6877        self.control_handle.shutdown();
6878        // Safety: drops once, never accessed again
6879        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6880    }
6881}
6882
6883impl fidl::endpoints::Responder for FrameAddBeforeLoadJavaScriptResponder {
6884    type ControlHandle = FrameControlHandle;
6885
6886    fn control_handle(&self) -> &FrameControlHandle {
6887        &self.control_handle
6888    }
6889
6890    fn drop_without_shutdown(mut self) {
6891        // Safety: drops once, never accessed again due to mem::forget
6892        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6893        // Prevent Drop from running (which would shut down the channel)
6894        std::mem::forget(self);
6895    }
6896}
6897
6898impl FrameAddBeforeLoadJavaScriptResponder {
6899    /// Sends a response to the FIDL transaction.
6900    ///
6901    /// Sets the channel to shutdown if an error occurs.
6902    pub fn send(self, mut result: Result<(), FrameError>) -> Result<(), fidl::Error> {
6903        let _result = self.send_raw(result);
6904        if _result.is_err() {
6905            self.control_handle.shutdown();
6906        }
6907        self.drop_without_shutdown();
6908        _result
6909    }
6910
6911    /// Similar to "send" but does not shutdown the channel if an error occurs.
6912    pub fn send_no_shutdown_on_err(
6913        self,
6914        mut result: Result<(), FrameError>,
6915    ) -> Result<(), fidl::Error> {
6916        let _result = self.send_raw(result);
6917        self.drop_without_shutdown();
6918        _result
6919    }
6920
6921    fn send_raw(&self, mut result: Result<(), FrameError>) -> Result<(), fidl::Error> {
6922        self.control_handle
6923            .inner
6924            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FrameError>>(
6925                result,
6926                self.tx_id,
6927                0x540ac0da59d823e,
6928                fidl::encoding::DynamicFlags::empty(),
6929            )
6930    }
6931}
6932
6933#[must_use = "FIDL methods require a response to be sent"]
6934#[derive(Debug)]
6935pub struct FramePostMessageResponder {
6936    control_handle: std::mem::ManuallyDrop<FrameControlHandle>,
6937    tx_id: u32,
6938}
6939
6940/// Set the the channel to be shutdown (see [`FrameControlHandle::shutdown`])
6941/// if the responder is dropped without sending a response, so that the client
6942/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6943impl std::ops::Drop for FramePostMessageResponder {
6944    fn drop(&mut self) {
6945        self.control_handle.shutdown();
6946        // Safety: drops once, never accessed again
6947        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6948    }
6949}
6950
6951impl fidl::endpoints::Responder for FramePostMessageResponder {
6952    type ControlHandle = FrameControlHandle;
6953
6954    fn control_handle(&self) -> &FrameControlHandle {
6955        &self.control_handle
6956    }
6957
6958    fn drop_without_shutdown(mut self) {
6959        // Safety: drops once, never accessed again due to mem::forget
6960        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6961        // Prevent Drop from running (which would shut down the channel)
6962        std::mem::forget(self);
6963    }
6964}
6965
6966impl FramePostMessageResponder {
6967    /// Sends a response to the FIDL transaction.
6968    ///
6969    /// Sets the channel to shutdown if an error occurs.
6970    pub fn send(self, mut result: Result<(), FrameError>) -> Result<(), fidl::Error> {
6971        let _result = self.send_raw(result);
6972        if _result.is_err() {
6973            self.control_handle.shutdown();
6974        }
6975        self.drop_without_shutdown();
6976        _result
6977    }
6978
6979    /// Similar to "send" but does not shutdown the channel if an error occurs.
6980    pub fn send_no_shutdown_on_err(
6981        self,
6982        mut result: Result<(), FrameError>,
6983    ) -> Result<(), fidl::Error> {
6984        let _result = self.send_raw(result);
6985        self.drop_without_shutdown();
6986        _result
6987    }
6988
6989    fn send_raw(&self, mut result: Result<(), FrameError>) -> Result<(), fidl::Error> {
6990        self.control_handle
6991            .inner
6992            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FrameError>>(
6993                result,
6994                self.tx_id,
6995                0x751d686eb7caa341,
6996                fidl::encoding::DynamicFlags::empty(),
6997            )
6998    }
6999}
7000
7001#[must_use = "FIDL methods require a response to be sent"]
7002#[derive(Debug)]
7003pub struct FrameSetUrlRequestRewriteRulesResponder {
7004    control_handle: std::mem::ManuallyDrop<FrameControlHandle>,
7005    tx_id: u32,
7006}
7007
7008/// Set the the channel to be shutdown (see [`FrameControlHandle::shutdown`])
7009/// if the responder is dropped without sending a response, so that the client
7010/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7011impl std::ops::Drop for FrameSetUrlRequestRewriteRulesResponder {
7012    fn drop(&mut self) {
7013        self.control_handle.shutdown();
7014        // Safety: drops once, never accessed again
7015        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7016    }
7017}
7018
7019impl fidl::endpoints::Responder for FrameSetUrlRequestRewriteRulesResponder {
7020    type ControlHandle = FrameControlHandle;
7021
7022    fn control_handle(&self) -> &FrameControlHandle {
7023        &self.control_handle
7024    }
7025
7026    fn drop_without_shutdown(mut self) {
7027        // Safety: drops once, never accessed again due to mem::forget
7028        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7029        // Prevent Drop from running (which would shut down the channel)
7030        std::mem::forget(self);
7031    }
7032}
7033
7034impl FrameSetUrlRequestRewriteRulesResponder {
7035    /// Sends a response to the FIDL transaction.
7036    ///
7037    /// Sets the channel to shutdown if an error occurs.
7038    pub fn send(self) -> Result<(), fidl::Error> {
7039        let _result = self.send_raw();
7040        if _result.is_err() {
7041            self.control_handle.shutdown();
7042        }
7043        self.drop_without_shutdown();
7044        _result
7045    }
7046
7047    /// Similar to "send" but does not shutdown the channel if an error occurs.
7048    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
7049        let _result = self.send_raw();
7050        self.drop_without_shutdown();
7051        _result
7052    }
7053
7054    fn send_raw(&self) -> Result<(), fidl::Error> {
7055        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
7056            (),
7057            self.tx_id,
7058            0x2e3f797350ab3281,
7059            fidl::encoding::DynamicFlags::empty(),
7060        )
7061    }
7062}
7063
7064#[must_use = "FIDL methods require a response to be sent"]
7065#[derive(Debug)]
7066pub struct FrameGetPrivateMemorySizeResponder {
7067    control_handle: std::mem::ManuallyDrop<FrameControlHandle>,
7068    tx_id: u32,
7069}
7070
7071/// Set the the channel to be shutdown (see [`FrameControlHandle::shutdown`])
7072/// if the responder is dropped without sending a response, so that the client
7073/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7074impl std::ops::Drop for FrameGetPrivateMemorySizeResponder {
7075    fn drop(&mut self) {
7076        self.control_handle.shutdown();
7077        // Safety: drops once, never accessed again
7078        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7079    }
7080}
7081
7082impl fidl::endpoints::Responder for FrameGetPrivateMemorySizeResponder {
7083    type ControlHandle = FrameControlHandle;
7084
7085    fn control_handle(&self) -> &FrameControlHandle {
7086        &self.control_handle
7087    }
7088
7089    fn drop_without_shutdown(mut self) {
7090        // Safety: drops once, never accessed again due to mem::forget
7091        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7092        // Prevent Drop from running (which would shut down the channel)
7093        std::mem::forget(self);
7094    }
7095}
7096
7097impl FrameGetPrivateMemorySizeResponder {
7098    /// Sends a response to the FIDL transaction.
7099    ///
7100    /// Sets the channel to shutdown if an error occurs.
7101    pub fn send(self, mut size_bytes: u64) -> Result<(), fidl::Error> {
7102        let _result = self.send_raw(size_bytes);
7103        if _result.is_err() {
7104            self.control_handle.shutdown();
7105        }
7106        self.drop_without_shutdown();
7107        _result
7108    }
7109
7110    /// Similar to "send" but does not shutdown the channel if an error occurs.
7111    pub fn send_no_shutdown_on_err(self, mut size_bytes: u64) -> Result<(), fidl::Error> {
7112        let _result = self.send_raw(size_bytes);
7113        self.drop_without_shutdown();
7114        _result
7115    }
7116
7117    fn send_raw(&self, mut size_bytes: u64) -> Result<(), fidl::Error> {
7118        self.control_handle.inner.send::<FrameGetPrivateMemorySizeResponse>(
7119            (size_bytes,),
7120            self.tx_id,
7121            0x6ad4d43da6c129b0,
7122            fidl::encoding::DynamicFlags::empty(),
7123        )
7124    }
7125}
7126
7127#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7128pub struct FrameHostMarker;
7129
7130impl fidl::endpoints::ProtocolMarker for FrameHostMarker {
7131    type Proxy = FrameHostProxy;
7132    type RequestStream = FrameHostRequestStream;
7133    #[cfg(target_os = "fuchsia")]
7134    type SynchronousProxy = FrameHostSynchronousProxy;
7135
7136    const DEBUG_NAME: &'static str = "fuchsia.web.FrameHost";
7137}
7138impl fidl::endpoints::DiscoverableProtocolMarker for FrameHostMarker {}
7139
7140pub trait FrameHostProxyInterface: Send + Sync {
7141    fn r#create_frame_with_params(
7142        &self,
7143        params: CreateFrameParams,
7144        frame: fidl::endpoints::ServerEnd<FrameMarker>,
7145    ) -> Result<(), fidl::Error>;
7146}
7147#[derive(Debug)]
7148#[cfg(target_os = "fuchsia")]
7149pub struct FrameHostSynchronousProxy {
7150    client: fidl::client::sync::Client,
7151}
7152
7153#[cfg(target_os = "fuchsia")]
7154impl fidl::endpoints::SynchronousProxy for FrameHostSynchronousProxy {
7155    type Proxy = FrameHostProxy;
7156    type Protocol = FrameHostMarker;
7157
7158    fn from_channel(inner: fidl::Channel) -> Self {
7159        Self::new(inner)
7160    }
7161
7162    fn into_channel(self) -> fidl::Channel {
7163        self.client.into_channel()
7164    }
7165
7166    fn as_channel(&self) -> &fidl::Channel {
7167        self.client.as_channel()
7168    }
7169}
7170
7171#[cfg(target_os = "fuchsia")]
7172impl FrameHostSynchronousProxy {
7173    pub fn new(channel: fidl::Channel) -> Self {
7174        let protocol_name = <FrameHostMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7175        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
7176    }
7177
7178    pub fn into_channel(self) -> fidl::Channel {
7179        self.client.into_channel()
7180    }
7181
7182    /// Waits until an event arrives and returns it. It is safe for other
7183    /// threads to make concurrent requests while waiting for an event.
7184    pub fn wait_for_event(
7185        &self,
7186        deadline: zx::MonotonicInstant,
7187    ) -> Result<FrameHostEvent, fidl::Error> {
7188        FrameHostEvent::decode(self.client.wait_for_event(deadline)?)
7189    }
7190
7191    /// Behaves identically to [`Context.CreateFrameWithParams`].
7192    pub fn r#create_frame_with_params(
7193        &self,
7194        mut params: CreateFrameParams,
7195        mut frame: fidl::endpoints::ServerEnd<FrameMarker>,
7196    ) -> Result<(), fidl::Error> {
7197        self.client.send::<FrameHostCreateFrameWithParamsRequest>(
7198            (&mut params, frame),
7199            0x670186c3a1b3f28,
7200            fidl::encoding::DynamicFlags::empty(),
7201        )
7202    }
7203}
7204
7205#[cfg(target_os = "fuchsia")]
7206impl From<FrameHostSynchronousProxy> for zx::Handle {
7207    fn from(value: FrameHostSynchronousProxy) -> Self {
7208        value.into_channel().into()
7209    }
7210}
7211
7212#[cfg(target_os = "fuchsia")]
7213impl From<fidl::Channel> for FrameHostSynchronousProxy {
7214    fn from(value: fidl::Channel) -> Self {
7215        Self::new(value)
7216    }
7217}
7218
7219#[cfg(target_os = "fuchsia")]
7220impl fidl::endpoints::FromClient for FrameHostSynchronousProxy {
7221    type Protocol = FrameHostMarker;
7222
7223    fn from_client(value: fidl::endpoints::ClientEnd<FrameHostMarker>) -> Self {
7224        Self::new(value.into_channel())
7225    }
7226}
7227
7228#[derive(Debug, Clone)]
7229pub struct FrameHostProxy {
7230    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7231}
7232
7233impl fidl::endpoints::Proxy for FrameHostProxy {
7234    type Protocol = FrameHostMarker;
7235
7236    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7237        Self::new(inner)
7238    }
7239
7240    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7241        self.client.into_channel().map_err(|client| Self { client })
7242    }
7243
7244    fn as_channel(&self) -> &::fidl::AsyncChannel {
7245        self.client.as_channel()
7246    }
7247}
7248
7249impl FrameHostProxy {
7250    /// Create a new Proxy for fuchsia.web/FrameHost.
7251    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7252        let protocol_name = <FrameHostMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7253        Self { client: fidl::client::Client::new(channel, protocol_name) }
7254    }
7255
7256    /// Get a Stream of events from the remote end of the protocol.
7257    ///
7258    /// # Panics
7259    ///
7260    /// Panics if the event stream was already taken.
7261    pub fn take_event_stream(&self) -> FrameHostEventStream {
7262        FrameHostEventStream { event_receiver: self.client.take_event_receiver() }
7263    }
7264
7265    /// Behaves identically to [`Context.CreateFrameWithParams`].
7266    pub fn r#create_frame_with_params(
7267        &self,
7268        mut params: CreateFrameParams,
7269        mut frame: fidl::endpoints::ServerEnd<FrameMarker>,
7270    ) -> Result<(), fidl::Error> {
7271        FrameHostProxyInterface::r#create_frame_with_params(self, params, frame)
7272    }
7273}
7274
7275impl FrameHostProxyInterface for FrameHostProxy {
7276    fn r#create_frame_with_params(
7277        &self,
7278        mut params: CreateFrameParams,
7279        mut frame: fidl::endpoints::ServerEnd<FrameMarker>,
7280    ) -> Result<(), fidl::Error> {
7281        self.client.send::<FrameHostCreateFrameWithParamsRequest>(
7282            (&mut params, frame),
7283            0x670186c3a1b3f28,
7284            fidl::encoding::DynamicFlags::empty(),
7285        )
7286    }
7287}
7288
7289pub struct FrameHostEventStream {
7290    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7291}
7292
7293impl std::marker::Unpin for FrameHostEventStream {}
7294
7295impl futures::stream::FusedStream for FrameHostEventStream {
7296    fn is_terminated(&self) -> bool {
7297        self.event_receiver.is_terminated()
7298    }
7299}
7300
7301impl futures::Stream for FrameHostEventStream {
7302    type Item = Result<FrameHostEvent, fidl::Error>;
7303
7304    fn poll_next(
7305        mut self: std::pin::Pin<&mut Self>,
7306        cx: &mut std::task::Context<'_>,
7307    ) -> std::task::Poll<Option<Self::Item>> {
7308        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7309            &mut self.event_receiver,
7310            cx
7311        )?) {
7312            Some(buf) => std::task::Poll::Ready(Some(FrameHostEvent::decode(buf))),
7313            None => std::task::Poll::Ready(None),
7314        }
7315    }
7316}
7317
7318#[derive(Debug)]
7319pub enum FrameHostEvent {}
7320
7321impl FrameHostEvent {
7322    /// Decodes a message buffer as a [`FrameHostEvent`].
7323    fn decode(
7324        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7325    ) -> Result<FrameHostEvent, fidl::Error> {
7326        let (bytes, _handles) = buf.split_mut();
7327        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7328        debug_assert_eq!(tx_header.tx_id, 0);
7329        match tx_header.ordinal {
7330            _ => Err(fidl::Error::UnknownOrdinal {
7331                ordinal: tx_header.ordinal,
7332                protocol_name: <FrameHostMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7333            }),
7334        }
7335    }
7336}
7337
7338/// A Stream of incoming requests for fuchsia.web/FrameHost.
7339pub struct FrameHostRequestStream {
7340    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7341    is_terminated: bool,
7342}
7343
7344impl std::marker::Unpin for FrameHostRequestStream {}
7345
7346impl futures::stream::FusedStream for FrameHostRequestStream {
7347    fn is_terminated(&self) -> bool {
7348        self.is_terminated
7349    }
7350}
7351
7352impl fidl::endpoints::RequestStream for FrameHostRequestStream {
7353    type Protocol = FrameHostMarker;
7354    type ControlHandle = FrameHostControlHandle;
7355
7356    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7357        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7358    }
7359
7360    fn control_handle(&self) -> Self::ControlHandle {
7361        FrameHostControlHandle { inner: self.inner.clone() }
7362    }
7363
7364    fn into_inner(
7365        self,
7366    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7367    {
7368        (self.inner, self.is_terminated)
7369    }
7370
7371    fn from_inner(
7372        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7373        is_terminated: bool,
7374    ) -> Self {
7375        Self { inner, is_terminated }
7376    }
7377}
7378
7379impl futures::Stream for FrameHostRequestStream {
7380    type Item = Result<FrameHostRequest, fidl::Error>;
7381
7382    fn poll_next(
7383        mut self: std::pin::Pin<&mut Self>,
7384        cx: &mut std::task::Context<'_>,
7385    ) -> std::task::Poll<Option<Self::Item>> {
7386        let this = &mut *self;
7387        if this.inner.check_shutdown(cx) {
7388            this.is_terminated = true;
7389            return std::task::Poll::Ready(None);
7390        }
7391        if this.is_terminated {
7392            panic!("polled FrameHostRequestStream after completion");
7393        }
7394        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7395            |bytes, handles| {
7396                match this.inner.channel().read_etc(cx, bytes, handles) {
7397                    std::task::Poll::Ready(Ok(())) => {}
7398                    std::task::Poll::Pending => return std::task::Poll::Pending,
7399                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7400                        this.is_terminated = true;
7401                        return std::task::Poll::Ready(None);
7402                    }
7403                    std::task::Poll::Ready(Err(e)) => {
7404                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7405                            e.into(),
7406                        ))));
7407                    }
7408                }
7409
7410                // A message has been received from the channel
7411                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7412
7413                std::task::Poll::Ready(Some(match header.ordinal {
7414                    0x670186c3a1b3f28 => {
7415                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
7416                        let mut req = fidl::new_empty!(
7417                            FrameHostCreateFrameWithParamsRequest,
7418                            fidl::encoding::DefaultFuchsiaResourceDialect
7419                        );
7420                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameHostCreateFrameWithParamsRequest>(&header, _body_bytes, handles, &mut req)?;
7421                        let control_handle = FrameHostControlHandle { inner: this.inner.clone() };
7422                        Ok(FrameHostRequest::CreateFrameWithParams {
7423                            params: req.params,
7424                            frame: req.frame,
7425
7426                            control_handle,
7427                        })
7428                    }
7429                    _ => Err(fidl::Error::UnknownOrdinal {
7430                        ordinal: header.ordinal,
7431                        protocol_name:
7432                            <FrameHostMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7433                    }),
7434                }))
7435            },
7436        )
7437    }
7438}
7439
7440/// Used by [`Context`] clients to delegate [`Frame`] hosting capabilities to selected peers.
7441#[derive(Debug)]
7442pub enum FrameHostRequest {
7443    /// Behaves identically to [`Context.CreateFrameWithParams`].
7444    CreateFrameWithParams {
7445        params: CreateFrameParams,
7446        frame: fidl::endpoints::ServerEnd<FrameMarker>,
7447        control_handle: FrameHostControlHandle,
7448    },
7449}
7450
7451impl FrameHostRequest {
7452    #[allow(irrefutable_let_patterns)]
7453    pub fn into_create_frame_with_params(
7454        self,
7455    ) -> Option<(CreateFrameParams, fidl::endpoints::ServerEnd<FrameMarker>, FrameHostControlHandle)>
7456    {
7457        if let FrameHostRequest::CreateFrameWithParams { params, frame, control_handle } = self {
7458            Some((params, frame, control_handle))
7459        } else {
7460            None
7461        }
7462    }
7463
7464    /// Name of the method defined in FIDL
7465    pub fn method_name(&self) -> &'static str {
7466        match *self {
7467            FrameHostRequest::CreateFrameWithParams { .. } => "create_frame_with_params",
7468        }
7469    }
7470}
7471
7472#[derive(Debug, Clone)]
7473pub struct FrameHostControlHandle {
7474    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7475}
7476
7477impl fidl::endpoints::ControlHandle for FrameHostControlHandle {
7478    fn shutdown(&self) {
7479        self.inner.shutdown()
7480    }
7481    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7482        self.inner.shutdown_with_epitaph(status)
7483    }
7484
7485    fn is_closed(&self) -> bool {
7486        self.inner.channel().is_closed()
7487    }
7488    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7489        self.inner.channel().on_closed()
7490    }
7491
7492    #[cfg(target_os = "fuchsia")]
7493    fn signal_peer(
7494        &self,
7495        clear_mask: zx::Signals,
7496        set_mask: zx::Signals,
7497    ) -> Result<(), zx_status::Status> {
7498        use fidl::Peered;
7499        self.inner.channel().signal_peer(clear_mask, set_mask)
7500    }
7501}
7502
7503impl FrameHostControlHandle {}
7504
7505#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7506pub struct MessagePortMarker;
7507
7508impl fidl::endpoints::ProtocolMarker for MessagePortMarker {
7509    type Proxy = MessagePortProxy;
7510    type RequestStream = MessagePortRequestStream;
7511    #[cfg(target_os = "fuchsia")]
7512    type SynchronousProxy = MessagePortSynchronousProxy;
7513
7514    const DEBUG_NAME: &'static str = "(anonymous) MessagePort";
7515}
7516pub type MessagePortPostMessageResult = Result<(), FrameError>;
7517
7518pub trait MessagePortProxyInterface: Send + Sync {
7519    type PostMessageResponseFut: std::future::Future<Output = Result<MessagePortPostMessageResult, fidl::Error>>
7520        + Send;
7521    fn r#post_message(&self, message: WebMessage) -> Self::PostMessageResponseFut;
7522    type ReceiveMessageResponseFut: std::future::Future<Output = Result<WebMessage, fidl::Error>>
7523        + Send;
7524    fn r#receive_message(&self) -> Self::ReceiveMessageResponseFut;
7525}
7526#[derive(Debug)]
7527#[cfg(target_os = "fuchsia")]
7528pub struct MessagePortSynchronousProxy {
7529    client: fidl::client::sync::Client,
7530}
7531
7532#[cfg(target_os = "fuchsia")]
7533impl fidl::endpoints::SynchronousProxy for MessagePortSynchronousProxy {
7534    type Proxy = MessagePortProxy;
7535    type Protocol = MessagePortMarker;
7536
7537    fn from_channel(inner: fidl::Channel) -> Self {
7538        Self::new(inner)
7539    }
7540
7541    fn into_channel(self) -> fidl::Channel {
7542        self.client.into_channel()
7543    }
7544
7545    fn as_channel(&self) -> &fidl::Channel {
7546        self.client.as_channel()
7547    }
7548}
7549
7550#[cfg(target_os = "fuchsia")]
7551impl MessagePortSynchronousProxy {
7552    pub fn new(channel: fidl::Channel) -> Self {
7553        let protocol_name = <MessagePortMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7554        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
7555    }
7556
7557    pub fn into_channel(self) -> fidl::Channel {
7558        self.client.into_channel()
7559    }
7560
7561    /// Waits until an event arrives and returns it. It is safe for other
7562    /// threads to make concurrent requests while waiting for an event.
7563    pub fn wait_for_event(
7564        &self,
7565        deadline: zx::MonotonicInstant,
7566    ) -> Result<MessagePortEvent, fidl::Error> {
7567        MessagePortEvent::decode(self.client.wait_for_event(deadline)?)
7568    }
7569
7570    /// Sends a [`WebMessage`] to the peer. These are processed in order, one at a
7571    /// time. It is not necessary for the caller to wait for the completion callback before calling
7572    /// [`MessagePort.PostMessage`] again.
7573    ///
7574    /// If an error occurred, the [`FrameError`] will be set to one of these value:
7575    /// - `BUFFER_NOT_UTF8`: The script in `message`'s `data` property is not UTF-8 encoded.
7576    /// - `NO_DATA_IN_MESSAGE`: The `data` property is missing in `message`.
7577    pub fn r#post_message(
7578        &self,
7579        mut message: WebMessage,
7580        ___deadline: zx::MonotonicInstant,
7581    ) -> Result<MessagePortPostMessageResult, fidl::Error> {
7582        let _response = self.client.send_query::<
7583            MessagePortPostMessageRequest,
7584            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FrameError>,
7585        >(
7586            (&mut message,),
7587            0x2bcf0a6ed30ffd1f,
7588            fidl::encoding::DynamicFlags::empty(),
7589            ___deadline,
7590        )?;
7591        Ok(_response.map(|x| x))
7592    }
7593
7594    /// Asynchronously reads the next message from the channel. The client should invoke the
7595    /// callback when it is ready to process another message. Unreceived messages are buffered
7596    /// on the sender's side and bounded by its available resources.
7597    pub fn r#receive_message(
7598        &self,
7599        ___deadline: zx::MonotonicInstant,
7600    ) -> Result<WebMessage, fidl::Error> {
7601        let _response = self
7602            .client
7603            .send_query::<fidl::encoding::EmptyPayload, MessagePortReceiveMessageResponse>(
7604                (),
7605                0x6c8a6051690be58d,
7606                fidl::encoding::DynamicFlags::empty(),
7607                ___deadline,
7608            )?;
7609        Ok(_response.message)
7610    }
7611}
7612
7613#[cfg(target_os = "fuchsia")]
7614impl From<MessagePortSynchronousProxy> for zx::Handle {
7615    fn from(value: MessagePortSynchronousProxy) -> Self {
7616        value.into_channel().into()
7617    }
7618}
7619
7620#[cfg(target_os = "fuchsia")]
7621impl From<fidl::Channel> for MessagePortSynchronousProxy {
7622    fn from(value: fidl::Channel) -> Self {
7623        Self::new(value)
7624    }
7625}
7626
7627#[cfg(target_os = "fuchsia")]
7628impl fidl::endpoints::FromClient for MessagePortSynchronousProxy {
7629    type Protocol = MessagePortMarker;
7630
7631    fn from_client(value: fidl::endpoints::ClientEnd<MessagePortMarker>) -> Self {
7632        Self::new(value.into_channel())
7633    }
7634}
7635
7636#[derive(Debug, Clone)]
7637pub struct MessagePortProxy {
7638    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7639}
7640
7641impl fidl::endpoints::Proxy for MessagePortProxy {
7642    type Protocol = MessagePortMarker;
7643
7644    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7645        Self::new(inner)
7646    }
7647
7648    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7649        self.client.into_channel().map_err(|client| Self { client })
7650    }
7651
7652    fn as_channel(&self) -> &::fidl::AsyncChannel {
7653        self.client.as_channel()
7654    }
7655}
7656
7657impl MessagePortProxy {
7658    /// Create a new Proxy for fuchsia.web/MessagePort.
7659    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7660        let protocol_name = <MessagePortMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7661        Self { client: fidl::client::Client::new(channel, protocol_name) }
7662    }
7663
7664    /// Get a Stream of events from the remote end of the protocol.
7665    ///
7666    /// # Panics
7667    ///
7668    /// Panics if the event stream was already taken.
7669    pub fn take_event_stream(&self) -> MessagePortEventStream {
7670        MessagePortEventStream { event_receiver: self.client.take_event_receiver() }
7671    }
7672
7673    /// Sends a [`WebMessage`] to the peer. These are processed in order, one at a
7674    /// time. It is not necessary for the caller to wait for the completion callback before calling
7675    /// [`MessagePort.PostMessage`] again.
7676    ///
7677    /// If an error occurred, the [`FrameError`] will be set to one of these value:
7678    /// - `BUFFER_NOT_UTF8`: The script in `message`'s `data` property is not UTF-8 encoded.
7679    /// - `NO_DATA_IN_MESSAGE`: The `data` property is missing in `message`.
7680    pub fn r#post_message(
7681        &self,
7682        mut message: WebMessage,
7683    ) -> fidl::client::QueryResponseFut<
7684        MessagePortPostMessageResult,
7685        fidl::encoding::DefaultFuchsiaResourceDialect,
7686    > {
7687        MessagePortProxyInterface::r#post_message(self, message)
7688    }
7689
7690    /// Asynchronously reads the next message from the channel. The client should invoke the
7691    /// callback when it is ready to process another message. Unreceived messages are buffered
7692    /// on the sender's side and bounded by its available resources.
7693    pub fn r#receive_message(
7694        &self,
7695    ) -> fidl::client::QueryResponseFut<WebMessage, fidl::encoding::DefaultFuchsiaResourceDialect>
7696    {
7697        MessagePortProxyInterface::r#receive_message(self)
7698    }
7699}
7700
7701impl MessagePortProxyInterface for MessagePortProxy {
7702    type PostMessageResponseFut = fidl::client::QueryResponseFut<
7703        MessagePortPostMessageResult,
7704        fidl::encoding::DefaultFuchsiaResourceDialect,
7705    >;
7706    fn r#post_message(&self, mut message: WebMessage) -> Self::PostMessageResponseFut {
7707        fn _decode(
7708            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7709        ) -> Result<MessagePortPostMessageResult, fidl::Error> {
7710            let _response = fidl::client::decode_transaction_body::<
7711                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FrameError>,
7712                fidl::encoding::DefaultFuchsiaResourceDialect,
7713                0x2bcf0a6ed30ffd1f,
7714            >(_buf?)?;
7715            Ok(_response.map(|x| x))
7716        }
7717        self.client
7718            .send_query_and_decode::<MessagePortPostMessageRequest, MessagePortPostMessageResult>(
7719                (&mut message,),
7720                0x2bcf0a6ed30ffd1f,
7721                fidl::encoding::DynamicFlags::empty(),
7722                _decode,
7723            )
7724    }
7725
7726    type ReceiveMessageResponseFut =
7727        fidl::client::QueryResponseFut<WebMessage, fidl::encoding::DefaultFuchsiaResourceDialect>;
7728    fn r#receive_message(&self) -> Self::ReceiveMessageResponseFut {
7729        fn _decode(
7730            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7731        ) -> Result<WebMessage, fidl::Error> {
7732            let _response = fidl::client::decode_transaction_body::<
7733                MessagePortReceiveMessageResponse,
7734                fidl::encoding::DefaultFuchsiaResourceDialect,
7735                0x6c8a6051690be58d,
7736            >(_buf?)?;
7737            Ok(_response.message)
7738        }
7739        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, WebMessage>(
7740            (),
7741            0x6c8a6051690be58d,
7742            fidl::encoding::DynamicFlags::empty(),
7743            _decode,
7744        )
7745    }
7746}
7747
7748pub struct MessagePortEventStream {
7749    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7750}
7751
7752impl std::marker::Unpin for MessagePortEventStream {}
7753
7754impl futures::stream::FusedStream for MessagePortEventStream {
7755    fn is_terminated(&self) -> bool {
7756        self.event_receiver.is_terminated()
7757    }
7758}
7759
7760impl futures::Stream for MessagePortEventStream {
7761    type Item = Result<MessagePortEvent, fidl::Error>;
7762
7763    fn poll_next(
7764        mut self: std::pin::Pin<&mut Self>,
7765        cx: &mut std::task::Context<'_>,
7766    ) -> std::task::Poll<Option<Self::Item>> {
7767        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7768            &mut self.event_receiver,
7769            cx
7770        )?) {
7771            Some(buf) => std::task::Poll::Ready(Some(MessagePortEvent::decode(buf))),
7772            None => std::task::Poll::Ready(None),
7773        }
7774    }
7775}
7776
7777#[derive(Debug)]
7778pub enum MessagePortEvent {}
7779
7780impl MessagePortEvent {
7781    /// Decodes a message buffer as a [`MessagePortEvent`].
7782    fn decode(
7783        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7784    ) -> Result<MessagePortEvent, fidl::Error> {
7785        let (bytes, _handles) = buf.split_mut();
7786        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7787        debug_assert_eq!(tx_header.tx_id, 0);
7788        match tx_header.ordinal {
7789            _ => Err(fidl::Error::UnknownOrdinal {
7790                ordinal: tx_header.ordinal,
7791                protocol_name: <MessagePortMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7792            }),
7793        }
7794    }
7795}
7796
7797/// A Stream of incoming requests for fuchsia.web/MessagePort.
7798pub struct MessagePortRequestStream {
7799    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7800    is_terminated: bool,
7801}
7802
7803impl std::marker::Unpin for MessagePortRequestStream {}
7804
7805impl futures::stream::FusedStream for MessagePortRequestStream {
7806    fn is_terminated(&self) -> bool {
7807        self.is_terminated
7808    }
7809}
7810
7811impl fidl::endpoints::RequestStream for MessagePortRequestStream {
7812    type Protocol = MessagePortMarker;
7813    type ControlHandle = MessagePortControlHandle;
7814
7815    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7816        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7817    }
7818
7819    fn control_handle(&self) -> Self::ControlHandle {
7820        MessagePortControlHandle { inner: self.inner.clone() }
7821    }
7822
7823    fn into_inner(
7824        self,
7825    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7826    {
7827        (self.inner, self.is_terminated)
7828    }
7829
7830    fn from_inner(
7831        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7832        is_terminated: bool,
7833    ) -> Self {
7834        Self { inner, is_terminated }
7835    }
7836}
7837
7838impl futures::Stream for MessagePortRequestStream {
7839    type Item = Result<MessagePortRequest, fidl::Error>;
7840
7841    fn poll_next(
7842        mut self: std::pin::Pin<&mut Self>,
7843        cx: &mut std::task::Context<'_>,
7844    ) -> std::task::Poll<Option<Self::Item>> {
7845        let this = &mut *self;
7846        if this.inner.check_shutdown(cx) {
7847            this.is_terminated = true;
7848            return std::task::Poll::Ready(None);
7849        }
7850        if this.is_terminated {
7851            panic!("polled MessagePortRequestStream after completion");
7852        }
7853        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7854            |bytes, handles| {
7855                match this.inner.channel().read_etc(cx, bytes, handles) {
7856                    std::task::Poll::Ready(Ok(())) => {}
7857                    std::task::Poll::Pending => return std::task::Poll::Pending,
7858                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7859                        this.is_terminated = true;
7860                        return std::task::Poll::Ready(None);
7861                    }
7862                    std::task::Poll::Ready(Err(e)) => {
7863                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7864                            e.into(),
7865                        ))));
7866                    }
7867                }
7868
7869                // A message has been received from the channel
7870                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7871
7872                std::task::Poll::Ready(Some(match header.ordinal {
7873                    0x2bcf0a6ed30ffd1f => {
7874                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7875                        let mut req = fidl::new_empty!(
7876                            MessagePortPostMessageRequest,
7877                            fidl::encoding::DefaultFuchsiaResourceDialect
7878                        );
7879                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MessagePortPostMessageRequest>(&header, _body_bytes, handles, &mut req)?;
7880                        let control_handle = MessagePortControlHandle { inner: this.inner.clone() };
7881                        Ok(MessagePortRequest::PostMessage {
7882                            message: req.message,
7883
7884                            responder: MessagePortPostMessageResponder {
7885                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7886                                tx_id: header.tx_id,
7887                            },
7888                        })
7889                    }
7890                    0x6c8a6051690be58d => {
7891                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7892                        let mut req = fidl::new_empty!(
7893                            fidl::encoding::EmptyPayload,
7894                            fidl::encoding::DefaultFuchsiaResourceDialect
7895                        );
7896                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7897                        let control_handle = MessagePortControlHandle { inner: this.inner.clone() };
7898                        Ok(MessagePortRequest::ReceiveMessage {
7899                            responder: MessagePortReceiveMessageResponder {
7900                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7901                                tx_id: header.tx_id,
7902                            },
7903                        })
7904                    }
7905                    _ => Err(fidl::Error::UnknownOrdinal {
7906                        ordinal: header.ordinal,
7907                        protocol_name:
7908                            <MessagePortMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7909                    }),
7910                }))
7911            },
7912        )
7913    }
7914}
7915
7916/// Represents one end of an HTML5 MessageChannel. Can be used to send and exchange Messages with
7917/// the peered MessagePort in the Frame's script context. The port is destroyed when either end of
7918/// the MessagePort channel is torn down.
7919#[derive(Debug)]
7920pub enum MessagePortRequest {
7921    /// Sends a [`WebMessage`] to the peer. These are processed in order, one at a
7922    /// time. It is not necessary for the caller to wait for the completion callback before calling
7923    /// [`MessagePort.PostMessage`] again.
7924    ///
7925    /// If an error occurred, the [`FrameError`] will be set to one of these value:
7926    /// - `BUFFER_NOT_UTF8`: The script in `message`'s `data` property is not UTF-8 encoded.
7927    /// - `NO_DATA_IN_MESSAGE`: The `data` property is missing in `message`.
7928    PostMessage { message: WebMessage, responder: MessagePortPostMessageResponder },
7929    /// Asynchronously reads the next message from the channel. The client should invoke the
7930    /// callback when it is ready to process another message. Unreceived messages are buffered
7931    /// on the sender's side and bounded by its available resources.
7932    ReceiveMessage { responder: MessagePortReceiveMessageResponder },
7933}
7934
7935impl MessagePortRequest {
7936    #[allow(irrefutable_let_patterns)]
7937    pub fn into_post_message(self) -> Option<(WebMessage, MessagePortPostMessageResponder)> {
7938        if let MessagePortRequest::PostMessage { message, responder } = self {
7939            Some((message, responder))
7940        } else {
7941            None
7942        }
7943    }
7944
7945    #[allow(irrefutable_let_patterns)]
7946    pub fn into_receive_message(self) -> Option<(MessagePortReceiveMessageResponder)> {
7947        if let MessagePortRequest::ReceiveMessage { responder } = self {
7948            Some((responder))
7949        } else {
7950            None
7951        }
7952    }
7953
7954    /// Name of the method defined in FIDL
7955    pub fn method_name(&self) -> &'static str {
7956        match *self {
7957            MessagePortRequest::PostMessage { .. } => "post_message",
7958            MessagePortRequest::ReceiveMessage { .. } => "receive_message",
7959        }
7960    }
7961}
7962
7963#[derive(Debug, Clone)]
7964pub struct MessagePortControlHandle {
7965    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7966}
7967
7968impl fidl::endpoints::ControlHandle for MessagePortControlHandle {
7969    fn shutdown(&self) {
7970        self.inner.shutdown()
7971    }
7972    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7973        self.inner.shutdown_with_epitaph(status)
7974    }
7975
7976    fn is_closed(&self) -> bool {
7977        self.inner.channel().is_closed()
7978    }
7979    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7980        self.inner.channel().on_closed()
7981    }
7982
7983    #[cfg(target_os = "fuchsia")]
7984    fn signal_peer(
7985        &self,
7986        clear_mask: zx::Signals,
7987        set_mask: zx::Signals,
7988    ) -> Result<(), zx_status::Status> {
7989        use fidl::Peered;
7990        self.inner.channel().signal_peer(clear_mask, set_mask)
7991    }
7992}
7993
7994impl MessagePortControlHandle {}
7995
7996#[must_use = "FIDL methods require a response to be sent"]
7997#[derive(Debug)]
7998pub struct MessagePortPostMessageResponder {
7999    control_handle: std::mem::ManuallyDrop<MessagePortControlHandle>,
8000    tx_id: u32,
8001}
8002
8003/// Set the the channel to be shutdown (see [`MessagePortControlHandle::shutdown`])
8004/// if the responder is dropped without sending a response, so that the client
8005/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8006impl std::ops::Drop for MessagePortPostMessageResponder {
8007    fn drop(&mut self) {
8008        self.control_handle.shutdown();
8009        // Safety: drops once, never accessed again
8010        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8011    }
8012}
8013
8014impl fidl::endpoints::Responder for MessagePortPostMessageResponder {
8015    type ControlHandle = MessagePortControlHandle;
8016
8017    fn control_handle(&self) -> &MessagePortControlHandle {
8018        &self.control_handle
8019    }
8020
8021    fn drop_without_shutdown(mut self) {
8022        // Safety: drops once, never accessed again due to mem::forget
8023        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8024        // Prevent Drop from running (which would shut down the channel)
8025        std::mem::forget(self);
8026    }
8027}
8028
8029impl MessagePortPostMessageResponder {
8030    /// Sends a response to the FIDL transaction.
8031    ///
8032    /// Sets the channel to shutdown if an error occurs.
8033    pub fn send(self, mut result: Result<(), FrameError>) -> Result<(), fidl::Error> {
8034        let _result = self.send_raw(result);
8035        if _result.is_err() {
8036            self.control_handle.shutdown();
8037        }
8038        self.drop_without_shutdown();
8039        _result
8040    }
8041
8042    /// Similar to "send" but does not shutdown the channel if an error occurs.
8043    pub fn send_no_shutdown_on_err(
8044        self,
8045        mut result: Result<(), FrameError>,
8046    ) -> Result<(), fidl::Error> {
8047        let _result = self.send_raw(result);
8048        self.drop_without_shutdown();
8049        _result
8050    }
8051
8052    fn send_raw(&self, mut result: Result<(), FrameError>) -> Result<(), fidl::Error> {
8053        self.control_handle
8054            .inner
8055            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FrameError>>(
8056                result,
8057                self.tx_id,
8058                0x2bcf0a6ed30ffd1f,
8059                fidl::encoding::DynamicFlags::empty(),
8060            )
8061    }
8062}
8063
8064#[must_use = "FIDL methods require a response to be sent"]
8065#[derive(Debug)]
8066pub struct MessagePortReceiveMessageResponder {
8067    control_handle: std::mem::ManuallyDrop<MessagePortControlHandle>,
8068    tx_id: u32,
8069}
8070
8071/// Set the the channel to be shutdown (see [`MessagePortControlHandle::shutdown`])
8072/// if the responder is dropped without sending a response, so that the client
8073/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8074impl std::ops::Drop for MessagePortReceiveMessageResponder {
8075    fn drop(&mut self) {
8076        self.control_handle.shutdown();
8077        // Safety: drops once, never accessed again
8078        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8079    }
8080}
8081
8082impl fidl::endpoints::Responder for MessagePortReceiveMessageResponder {
8083    type ControlHandle = MessagePortControlHandle;
8084
8085    fn control_handle(&self) -> &MessagePortControlHandle {
8086        &self.control_handle
8087    }
8088
8089    fn drop_without_shutdown(mut self) {
8090        // Safety: drops once, never accessed again due to mem::forget
8091        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8092        // Prevent Drop from running (which would shut down the channel)
8093        std::mem::forget(self);
8094    }
8095}
8096
8097impl MessagePortReceiveMessageResponder {
8098    /// Sends a response to the FIDL transaction.
8099    ///
8100    /// Sets the channel to shutdown if an error occurs.
8101    pub fn send(self, mut message: WebMessage) -> Result<(), fidl::Error> {
8102        let _result = self.send_raw(message);
8103        if _result.is_err() {
8104            self.control_handle.shutdown();
8105        }
8106        self.drop_without_shutdown();
8107        _result
8108    }
8109
8110    /// Similar to "send" but does not shutdown the channel if an error occurs.
8111    pub fn send_no_shutdown_on_err(self, mut message: WebMessage) -> Result<(), fidl::Error> {
8112        let _result = self.send_raw(message);
8113        self.drop_without_shutdown();
8114        _result
8115    }
8116
8117    fn send_raw(&self, mut message: WebMessage) -> Result<(), fidl::Error> {
8118        self.control_handle.inner.send::<MessagePortReceiveMessageResponse>(
8119            (&mut message,),
8120            self.tx_id,
8121            0x6c8a6051690be58d,
8122            fidl::encoding::DynamicFlags::empty(),
8123        )
8124    }
8125}
8126
8127#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8128pub struct NavigationControllerMarker;
8129
8130impl fidl::endpoints::ProtocolMarker for NavigationControllerMarker {
8131    type Proxy = NavigationControllerProxy;
8132    type RequestStream = NavigationControllerRequestStream;
8133    #[cfg(target_os = "fuchsia")]
8134    type SynchronousProxy = NavigationControllerSynchronousProxy;
8135
8136    const DEBUG_NAME: &'static str = "(anonymous) NavigationController";
8137}
8138pub type NavigationControllerLoadUrlResult = Result<(), NavigationControllerError>;
8139
8140pub trait NavigationControllerProxyInterface: Send + Sync {
8141    type LoadUrlResponseFut: std::future::Future<Output = Result<NavigationControllerLoadUrlResult, fidl::Error>>
8142        + Send;
8143    fn r#load_url(&self, url: &str, params: LoadUrlParams) -> Self::LoadUrlResponseFut;
8144    fn r#go_back(&self) -> Result<(), fidl::Error>;
8145    fn r#go_forward(&self) -> Result<(), fidl::Error>;
8146    fn r#stop(&self) -> Result<(), fidl::Error>;
8147    fn r#reload(&self, type_: ReloadType) -> Result<(), fidl::Error>;
8148}
8149#[derive(Debug)]
8150#[cfg(target_os = "fuchsia")]
8151pub struct NavigationControllerSynchronousProxy {
8152    client: fidl::client::sync::Client,
8153}
8154
8155#[cfg(target_os = "fuchsia")]
8156impl fidl::endpoints::SynchronousProxy for NavigationControllerSynchronousProxy {
8157    type Proxy = NavigationControllerProxy;
8158    type Protocol = NavigationControllerMarker;
8159
8160    fn from_channel(inner: fidl::Channel) -> Self {
8161        Self::new(inner)
8162    }
8163
8164    fn into_channel(self) -> fidl::Channel {
8165        self.client.into_channel()
8166    }
8167
8168    fn as_channel(&self) -> &fidl::Channel {
8169        self.client.as_channel()
8170    }
8171}
8172
8173#[cfg(target_os = "fuchsia")]
8174impl NavigationControllerSynchronousProxy {
8175    pub fn new(channel: fidl::Channel) -> Self {
8176        let protocol_name =
8177            <NavigationControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8178        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
8179    }
8180
8181    pub fn into_channel(self) -> fidl::Channel {
8182        self.client.into_channel()
8183    }
8184
8185    /// Waits until an event arrives and returns it. It is safe for other
8186    /// threads to make concurrent requests while waiting for an event.
8187    pub fn wait_for_event(
8188        &self,
8189        deadline: zx::MonotonicInstant,
8190    ) -> Result<NavigationControllerEvent, fidl::Error> {
8191        NavigationControllerEvent::decode(self.client.wait_for_event(deadline)?)
8192    }
8193
8194    /// Tells the [`Frame`] to navigate to a `url`.
8195    ///
8196    /// - `url`: The address to navigate to.
8197    /// - `params`: Additional parameters that affect how the resource will be  loaded (e.g.
8198    ///   cookies, HTTP headers, etc.)
8199    ///
8200    /// If an error occurred, the [`NavigationControllerError`] will be set to one of these values:
8201    /// - `INVALID_URL`: The `url` parameter is invalid.
8202    /// - `INVALID_HEADER`: At least one of the headers in [`LoadUrlParams.headers`] is invalid.
8203    pub fn r#load_url(
8204        &self,
8205        mut url: &str,
8206        mut params: LoadUrlParams,
8207        ___deadline: zx::MonotonicInstant,
8208    ) -> Result<NavigationControllerLoadUrlResult, fidl::Error> {
8209        let _response =
8210            self.client
8211                .send_query::<NavigationControllerLoadUrlRequest, fidl::encoding::ResultType<
8212                    fidl::encoding::EmptyStruct,
8213                    NavigationControllerError,
8214                >>(
8215                    (url, &mut params),
8216                    0x78f2ab0a480d0182,
8217                    fidl::encoding::DynamicFlags::empty(),
8218                    ___deadline,
8219                )?;
8220        Ok(_response.map(|x| x))
8221    }
8222
8223    /// Tells the [`Frame`] to navigate to the previous page in its history, if any.
8224    pub fn r#go_back(&self) -> Result<(), fidl::Error> {
8225        self.client.send::<fidl::encoding::EmptyPayload>(
8226            (),
8227            0x2accdd8d87d89c38,
8228            fidl::encoding::DynamicFlags::empty(),
8229        )
8230    }
8231
8232    /// Tells the [`Frame`] to navigate to the next page in its history, if any.
8233    pub fn r#go_forward(&self) -> Result<(), fidl::Error> {
8234        self.client.send::<fidl::encoding::EmptyPayload>(
8235            (),
8236            0x39e4ac955ade2781,
8237            fidl::encoding::DynamicFlags::empty(),
8238        )
8239    }
8240
8241    /// Tells the [`Frame`] to stop the current navigation if a navigation is ongoing.
8242    pub fn r#stop(&self) -> Result<(), fidl::Error> {
8243        self.client.send::<fidl::encoding::EmptyPayload>(
8244            (),
8245            0x2383078ffbe6fea,
8246            fidl::encoding::DynamicFlags::empty(),
8247        )
8248    }
8249
8250    /// Tells the [`Frame`] to reload the current page.
8251    pub fn r#reload(&self, mut type_: ReloadType) -> Result<(), fidl::Error> {
8252        self.client.send::<NavigationControllerReloadRequest>(
8253            (type_,),
8254            0x33faedfe67d6f00,
8255            fidl::encoding::DynamicFlags::empty(),
8256        )
8257    }
8258}
8259
8260#[cfg(target_os = "fuchsia")]
8261impl From<NavigationControllerSynchronousProxy> for zx::Handle {
8262    fn from(value: NavigationControllerSynchronousProxy) -> Self {
8263        value.into_channel().into()
8264    }
8265}
8266
8267#[cfg(target_os = "fuchsia")]
8268impl From<fidl::Channel> for NavigationControllerSynchronousProxy {
8269    fn from(value: fidl::Channel) -> Self {
8270        Self::new(value)
8271    }
8272}
8273
8274#[cfg(target_os = "fuchsia")]
8275impl fidl::endpoints::FromClient for NavigationControllerSynchronousProxy {
8276    type Protocol = NavigationControllerMarker;
8277
8278    fn from_client(value: fidl::endpoints::ClientEnd<NavigationControllerMarker>) -> Self {
8279        Self::new(value.into_channel())
8280    }
8281}
8282
8283#[derive(Debug, Clone)]
8284pub struct NavigationControllerProxy {
8285    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8286}
8287
8288impl fidl::endpoints::Proxy for NavigationControllerProxy {
8289    type Protocol = NavigationControllerMarker;
8290
8291    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8292        Self::new(inner)
8293    }
8294
8295    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8296        self.client.into_channel().map_err(|client| Self { client })
8297    }
8298
8299    fn as_channel(&self) -> &::fidl::AsyncChannel {
8300        self.client.as_channel()
8301    }
8302}
8303
8304impl NavigationControllerProxy {
8305    /// Create a new Proxy for fuchsia.web/NavigationController.
8306    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8307        let protocol_name =
8308            <NavigationControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8309        Self { client: fidl::client::Client::new(channel, protocol_name) }
8310    }
8311
8312    /// Get a Stream of events from the remote end of the protocol.
8313    ///
8314    /// # Panics
8315    ///
8316    /// Panics if the event stream was already taken.
8317    pub fn take_event_stream(&self) -> NavigationControllerEventStream {
8318        NavigationControllerEventStream { event_receiver: self.client.take_event_receiver() }
8319    }
8320
8321    /// Tells the [`Frame`] to navigate to a `url`.
8322    ///
8323    /// - `url`: The address to navigate to.
8324    /// - `params`: Additional parameters that affect how the resource will be  loaded (e.g.
8325    ///   cookies, HTTP headers, etc.)
8326    ///
8327    /// If an error occurred, the [`NavigationControllerError`] will be set to one of these values:
8328    /// - `INVALID_URL`: The `url` parameter is invalid.
8329    /// - `INVALID_HEADER`: At least one of the headers in [`LoadUrlParams.headers`] is invalid.
8330    pub fn r#load_url(
8331        &self,
8332        mut url: &str,
8333        mut params: LoadUrlParams,
8334    ) -> fidl::client::QueryResponseFut<
8335        NavigationControllerLoadUrlResult,
8336        fidl::encoding::DefaultFuchsiaResourceDialect,
8337    > {
8338        NavigationControllerProxyInterface::r#load_url(self, url, params)
8339    }
8340
8341    /// Tells the [`Frame`] to navigate to the previous page in its history, if any.
8342    pub fn r#go_back(&self) -> Result<(), fidl::Error> {
8343        NavigationControllerProxyInterface::r#go_back(self)
8344    }
8345
8346    /// Tells the [`Frame`] to navigate to the next page in its history, if any.
8347    pub fn r#go_forward(&self) -> Result<(), fidl::Error> {
8348        NavigationControllerProxyInterface::r#go_forward(self)
8349    }
8350
8351    /// Tells the [`Frame`] to stop the current navigation if a navigation is ongoing.
8352    pub fn r#stop(&self) -> Result<(), fidl::Error> {
8353        NavigationControllerProxyInterface::r#stop(self)
8354    }
8355
8356    /// Tells the [`Frame`] to reload the current page.
8357    pub fn r#reload(&self, mut type_: ReloadType) -> Result<(), fidl::Error> {
8358        NavigationControllerProxyInterface::r#reload(self, type_)
8359    }
8360}
8361
8362impl NavigationControllerProxyInterface for NavigationControllerProxy {
8363    type LoadUrlResponseFut = fidl::client::QueryResponseFut<
8364        NavigationControllerLoadUrlResult,
8365        fidl::encoding::DefaultFuchsiaResourceDialect,
8366    >;
8367    fn r#load_url(&self, mut url: &str, mut params: LoadUrlParams) -> Self::LoadUrlResponseFut {
8368        fn _decode(
8369            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8370        ) -> Result<NavigationControllerLoadUrlResult, fidl::Error> {
8371            let _response = fidl::client::decode_transaction_body::<
8372                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, NavigationControllerError>,
8373                fidl::encoding::DefaultFuchsiaResourceDialect,
8374                0x78f2ab0a480d0182,
8375            >(_buf?)?;
8376            Ok(_response.map(|x| x))
8377        }
8378        self.client.send_query_and_decode::<
8379            NavigationControllerLoadUrlRequest,
8380            NavigationControllerLoadUrlResult,
8381        >(
8382            (url, &mut params,),
8383            0x78f2ab0a480d0182,
8384            fidl::encoding::DynamicFlags::empty(),
8385            _decode,
8386        )
8387    }
8388
8389    fn r#go_back(&self) -> Result<(), fidl::Error> {
8390        self.client.send::<fidl::encoding::EmptyPayload>(
8391            (),
8392            0x2accdd8d87d89c38,
8393            fidl::encoding::DynamicFlags::empty(),
8394        )
8395    }
8396
8397    fn r#go_forward(&self) -> Result<(), fidl::Error> {
8398        self.client.send::<fidl::encoding::EmptyPayload>(
8399            (),
8400            0x39e4ac955ade2781,
8401            fidl::encoding::DynamicFlags::empty(),
8402        )
8403    }
8404
8405    fn r#stop(&self) -> Result<(), fidl::Error> {
8406        self.client.send::<fidl::encoding::EmptyPayload>(
8407            (),
8408            0x2383078ffbe6fea,
8409            fidl::encoding::DynamicFlags::empty(),
8410        )
8411    }
8412
8413    fn r#reload(&self, mut type_: ReloadType) -> Result<(), fidl::Error> {
8414        self.client.send::<NavigationControllerReloadRequest>(
8415            (type_,),
8416            0x33faedfe67d6f00,
8417            fidl::encoding::DynamicFlags::empty(),
8418        )
8419    }
8420}
8421
8422pub struct NavigationControllerEventStream {
8423    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8424}
8425
8426impl std::marker::Unpin for NavigationControllerEventStream {}
8427
8428impl futures::stream::FusedStream for NavigationControllerEventStream {
8429    fn is_terminated(&self) -> bool {
8430        self.event_receiver.is_terminated()
8431    }
8432}
8433
8434impl futures::Stream for NavigationControllerEventStream {
8435    type Item = Result<NavigationControllerEvent, fidl::Error>;
8436
8437    fn poll_next(
8438        mut self: std::pin::Pin<&mut Self>,
8439        cx: &mut std::task::Context<'_>,
8440    ) -> std::task::Poll<Option<Self::Item>> {
8441        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8442            &mut self.event_receiver,
8443            cx
8444        )?) {
8445            Some(buf) => std::task::Poll::Ready(Some(NavigationControllerEvent::decode(buf))),
8446            None => std::task::Poll::Ready(None),
8447        }
8448    }
8449}
8450
8451#[derive(Debug)]
8452pub enum NavigationControllerEvent {}
8453
8454impl NavigationControllerEvent {
8455    /// Decodes a message buffer as a [`NavigationControllerEvent`].
8456    fn decode(
8457        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8458    ) -> Result<NavigationControllerEvent, fidl::Error> {
8459        let (bytes, _handles) = buf.split_mut();
8460        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8461        debug_assert_eq!(tx_header.tx_id, 0);
8462        match tx_header.ordinal {
8463            _ => Err(fidl::Error::UnknownOrdinal {
8464                ordinal: tx_header.ordinal,
8465                protocol_name:
8466                    <NavigationControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8467            }),
8468        }
8469    }
8470}
8471
8472/// A Stream of incoming requests for fuchsia.web/NavigationController.
8473pub struct NavigationControllerRequestStream {
8474    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8475    is_terminated: bool,
8476}
8477
8478impl std::marker::Unpin for NavigationControllerRequestStream {}
8479
8480impl futures::stream::FusedStream for NavigationControllerRequestStream {
8481    fn is_terminated(&self) -> bool {
8482        self.is_terminated
8483    }
8484}
8485
8486impl fidl::endpoints::RequestStream for NavigationControllerRequestStream {
8487    type Protocol = NavigationControllerMarker;
8488    type ControlHandle = NavigationControllerControlHandle;
8489
8490    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8491        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8492    }
8493
8494    fn control_handle(&self) -> Self::ControlHandle {
8495        NavigationControllerControlHandle { inner: self.inner.clone() }
8496    }
8497
8498    fn into_inner(
8499        self,
8500    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8501    {
8502        (self.inner, self.is_terminated)
8503    }
8504
8505    fn from_inner(
8506        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8507        is_terminated: bool,
8508    ) -> Self {
8509        Self { inner, is_terminated }
8510    }
8511}
8512
8513impl futures::Stream for NavigationControllerRequestStream {
8514    type Item = Result<NavigationControllerRequest, fidl::Error>;
8515
8516    fn poll_next(
8517        mut self: std::pin::Pin<&mut Self>,
8518        cx: &mut std::task::Context<'_>,
8519    ) -> std::task::Poll<Option<Self::Item>> {
8520        let this = &mut *self;
8521        if this.inner.check_shutdown(cx) {
8522            this.is_terminated = true;
8523            return std::task::Poll::Ready(None);
8524        }
8525        if this.is_terminated {
8526            panic!("polled NavigationControllerRequestStream after completion");
8527        }
8528        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8529            |bytes, handles| {
8530                match this.inner.channel().read_etc(cx, bytes, handles) {
8531                    std::task::Poll::Ready(Ok(())) => {}
8532                    std::task::Poll::Pending => return std::task::Poll::Pending,
8533                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8534                        this.is_terminated = true;
8535                        return std::task::Poll::Ready(None);
8536                    }
8537                    std::task::Poll::Ready(Err(e)) => {
8538                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8539                            e.into(),
8540                        ))));
8541                    }
8542                }
8543
8544                // A message has been received from the channel
8545                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8546
8547                std::task::Poll::Ready(Some(match header.ordinal {
8548                0x78f2ab0a480d0182 => {
8549                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8550                    let mut req = fidl::new_empty!(NavigationControllerLoadUrlRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
8551                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NavigationControllerLoadUrlRequest>(&header, _body_bytes, handles, &mut req)?;
8552                    let control_handle = NavigationControllerControlHandle {
8553                        inner: this.inner.clone(),
8554                    };
8555                    Ok(NavigationControllerRequest::LoadUrl {url: req.url,
8556params: req.params,
8557
8558                        responder: NavigationControllerLoadUrlResponder {
8559                            control_handle: std::mem::ManuallyDrop::new(control_handle),
8560                            tx_id: header.tx_id,
8561                        },
8562                    })
8563                }
8564                0x2accdd8d87d89c38 => {
8565                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8566                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
8567                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8568                    let control_handle = NavigationControllerControlHandle {
8569                        inner: this.inner.clone(),
8570                    };
8571                    Ok(NavigationControllerRequest::GoBack {
8572                        control_handle,
8573                    })
8574                }
8575                0x39e4ac955ade2781 => {
8576                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8577                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
8578                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8579                    let control_handle = NavigationControllerControlHandle {
8580                        inner: this.inner.clone(),
8581                    };
8582                    Ok(NavigationControllerRequest::GoForward {
8583                        control_handle,
8584                    })
8585                }
8586                0x2383078ffbe6fea => {
8587                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8588                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
8589                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8590                    let control_handle = NavigationControllerControlHandle {
8591                        inner: this.inner.clone(),
8592                    };
8593                    Ok(NavigationControllerRequest::Stop {
8594                        control_handle,
8595                    })
8596                }
8597                0x33faedfe67d6f00 => {
8598                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8599                    let mut req = fidl::new_empty!(NavigationControllerReloadRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
8600                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NavigationControllerReloadRequest>(&header, _body_bytes, handles, &mut req)?;
8601                    let control_handle = NavigationControllerControlHandle {
8602                        inner: this.inner.clone(),
8603                    };
8604                    Ok(NavigationControllerRequest::Reload {type_: req.type_,
8605
8606                        control_handle,
8607                    })
8608                }
8609                _ => Err(fidl::Error::UnknownOrdinal {
8610                    ordinal: header.ordinal,
8611                    protocol_name: <NavigationControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8612                }),
8613            }))
8614            },
8615        )
8616    }
8617}
8618
8619/// Provides methods for controlling and querying the navigation state of a [`Frame`].
8620#[derive(Debug)]
8621pub enum NavigationControllerRequest {
8622    /// Tells the [`Frame`] to navigate to a `url`.
8623    ///
8624    /// - `url`: The address to navigate to.
8625    /// - `params`: Additional parameters that affect how the resource will be  loaded (e.g.
8626    ///   cookies, HTTP headers, etc.)
8627    ///
8628    /// If an error occurred, the [`NavigationControllerError`] will be set to one of these values:
8629    /// - `INVALID_URL`: The `url` parameter is invalid.
8630    /// - `INVALID_HEADER`: At least one of the headers in [`LoadUrlParams.headers`] is invalid.
8631    LoadUrl { url: String, params: LoadUrlParams, responder: NavigationControllerLoadUrlResponder },
8632    /// Tells the [`Frame`] to navigate to the previous page in its history, if any.
8633    GoBack { control_handle: NavigationControllerControlHandle },
8634    /// Tells the [`Frame`] to navigate to the next page in its history, if any.
8635    GoForward { control_handle: NavigationControllerControlHandle },
8636    /// Tells the [`Frame`] to stop the current navigation if a navigation is ongoing.
8637    Stop { control_handle: NavigationControllerControlHandle },
8638    /// Tells the [`Frame`] to reload the current page.
8639    Reload { type_: ReloadType, control_handle: NavigationControllerControlHandle },
8640}
8641
8642impl NavigationControllerRequest {
8643    #[allow(irrefutable_let_patterns)]
8644    pub fn into_load_url(
8645        self,
8646    ) -> Option<(String, LoadUrlParams, NavigationControllerLoadUrlResponder)> {
8647        if let NavigationControllerRequest::LoadUrl { url, params, responder } = self {
8648            Some((url, params, responder))
8649        } else {
8650            None
8651        }
8652    }
8653
8654    #[allow(irrefutable_let_patterns)]
8655    pub fn into_go_back(self) -> Option<(NavigationControllerControlHandle)> {
8656        if let NavigationControllerRequest::GoBack { control_handle } = self {
8657            Some((control_handle))
8658        } else {
8659            None
8660        }
8661    }
8662
8663    #[allow(irrefutable_let_patterns)]
8664    pub fn into_go_forward(self) -> Option<(NavigationControllerControlHandle)> {
8665        if let NavigationControllerRequest::GoForward { control_handle } = self {
8666            Some((control_handle))
8667        } else {
8668            None
8669        }
8670    }
8671
8672    #[allow(irrefutable_let_patterns)]
8673    pub fn into_stop(self) -> Option<(NavigationControllerControlHandle)> {
8674        if let NavigationControllerRequest::Stop { control_handle } = self {
8675            Some((control_handle))
8676        } else {
8677            None
8678        }
8679    }
8680
8681    #[allow(irrefutable_let_patterns)]
8682    pub fn into_reload(self) -> Option<(ReloadType, NavigationControllerControlHandle)> {
8683        if let NavigationControllerRequest::Reload { type_, control_handle } = self {
8684            Some((type_, control_handle))
8685        } else {
8686            None
8687        }
8688    }
8689
8690    /// Name of the method defined in FIDL
8691    pub fn method_name(&self) -> &'static str {
8692        match *self {
8693            NavigationControllerRequest::LoadUrl { .. } => "load_url",
8694            NavigationControllerRequest::GoBack { .. } => "go_back",
8695            NavigationControllerRequest::GoForward { .. } => "go_forward",
8696            NavigationControllerRequest::Stop { .. } => "stop",
8697            NavigationControllerRequest::Reload { .. } => "reload",
8698        }
8699    }
8700}
8701
8702#[derive(Debug, Clone)]
8703pub struct NavigationControllerControlHandle {
8704    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8705}
8706
8707impl fidl::endpoints::ControlHandle for NavigationControllerControlHandle {
8708    fn shutdown(&self) {
8709        self.inner.shutdown()
8710    }
8711    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8712        self.inner.shutdown_with_epitaph(status)
8713    }
8714
8715    fn is_closed(&self) -> bool {
8716        self.inner.channel().is_closed()
8717    }
8718    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8719        self.inner.channel().on_closed()
8720    }
8721
8722    #[cfg(target_os = "fuchsia")]
8723    fn signal_peer(
8724        &self,
8725        clear_mask: zx::Signals,
8726        set_mask: zx::Signals,
8727    ) -> Result<(), zx_status::Status> {
8728        use fidl::Peered;
8729        self.inner.channel().signal_peer(clear_mask, set_mask)
8730    }
8731}
8732
8733impl NavigationControllerControlHandle {}
8734
8735#[must_use = "FIDL methods require a response to be sent"]
8736#[derive(Debug)]
8737pub struct NavigationControllerLoadUrlResponder {
8738    control_handle: std::mem::ManuallyDrop<NavigationControllerControlHandle>,
8739    tx_id: u32,
8740}
8741
8742/// Set the the channel to be shutdown (see [`NavigationControllerControlHandle::shutdown`])
8743/// if the responder is dropped without sending a response, so that the client
8744/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8745impl std::ops::Drop for NavigationControllerLoadUrlResponder {
8746    fn drop(&mut self) {
8747        self.control_handle.shutdown();
8748        // Safety: drops once, never accessed again
8749        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8750    }
8751}
8752
8753impl fidl::endpoints::Responder for NavigationControllerLoadUrlResponder {
8754    type ControlHandle = NavigationControllerControlHandle;
8755
8756    fn control_handle(&self) -> &NavigationControllerControlHandle {
8757        &self.control_handle
8758    }
8759
8760    fn drop_without_shutdown(mut self) {
8761        // Safety: drops once, never accessed again due to mem::forget
8762        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8763        // Prevent Drop from running (which would shut down the channel)
8764        std::mem::forget(self);
8765    }
8766}
8767
8768impl NavigationControllerLoadUrlResponder {
8769    /// Sends a response to the FIDL transaction.
8770    ///
8771    /// Sets the channel to shutdown if an error occurs.
8772    pub fn send(
8773        self,
8774        mut result: Result<(), NavigationControllerError>,
8775    ) -> Result<(), fidl::Error> {
8776        let _result = self.send_raw(result);
8777        if _result.is_err() {
8778            self.control_handle.shutdown();
8779        }
8780        self.drop_without_shutdown();
8781        _result
8782    }
8783
8784    /// Similar to "send" but does not shutdown the channel if an error occurs.
8785    pub fn send_no_shutdown_on_err(
8786        self,
8787        mut result: Result<(), NavigationControllerError>,
8788    ) -> Result<(), fidl::Error> {
8789        let _result = self.send_raw(result);
8790        self.drop_without_shutdown();
8791        _result
8792    }
8793
8794    fn send_raw(
8795        &self,
8796        mut result: Result<(), NavigationControllerError>,
8797    ) -> Result<(), fidl::Error> {
8798        self.control_handle.inner.send::<fidl::encoding::ResultType<
8799            fidl::encoding::EmptyStruct,
8800            NavigationControllerError,
8801        >>(
8802            result,
8803            self.tx_id,
8804            0x78f2ab0a480d0182,
8805            fidl::encoding::DynamicFlags::empty(),
8806        )
8807    }
8808}
8809
8810#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8811pub struct NavigationEventListenerMarker;
8812
8813impl fidl::endpoints::ProtocolMarker for NavigationEventListenerMarker {
8814    type Proxy = NavigationEventListenerProxy;
8815    type RequestStream = NavigationEventListenerRequestStream;
8816    #[cfg(target_os = "fuchsia")]
8817    type SynchronousProxy = NavigationEventListenerSynchronousProxy;
8818
8819    const DEBUG_NAME: &'static str = "(anonymous) NavigationEventListener";
8820}
8821
8822pub trait NavigationEventListenerProxyInterface: Send + Sync {
8823    type OnNavigationStateChangedResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
8824        + Send;
8825    fn r#on_navigation_state_changed(
8826        &self,
8827        change: NavigationState,
8828    ) -> Self::OnNavigationStateChangedResponseFut;
8829}
8830#[derive(Debug)]
8831#[cfg(target_os = "fuchsia")]
8832pub struct NavigationEventListenerSynchronousProxy {
8833    client: fidl::client::sync::Client,
8834}
8835
8836#[cfg(target_os = "fuchsia")]
8837impl fidl::endpoints::SynchronousProxy for NavigationEventListenerSynchronousProxy {
8838    type Proxy = NavigationEventListenerProxy;
8839    type Protocol = NavigationEventListenerMarker;
8840
8841    fn from_channel(inner: fidl::Channel) -> Self {
8842        Self::new(inner)
8843    }
8844
8845    fn into_channel(self) -> fidl::Channel {
8846        self.client.into_channel()
8847    }
8848
8849    fn as_channel(&self) -> &fidl::Channel {
8850        self.client.as_channel()
8851    }
8852}
8853
8854#[cfg(target_os = "fuchsia")]
8855impl NavigationEventListenerSynchronousProxy {
8856    pub fn new(channel: fidl::Channel) -> Self {
8857        let protocol_name =
8858            <NavigationEventListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8859        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
8860    }
8861
8862    pub fn into_channel(self) -> fidl::Channel {
8863        self.client.into_channel()
8864    }
8865
8866    /// Waits until an event arrives and returns it. It is safe for other
8867    /// threads to make concurrent requests while waiting for an event.
8868    pub fn wait_for_event(
8869        &self,
8870        deadline: zx::MonotonicInstant,
8871    ) -> Result<NavigationEventListenerEvent, fidl::Error> {
8872        NavigationEventListenerEvent::decode(self.client.wait_for_event(deadline)?)
8873    }
8874
8875    /// Called immediately after [`Frame.SetNavigationEventListener`] and every time user-visible
8876    /// navigation state has changed. In the first call, `change` contains the current navigation
8877    /// state (empty before the first navigation request). In every following call, `change` will
8878    /// have values set for all fields that have changed at any time since the previous
8879    /// notification. This means that some fields may have the same value as was previously
8880    /// reported, for example, if they changed to some other value and back again. If a field is
8881    /// unset, then its value has not changed at any time since the previous notification.
8882    ///
8883    /// Implementer must call the acknowledgement callback to receive new navigation events.
8884    pub fn r#on_navigation_state_changed(
8885        &self,
8886        mut change: NavigationState,
8887        ___deadline: zx::MonotonicInstant,
8888    ) -> Result<(), fidl::Error> {
8889        let _response = self.client.send_query::<
8890            NavigationEventListenerOnNavigationStateChangedRequest,
8891            fidl::encoding::EmptyPayload,
8892        >(
8893            (&mut change,),
8894            0x453ac6bcbc82fbb6,
8895            fidl::encoding::DynamicFlags::empty(),
8896            ___deadline,
8897        )?;
8898        Ok(_response)
8899    }
8900}
8901
8902#[cfg(target_os = "fuchsia")]
8903impl From<NavigationEventListenerSynchronousProxy> for zx::Handle {
8904    fn from(value: NavigationEventListenerSynchronousProxy) -> Self {
8905        value.into_channel().into()
8906    }
8907}
8908
8909#[cfg(target_os = "fuchsia")]
8910impl From<fidl::Channel> for NavigationEventListenerSynchronousProxy {
8911    fn from(value: fidl::Channel) -> Self {
8912        Self::new(value)
8913    }
8914}
8915
8916#[cfg(target_os = "fuchsia")]
8917impl fidl::endpoints::FromClient for NavigationEventListenerSynchronousProxy {
8918    type Protocol = NavigationEventListenerMarker;
8919
8920    fn from_client(value: fidl::endpoints::ClientEnd<NavigationEventListenerMarker>) -> Self {
8921        Self::new(value.into_channel())
8922    }
8923}
8924
8925#[derive(Debug, Clone)]
8926pub struct NavigationEventListenerProxy {
8927    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8928}
8929
8930impl fidl::endpoints::Proxy for NavigationEventListenerProxy {
8931    type Protocol = NavigationEventListenerMarker;
8932
8933    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8934        Self::new(inner)
8935    }
8936
8937    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8938        self.client.into_channel().map_err(|client| Self { client })
8939    }
8940
8941    fn as_channel(&self) -> &::fidl::AsyncChannel {
8942        self.client.as_channel()
8943    }
8944}
8945
8946impl NavigationEventListenerProxy {
8947    /// Create a new Proxy for fuchsia.web/NavigationEventListener.
8948    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8949        let protocol_name =
8950            <NavigationEventListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8951        Self { client: fidl::client::Client::new(channel, protocol_name) }
8952    }
8953
8954    /// Get a Stream of events from the remote end of the protocol.
8955    ///
8956    /// # Panics
8957    ///
8958    /// Panics if the event stream was already taken.
8959    pub fn take_event_stream(&self) -> NavigationEventListenerEventStream {
8960        NavigationEventListenerEventStream { event_receiver: self.client.take_event_receiver() }
8961    }
8962
8963    /// Called immediately after [`Frame.SetNavigationEventListener`] and every time user-visible
8964    /// navigation state has changed. In the first call, `change` contains the current navigation
8965    /// state (empty before the first navigation request). In every following call, `change` will
8966    /// have values set for all fields that have changed at any time since the previous
8967    /// notification. This means that some fields may have the same value as was previously
8968    /// reported, for example, if they changed to some other value and back again. If a field is
8969    /// unset, then its value has not changed at any time since the previous notification.
8970    ///
8971    /// Implementer must call the acknowledgement callback to receive new navigation events.
8972    pub fn r#on_navigation_state_changed(
8973        &self,
8974        mut change: NavigationState,
8975    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
8976        NavigationEventListenerProxyInterface::r#on_navigation_state_changed(self, change)
8977    }
8978}
8979
8980impl NavigationEventListenerProxyInterface for NavigationEventListenerProxy {
8981    type OnNavigationStateChangedResponseFut =
8982        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
8983    fn r#on_navigation_state_changed(
8984        &self,
8985        mut change: NavigationState,
8986    ) -> Self::OnNavigationStateChangedResponseFut {
8987        fn _decode(
8988            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8989        ) -> Result<(), fidl::Error> {
8990            let _response = fidl::client::decode_transaction_body::<
8991                fidl::encoding::EmptyPayload,
8992                fidl::encoding::DefaultFuchsiaResourceDialect,
8993                0x453ac6bcbc82fbb6,
8994            >(_buf?)?;
8995            Ok(_response)
8996        }
8997        self.client
8998            .send_query_and_decode::<NavigationEventListenerOnNavigationStateChangedRequest, ()>(
8999                (&mut change,),
9000                0x453ac6bcbc82fbb6,
9001                fidl::encoding::DynamicFlags::empty(),
9002                _decode,
9003            )
9004    }
9005}
9006
9007pub struct NavigationEventListenerEventStream {
9008    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
9009}
9010
9011impl std::marker::Unpin for NavigationEventListenerEventStream {}
9012
9013impl futures::stream::FusedStream for NavigationEventListenerEventStream {
9014    fn is_terminated(&self) -> bool {
9015        self.event_receiver.is_terminated()
9016    }
9017}
9018
9019impl futures::Stream for NavigationEventListenerEventStream {
9020    type Item = Result<NavigationEventListenerEvent, fidl::Error>;
9021
9022    fn poll_next(
9023        mut self: std::pin::Pin<&mut Self>,
9024        cx: &mut std::task::Context<'_>,
9025    ) -> std::task::Poll<Option<Self::Item>> {
9026        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
9027            &mut self.event_receiver,
9028            cx
9029        )?) {
9030            Some(buf) => std::task::Poll::Ready(Some(NavigationEventListenerEvent::decode(buf))),
9031            None => std::task::Poll::Ready(None),
9032        }
9033    }
9034}
9035
9036#[derive(Debug)]
9037pub enum NavigationEventListenerEvent {}
9038
9039impl NavigationEventListenerEvent {
9040    /// Decodes a message buffer as a [`NavigationEventListenerEvent`].
9041    fn decode(
9042        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
9043    ) -> Result<NavigationEventListenerEvent, fidl::Error> {
9044        let (bytes, _handles) = buf.split_mut();
9045        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9046        debug_assert_eq!(tx_header.tx_id, 0);
9047        match tx_header.ordinal {
9048            _ => Err(fidl::Error::UnknownOrdinal {
9049                ordinal: tx_header.ordinal,
9050                protocol_name:
9051                    <NavigationEventListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9052            }),
9053        }
9054    }
9055}
9056
9057/// A Stream of incoming requests for fuchsia.web/NavigationEventListener.
9058pub struct NavigationEventListenerRequestStream {
9059    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9060    is_terminated: bool,
9061}
9062
9063impl std::marker::Unpin for NavigationEventListenerRequestStream {}
9064
9065impl futures::stream::FusedStream for NavigationEventListenerRequestStream {
9066    fn is_terminated(&self) -> bool {
9067        self.is_terminated
9068    }
9069}
9070
9071impl fidl::endpoints::RequestStream for NavigationEventListenerRequestStream {
9072    type Protocol = NavigationEventListenerMarker;
9073    type ControlHandle = NavigationEventListenerControlHandle;
9074
9075    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
9076        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
9077    }
9078
9079    fn control_handle(&self) -> Self::ControlHandle {
9080        NavigationEventListenerControlHandle { inner: self.inner.clone() }
9081    }
9082
9083    fn into_inner(
9084        self,
9085    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
9086    {
9087        (self.inner, self.is_terminated)
9088    }
9089
9090    fn from_inner(
9091        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9092        is_terminated: bool,
9093    ) -> Self {
9094        Self { inner, is_terminated }
9095    }
9096}
9097
9098impl futures::Stream for NavigationEventListenerRequestStream {
9099    type Item = Result<NavigationEventListenerRequest, fidl::Error>;
9100
9101    fn poll_next(
9102        mut self: std::pin::Pin<&mut Self>,
9103        cx: &mut std::task::Context<'_>,
9104    ) -> std::task::Poll<Option<Self::Item>> {
9105        let this = &mut *self;
9106        if this.inner.check_shutdown(cx) {
9107            this.is_terminated = true;
9108            return std::task::Poll::Ready(None);
9109        }
9110        if this.is_terminated {
9111            panic!("polled NavigationEventListenerRequestStream after completion");
9112        }
9113        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
9114            |bytes, handles| {
9115                match this.inner.channel().read_etc(cx, bytes, handles) {
9116                    std::task::Poll::Ready(Ok(())) => {}
9117                    std::task::Poll::Pending => return std::task::Poll::Pending,
9118                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
9119                        this.is_terminated = true;
9120                        return std::task::Poll::Ready(None);
9121                    }
9122                    std::task::Poll::Ready(Err(e)) => {
9123                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
9124                            e.into(),
9125                        ))));
9126                    }
9127                }
9128
9129                // A message has been received from the channel
9130                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9131
9132                std::task::Poll::Ready(Some(match header.ordinal {
9133                0x453ac6bcbc82fbb6 => {
9134                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9135                    let mut req = fidl::new_empty!(NavigationEventListenerOnNavigationStateChangedRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
9136                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NavigationEventListenerOnNavigationStateChangedRequest>(&header, _body_bytes, handles, &mut req)?;
9137                    let control_handle = NavigationEventListenerControlHandle {
9138                        inner: this.inner.clone(),
9139                    };
9140                    Ok(NavigationEventListenerRequest::OnNavigationStateChanged {change: req.change,
9141
9142                        responder: NavigationEventListenerOnNavigationStateChangedResponder {
9143                            control_handle: std::mem::ManuallyDrop::new(control_handle),
9144                            tx_id: header.tx_id,
9145                        },
9146                    })
9147                }
9148                _ => Err(fidl::Error::UnknownOrdinal {
9149                    ordinal: header.ordinal,
9150                    protocol_name: <NavigationEventListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9151                }),
9152            }))
9153            },
9154        )
9155    }
9156}
9157
9158/// Interface supplied by the embedder for receiving notifications about navigation events in a
9159/// [`Frame`].
9160#[derive(Debug)]
9161pub enum NavigationEventListenerRequest {
9162    /// Called immediately after [`Frame.SetNavigationEventListener`] and every time user-visible
9163    /// navigation state has changed. In the first call, `change` contains the current navigation
9164    /// state (empty before the first navigation request). In every following call, `change` will
9165    /// have values set for all fields that have changed at any time since the previous
9166    /// notification. This means that some fields may have the same value as was previously
9167    /// reported, for example, if they changed to some other value and back again. If a field is
9168    /// unset, then its value has not changed at any time since the previous notification.
9169    ///
9170    /// Implementer must call the acknowledgement callback to receive new navigation events.
9171    OnNavigationStateChanged {
9172        change: NavigationState,
9173        responder: NavigationEventListenerOnNavigationStateChangedResponder,
9174    },
9175}
9176
9177impl NavigationEventListenerRequest {
9178    #[allow(irrefutable_let_patterns)]
9179    pub fn into_on_navigation_state_changed(
9180        self,
9181    ) -> Option<(NavigationState, NavigationEventListenerOnNavigationStateChangedResponder)> {
9182        if let NavigationEventListenerRequest::OnNavigationStateChanged { change, responder } = self
9183        {
9184            Some((change, responder))
9185        } else {
9186            None
9187        }
9188    }
9189
9190    /// Name of the method defined in FIDL
9191    pub fn method_name(&self) -> &'static str {
9192        match *self {
9193            NavigationEventListenerRequest::OnNavigationStateChanged { .. } => {
9194                "on_navigation_state_changed"
9195            }
9196        }
9197    }
9198}
9199
9200#[derive(Debug, Clone)]
9201pub struct NavigationEventListenerControlHandle {
9202    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9203}
9204
9205impl fidl::endpoints::ControlHandle for NavigationEventListenerControlHandle {
9206    fn shutdown(&self) {
9207        self.inner.shutdown()
9208    }
9209    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
9210        self.inner.shutdown_with_epitaph(status)
9211    }
9212
9213    fn is_closed(&self) -> bool {
9214        self.inner.channel().is_closed()
9215    }
9216    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
9217        self.inner.channel().on_closed()
9218    }
9219
9220    #[cfg(target_os = "fuchsia")]
9221    fn signal_peer(
9222        &self,
9223        clear_mask: zx::Signals,
9224        set_mask: zx::Signals,
9225    ) -> Result<(), zx_status::Status> {
9226        use fidl::Peered;
9227        self.inner.channel().signal_peer(clear_mask, set_mask)
9228    }
9229}
9230
9231impl NavigationEventListenerControlHandle {}
9232
9233#[must_use = "FIDL methods require a response to be sent"]
9234#[derive(Debug)]
9235pub struct NavigationEventListenerOnNavigationStateChangedResponder {
9236    control_handle: std::mem::ManuallyDrop<NavigationEventListenerControlHandle>,
9237    tx_id: u32,
9238}
9239
9240/// Set the the channel to be shutdown (see [`NavigationEventListenerControlHandle::shutdown`])
9241/// if the responder is dropped without sending a response, so that the client
9242/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9243impl std::ops::Drop for NavigationEventListenerOnNavigationStateChangedResponder {
9244    fn drop(&mut self) {
9245        self.control_handle.shutdown();
9246        // Safety: drops once, never accessed again
9247        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9248    }
9249}
9250
9251impl fidl::endpoints::Responder for NavigationEventListenerOnNavigationStateChangedResponder {
9252    type ControlHandle = NavigationEventListenerControlHandle;
9253
9254    fn control_handle(&self) -> &NavigationEventListenerControlHandle {
9255        &self.control_handle
9256    }
9257
9258    fn drop_without_shutdown(mut self) {
9259        // Safety: drops once, never accessed again due to mem::forget
9260        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9261        // Prevent Drop from running (which would shut down the channel)
9262        std::mem::forget(self);
9263    }
9264}
9265
9266impl NavigationEventListenerOnNavigationStateChangedResponder {
9267    /// Sends a response to the FIDL transaction.
9268    ///
9269    /// Sets the channel to shutdown if an error occurs.
9270    pub fn send(self) -> Result<(), fidl::Error> {
9271        let _result = self.send_raw();
9272        if _result.is_err() {
9273            self.control_handle.shutdown();
9274        }
9275        self.drop_without_shutdown();
9276        _result
9277    }
9278
9279    /// Similar to "send" but does not shutdown the channel if an error occurs.
9280    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
9281        let _result = self.send_raw();
9282        self.drop_without_shutdown();
9283        _result
9284    }
9285
9286    fn send_raw(&self) -> Result<(), fidl::Error> {
9287        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
9288            (),
9289            self.tx_id,
9290            0x453ac6bcbc82fbb6,
9291            fidl::encoding::DynamicFlags::empty(),
9292        )
9293    }
9294}
9295
9296#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9297pub struct NavigationPolicyProviderMarker;
9298
9299impl fidl::endpoints::ProtocolMarker for NavigationPolicyProviderMarker {
9300    type Proxy = NavigationPolicyProviderProxy;
9301    type RequestStream = NavigationPolicyProviderRequestStream;
9302    #[cfg(target_os = "fuchsia")]
9303    type SynchronousProxy = NavigationPolicyProviderSynchronousProxy;
9304
9305    const DEBUG_NAME: &'static str = "(anonymous) NavigationPolicyProvider";
9306}
9307
9308pub trait NavigationPolicyProviderProxyInterface: Send + Sync {
9309    type EvaluateRequestedNavigationResponseFut: std::future::Future<Output = Result<NavigationDecision, fidl::Error>>
9310        + Send;
9311    fn r#evaluate_requested_navigation(
9312        &self,
9313        requested_navigation: &RequestedNavigation,
9314    ) -> Self::EvaluateRequestedNavigationResponseFut;
9315}
9316#[derive(Debug)]
9317#[cfg(target_os = "fuchsia")]
9318pub struct NavigationPolicyProviderSynchronousProxy {
9319    client: fidl::client::sync::Client,
9320}
9321
9322#[cfg(target_os = "fuchsia")]
9323impl fidl::endpoints::SynchronousProxy for NavigationPolicyProviderSynchronousProxy {
9324    type Proxy = NavigationPolicyProviderProxy;
9325    type Protocol = NavigationPolicyProviderMarker;
9326
9327    fn from_channel(inner: fidl::Channel) -> Self {
9328        Self::new(inner)
9329    }
9330
9331    fn into_channel(self) -> fidl::Channel {
9332        self.client.into_channel()
9333    }
9334
9335    fn as_channel(&self) -> &fidl::Channel {
9336        self.client.as_channel()
9337    }
9338}
9339
9340#[cfg(target_os = "fuchsia")]
9341impl NavigationPolicyProviderSynchronousProxy {
9342    pub fn new(channel: fidl::Channel) -> Self {
9343        let protocol_name =
9344            <NavigationPolicyProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9345        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
9346    }
9347
9348    pub fn into_channel(self) -> fidl::Channel {
9349        self.client.into_channel()
9350    }
9351
9352    /// Waits until an event arrives and returns it. It is safe for other
9353    /// threads to make concurrent requests while waiting for an event.
9354    pub fn wait_for_event(
9355        &self,
9356        deadline: zx::MonotonicInstant,
9357    ) -> Result<NavigationPolicyProviderEvent, fidl::Error> {
9358        NavigationPolicyProviderEvent::decode(self.client.wait_for_event(deadline)?)
9359    }
9360
9361    /// Called when the [`Frame`] is processing a navigation request in one of the phase(s)
9362    /// specified in [`NavigationPolicyProviderParams`]. Navigation is paused until the result is
9363    /// received. The returned [`NavigationDecision`] defines how the navigation should proceed.
9364    pub fn r#evaluate_requested_navigation(
9365        &self,
9366        mut requested_navigation: &RequestedNavigation,
9367        ___deadline: zx::MonotonicInstant,
9368    ) -> Result<NavigationDecision, fidl::Error> {
9369        let _response = self.client.send_query::<
9370            NavigationPolicyProviderEvaluateRequestedNavigationRequest,
9371            NavigationPolicyProviderEvaluateRequestedNavigationResponse,
9372        >(
9373            (requested_navigation,),
9374            0x54446b50cf3512b6,
9375            fidl::encoding::DynamicFlags::empty(),
9376            ___deadline,
9377        )?;
9378        Ok(_response.decision)
9379    }
9380}
9381
9382#[cfg(target_os = "fuchsia")]
9383impl From<NavigationPolicyProviderSynchronousProxy> for zx::Handle {
9384    fn from(value: NavigationPolicyProviderSynchronousProxy) -> Self {
9385        value.into_channel().into()
9386    }
9387}
9388
9389#[cfg(target_os = "fuchsia")]
9390impl From<fidl::Channel> for NavigationPolicyProviderSynchronousProxy {
9391    fn from(value: fidl::Channel) -> Self {
9392        Self::new(value)
9393    }
9394}
9395
9396#[cfg(target_os = "fuchsia")]
9397impl fidl::endpoints::FromClient for NavigationPolicyProviderSynchronousProxy {
9398    type Protocol = NavigationPolicyProviderMarker;
9399
9400    fn from_client(value: fidl::endpoints::ClientEnd<NavigationPolicyProviderMarker>) -> Self {
9401        Self::new(value.into_channel())
9402    }
9403}
9404
9405#[derive(Debug, Clone)]
9406pub struct NavigationPolicyProviderProxy {
9407    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
9408}
9409
9410impl fidl::endpoints::Proxy for NavigationPolicyProviderProxy {
9411    type Protocol = NavigationPolicyProviderMarker;
9412
9413    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
9414        Self::new(inner)
9415    }
9416
9417    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
9418        self.client.into_channel().map_err(|client| Self { client })
9419    }
9420
9421    fn as_channel(&self) -> &::fidl::AsyncChannel {
9422        self.client.as_channel()
9423    }
9424}
9425
9426impl NavigationPolicyProviderProxy {
9427    /// Create a new Proxy for fuchsia.web/NavigationPolicyProvider.
9428    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
9429        let protocol_name =
9430            <NavigationPolicyProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9431        Self { client: fidl::client::Client::new(channel, protocol_name) }
9432    }
9433
9434    /// Get a Stream of events from the remote end of the protocol.
9435    ///
9436    /// # Panics
9437    ///
9438    /// Panics if the event stream was already taken.
9439    pub fn take_event_stream(&self) -> NavigationPolicyProviderEventStream {
9440        NavigationPolicyProviderEventStream { event_receiver: self.client.take_event_receiver() }
9441    }
9442
9443    /// Called when the [`Frame`] is processing a navigation request in one of the phase(s)
9444    /// specified in [`NavigationPolicyProviderParams`]. Navigation is paused until the result is
9445    /// received. The returned [`NavigationDecision`] defines how the navigation should proceed.
9446    pub fn r#evaluate_requested_navigation(
9447        &self,
9448        mut requested_navigation: &RequestedNavigation,
9449    ) -> fidl::client::QueryResponseFut<
9450        NavigationDecision,
9451        fidl::encoding::DefaultFuchsiaResourceDialect,
9452    > {
9453        NavigationPolicyProviderProxyInterface::r#evaluate_requested_navigation(
9454            self,
9455            requested_navigation,
9456        )
9457    }
9458}
9459
9460impl NavigationPolicyProviderProxyInterface for NavigationPolicyProviderProxy {
9461    type EvaluateRequestedNavigationResponseFut = fidl::client::QueryResponseFut<
9462        NavigationDecision,
9463        fidl::encoding::DefaultFuchsiaResourceDialect,
9464    >;
9465    fn r#evaluate_requested_navigation(
9466        &self,
9467        mut requested_navigation: &RequestedNavigation,
9468    ) -> Self::EvaluateRequestedNavigationResponseFut {
9469        fn _decode(
9470            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9471        ) -> Result<NavigationDecision, fidl::Error> {
9472            let _response = fidl::client::decode_transaction_body::<
9473                NavigationPolicyProviderEvaluateRequestedNavigationResponse,
9474                fidl::encoding::DefaultFuchsiaResourceDialect,
9475                0x54446b50cf3512b6,
9476            >(_buf?)?;
9477            Ok(_response.decision)
9478        }
9479        self.client.send_query_and_decode::<
9480            NavigationPolicyProviderEvaluateRequestedNavigationRequest,
9481            NavigationDecision,
9482        >(
9483            (requested_navigation,),
9484            0x54446b50cf3512b6,
9485            fidl::encoding::DynamicFlags::empty(),
9486            _decode,
9487        )
9488    }
9489}
9490
9491pub struct NavigationPolicyProviderEventStream {
9492    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
9493}
9494
9495impl std::marker::Unpin for NavigationPolicyProviderEventStream {}
9496
9497impl futures::stream::FusedStream for NavigationPolicyProviderEventStream {
9498    fn is_terminated(&self) -> bool {
9499        self.event_receiver.is_terminated()
9500    }
9501}
9502
9503impl futures::Stream for NavigationPolicyProviderEventStream {
9504    type Item = Result<NavigationPolicyProviderEvent, fidl::Error>;
9505
9506    fn poll_next(
9507        mut self: std::pin::Pin<&mut Self>,
9508        cx: &mut std::task::Context<'_>,
9509    ) -> std::task::Poll<Option<Self::Item>> {
9510        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
9511            &mut self.event_receiver,
9512            cx
9513        )?) {
9514            Some(buf) => std::task::Poll::Ready(Some(NavigationPolicyProviderEvent::decode(buf))),
9515            None => std::task::Poll::Ready(None),
9516        }
9517    }
9518}
9519
9520#[derive(Debug)]
9521pub enum NavigationPolicyProviderEvent {}
9522
9523impl NavigationPolicyProviderEvent {
9524    /// Decodes a message buffer as a [`NavigationPolicyProviderEvent`].
9525    fn decode(
9526        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
9527    ) -> Result<NavigationPolicyProviderEvent, fidl::Error> {
9528        let (bytes, _handles) = buf.split_mut();
9529        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9530        debug_assert_eq!(tx_header.tx_id, 0);
9531        match tx_header.ordinal {
9532            _ => Err(fidl::Error::UnknownOrdinal {
9533                ordinal: tx_header.ordinal,
9534                protocol_name:
9535                    <NavigationPolicyProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9536            }),
9537        }
9538    }
9539}
9540
9541/// A Stream of incoming requests for fuchsia.web/NavigationPolicyProvider.
9542pub struct NavigationPolicyProviderRequestStream {
9543    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9544    is_terminated: bool,
9545}
9546
9547impl std::marker::Unpin for NavigationPolicyProviderRequestStream {}
9548
9549impl futures::stream::FusedStream for NavigationPolicyProviderRequestStream {
9550    fn is_terminated(&self) -> bool {
9551        self.is_terminated
9552    }
9553}
9554
9555impl fidl::endpoints::RequestStream for NavigationPolicyProviderRequestStream {
9556    type Protocol = NavigationPolicyProviderMarker;
9557    type ControlHandle = NavigationPolicyProviderControlHandle;
9558
9559    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
9560        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
9561    }
9562
9563    fn control_handle(&self) -> Self::ControlHandle {
9564        NavigationPolicyProviderControlHandle { inner: self.inner.clone() }
9565    }
9566
9567    fn into_inner(
9568        self,
9569    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
9570    {
9571        (self.inner, self.is_terminated)
9572    }
9573
9574    fn from_inner(
9575        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9576        is_terminated: bool,
9577    ) -> Self {
9578        Self { inner, is_terminated }
9579    }
9580}
9581
9582impl futures::Stream for NavigationPolicyProviderRequestStream {
9583    type Item = Result<NavigationPolicyProviderRequest, fidl::Error>;
9584
9585    fn poll_next(
9586        mut self: std::pin::Pin<&mut Self>,
9587        cx: &mut std::task::Context<'_>,
9588    ) -> std::task::Poll<Option<Self::Item>> {
9589        let this = &mut *self;
9590        if this.inner.check_shutdown(cx) {
9591            this.is_terminated = true;
9592            return std::task::Poll::Ready(None);
9593        }
9594        if this.is_terminated {
9595            panic!("polled NavigationPolicyProviderRequestStream after completion");
9596        }
9597        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
9598            |bytes, handles| {
9599                match this.inner.channel().read_etc(cx, bytes, handles) {
9600                    std::task::Poll::Ready(Ok(())) => {}
9601                    std::task::Poll::Pending => return std::task::Poll::Pending,
9602                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
9603                        this.is_terminated = true;
9604                        return std::task::Poll::Ready(None);
9605                    }
9606                    std::task::Poll::Ready(Err(e)) => {
9607                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
9608                            e.into(),
9609                        ))));
9610                    }
9611                }
9612
9613                // A message has been received from the channel
9614                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9615
9616                std::task::Poll::Ready(Some(match header.ordinal {
9617                0x54446b50cf3512b6 => {
9618                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9619                    let mut req = fidl::new_empty!(NavigationPolicyProviderEvaluateRequestedNavigationRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
9620                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NavigationPolicyProviderEvaluateRequestedNavigationRequest>(&header, _body_bytes, handles, &mut req)?;
9621                    let control_handle = NavigationPolicyProviderControlHandle {
9622                        inner: this.inner.clone(),
9623                    };
9624                    Ok(NavigationPolicyProviderRequest::EvaluateRequestedNavigation {requested_navigation: req.requested_navigation,
9625
9626                        responder: NavigationPolicyProviderEvaluateRequestedNavigationResponder {
9627                            control_handle: std::mem::ManuallyDrop::new(control_handle),
9628                            tx_id: header.tx_id,
9629                        },
9630                    })
9631                }
9632                _ => Err(fidl::Error::UnknownOrdinal {
9633                    ordinal: header.ordinal,
9634                    protocol_name: <NavigationPolicyProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9635                }),
9636            }))
9637            },
9638        )
9639    }
9640}
9641
9642#[derive(Debug)]
9643pub enum NavigationPolicyProviderRequest {
9644    /// Called when the [`Frame`] is processing a navigation request in one of the phase(s)
9645    /// specified in [`NavigationPolicyProviderParams`]. Navigation is paused until the result is
9646    /// received. The returned [`NavigationDecision`] defines how the navigation should proceed.
9647    EvaluateRequestedNavigation {
9648        requested_navigation: RequestedNavigation,
9649        responder: NavigationPolicyProviderEvaluateRequestedNavigationResponder,
9650    },
9651}
9652
9653impl NavigationPolicyProviderRequest {
9654    #[allow(irrefutable_let_patterns)]
9655    pub fn into_evaluate_requested_navigation(
9656        self,
9657    ) -> Option<(RequestedNavigation, NavigationPolicyProviderEvaluateRequestedNavigationResponder)>
9658    {
9659        if let NavigationPolicyProviderRequest::EvaluateRequestedNavigation {
9660            requested_navigation,
9661            responder,
9662        } = self
9663        {
9664            Some((requested_navigation, responder))
9665        } else {
9666            None
9667        }
9668    }
9669
9670    /// Name of the method defined in FIDL
9671    pub fn method_name(&self) -> &'static str {
9672        match *self {
9673            NavigationPolicyProviderRequest::EvaluateRequestedNavigation { .. } => {
9674                "evaluate_requested_navigation"
9675            }
9676        }
9677    }
9678}
9679
9680#[derive(Debug, Clone)]
9681pub struct NavigationPolicyProviderControlHandle {
9682    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9683}
9684
9685impl fidl::endpoints::ControlHandle for NavigationPolicyProviderControlHandle {
9686    fn shutdown(&self) {
9687        self.inner.shutdown()
9688    }
9689    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
9690        self.inner.shutdown_with_epitaph(status)
9691    }
9692
9693    fn is_closed(&self) -> bool {
9694        self.inner.channel().is_closed()
9695    }
9696    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
9697        self.inner.channel().on_closed()
9698    }
9699
9700    #[cfg(target_os = "fuchsia")]
9701    fn signal_peer(
9702        &self,
9703        clear_mask: zx::Signals,
9704        set_mask: zx::Signals,
9705    ) -> Result<(), zx_status::Status> {
9706        use fidl::Peered;
9707        self.inner.channel().signal_peer(clear_mask, set_mask)
9708    }
9709}
9710
9711impl NavigationPolicyProviderControlHandle {}
9712
9713#[must_use = "FIDL methods require a response to be sent"]
9714#[derive(Debug)]
9715pub struct NavigationPolicyProviderEvaluateRequestedNavigationResponder {
9716    control_handle: std::mem::ManuallyDrop<NavigationPolicyProviderControlHandle>,
9717    tx_id: u32,
9718}
9719
9720/// Set the the channel to be shutdown (see [`NavigationPolicyProviderControlHandle::shutdown`])
9721/// if the responder is dropped without sending a response, so that the client
9722/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9723impl std::ops::Drop for NavigationPolicyProviderEvaluateRequestedNavigationResponder {
9724    fn drop(&mut self) {
9725        self.control_handle.shutdown();
9726        // Safety: drops once, never accessed again
9727        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9728    }
9729}
9730
9731impl fidl::endpoints::Responder for NavigationPolicyProviderEvaluateRequestedNavigationResponder {
9732    type ControlHandle = NavigationPolicyProviderControlHandle;
9733
9734    fn control_handle(&self) -> &NavigationPolicyProviderControlHandle {
9735        &self.control_handle
9736    }
9737
9738    fn drop_without_shutdown(mut self) {
9739        // Safety: drops once, never accessed again due to mem::forget
9740        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9741        // Prevent Drop from running (which would shut down the channel)
9742        std::mem::forget(self);
9743    }
9744}
9745
9746impl NavigationPolicyProviderEvaluateRequestedNavigationResponder {
9747    /// Sends a response to the FIDL transaction.
9748    ///
9749    /// Sets the channel to shutdown if an error occurs.
9750    pub fn send(self, mut decision: NavigationDecision) -> Result<(), fidl::Error> {
9751        let _result = self.send_raw(decision);
9752        if _result.is_err() {
9753            self.control_handle.shutdown();
9754        }
9755        self.drop_without_shutdown();
9756        _result
9757    }
9758
9759    /// Similar to "send" but does not shutdown the channel if an error occurs.
9760    pub fn send_no_shutdown_on_err(
9761        self,
9762        mut decision: NavigationDecision,
9763    ) -> Result<(), fidl::Error> {
9764        let _result = self.send_raw(decision);
9765        self.drop_without_shutdown();
9766        _result
9767    }
9768
9769    fn send_raw(&self, mut decision: NavigationDecision) -> Result<(), fidl::Error> {
9770        self.control_handle
9771            .inner
9772            .send::<NavigationPolicyProviderEvaluateRequestedNavigationResponse>(
9773                (&mut decision,),
9774                self.tx_id,
9775                0x54446b50cf3512b6,
9776                fidl::encoding::DynamicFlags::empty(),
9777            )
9778    }
9779}
9780
9781#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9782pub struct PopupFrameCreationListenerMarker;
9783
9784impl fidl::endpoints::ProtocolMarker for PopupFrameCreationListenerMarker {
9785    type Proxy = PopupFrameCreationListenerProxy;
9786    type RequestStream = PopupFrameCreationListenerRequestStream;
9787    #[cfg(target_os = "fuchsia")]
9788    type SynchronousProxy = PopupFrameCreationListenerSynchronousProxy;
9789
9790    const DEBUG_NAME: &'static str = "(anonymous) PopupFrameCreationListener";
9791}
9792
9793pub trait PopupFrameCreationListenerProxyInterface: Send + Sync {
9794    type OnPopupFrameCreatedResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
9795        + Send;
9796    fn r#on_popup_frame_created(
9797        &self,
9798        frame: fidl::endpoints::ClientEnd<FrameMarker>,
9799        info: PopupFrameCreationInfo,
9800    ) -> Self::OnPopupFrameCreatedResponseFut;
9801}
9802#[derive(Debug)]
9803#[cfg(target_os = "fuchsia")]
9804pub struct PopupFrameCreationListenerSynchronousProxy {
9805    client: fidl::client::sync::Client,
9806}
9807
9808#[cfg(target_os = "fuchsia")]
9809impl fidl::endpoints::SynchronousProxy for PopupFrameCreationListenerSynchronousProxy {
9810    type Proxy = PopupFrameCreationListenerProxy;
9811    type Protocol = PopupFrameCreationListenerMarker;
9812
9813    fn from_channel(inner: fidl::Channel) -> Self {
9814        Self::new(inner)
9815    }
9816
9817    fn into_channel(self) -> fidl::Channel {
9818        self.client.into_channel()
9819    }
9820
9821    fn as_channel(&self) -> &fidl::Channel {
9822        self.client.as_channel()
9823    }
9824}
9825
9826#[cfg(target_os = "fuchsia")]
9827impl PopupFrameCreationListenerSynchronousProxy {
9828    pub fn new(channel: fidl::Channel) -> Self {
9829        let protocol_name =
9830            <PopupFrameCreationListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9831        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
9832    }
9833
9834    pub fn into_channel(self) -> fidl::Channel {
9835        self.client.into_channel()
9836    }
9837
9838    /// Waits until an event arrives and returns it. It is safe for other
9839    /// threads to make concurrent requests while waiting for an event.
9840    pub fn wait_for_event(
9841        &self,
9842        deadline: zx::MonotonicInstant,
9843    ) -> Result<PopupFrameCreationListenerEvent, fidl::Error> {
9844        PopupFrameCreationListenerEvent::decode(self.client.wait_for_event(deadline)?)
9845    }
9846
9847    /// Called when a [`Frame`] has created a new popup `frame`. Information about the popup frame,
9848    /// and how it was created, is provided via `info`. Additional popup frames are delivered after
9849    /// the acknowledgement callback is invoked.
9850    pub fn r#on_popup_frame_created(
9851        &self,
9852        mut frame: fidl::endpoints::ClientEnd<FrameMarker>,
9853        mut info: PopupFrameCreationInfo,
9854        ___deadline: zx::MonotonicInstant,
9855    ) -> Result<(), fidl::Error> {
9856        let _response = self.client.send_query::<
9857            PopupFrameCreationListenerOnPopupFrameCreatedRequest,
9858            fidl::encoding::EmptyPayload,
9859        >(
9860            (frame, &mut info,),
9861            0x19b212672dc41d51,
9862            fidl::encoding::DynamicFlags::empty(),
9863            ___deadline,
9864        )?;
9865        Ok(_response)
9866    }
9867}
9868
9869#[cfg(target_os = "fuchsia")]
9870impl From<PopupFrameCreationListenerSynchronousProxy> for zx::Handle {
9871    fn from(value: PopupFrameCreationListenerSynchronousProxy) -> Self {
9872        value.into_channel().into()
9873    }
9874}
9875
9876#[cfg(target_os = "fuchsia")]
9877impl From<fidl::Channel> for PopupFrameCreationListenerSynchronousProxy {
9878    fn from(value: fidl::Channel) -> Self {
9879        Self::new(value)
9880    }
9881}
9882
9883#[cfg(target_os = "fuchsia")]
9884impl fidl::endpoints::FromClient for PopupFrameCreationListenerSynchronousProxy {
9885    type Protocol = PopupFrameCreationListenerMarker;
9886
9887    fn from_client(value: fidl::endpoints::ClientEnd<PopupFrameCreationListenerMarker>) -> Self {
9888        Self::new(value.into_channel())
9889    }
9890}
9891
9892#[derive(Debug, Clone)]
9893pub struct PopupFrameCreationListenerProxy {
9894    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
9895}
9896
9897impl fidl::endpoints::Proxy for PopupFrameCreationListenerProxy {
9898    type Protocol = PopupFrameCreationListenerMarker;
9899
9900    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
9901        Self::new(inner)
9902    }
9903
9904    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
9905        self.client.into_channel().map_err(|client| Self { client })
9906    }
9907
9908    fn as_channel(&self) -> &::fidl::AsyncChannel {
9909        self.client.as_channel()
9910    }
9911}
9912
9913impl PopupFrameCreationListenerProxy {
9914    /// Create a new Proxy for fuchsia.web/PopupFrameCreationListener.
9915    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
9916        let protocol_name =
9917            <PopupFrameCreationListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9918        Self { client: fidl::client::Client::new(channel, protocol_name) }
9919    }
9920
9921    /// Get a Stream of events from the remote end of the protocol.
9922    ///
9923    /// # Panics
9924    ///
9925    /// Panics if the event stream was already taken.
9926    pub fn take_event_stream(&self) -> PopupFrameCreationListenerEventStream {
9927        PopupFrameCreationListenerEventStream { event_receiver: self.client.take_event_receiver() }
9928    }
9929
9930    /// Called when a [`Frame`] has created a new popup `frame`. Information about the popup frame,
9931    /// and how it was created, is provided via `info`. Additional popup frames are delivered after
9932    /// the acknowledgement callback is invoked.
9933    pub fn r#on_popup_frame_created(
9934        &self,
9935        mut frame: fidl::endpoints::ClientEnd<FrameMarker>,
9936        mut info: PopupFrameCreationInfo,
9937    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
9938        PopupFrameCreationListenerProxyInterface::r#on_popup_frame_created(self, frame, info)
9939    }
9940}
9941
9942impl PopupFrameCreationListenerProxyInterface for PopupFrameCreationListenerProxy {
9943    type OnPopupFrameCreatedResponseFut =
9944        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
9945    fn r#on_popup_frame_created(
9946        &self,
9947        mut frame: fidl::endpoints::ClientEnd<FrameMarker>,
9948        mut info: PopupFrameCreationInfo,
9949    ) -> Self::OnPopupFrameCreatedResponseFut {
9950        fn _decode(
9951            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9952        ) -> Result<(), fidl::Error> {
9953            let _response = fidl::client::decode_transaction_body::<
9954                fidl::encoding::EmptyPayload,
9955                fidl::encoding::DefaultFuchsiaResourceDialect,
9956                0x19b212672dc41d51,
9957            >(_buf?)?;
9958            Ok(_response)
9959        }
9960        self.client
9961            .send_query_and_decode::<PopupFrameCreationListenerOnPopupFrameCreatedRequest, ()>(
9962                (frame, &mut info),
9963                0x19b212672dc41d51,
9964                fidl::encoding::DynamicFlags::empty(),
9965                _decode,
9966            )
9967    }
9968}
9969
9970pub struct PopupFrameCreationListenerEventStream {
9971    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
9972}
9973
9974impl std::marker::Unpin for PopupFrameCreationListenerEventStream {}
9975
9976impl futures::stream::FusedStream for PopupFrameCreationListenerEventStream {
9977    fn is_terminated(&self) -> bool {
9978        self.event_receiver.is_terminated()
9979    }
9980}
9981
9982impl futures::Stream for PopupFrameCreationListenerEventStream {
9983    type Item = Result<PopupFrameCreationListenerEvent, fidl::Error>;
9984
9985    fn poll_next(
9986        mut self: std::pin::Pin<&mut Self>,
9987        cx: &mut std::task::Context<'_>,
9988    ) -> std::task::Poll<Option<Self::Item>> {
9989        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
9990            &mut self.event_receiver,
9991            cx
9992        )?) {
9993            Some(buf) => std::task::Poll::Ready(Some(PopupFrameCreationListenerEvent::decode(buf))),
9994            None => std::task::Poll::Ready(None),
9995        }
9996    }
9997}
9998
9999#[derive(Debug)]
10000pub enum PopupFrameCreationListenerEvent {}
10001
10002impl PopupFrameCreationListenerEvent {
10003    /// Decodes a message buffer as a [`PopupFrameCreationListenerEvent`].
10004    fn decode(
10005        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
10006    ) -> Result<PopupFrameCreationListenerEvent, fidl::Error> {
10007        let (bytes, _handles) = buf.split_mut();
10008        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10009        debug_assert_eq!(tx_header.tx_id, 0);
10010        match tx_header.ordinal {
10011            _ => Err(fidl::Error::UnknownOrdinal {
10012                ordinal: tx_header.ordinal,
10013                protocol_name: <PopupFrameCreationListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
10014            })
10015        }
10016    }
10017}
10018
10019/// A Stream of incoming requests for fuchsia.web/PopupFrameCreationListener.
10020pub struct PopupFrameCreationListenerRequestStream {
10021    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10022    is_terminated: bool,
10023}
10024
10025impl std::marker::Unpin for PopupFrameCreationListenerRequestStream {}
10026
10027impl futures::stream::FusedStream for PopupFrameCreationListenerRequestStream {
10028    fn is_terminated(&self) -> bool {
10029        self.is_terminated
10030    }
10031}
10032
10033impl fidl::endpoints::RequestStream for PopupFrameCreationListenerRequestStream {
10034    type Protocol = PopupFrameCreationListenerMarker;
10035    type ControlHandle = PopupFrameCreationListenerControlHandle;
10036
10037    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
10038        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
10039    }
10040
10041    fn control_handle(&self) -> Self::ControlHandle {
10042        PopupFrameCreationListenerControlHandle { inner: self.inner.clone() }
10043    }
10044
10045    fn into_inner(
10046        self,
10047    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
10048    {
10049        (self.inner, self.is_terminated)
10050    }
10051
10052    fn from_inner(
10053        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10054        is_terminated: bool,
10055    ) -> Self {
10056        Self { inner, is_terminated }
10057    }
10058}
10059
10060impl futures::Stream for PopupFrameCreationListenerRequestStream {
10061    type Item = Result<PopupFrameCreationListenerRequest, fidl::Error>;
10062
10063    fn poll_next(
10064        mut self: std::pin::Pin<&mut Self>,
10065        cx: &mut std::task::Context<'_>,
10066    ) -> std::task::Poll<Option<Self::Item>> {
10067        let this = &mut *self;
10068        if this.inner.check_shutdown(cx) {
10069            this.is_terminated = true;
10070            return std::task::Poll::Ready(None);
10071        }
10072        if this.is_terminated {
10073            panic!("polled PopupFrameCreationListenerRequestStream after completion");
10074        }
10075        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
10076            |bytes, handles| {
10077                match this.inner.channel().read_etc(cx, bytes, handles) {
10078                    std::task::Poll::Ready(Ok(())) => {}
10079                    std::task::Poll::Pending => return std::task::Poll::Pending,
10080                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
10081                        this.is_terminated = true;
10082                        return std::task::Poll::Ready(None);
10083                    }
10084                    std::task::Poll::Ready(Err(e)) => {
10085                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
10086                            e.into(),
10087                        ))));
10088                    }
10089                }
10090
10091                // A message has been received from the channel
10092                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10093
10094                std::task::Poll::Ready(Some(match header.ordinal {
10095                0x19b212672dc41d51 => {
10096                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10097                    let mut req = fidl::new_empty!(PopupFrameCreationListenerOnPopupFrameCreatedRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
10098                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PopupFrameCreationListenerOnPopupFrameCreatedRequest>(&header, _body_bytes, handles, &mut req)?;
10099                    let control_handle = PopupFrameCreationListenerControlHandle {
10100                        inner: this.inner.clone(),
10101                    };
10102                    Ok(PopupFrameCreationListenerRequest::OnPopupFrameCreated {frame: req.frame,
10103info: req.info,
10104
10105                        responder: PopupFrameCreationListenerOnPopupFrameCreatedResponder {
10106                            control_handle: std::mem::ManuallyDrop::new(control_handle),
10107                            tx_id: header.tx_id,
10108                        },
10109                    })
10110                }
10111                _ => Err(fidl::Error::UnknownOrdinal {
10112                    ordinal: header.ordinal,
10113                    protocol_name: <PopupFrameCreationListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
10114                }),
10115            }))
10116            },
10117        )
10118    }
10119}
10120
10121#[derive(Debug)]
10122pub enum PopupFrameCreationListenerRequest {
10123    /// Called when a [`Frame`] has created a new popup `frame`. Information about the popup frame,
10124    /// and how it was created, is provided via `info`. Additional popup frames are delivered after
10125    /// the acknowledgement callback is invoked.
10126    OnPopupFrameCreated {
10127        frame: fidl::endpoints::ClientEnd<FrameMarker>,
10128        info: PopupFrameCreationInfo,
10129        responder: PopupFrameCreationListenerOnPopupFrameCreatedResponder,
10130    },
10131}
10132
10133impl PopupFrameCreationListenerRequest {
10134    #[allow(irrefutable_let_patterns)]
10135    pub fn into_on_popup_frame_created(
10136        self,
10137    ) -> Option<(
10138        fidl::endpoints::ClientEnd<FrameMarker>,
10139        PopupFrameCreationInfo,
10140        PopupFrameCreationListenerOnPopupFrameCreatedResponder,
10141    )> {
10142        if let PopupFrameCreationListenerRequest::OnPopupFrameCreated { frame, info, responder } =
10143            self
10144        {
10145            Some((frame, info, responder))
10146        } else {
10147            None
10148        }
10149    }
10150
10151    /// Name of the method defined in FIDL
10152    pub fn method_name(&self) -> &'static str {
10153        match *self {
10154            PopupFrameCreationListenerRequest::OnPopupFrameCreated { .. } => {
10155                "on_popup_frame_created"
10156            }
10157        }
10158    }
10159}
10160
10161#[derive(Debug, Clone)]
10162pub struct PopupFrameCreationListenerControlHandle {
10163    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10164}
10165
10166impl fidl::endpoints::ControlHandle for PopupFrameCreationListenerControlHandle {
10167    fn shutdown(&self) {
10168        self.inner.shutdown()
10169    }
10170    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
10171        self.inner.shutdown_with_epitaph(status)
10172    }
10173
10174    fn is_closed(&self) -> bool {
10175        self.inner.channel().is_closed()
10176    }
10177    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
10178        self.inner.channel().on_closed()
10179    }
10180
10181    #[cfg(target_os = "fuchsia")]
10182    fn signal_peer(
10183        &self,
10184        clear_mask: zx::Signals,
10185        set_mask: zx::Signals,
10186    ) -> Result<(), zx_status::Status> {
10187        use fidl::Peered;
10188        self.inner.channel().signal_peer(clear_mask, set_mask)
10189    }
10190}
10191
10192impl PopupFrameCreationListenerControlHandle {}
10193
10194#[must_use = "FIDL methods require a response to be sent"]
10195#[derive(Debug)]
10196pub struct PopupFrameCreationListenerOnPopupFrameCreatedResponder {
10197    control_handle: std::mem::ManuallyDrop<PopupFrameCreationListenerControlHandle>,
10198    tx_id: u32,
10199}
10200
10201/// Set the the channel to be shutdown (see [`PopupFrameCreationListenerControlHandle::shutdown`])
10202/// if the responder is dropped without sending a response, so that the client
10203/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10204impl std::ops::Drop for PopupFrameCreationListenerOnPopupFrameCreatedResponder {
10205    fn drop(&mut self) {
10206        self.control_handle.shutdown();
10207        // Safety: drops once, never accessed again
10208        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10209    }
10210}
10211
10212impl fidl::endpoints::Responder for PopupFrameCreationListenerOnPopupFrameCreatedResponder {
10213    type ControlHandle = PopupFrameCreationListenerControlHandle;
10214
10215    fn control_handle(&self) -> &PopupFrameCreationListenerControlHandle {
10216        &self.control_handle
10217    }
10218
10219    fn drop_without_shutdown(mut self) {
10220        // Safety: drops once, never accessed again due to mem::forget
10221        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10222        // Prevent Drop from running (which would shut down the channel)
10223        std::mem::forget(self);
10224    }
10225}
10226
10227impl PopupFrameCreationListenerOnPopupFrameCreatedResponder {
10228    /// Sends a response to the FIDL transaction.
10229    ///
10230    /// Sets the channel to shutdown if an error occurs.
10231    pub fn send(self) -> Result<(), fidl::Error> {
10232        let _result = self.send_raw();
10233        if _result.is_err() {
10234            self.control_handle.shutdown();
10235        }
10236        self.drop_without_shutdown();
10237        _result
10238    }
10239
10240    /// Similar to "send" but does not shutdown the channel if an error occurs.
10241    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
10242        let _result = self.send_raw();
10243        self.drop_without_shutdown();
10244        _result
10245    }
10246
10247    fn send_raw(&self) -> Result<(), fidl::Error> {
10248        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
10249            (),
10250            self.tx_id,
10251            0x19b212672dc41d51,
10252            fidl::encoding::DynamicFlags::empty(),
10253        )
10254    }
10255}
10256
10257mod internal {
10258    use super::*;
10259
10260    impl fidl::encoding::ResourceTypeMarker for ContextCreateFrameRequest {
10261        type Borrowed<'a> = &'a mut Self;
10262        fn take_or_borrow<'a>(
10263            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10264        ) -> Self::Borrowed<'a> {
10265            value
10266        }
10267    }
10268
10269    unsafe impl fidl::encoding::TypeMarker for ContextCreateFrameRequest {
10270        type Owned = Self;
10271
10272        #[inline(always)]
10273        fn inline_align(_context: fidl::encoding::Context) -> usize {
10274            4
10275        }
10276
10277        #[inline(always)]
10278        fn inline_size(_context: fidl::encoding::Context) -> usize {
10279            4
10280        }
10281    }
10282
10283    unsafe impl
10284        fidl::encoding::Encode<
10285            ContextCreateFrameRequest,
10286            fidl::encoding::DefaultFuchsiaResourceDialect,
10287        > for &mut ContextCreateFrameRequest
10288    {
10289        #[inline]
10290        unsafe fn encode(
10291            self,
10292            encoder: &mut fidl::encoding::Encoder<
10293                '_,
10294                fidl::encoding::DefaultFuchsiaResourceDialect,
10295            >,
10296            offset: usize,
10297            _depth: fidl::encoding::Depth,
10298        ) -> fidl::Result<()> {
10299            encoder.debug_check_bounds::<ContextCreateFrameRequest>(offset);
10300            // Delegate to tuple encoding.
10301            fidl::encoding::Encode::<ContextCreateFrameRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10302                (
10303                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FrameMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.frame),
10304                ),
10305                encoder, offset, _depth
10306            )
10307        }
10308    }
10309    unsafe impl<
10310        T0: fidl::encoding::Encode<
10311                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FrameMarker>>,
10312                fidl::encoding::DefaultFuchsiaResourceDialect,
10313            >,
10314    >
10315        fidl::encoding::Encode<
10316            ContextCreateFrameRequest,
10317            fidl::encoding::DefaultFuchsiaResourceDialect,
10318        > for (T0,)
10319    {
10320        #[inline]
10321        unsafe fn encode(
10322            self,
10323            encoder: &mut fidl::encoding::Encoder<
10324                '_,
10325                fidl::encoding::DefaultFuchsiaResourceDialect,
10326            >,
10327            offset: usize,
10328            depth: fidl::encoding::Depth,
10329        ) -> fidl::Result<()> {
10330            encoder.debug_check_bounds::<ContextCreateFrameRequest>(offset);
10331            // Zero out padding regions. There's no need to apply masks
10332            // because the unmasked parts will be overwritten by fields.
10333            // Write the fields.
10334            self.0.encode(encoder, offset + 0, depth)?;
10335            Ok(())
10336        }
10337    }
10338
10339    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10340        for ContextCreateFrameRequest
10341    {
10342        #[inline(always)]
10343        fn new_empty() -> Self {
10344            Self {
10345                frame: fidl::new_empty!(
10346                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FrameMarker>>,
10347                    fidl::encoding::DefaultFuchsiaResourceDialect
10348                ),
10349            }
10350        }
10351
10352        #[inline]
10353        unsafe fn decode(
10354            &mut self,
10355            decoder: &mut fidl::encoding::Decoder<
10356                '_,
10357                fidl::encoding::DefaultFuchsiaResourceDialect,
10358            >,
10359            offset: usize,
10360            _depth: fidl::encoding::Depth,
10361        ) -> fidl::Result<()> {
10362            decoder.debug_check_bounds::<Self>(offset);
10363            // Verify that padding bytes are zero.
10364            fidl::decode!(
10365                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FrameMarker>>,
10366                fidl::encoding::DefaultFuchsiaResourceDialect,
10367                &mut self.frame,
10368                decoder,
10369                offset + 0,
10370                _depth
10371            )?;
10372            Ok(())
10373        }
10374    }
10375
10376    impl fidl::encoding::ResourceTypeMarker for ContextCreateFrameWithParamsRequest {
10377        type Borrowed<'a> = &'a mut Self;
10378        fn take_or_borrow<'a>(
10379            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10380        ) -> Self::Borrowed<'a> {
10381            value
10382        }
10383    }
10384
10385    unsafe impl fidl::encoding::TypeMarker for ContextCreateFrameWithParamsRequest {
10386        type Owned = Self;
10387
10388        #[inline(always)]
10389        fn inline_align(_context: fidl::encoding::Context) -> usize {
10390            8
10391        }
10392
10393        #[inline(always)]
10394        fn inline_size(_context: fidl::encoding::Context) -> usize {
10395            24
10396        }
10397    }
10398
10399    unsafe impl
10400        fidl::encoding::Encode<
10401            ContextCreateFrameWithParamsRequest,
10402            fidl::encoding::DefaultFuchsiaResourceDialect,
10403        > for &mut ContextCreateFrameWithParamsRequest
10404    {
10405        #[inline]
10406        unsafe fn encode(
10407            self,
10408            encoder: &mut fidl::encoding::Encoder<
10409                '_,
10410                fidl::encoding::DefaultFuchsiaResourceDialect,
10411            >,
10412            offset: usize,
10413            _depth: fidl::encoding::Depth,
10414        ) -> fidl::Result<()> {
10415            encoder.debug_check_bounds::<ContextCreateFrameWithParamsRequest>(offset);
10416            // Delegate to tuple encoding.
10417            fidl::encoding::Encode::<ContextCreateFrameWithParamsRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10418                (
10419                    <CreateFrameParams as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.params),
10420                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FrameMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.frame),
10421                ),
10422                encoder, offset, _depth
10423            )
10424        }
10425    }
10426    unsafe impl<
10427        T0: fidl::encoding::Encode<CreateFrameParams, fidl::encoding::DefaultFuchsiaResourceDialect>,
10428        T1: fidl::encoding::Encode<
10429                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FrameMarker>>,
10430                fidl::encoding::DefaultFuchsiaResourceDialect,
10431            >,
10432    >
10433        fidl::encoding::Encode<
10434            ContextCreateFrameWithParamsRequest,
10435            fidl::encoding::DefaultFuchsiaResourceDialect,
10436        > for (T0, T1)
10437    {
10438        #[inline]
10439        unsafe fn encode(
10440            self,
10441            encoder: &mut fidl::encoding::Encoder<
10442                '_,
10443                fidl::encoding::DefaultFuchsiaResourceDialect,
10444            >,
10445            offset: usize,
10446            depth: fidl::encoding::Depth,
10447        ) -> fidl::Result<()> {
10448            encoder.debug_check_bounds::<ContextCreateFrameWithParamsRequest>(offset);
10449            // Zero out padding regions. There's no need to apply masks
10450            // because the unmasked parts will be overwritten by fields.
10451            unsafe {
10452                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
10453                (ptr as *mut u64).write_unaligned(0);
10454            }
10455            // Write the fields.
10456            self.0.encode(encoder, offset + 0, depth)?;
10457            self.1.encode(encoder, offset + 16, depth)?;
10458            Ok(())
10459        }
10460    }
10461
10462    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10463        for ContextCreateFrameWithParamsRequest
10464    {
10465        #[inline(always)]
10466        fn new_empty() -> Self {
10467            Self {
10468                params: fidl::new_empty!(
10469                    CreateFrameParams,
10470                    fidl::encoding::DefaultFuchsiaResourceDialect
10471                ),
10472                frame: fidl::new_empty!(
10473                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FrameMarker>>,
10474                    fidl::encoding::DefaultFuchsiaResourceDialect
10475                ),
10476            }
10477        }
10478
10479        #[inline]
10480        unsafe fn decode(
10481            &mut self,
10482            decoder: &mut fidl::encoding::Decoder<
10483                '_,
10484                fidl::encoding::DefaultFuchsiaResourceDialect,
10485            >,
10486            offset: usize,
10487            _depth: fidl::encoding::Depth,
10488        ) -> fidl::Result<()> {
10489            decoder.debug_check_bounds::<Self>(offset);
10490            // Verify that padding bytes are zero.
10491            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
10492            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10493            let mask = 0xffffffff00000000u64;
10494            let maskedval = padval & mask;
10495            if maskedval != 0 {
10496                return Err(fidl::Error::NonZeroPadding {
10497                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
10498                });
10499            }
10500            fidl::decode!(
10501                CreateFrameParams,
10502                fidl::encoding::DefaultFuchsiaResourceDialect,
10503                &mut self.params,
10504                decoder,
10505                offset + 0,
10506                _depth
10507            )?;
10508            fidl::decode!(
10509                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FrameMarker>>,
10510                fidl::encoding::DefaultFuchsiaResourceDialect,
10511                &mut self.frame,
10512                decoder,
10513                offset + 16,
10514                _depth
10515            )?;
10516            Ok(())
10517        }
10518    }
10519
10520    impl fidl::encoding::ResourceTypeMarker for ContextGetCookieManagerRequest {
10521        type Borrowed<'a> = &'a mut Self;
10522        fn take_or_borrow<'a>(
10523            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10524        ) -> Self::Borrowed<'a> {
10525            value
10526        }
10527    }
10528
10529    unsafe impl fidl::encoding::TypeMarker for ContextGetCookieManagerRequest {
10530        type Owned = Self;
10531
10532        #[inline(always)]
10533        fn inline_align(_context: fidl::encoding::Context) -> usize {
10534            4
10535        }
10536
10537        #[inline(always)]
10538        fn inline_size(_context: fidl::encoding::Context) -> usize {
10539            4
10540        }
10541    }
10542
10543    unsafe impl
10544        fidl::encoding::Encode<
10545            ContextGetCookieManagerRequest,
10546            fidl::encoding::DefaultFuchsiaResourceDialect,
10547        > for &mut ContextGetCookieManagerRequest
10548    {
10549        #[inline]
10550        unsafe fn encode(
10551            self,
10552            encoder: &mut fidl::encoding::Encoder<
10553                '_,
10554                fidl::encoding::DefaultFuchsiaResourceDialect,
10555            >,
10556            offset: usize,
10557            _depth: fidl::encoding::Depth,
10558        ) -> fidl::Result<()> {
10559            encoder.debug_check_bounds::<ContextGetCookieManagerRequest>(offset);
10560            // Delegate to tuple encoding.
10561            fidl::encoding::Encode::<ContextGetCookieManagerRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10562                (
10563                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookieManagerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.manager),
10564                ),
10565                encoder, offset, _depth
10566            )
10567        }
10568    }
10569    unsafe impl<
10570        T0: fidl::encoding::Encode<
10571                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookieManagerMarker>>,
10572                fidl::encoding::DefaultFuchsiaResourceDialect,
10573            >,
10574    >
10575        fidl::encoding::Encode<
10576            ContextGetCookieManagerRequest,
10577            fidl::encoding::DefaultFuchsiaResourceDialect,
10578        > for (T0,)
10579    {
10580        #[inline]
10581        unsafe fn encode(
10582            self,
10583            encoder: &mut fidl::encoding::Encoder<
10584                '_,
10585                fidl::encoding::DefaultFuchsiaResourceDialect,
10586            >,
10587            offset: usize,
10588            depth: fidl::encoding::Depth,
10589        ) -> fidl::Result<()> {
10590            encoder.debug_check_bounds::<ContextGetCookieManagerRequest>(offset);
10591            // Zero out padding regions. There's no need to apply masks
10592            // because the unmasked parts will be overwritten by fields.
10593            // Write the fields.
10594            self.0.encode(encoder, offset + 0, depth)?;
10595            Ok(())
10596        }
10597    }
10598
10599    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10600        for ContextGetCookieManagerRequest
10601    {
10602        #[inline(always)]
10603        fn new_empty() -> Self {
10604            Self {
10605                manager: fidl::new_empty!(
10606                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookieManagerMarker>>,
10607                    fidl::encoding::DefaultFuchsiaResourceDialect
10608                ),
10609            }
10610        }
10611
10612        #[inline]
10613        unsafe fn decode(
10614            &mut self,
10615            decoder: &mut fidl::encoding::Decoder<
10616                '_,
10617                fidl::encoding::DefaultFuchsiaResourceDialect,
10618            >,
10619            offset: usize,
10620            _depth: fidl::encoding::Depth,
10621        ) -> fidl::Result<()> {
10622            decoder.debug_check_bounds::<Self>(offset);
10623            // Verify that padding bytes are zero.
10624            fidl::decode!(
10625                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookieManagerMarker>>,
10626                fidl::encoding::DefaultFuchsiaResourceDialect,
10627                &mut self.manager,
10628                decoder,
10629                offset + 0,
10630                _depth
10631            )?;
10632            Ok(())
10633        }
10634    }
10635
10636    impl fidl::encoding::ResourceTypeMarker for ContextProviderCreateRequest {
10637        type Borrowed<'a> = &'a mut Self;
10638        fn take_or_borrow<'a>(
10639            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10640        ) -> Self::Borrowed<'a> {
10641            value
10642        }
10643    }
10644
10645    unsafe impl fidl::encoding::TypeMarker for ContextProviderCreateRequest {
10646        type Owned = Self;
10647
10648        #[inline(always)]
10649        fn inline_align(_context: fidl::encoding::Context) -> usize {
10650            8
10651        }
10652
10653        #[inline(always)]
10654        fn inline_size(_context: fidl::encoding::Context) -> usize {
10655            24
10656        }
10657    }
10658
10659    unsafe impl
10660        fidl::encoding::Encode<
10661            ContextProviderCreateRequest,
10662            fidl::encoding::DefaultFuchsiaResourceDialect,
10663        > for &mut ContextProviderCreateRequest
10664    {
10665        #[inline]
10666        unsafe fn encode(
10667            self,
10668            encoder: &mut fidl::encoding::Encoder<
10669                '_,
10670                fidl::encoding::DefaultFuchsiaResourceDialect,
10671            >,
10672            offset: usize,
10673            _depth: fidl::encoding::Depth,
10674        ) -> fidl::Result<()> {
10675            encoder.debug_check_bounds::<ContextProviderCreateRequest>(offset);
10676            // Delegate to tuple encoding.
10677            fidl::encoding::Encode::<ContextProviderCreateRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10678                (
10679                    <CreateContextParams as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.params),
10680                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ContextMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.context),
10681                ),
10682                encoder, offset, _depth
10683            )
10684        }
10685    }
10686    unsafe impl<
10687        T0: fidl::encoding::Encode<CreateContextParams, fidl::encoding::DefaultFuchsiaResourceDialect>,
10688        T1: fidl::encoding::Encode<
10689                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ContextMarker>>,
10690                fidl::encoding::DefaultFuchsiaResourceDialect,
10691            >,
10692    >
10693        fidl::encoding::Encode<
10694            ContextProviderCreateRequest,
10695            fidl::encoding::DefaultFuchsiaResourceDialect,
10696        > for (T0, T1)
10697    {
10698        #[inline]
10699        unsafe fn encode(
10700            self,
10701            encoder: &mut fidl::encoding::Encoder<
10702                '_,
10703                fidl::encoding::DefaultFuchsiaResourceDialect,
10704            >,
10705            offset: usize,
10706            depth: fidl::encoding::Depth,
10707        ) -> fidl::Result<()> {
10708            encoder.debug_check_bounds::<ContextProviderCreateRequest>(offset);
10709            // Zero out padding regions. There's no need to apply masks
10710            // because the unmasked parts will be overwritten by fields.
10711            unsafe {
10712                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
10713                (ptr as *mut u64).write_unaligned(0);
10714            }
10715            // Write the fields.
10716            self.0.encode(encoder, offset + 0, depth)?;
10717            self.1.encode(encoder, offset + 16, depth)?;
10718            Ok(())
10719        }
10720    }
10721
10722    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10723        for ContextProviderCreateRequest
10724    {
10725        #[inline(always)]
10726        fn new_empty() -> Self {
10727            Self {
10728                params: fidl::new_empty!(
10729                    CreateContextParams,
10730                    fidl::encoding::DefaultFuchsiaResourceDialect
10731                ),
10732                context: fidl::new_empty!(
10733                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ContextMarker>>,
10734                    fidl::encoding::DefaultFuchsiaResourceDialect
10735                ),
10736            }
10737        }
10738
10739        #[inline]
10740        unsafe fn decode(
10741            &mut self,
10742            decoder: &mut fidl::encoding::Decoder<
10743                '_,
10744                fidl::encoding::DefaultFuchsiaResourceDialect,
10745            >,
10746            offset: usize,
10747            _depth: fidl::encoding::Depth,
10748        ) -> fidl::Result<()> {
10749            decoder.debug_check_bounds::<Self>(offset);
10750            // Verify that padding bytes are zero.
10751            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
10752            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10753            let mask = 0xffffffff00000000u64;
10754            let maskedval = padval & mask;
10755            if maskedval != 0 {
10756                return Err(fidl::Error::NonZeroPadding {
10757                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
10758                });
10759            }
10760            fidl::decode!(
10761                CreateContextParams,
10762                fidl::encoding::DefaultFuchsiaResourceDialect,
10763                &mut self.params,
10764                decoder,
10765                offset + 0,
10766                _depth
10767            )?;
10768            fidl::decode!(
10769                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ContextMarker>>,
10770                fidl::encoding::DefaultFuchsiaResourceDialect,
10771                &mut self.context,
10772                decoder,
10773                offset + 16,
10774                _depth
10775            )?;
10776            Ok(())
10777        }
10778    }
10779
10780    impl fidl::encoding::ResourceTypeMarker for CookieManagerGetCookieListRequest {
10781        type Borrowed<'a> = &'a mut Self;
10782        fn take_or_borrow<'a>(
10783            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10784        ) -> Self::Borrowed<'a> {
10785            value
10786        }
10787    }
10788
10789    unsafe impl fidl::encoding::TypeMarker for CookieManagerGetCookieListRequest {
10790        type Owned = Self;
10791
10792        #[inline(always)]
10793        fn inline_align(_context: fidl::encoding::Context) -> usize {
10794            8
10795        }
10796
10797        #[inline(always)]
10798        fn inline_size(_context: fidl::encoding::Context) -> usize {
10799            40
10800        }
10801    }
10802
10803    unsafe impl
10804        fidl::encoding::Encode<
10805            CookieManagerGetCookieListRequest,
10806            fidl::encoding::DefaultFuchsiaResourceDialect,
10807        > for &mut CookieManagerGetCookieListRequest
10808    {
10809        #[inline]
10810        unsafe fn encode(
10811            self,
10812            encoder: &mut fidl::encoding::Encoder<
10813                '_,
10814                fidl::encoding::DefaultFuchsiaResourceDialect,
10815            >,
10816            offset: usize,
10817            _depth: fidl::encoding::Depth,
10818        ) -> fidl::Result<()> {
10819            encoder.debug_check_bounds::<CookieManagerGetCookieListRequest>(offset);
10820            // Delegate to tuple encoding.
10821            fidl::encoding::Encode::<CookieManagerGetCookieListRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10822                (
10823                    <fidl::encoding::Optional<fidl::encoding::BoundedString<65536>> as fidl::encoding::ValueTypeMarker>::borrow(&self.url),
10824                    <fidl::encoding::Optional<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
10825                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookiesIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.cookies),
10826                ),
10827                encoder, offset, _depth
10828            )
10829        }
10830    }
10831    unsafe impl<
10832        T0: fidl::encoding::Encode<
10833                fidl::encoding::Optional<fidl::encoding::BoundedString<65536>>,
10834                fidl::encoding::DefaultFuchsiaResourceDialect,
10835            >,
10836        T1: fidl::encoding::Encode<
10837                fidl::encoding::Optional<fidl::encoding::UnboundedString>,
10838                fidl::encoding::DefaultFuchsiaResourceDialect,
10839            >,
10840        T2: fidl::encoding::Encode<
10841                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookiesIteratorMarker>>,
10842                fidl::encoding::DefaultFuchsiaResourceDialect,
10843            >,
10844    >
10845        fidl::encoding::Encode<
10846            CookieManagerGetCookieListRequest,
10847            fidl::encoding::DefaultFuchsiaResourceDialect,
10848        > for (T0, T1, T2)
10849    {
10850        #[inline]
10851        unsafe fn encode(
10852            self,
10853            encoder: &mut fidl::encoding::Encoder<
10854                '_,
10855                fidl::encoding::DefaultFuchsiaResourceDialect,
10856            >,
10857            offset: usize,
10858            depth: fidl::encoding::Depth,
10859        ) -> fidl::Result<()> {
10860            encoder.debug_check_bounds::<CookieManagerGetCookieListRequest>(offset);
10861            // Zero out padding regions. There's no need to apply masks
10862            // because the unmasked parts will be overwritten by fields.
10863            unsafe {
10864                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
10865                (ptr as *mut u64).write_unaligned(0);
10866            }
10867            // Write the fields.
10868            self.0.encode(encoder, offset + 0, depth)?;
10869            self.1.encode(encoder, offset + 16, depth)?;
10870            self.2.encode(encoder, offset + 32, depth)?;
10871            Ok(())
10872        }
10873    }
10874
10875    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10876        for CookieManagerGetCookieListRequest
10877    {
10878        #[inline(always)]
10879        fn new_empty() -> Self {
10880            Self {
10881                url: fidl::new_empty!(
10882                    fidl::encoding::Optional<fidl::encoding::BoundedString<65536>>,
10883                    fidl::encoding::DefaultFuchsiaResourceDialect
10884                ),
10885                name: fidl::new_empty!(
10886                    fidl::encoding::Optional<fidl::encoding::UnboundedString>,
10887                    fidl::encoding::DefaultFuchsiaResourceDialect
10888                ),
10889                cookies: fidl::new_empty!(
10890                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookiesIteratorMarker>>,
10891                    fidl::encoding::DefaultFuchsiaResourceDialect
10892                ),
10893            }
10894        }
10895
10896        #[inline]
10897        unsafe fn decode(
10898            &mut self,
10899            decoder: &mut fidl::encoding::Decoder<
10900                '_,
10901                fidl::encoding::DefaultFuchsiaResourceDialect,
10902            >,
10903            offset: usize,
10904            _depth: fidl::encoding::Depth,
10905        ) -> fidl::Result<()> {
10906            decoder.debug_check_bounds::<Self>(offset);
10907            // Verify that padding bytes are zero.
10908            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
10909            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10910            let mask = 0xffffffff00000000u64;
10911            let maskedval = padval & mask;
10912            if maskedval != 0 {
10913                return Err(fidl::Error::NonZeroPadding {
10914                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
10915                });
10916            }
10917            fidl::decode!(
10918                fidl::encoding::Optional<fidl::encoding::BoundedString<65536>>,
10919                fidl::encoding::DefaultFuchsiaResourceDialect,
10920                &mut self.url,
10921                decoder,
10922                offset + 0,
10923                _depth
10924            )?;
10925            fidl::decode!(
10926                fidl::encoding::Optional<fidl::encoding::UnboundedString>,
10927                fidl::encoding::DefaultFuchsiaResourceDialect,
10928                &mut self.name,
10929                decoder,
10930                offset + 16,
10931                _depth
10932            )?;
10933            fidl::decode!(
10934                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookiesIteratorMarker>>,
10935                fidl::encoding::DefaultFuchsiaResourceDialect,
10936                &mut self.cookies,
10937                decoder,
10938                offset + 32,
10939                _depth
10940            )?;
10941            Ok(())
10942        }
10943    }
10944
10945    impl fidl::encoding::ResourceTypeMarker for CookieManagerObserveCookieChangesRequest {
10946        type Borrowed<'a> = &'a mut Self;
10947        fn take_or_borrow<'a>(
10948            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10949        ) -> Self::Borrowed<'a> {
10950            value
10951        }
10952    }
10953
10954    unsafe impl fidl::encoding::TypeMarker for CookieManagerObserveCookieChangesRequest {
10955        type Owned = Self;
10956
10957        #[inline(always)]
10958        fn inline_align(_context: fidl::encoding::Context) -> usize {
10959            8
10960        }
10961
10962        #[inline(always)]
10963        fn inline_size(_context: fidl::encoding::Context) -> usize {
10964            40
10965        }
10966    }
10967
10968    unsafe impl
10969        fidl::encoding::Encode<
10970            CookieManagerObserveCookieChangesRequest,
10971            fidl::encoding::DefaultFuchsiaResourceDialect,
10972        > for &mut CookieManagerObserveCookieChangesRequest
10973    {
10974        #[inline]
10975        unsafe fn encode(
10976            self,
10977            encoder: &mut fidl::encoding::Encoder<
10978                '_,
10979                fidl::encoding::DefaultFuchsiaResourceDialect,
10980            >,
10981            offset: usize,
10982            _depth: fidl::encoding::Depth,
10983        ) -> fidl::Result<()> {
10984            encoder.debug_check_bounds::<CookieManagerObserveCookieChangesRequest>(offset);
10985            // Delegate to tuple encoding.
10986            fidl::encoding::Encode::<CookieManagerObserveCookieChangesRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10987                (
10988                    <fidl::encoding::Optional<fidl::encoding::BoundedString<65536>> as fidl::encoding::ValueTypeMarker>::borrow(&self.url),
10989                    <fidl::encoding::Optional<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
10990                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookiesIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.changes),
10991                ),
10992                encoder, offset, _depth
10993            )
10994        }
10995    }
10996    unsafe impl<
10997        T0: fidl::encoding::Encode<
10998                fidl::encoding::Optional<fidl::encoding::BoundedString<65536>>,
10999                fidl::encoding::DefaultFuchsiaResourceDialect,
11000            >,
11001        T1: fidl::encoding::Encode<
11002                fidl::encoding::Optional<fidl::encoding::UnboundedString>,
11003                fidl::encoding::DefaultFuchsiaResourceDialect,
11004            >,
11005        T2: fidl::encoding::Encode<
11006                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookiesIteratorMarker>>,
11007                fidl::encoding::DefaultFuchsiaResourceDialect,
11008            >,
11009    >
11010        fidl::encoding::Encode<
11011            CookieManagerObserveCookieChangesRequest,
11012            fidl::encoding::DefaultFuchsiaResourceDialect,
11013        > for (T0, T1, T2)
11014    {
11015        #[inline]
11016        unsafe fn encode(
11017            self,
11018            encoder: &mut fidl::encoding::Encoder<
11019                '_,
11020                fidl::encoding::DefaultFuchsiaResourceDialect,
11021            >,
11022            offset: usize,
11023            depth: fidl::encoding::Depth,
11024        ) -> fidl::Result<()> {
11025            encoder.debug_check_bounds::<CookieManagerObserveCookieChangesRequest>(offset);
11026            // Zero out padding regions. There's no need to apply masks
11027            // because the unmasked parts will be overwritten by fields.
11028            unsafe {
11029                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
11030                (ptr as *mut u64).write_unaligned(0);
11031            }
11032            // Write the fields.
11033            self.0.encode(encoder, offset + 0, depth)?;
11034            self.1.encode(encoder, offset + 16, depth)?;
11035            self.2.encode(encoder, offset + 32, depth)?;
11036            Ok(())
11037        }
11038    }
11039
11040    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11041        for CookieManagerObserveCookieChangesRequest
11042    {
11043        #[inline(always)]
11044        fn new_empty() -> Self {
11045            Self {
11046                url: fidl::new_empty!(
11047                    fidl::encoding::Optional<fidl::encoding::BoundedString<65536>>,
11048                    fidl::encoding::DefaultFuchsiaResourceDialect
11049                ),
11050                name: fidl::new_empty!(
11051                    fidl::encoding::Optional<fidl::encoding::UnboundedString>,
11052                    fidl::encoding::DefaultFuchsiaResourceDialect
11053                ),
11054                changes: fidl::new_empty!(
11055                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookiesIteratorMarker>>,
11056                    fidl::encoding::DefaultFuchsiaResourceDialect
11057                ),
11058            }
11059        }
11060
11061        #[inline]
11062        unsafe fn decode(
11063            &mut self,
11064            decoder: &mut fidl::encoding::Decoder<
11065                '_,
11066                fidl::encoding::DefaultFuchsiaResourceDialect,
11067            >,
11068            offset: usize,
11069            _depth: fidl::encoding::Depth,
11070        ) -> fidl::Result<()> {
11071            decoder.debug_check_bounds::<Self>(offset);
11072            // Verify that padding bytes are zero.
11073            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
11074            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11075            let mask = 0xffffffff00000000u64;
11076            let maskedval = padval & mask;
11077            if maskedval != 0 {
11078                return Err(fidl::Error::NonZeroPadding {
11079                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
11080                });
11081            }
11082            fidl::decode!(
11083                fidl::encoding::Optional<fidl::encoding::BoundedString<65536>>,
11084                fidl::encoding::DefaultFuchsiaResourceDialect,
11085                &mut self.url,
11086                decoder,
11087                offset + 0,
11088                _depth
11089            )?;
11090            fidl::decode!(
11091                fidl::encoding::Optional<fidl::encoding::UnboundedString>,
11092                fidl::encoding::DefaultFuchsiaResourceDialect,
11093                &mut self.name,
11094                decoder,
11095                offset + 16,
11096                _depth
11097            )?;
11098            fidl::decode!(
11099                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookiesIteratorMarker>>,
11100                fidl::encoding::DefaultFuchsiaResourceDialect,
11101                &mut self.changes,
11102                decoder,
11103                offset + 32,
11104                _depth
11105            )?;
11106            Ok(())
11107        }
11108    }
11109
11110    impl fidl::encoding::ResourceTypeMarker for CookiesIteratorGetNextResponse {
11111        type Borrowed<'a> = &'a mut Self;
11112        fn take_or_borrow<'a>(
11113            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11114        ) -> Self::Borrowed<'a> {
11115            value
11116        }
11117    }
11118
11119    unsafe impl fidl::encoding::TypeMarker for CookiesIteratorGetNextResponse {
11120        type Owned = Self;
11121
11122        #[inline(always)]
11123        fn inline_align(_context: fidl::encoding::Context) -> usize {
11124            8
11125        }
11126
11127        #[inline(always)]
11128        fn inline_size(_context: fidl::encoding::Context) -> usize {
11129            16
11130        }
11131    }
11132
11133    unsafe impl
11134        fidl::encoding::Encode<
11135            CookiesIteratorGetNextResponse,
11136            fidl::encoding::DefaultFuchsiaResourceDialect,
11137        > for &mut CookiesIteratorGetNextResponse
11138    {
11139        #[inline]
11140        unsafe fn encode(
11141            self,
11142            encoder: &mut fidl::encoding::Encoder<
11143                '_,
11144                fidl::encoding::DefaultFuchsiaResourceDialect,
11145            >,
11146            offset: usize,
11147            _depth: fidl::encoding::Depth,
11148        ) -> fidl::Result<()> {
11149            encoder.debug_check_bounds::<CookiesIteratorGetNextResponse>(offset);
11150            // Delegate to tuple encoding.
11151            fidl::encoding::Encode::<CookiesIteratorGetNextResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11152                (
11153                    <fidl::encoding::UnboundedVector<Cookie> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.changed_cookies),
11154                ),
11155                encoder, offset, _depth
11156            )
11157        }
11158    }
11159    unsafe impl<
11160        T0: fidl::encoding::Encode<
11161                fidl::encoding::UnboundedVector<Cookie>,
11162                fidl::encoding::DefaultFuchsiaResourceDialect,
11163            >,
11164    >
11165        fidl::encoding::Encode<
11166            CookiesIteratorGetNextResponse,
11167            fidl::encoding::DefaultFuchsiaResourceDialect,
11168        > for (T0,)
11169    {
11170        #[inline]
11171        unsafe fn encode(
11172            self,
11173            encoder: &mut fidl::encoding::Encoder<
11174                '_,
11175                fidl::encoding::DefaultFuchsiaResourceDialect,
11176            >,
11177            offset: usize,
11178            depth: fidl::encoding::Depth,
11179        ) -> fidl::Result<()> {
11180            encoder.debug_check_bounds::<CookiesIteratorGetNextResponse>(offset);
11181            // Zero out padding regions. There's no need to apply masks
11182            // because the unmasked parts will be overwritten by fields.
11183            // Write the fields.
11184            self.0.encode(encoder, offset + 0, depth)?;
11185            Ok(())
11186        }
11187    }
11188
11189    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11190        for CookiesIteratorGetNextResponse
11191    {
11192        #[inline(always)]
11193        fn new_empty() -> Self {
11194            Self {
11195                changed_cookies: fidl::new_empty!(
11196                    fidl::encoding::UnboundedVector<Cookie>,
11197                    fidl::encoding::DefaultFuchsiaResourceDialect
11198                ),
11199            }
11200        }
11201
11202        #[inline]
11203        unsafe fn decode(
11204            &mut self,
11205            decoder: &mut fidl::encoding::Decoder<
11206                '_,
11207                fidl::encoding::DefaultFuchsiaResourceDialect,
11208            >,
11209            offset: usize,
11210            _depth: fidl::encoding::Depth,
11211        ) -> fidl::Result<()> {
11212            decoder.debug_check_bounds::<Self>(offset);
11213            // Verify that padding bytes are zero.
11214            fidl::decode!(
11215                fidl::encoding::UnboundedVector<Cookie>,
11216                fidl::encoding::DefaultFuchsiaResourceDialect,
11217                &mut self.changed_cookies,
11218                decoder,
11219                offset + 0,
11220                _depth
11221            )?;
11222            Ok(())
11223        }
11224    }
11225
11226    impl fidl::encoding::ResourceTypeMarker for DebugEnableDevToolsRequest {
11227        type Borrowed<'a> = &'a mut Self;
11228        fn take_or_borrow<'a>(
11229            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11230        ) -> Self::Borrowed<'a> {
11231            value
11232        }
11233    }
11234
11235    unsafe impl fidl::encoding::TypeMarker for DebugEnableDevToolsRequest {
11236        type Owned = Self;
11237
11238        #[inline(always)]
11239        fn inline_align(_context: fidl::encoding::Context) -> usize {
11240            4
11241        }
11242
11243        #[inline(always)]
11244        fn inline_size(_context: fidl::encoding::Context) -> usize {
11245            4
11246        }
11247    }
11248
11249    unsafe impl
11250        fidl::encoding::Encode<
11251            DebugEnableDevToolsRequest,
11252            fidl::encoding::DefaultFuchsiaResourceDialect,
11253        > for &mut DebugEnableDevToolsRequest
11254    {
11255        #[inline]
11256        unsafe fn encode(
11257            self,
11258            encoder: &mut fidl::encoding::Encoder<
11259                '_,
11260                fidl::encoding::DefaultFuchsiaResourceDialect,
11261            >,
11262            offset: usize,
11263            _depth: fidl::encoding::Depth,
11264        ) -> fidl::Result<()> {
11265            encoder.debug_check_bounds::<DebugEnableDevToolsRequest>(offset);
11266            // Delegate to tuple encoding.
11267            fidl::encoding::Encode::<DebugEnableDevToolsRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11268                (
11269                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DevToolsListenerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.listener),
11270                ),
11271                encoder, offset, _depth
11272            )
11273        }
11274    }
11275    unsafe impl<
11276        T0: fidl::encoding::Encode<
11277                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DevToolsListenerMarker>>,
11278                fidl::encoding::DefaultFuchsiaResourceDialect,
11279            >,
11280    >
11281        fidl::encoding::Encode<
11282            DebugEnableDevToolsRequest,
11283            fidl::encoding::DefaultFuchsiaResourceDialect,
11284        > for (T0,)
11285    {
11286        #[inline]
11287        unsafe fn encode(
11288            self,
11289            encoder: &mut fidl::encoding::Encoder<
11290                '_,
11291                fidl::encoding::DefaultFuchsiaResourceDialect,
11292            >,
11293            offset: usize,
11294            depth: fidl::encoding::Depth,
11295        ) -> fidl::Result<()> {
11296            encoder.debug_check_bounds::<DebugEnableDevToolsRequest>(offset);
11297            // Zero out padding regions. There's no need to apply masks
11298            // because the unmasked parts will be overwritten by fields.
11299            // Write the fields.
11300            self.0.encode(encoder, offset + 0, depth)?;
11301            Ok(())
11302        }
11303    }
11304
11305    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11306        for DebugEnableDevToolsRequest
11307    {
11308        #[inline(always)]
11309        fn new_empty() -> Self {
11310            Self {
11311                listener: fidl::new_empty!(
11312                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DevToolsListenerMarker>>,
11313                    fidl::encoding::DefaultFuchsiaResourceDialect
11314                ),
11315            }
11316        }
11317
11318        #[inline]
11319        unsafe fn decode(
11320            &mut self,
11321            decoder: &mut fidl::encoding::Decoder<
11322                '_,
11323                fidl::encoding::DefaultFuchsiaResourceDialect,
11324            >,
11325            offset: usize,
11326            _depth: fidl::encoding::Depth,
11327        ) -> fidl::Result<()> {
11328            decoder.debug_check_bounds::<Self>(offset);
11329            // Verify that padding bytes are zero.
11330            fidl::decode!(
11331                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DevToolsListenerMarker>>,
11332                fidl::encoding::DefaultFuchsiaResourceDialect,
11333                &mut self.listener,
11334                decoder,
11335                offset + 0,
11336                _depth
11337            )?;
11338            Ok(())
11339        }
11340    }
11341
11342    impl fidl::encoding::ResourceTypeMarker for DevToolsListenerOnContextDevToolsAvailableRequest {
11343        type Borrowed<'a> = &'a mut Self;
11344        fn take_or_borrow<'a>(
11345            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11346        ) -> Self::Borrowed<'a> {
11347            value
11348        }
11349    }
11350
11351    unsafe impl fidl::encoding::TypeMarker for DevToolsListenerOnContextDevToolsAvailableRequest {
11352        type Owned = Self;
11353
11354        #[inline(always)]
11355        fn inline_align(_context: fidl::encoding::Context) -> usize {
11356            4
11357        }
11358
11359        #[inline(always)]
11360        fn inline_size(_context: fidl::encoding::Context) -> usize {
11361            4
11362        }
11363    }
11364
11365    unsafe impl
11366        fidl::encoding::Encode<
11367            DevToolsListenerOnContextDevToolsAvailableRequest,
11368            fidl::encoding::DefaultFuchsiaResourceDialect,
11369        > for &mut DevToolsListenerOnContextDevToolsAvailableRequest
11370    {
11371        #[inline]
11372        unsafe fn encode(
11373            self,
11374            encoder: &mut fidl::encoding::Encoder<
11375                '_,
11376                fidl::encoding::DefaultFuchsiaResourceDialect,
11377            >,
11378            offset: usize,
11379            _depth: fidl::encoding::Depth,
11380        ) -> fidl::Result<()> {
11381            encoder.debug_check_bounds::<DevToolsListenerOnContextDevToolsAvailableRequest>(offset);
11382            // Delegate to tuple encoding.
11383            fidl::encoding::Encode::<
11384                DevToolsListenerOnContextDevToolsAvailableRequest,
11385                fidl::encoding::DefaultFuchsiaResourceDialect,
11386            >::encode(
11387                (<fidl::encoding::Endpoint<
11388                    fidl::endpoints::ServerEnd<DevToolsPerContextListenerMarker>,
11389                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11390                    &mut self.listener
11391                ),),
11392                encoder,
11393                offset,
11394                _depth,
11395            )
11396        }
11397    }
11398    unsafe impl<
11399        T0: fidl::encoding::Encode<
11400                fidl::encoding::Endpoint<
11401                    fidl::endpoints::ServerEnd<DevToolsPerContextListenerMarker>,
11402                >,
11403                fidl::encoding::DefaultFuchsiaResourceDialect,
11404            >,
11405    >
11406        fidl::encoding::Encode<
11407            DevToolsListenerOnContextDevToolsAvailableRequest,
11408            fidl::encoding::DefaultFuchsiaResourceDialect,
11409        > for (T0,)
11410    {
11411        #[inline]
11412        unsafe fn encode(
11413            self,
11414            encoder: &mut fidl::encoding::Encoder<
11415                '_,
11416                fidl::encoding::DefaultFuchsiaResourceDialect,
11417            >,
11418            offset: usize,
11419            depth: fidl::encoding::Depth,
11420        ) -> fidl::Result<()> {
11421            encoder.debug_check_bounds::<DevToolsListenerOnContextDevToolsAvailableRequest>(offset);
11422            // Zero out padding regions. There's no need to apply masks
11423            // because the unmasked parts will be overwritten by fields.
11424            // Write the fields.
11425            self.0.encode(encoder, offset + 0, depth)?;
11426            Ok(())
11427        }
11428    }
11429
11430    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11431        for DevToolsListenerOnContextDevToolsAvailableRequest
11432    {
11433        #[inline(always)]
11434        fn new_empty() -> Self {
11435            Self {
11436                listener: fidl::new_empty!(
11437                    fidl::encoding::Endpoint<
11438                        fidl::endpoints::ServerEnd<DevToolsPerContextListenerMarker>,
11439                    >,
11440                    fidl::encoding::DefaultFuchsiaResourceDialect
11441                ),
11442            }
11443        }
11444
11445        #[inline]
11446        unsafe fn decode(
11447            &mut self,
11448            decoder: &mut fidl::encoding::Decoder<
11449                '_,
11450                fidl::encoding::DefaultFuchsiaResourceDialect,
11451            >,
11452            offset: usize,
11453            _depth: fidl::encoding::Depth,
11454        ) -> fidl::Result<()> {
11455            decoder.debug_check_bounds::<Self>(offset);
11456            // Verify that padding bytes are zero.
11457            fidl::decode!(
11458                fidl::encoding::Endpoint<
11459                    fidl::endpoints::ServerEnd<DevToolsPerContextListenerMarker>,
11460                >,
11461                fidl::encoding::DefaultFuchsiaResourceDialect,
11462                &mut self.listener,
11463                decoder,
11464                offset + 0,
11465                _depth
11466            )?;
11467            Ok(())
11468        }
11469    }
11470
11471    impl fidl::encoding::ResourceTypeMarker for FrameAddBeforeLoadJavaScriptRequest {
11472        type Borrowed<'a> = &'a mut Self;
11473        fn take_or_borrow<'a>(
11474            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11475        ) -> Self::Borrowed<'a> {
11476            value
11477        }
11478    }
11479
11480    unsafe impl fidl::encoding::TypeMarker for FrameAddBeforeLoadJavaScriptRequest {
11481        type Owned = Self;
11482
11483        #[inline(always)]
11484        fn inline_align(_context: fidl::encoding::Context) -> usize {
11485            8
11486        }
11487
11488        #[inline(always)]
11489        fn inline_size(_context: fidl::encoding::Context) -> usize {
11490            40
11491        }
11492    }
11493
11494    unsafe impl
11495        fidl::encoding::Encode<
11496            FrameAddBeforeLoadJavaScriptRequest,
11497            fidl::encoding::DefaultFuchsiaResourceDialect,
11498        > for &mut FrameAddBeforeLoadJavaScriptRequest
11499    {
11500        #[inline]
11501        unsafe fn encode(
11502            self,
11503            encoder: &mut fidl::encoding::Encoder<
11504                '_,
11505                fidl::encoding::DefaultFuchsiaResourceDialect,
11506            >,
11507            offset: usize,
11508            _depth: fidl::encoding::Depth,
11509        ) -> fidl::Result<()> {
11510            encoder.debug_check_bounds::<FrameAddBeforeLoadJavaScriptRequest>(offset);
11511            // Delegate to tuple encoding.
11512            fidl::encoding::Encode::<FrameAddBeforeLoadJavaScriptRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11513                (
11514                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
11515                    <fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>> as fidl::encoding::ValueTypeMarker>::borrow(&self.origins),
11516                    <fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.script),
11517                ),
11518                encoder, offset, _depth
11519            )
11520        }
11521    }
11522    unsafe impl<
11523        T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
11524        T1: fidl::encoding::Encode<
11525                fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>>,
11526                fidl::encoding::DefaultFuchsiaResourceDialect,
11527            >,
11528        T2: fidl::encoding::Encode<
11529                fidl_fuchsia_mem::Buffer,
11530                fidl::encoding::DefaultFuchsiaResourceDialect,
11531            >,
11532    >
11533        fidl::encoding::Encode<
11534            FrameAddBeforeLoadJavaScriptRequest,
11535            fidl::encoding::DefaultFuchsiaResourceDialect,
11536        > for (T0, T1, T2)
11537    {
11538        #[inline]
11539        unsafe fn encode(
11540            self,
11541            encoder: &mut fidl::encoding::Encoder<
11542                '_,
11543                fidl::encoding::DefaultFuchsiaResourceDialect,
11544            >,
11545            offset: usize,
11546            depth: fidl::encoding::Depth,
11547        ) -> fidl::Result<()> {
11548            encoder.debug_check_bounds::<FrameAddBeforeLoadJavaScriptRequest>(offset);
11549            // Zero out padding regions. There's no need to apply masks
11550            // because the unmasked parts will be overwritten by fields.
11551            // Write the fields.
11552            self.0.encode(encoder, offset + 0, depth)?;
11553            self.1.encode(encoder, offset + 8, depth)?;
11554            self.2.encode(encoder, offset + 24, depth)?;
11555            Ok(())
11556        }
11557    }
11558
11559    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11560        for FrameAddBeforeLoadJavaScriptRequest
11561    {
11562        #[inline(always)]
11563        fn new_empty() -> Self {
11564            Self {
11565                id: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
11566                origins: fidl::new_empty!(
11567                    fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>>,
11568                    fidl::encoding::DefaultFuchsiaResourceDialect
11569                ),
11570                script: fidl::new_empty!(
11571                    fidl_fuchsia_mem::Buffer,
11572                    fidl::encoding::DefaultFuchsiaResourceDialect
11573                ),
11574            }
11575        }
11576
11577        #[inline]
11578        unsafe fn decode(
11579            &mut self,
11580            decoder: &mut fidl::encoding::Decoder<
11581                '_,
11582                fidl::encoding::DefaultFuchsiaResourceDialect,
11583            >,
11584            offset: usize,
11585            _depth: fidl::encoding::Depth,
11586        ) -> fidl::Result<()> {
11587            decoder.debug_check_bounds::<Self>(offset);
11588            // Verify that padding bytes are zero.
11589            fidl::decode!(
11590                u64,
11591                fidl::encoding::DefaultFuchsiaResourceDialect,
11592                &mut self.id,
11593                decoder,
11594                offset + 0,
11595                _depth
11596            )?;
11597            fidl::decode!(
11598                fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>>,
11599                fidl::encoding::DefaultFuchsiaResourceDialect,
11600                &mut self.origins,
11601                decoder,
11602                offset + 8,
11603                _depth
11604            )?;
11605            fidl::decode!(
11606                fidl_fuchsia_mem::Buffer,
11607                fidl::encoding::DefaultFuchsiaResourceDialect,
11608                &mut self.script,
11609                decoder,
11610                offset + 24,
11611                _depth
11612            )?;
11613            Ok(())
11614        }
11615    }
11616
11617    impl fidl::encoding::ResourceTypeMarker for FrameCreateView2Request {
11618        type Borrowed<'a> = &'a mut Self;
11619        fn take_or_borrow<'a>(
11620            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11621        ) -> Self::Borrowed<'a> {
11622            value
11623        }
11624    }
11625
11626    unsafe impl fidl::encoding::TypeMarker for FrameCreateView2Request {
11627        type Owned = Self;
11628
11629        #[inline(always)]
11630        fn inline_align(_context: fidl::encoding::Context) -> usize {
11631            8
11632        }
11633
11634        #[inline(always)]
11635        fn inline_size(_context: fidl::encoding::Context) -> usize {
11636            16
11637        }
11638    }
11639
11640    unsafe impl
11641        fidl::encoding::Encode<
11642            FrameCreateView2Request,
11643            fidl::encoding::DefaultFuchsiaResourceDialect,
11644        > for &mut FrameCreateView2Request
11645    {
11646        #[inline]
11647        unsafe fn encode(
11648            self,
11649            encoder: &mut fidl::encoding::Encoder<
11650                '_,
11651                fidl::encoding::DefaultFuchsiaResourceDialect,
11652            >,
11653            offset: usize,
11654            _depth: fidl::encoding::Depth,
11655        ) -> fidl::Result<()> {
11656            encoder.debug_check_bounds::<FrameCreateView2Request>(offset);
11657            // Delegate to tuple encoding.
11658            fidl::encoding::Encode::<
11659                FrameCreateView2Request,
11660                fidl::encoding::DefaultFuchsiaResourceDialect,
11661            >::encode(
11662                (<CreateView2Args as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11663                    &mut self.args,
11664                ),),
11665                encoder,
11666                offset,
11667                _depth,
11668            )
11669        }
11670    }
11671    unsafe impl<
11672        T0: fidl::encoding::Encode<CreateView2Args, fidl::encoding::DefaultFuchsiaResourceDialect>,
11673    >
11674        fidl::encoding::Encode<
11675            FrameCreateView2Request,
11676            fidl::encoding::DefaultFuchsiaResourceDialect,
11677        > for (T0,)
11678    {
11679        #[inline]
11680        unsafe fn encode(
11681            self,
11682            encoder: &mut fidl::encoding::Encoder<
11683                '_,
11684                fidl::encoding::DefaultFuchsiaResourceDialect,
11685            >,
11686            offset: usize,
11687            depth: fidl::encoding::Depth,
11688        ) -> fidl::Result<()> {
11689            encoder.debug_check_bounds::<FrameCreateView2Request>(offset);
11690            // Zero out padding regions. There's no need to apply masks
11691            // because the unmasked parts will be overwritten by fields.
11692            // Write the fields.
11693            self.0.encode(encoder, offset + 0, depth)?;
11694            Ok(())
11695        }
11696    }
11697
11698    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11699        for FrameCreateView2Request
11700    {
11701        #[inline(always)]
11702        fn new_empty() -> Self {
11703            Self {
11704                args: fidl::new_empty!(
11705                    CreateView2Args,
11706                    fidl::encoding::DefaultFuchsiaResourceDialect
11707                ),
11708            }
11709        }
11710
11711        #[inline]
11712        unsafe fn decode(
11713            &mut self,
11714            decoder: &mut fidl::encoding::Decoder<
11715                '_,
11716                fidl::encoding::DefaultFuchsiaResourceDialect,
11717            >,
11718            offset: usize,
11719            _depth: fidl::encoding::Depth,
11720        ) -> fidl::Result<()> {
11721            decoder.debug_check_bounds::<Self>(offset);
11722            // Verify that padding bytes are zero.
11723            fidl::decode!(
11724                CreateView2Args,
11725                fidl::encoding::DefaultFuchsiaResourceDialect,
11726                &mut self.args,
11727                decoder,
11728                offset + 0,
11729                _depth
11730            )?;
11731            Ok(())
11732        }
11733    }
11734
11735    impl fidl::encoding::ResourceTypeMarker for FrameCreateViewRequest {
11736        type Borrowed<'a> = &'a mut Self;
11737        fn take_or_borrow<'a>(
11738            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11739        ) -> Self::Borrowed<'a> {
11740            value
11741        }
11742    }
11743
11744    unsafe impl fidl::encoding::TypeMarker for FrameCreateViewRequest {
11745        type Owned = Self;
11746
11747        #[inline(always)]
11748        fn inline_align(_context: fidl::encoding::Context) -> usize {
11749            4
11750        }
11751
11752        #[inline(always)]
11753        fn inline_size(_context: fidl::encoding::Context) -> usize {
11754            4
11755        }
11756    }
11757
11758    unsafe impl
11759        fidl::encoding::Encode<
11760            FrameCreateViewRequest,
11761            fidl::encoding::DefaultFuchsiaResourceDialect,
11762        > for &mut FrameCreateViewRequest
11763    {
11764        #[inline]
11765        unsafe fn encode(
11766            self,
11767            encoder: &mut fidl::encoding::Encoder<
11768                '_,
11769                fidl::encoding::DefaultFuchsiaResourceDialect,
11770            >,
11771            offset: usize,
11772            _depth: fidl::encoding::Depth,
11773        ) -> fidl::Result<()> {
11774            encoder.debug_check_bounds::<FrameCreateViewRequest>(offset);
11775            // Delegate to tuple encoding.
11776            fidl::encoding::Encode::<FrameCreateViewRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11777                (
11778                    <fidl_fuchsia_ui_views::ViewToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.view_token),
11779                ),
11780                encoder, offset, _depth
11781            )
11782        }
11783    }
11784    unsafe impl<
11785        T0: fidl::encoding::Encode<
11786                fidl_fuchsia_ui_views::ViewToken,
11787                fidl::encoding::DefaultFuchsiaResourceDialect,
11788            >,
11789    >
11790        fidl::encoding::Encode<
11791            FrameCreateViewRequest,
11792            fidl::encoding::DefaultFuchsiaResourceDialect,
11793        > for (T0,)
11794    {
11795        #[inline]
11796        unsafe fn encode(
11797            self,
11798            encoder: &mut fidl::encoding::Encoder<
11799                '_,
11800                fidl::encoding::DefaultFuchsiaResourceDialect,
11801            >,
11802            offset: usize,
11803            depth: fidl::encoding::Depth,
11804        ) -> fidl::Result<()> {
11805            encoder.debug_check_bounds::<FrameCreateViewRequest>(offset);
11806            // Zero out padding regions. There's no need to apply masks
11807            // because the unmasked parts will be overwritten by fields.
11808            // Write the fields.
11809            self.0.encode(encoder, offset + 0, depth)?;
11810            Ok(())
11811        }
11812    }
11813
11814    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11815        for FrameCreateViewRequest
11816    {
11817        #[inline(always)]
11818        fn new_empty() -> Self {
11819            Self {
11820                view_token: fidl::new_empty!(
11821                    fidl_fuchsia_ui_views::ViewToken,
11822                    fidl::encoding::DefaultFuchsiaResourceDialect
11823                ),
11824            }
11825        }
11826
11827        #[inline]
11828        unsafe fn decode(
11829            &mut self,
11830            decoder: &mut fidl::encoding::Decoder<
11831                '_,
11832                fidl::encoding::DefaultFuchsiaResourceDialect,
11833            >,
11834            offset: usize,
11835            _depth: fidl::encoding::Depth,
11836        ) -> fidl::Result<()> {
11837            decoder.debug_check_bounds::<Self>(offset);
11838            // Verify that padding bytes are zero.
11839            fidl::decode!(
11840                fidl_fuchsia_ui_views::ViewToken,
11841                fidl::encoding::DefaultFuchsiaResourceDialect,
11842                &mut self.view_token,
11843                decoder,
11844                offset + 0,
11845                _depth
11846            )?;
11847            Ok(())
11848        }
11849    }
11850
11851    impl fidl::encoding::ResourceTypeMarker for FrameCreateViewWithViewRefRequest {
11852        type Borrowed<'a> = &'a mut Self;
11853        fn take_or_borrow<'a>(
11854            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11855        ) -> Self::Borrowed<'a> {
11856            value
11857        }
11858    }
11859
11860    unsafe impl fidl::encoding::TypeMarker for FrameCreateViewWithViewRefRequest {
11861        type Owned = Self;
11862
11863        #[inline(always)]
11864        fn inline_align(_context: fidl::encoding::Context) -> usize {
11865            4
11866        }
11867
11868        #[inline(always)]
11869        fn inline_size(_context: fidl::encoding::Context) -> usize {
11870            12
11871        }
11872    }
11873
11874    unsafe impl
11875        fidl::encoding::Encode<
11876            FrameCreateViewWithViewRefRequest,
11877            fidl::encoding::DefaultFuchsiaResourceDialect,
11878        > for &mut FrameCreateViewWithViewRefRequest
11879    {
11880        #[inline]
11881        unsafe fn encode(
11882            self,
11883            encoder: &mut fidl::encoding::Encoder<
11884                '_,
11885                fidl::encoding::DefaultFuchsiaResourceDialect,
11886            >,
11887            offset: usize,
11888            _depth: fidl::encoding::Depth,
11889        ) -> fidl::Result<()> {
11890            encoder.debug_check_bounds::<FrameCreateViewWithViewRefRequest>(offset);
11891            // Delegate to tuple encoding.
11892            fidl::encoding::Encode::<FrameCreateViewWithViewRefRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11893                (
11894                    <fidl_fuchsia_ui_views::ViewToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.view_token),
11895                    <fidl_fuchsia_ui_views::ViewRefControl as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.view_ref_control),
11896                    <fidl_fuchsia_ui_views::ViewRef as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.view_ref),
11897                ),
11898                encoder, offset, _depth
11899            )
11900        }
11901    }
11902    unsafe impl<
11903        T0: fidl::encoding::Encode<
11904                fidl_fuchsia_ui_views::ViewToken,
11905                fidl::encoding::DefaultFuchsiaResourceDialect,
11906            >,
11907        T1: fidl::encoding::Encode<
11908                fidl_fuchsia_ui_views::ViewRefControl,
11909                fidl::encoding::DefaultFuchsiaResourceDialect,
11910            >,
11911        T2: fidl::encoding::Encode<
11912                fidl_fuchsia_ui_views::ViewRef,
11913                fidl::encoding::DefaultFuchsiaResourceDialect,
11914            >,
11915    >
11916        fidl::encoding::Encode<
11917            FrameCreateViewWithViewRefRequest,
11918            fidl::encoding::DefaultFuchsiaResourceDialect,
11919        > for (T0, T1, T2)
11920    {
11921        #[inline]
11922        unsafe fn encode(
11923            self,
11924            encoder: &mut fidl::encoding::Encoder<
11925                '_,
11926                fidl::encoding::DefaultFuchsiaResourceDialect,
11927            >,
11928            offset: usize,
11929            depth: fidl::encoding::Depth,
11930        ) -> fidl::Result<()> {
11931            encoder.debug_check_bounds::<FrameCreateViewWithViewRefRequest>(offset);
11932            // Zero out padding regions. There's no need to apply masks
11933            // because the unmasked parts will be overwritten by fields.
11934            // Write the fields.
11935            self.0.encode(encoder, offset + 0, depth)?;
11936            self.1.encode(encoder, offset + 4, depth)?;
11937            self.2.encode(encoder, offset + 8, depth)?;
11938            Ok(())
11939        }
11940    }
11941
11942    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11943        for FrameCreateViewWithViewRefRequest
11944    {
11945        #[inline(always)]
11946        fn new_empty() -> Self {
11947            Self {
11948                view_token: fidl::new_empty!(
11949                    fidl_fuchsia_ui_views::ViewToken,
11950                    fidl::encoding::DefaultFuchsiaResourceDialect
11951                ),
11952                view_ref_control: fidl::new_empty!(
11953                    fidl_fuchsia_ui_views::ViewRefControl,
11954                    fidl::encoding::DefaultFuchsiaResourceDialect
11955                ),
11956                view_ref: fidl::new_empty!(
11957                    fidl_fuchsia_ui_views::ViewRef,
11958                    fidl::encoding::DefaultFuchsiaResourceDialect
11959                ),
11960            }
11961        }
11962
11963        #[inline]
11964        unsafe fn decode(
11965            &mut self,
11966            decoder: &mut fidl::encoding::Decoder<
11967                '_,
11968                fidl::encoding::DefaultFuchsiaResourceDialect,
11969            >,
11970            offset: usize,
11971            _depth: fidl::encoding::Depth,
11972        ) -> fidl::Result<()> {
11973            decoder.debug_check_bounds::<Self>(offset);
11974            // Verify that padding bytes are zero.
11975            fidl::decode!(
11976                fidl_fuchsia_ui_views::ViewToken,
11977                fidl::encoding::DefaultFuchsiaResourceDialect,
11978                &mut self.view_token,
11979                decoder,
11980                offset + 0,
11981                _depth
11982            )?;
11983            fidl::decode!(
11984                fidl_fuchsia_ui_views::ViewRefControl,
11985                fidl::encoding::DefaultFuchsiaResourceDialect,
11986                &mut self.view_ref_control,
11987                decoder,
11988                offset + 4,
11989                _depth
11990            )?;
11991            fidl::decode!(
11992                fidl_fuchsia_ui_views::ViewRef,
11993                fidl::encoding::DefaultFuchsiaResourceDialect,
11994                &mut self.view_ref,
11995                decoder,
11996                offset + 8,
11997                _depth
11998            )?;
11999            Ok(())
12000        }
12001    }
12002
12003    impl fidl::encoding::ResourceTypeMarker for FrameExecuteJavaScriptNoResultRequest {
12004        type Borrowed<'a> = &'a mut Self;
12005        fn take_or_borrow<'a>(
12006            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12007        ) -> Self::Borrowed<'a> {
12008            value
12009        }
12010    }
12011
12012    unsafe impl fidl::encoding::TypeMarker for FrameExecuteJavaScriptNoResultRequest {
12013        type Owned = Self;
12014
12015        #[inline(always)]
12016        fn inline_align(_context: fidl::encoding::Context) -> usize {
12017            8
12018        }
12019
12020        #[inline(always)]
12021        fn inline_size(_context: fidl::encoding::Context) -> usize {
12022            32
12023        }
12024    }
12025
12026    unsafe impl
12027        fidl::encoding::Encode<
12028            FrameExecuteJavaScriptNoResultRequest,
12029            fidl::encoding::DefaultFuchsiaResourceDialect,
12030        > for &mut FrameExecuteJavaScriptNoResultRequest
12031    {
12032        #[inline]
12033        unsafe fn encode(
12034            self,
12035            encoder: &mut fidl::encoding::Encoder<
12036                '_,
12037                fidl::encoding::DefaultFuchsiaResourceDialect,
12038            >,
12039            offset: usize,
12040            _depth: fidl::encoding::Depth,
12041        ) -> fidl::Result<()> {
12042            encoder.debug_check_bounds::<FrameExecuteJavaScriptNoResultRequest>(offset);
12043            // Delegate to tuple encoding.
12044            fidl::encoding::Encode::<FrameExecuteJavaScriptNoResultRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
12045                (
12046                    <fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>> as fidl::encoding::ValueTypeMarker>::borrow(&self.origins),
12047                    <fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.script),
12048                ),
12049                encoder, offset, _depth
12050            )
12051        }
12052    }
12053    unsafe impl<
12054        T0: fidl::encoding::Encode<
12055                fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>>,
12056                fidl::encoding::DefaultFuchsiaResourceDialect,
12057            >,
12058        T1: fidl::encoding::Encode<
12059                fidl_fuchsia_mem::Buffer,
12060                fidl::encoding::DefaultFuchsiaResourceDialect,
12061            >,
12062    >
12063        fidl::encoding::Encode<
12064            FrameExecuteJavaScriptNoResultRequest,
12065            fidl::encoding::DefaultFuchsiaResourceDialect,
12066        > for (T0, T1)
12067    {
12068        #[inline]
12069        unsafe fn encode(
12070            self,
12071            encoder: &mut fidl::encoding::Encoder<
12072                '_,
12073                fidl::encoding::DefaultFuchsiaResourceDialect,
12074            >,
12075            offset: usize,
12076            depth: fidl::encoding::Depth,
12077        ) -> fidl::Result<()> {
12078            encoder.debug_check_bounds::<FrameExecuteJavaScriptNoResultRequest>(offset);
12079            // Zero out padding regions. There's no need to apply masks
12080            // because the unmasked parts will be overwritten by fields.
12081            // Write the fields.
12082            self.0.encode(encoder, offset + 0, depth)?;
12083            self.1.encode(encoder, offset + 16, depth)?;
12084            Ok(())
12085        }
12086    }
12087
12088    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12089        for FrameExecuteJavaScriptNoResultRequest
12090    {
12091        #[inline(always)]
12092        fn new_empty() -> Self {
12093            Self {
12094                origins: fidl::new_empty!(
12095                    fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>>,
12096                    fidl::encoding::DefaultFuchsiaResourceDialect
12097                ),
12098                script: fidl::new_empty!(
12099                    fidl_fuchsia_mem::Buffer,
12100                    fidl::encoding::DefaultFuchsiaResourceDialect
12101                ),
12102            }
12103        }
12104
12105        #[inline]
12106        unsafe fn decode(
12107            &mut self,
12108            decoder: &mut fidl::encoding::Decoder<
12109                '_,
12110                fidl::encoding::DefaultFuchsiaResourceDialect,
12111            >,
12112            offset: usize,
12113            _depth: fidl::encoding::Depth,
12114        ) -> fidl::Result<()> {
12115            decoder.debug_check_bounds::<Self>(offset);
12116            // Verify that padding bytes are zero.
12117            fidl::decode!(
12118                fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>>,
12119                fidl::encoding::DefaultFuchsiaResourceDialect,
12120                &mut self.origins,
12121                decoder,
12122                offset + 0,
12123                _depth
12124            )?;
12125            fidl::decode!(
12126                fidl_fuchsia_mem::Buffer,
12127                fidl::encoding::DefaultFuchsiaResourceDialect,
12128                &mut self.script,
12129                decoder,
12130                offset + 16,
12131                _depth
12132            )?;
12133            Ok(())
12134        }
12135    }
12136
12137    impl fidl::encoding::ResourceTypeMarker for FrameExecuteJavaScriptRequest {
12138        type Borrowed<'a> = &'a mut Self;
12139        fn take_or_borrow<'a>(
12140            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12141        ) -> Self::Borrowed<'a> {
12142            value
12143        }
12144    }
12145
12146    unsafe impl fidl::encoding::TypeMarker for FrameExecuteJavaScriptRequest {
12147        type Owned = Self;
12148
12149        #[inline(always)]
12150        fn inline_align(_context: fidl::encoding::Context) -> usize {
12151            8
12152        }
12153
12154        #[inline(always)]
12155        fn inline_size(_context: fidl::encoding::Context) -> usize {
12156            32
12157        }
12158    }
12159
12160    unsafe impl
12161        fidl::encoding::Encode<
12162            FrameExecuteJavaScriptRequest,
12163            fidl::encoding::DefaultFuchsiaResourceDialect,
12164        > for &mut FrameExecuteJavaScriptRequest
12165    {
12166        #[inline]
12167        unsafe fn encode(
12168            self,
12169            encoder: &mut fidl::encoding::Encoder<
12170                '_,
12171                fidl::encoding::DefaultFuchsiaResourceDialect,
12172            >,
12173            offset: usize,
12174            _depth: fidl::encoding::Depth,
12175        ) -> fidl::Result<()> {
12176            encoder.debug_check_bounds::<FrameExecuteJavaScriptRequest>(offset);
12177            // Delegate to tuple encoding.
12178            fidl::encoding::Encode::<FrameExecuteJavaScriptRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
12179                (
12180                    <fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>> as fidl::encoding::ValueTypeMarker>::borrow(&self.origins),
12181                    <fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.script),
12182                ),
12183                encoder, offset, _depth
12184            )
12185        }
12186    }
12187    unsafe impl<
12188        T0: fidl::encoding::Encode<
12189                fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>>,
12190                fidl::encoding::DefaultFuchsiaResourceDialect,
12191            >,
12192        T1: fidl::encoding::Encode<
12193                fidl_fuchsia_mem::Buffer,
12194                fidl::encoding::DefaultFuchsiaResourceDialect,
12195            >,
12196    >
12197        fidl::encoding::Encode<
12198            FrameExecuteJavaScriptRequest,
12199            fidl::encoding::DefaultFuchsiaResourceDialect,
12200        > for (T0, T1)
12201    {
12202        #[inline]
12203        unsafe fn encode(
12204            self,
12205            encoder: &mut fidl::encoding::Encoder<
12206                '_,
12207                fidl::encoding::DefaultFuchsiaResourceDialect,
12208            >,
12209            offset: usize,
12210            depth: fidl::encoding::Depth,
12211        ) -> fidl::Result<()> {
12212            encoder.debug_check_bounds::<FrameExecuteJavaScriptRequest>(offset);
12213            // Zero out padding regions. There's no need to apply masks
12214            // because the unmasked parts will be overwritten by fields.
12215            // Write the fields.
12216            self.0.encode(encoder, offset + 0, depth)?;
12217            self.1.encode(encoder, offset + 16, depth)?;
12218            Ok(())
12219        }
12220    }
12221
12222    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12223        for FrameExecuteJavaScriptRequest
12224    {
12225        #[inline(always)]
12226        fn new_empty() -> Self {
12227            Self {
12228                origins: fidl::new_empty!(
12229                    fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>>,
12230                    fidl::encoding::DefaultFuchsiaResourceDialect
12231                ),
12232                script: fidl::new_empty!(
12233                    fidl_fuchsia_mem::Buffer,
12234                    fidl::encoding::DefaultFuchsiaResourceDialect
12235                ),
12236            }
12237        }
12238
12239        #[inline]
12240        unsafe fn decode(
12241            &mut self,
12242            decoder: &mut fidl::encoding::Decoder<
12243                '_,
12244                fidl::encoding::DefaultFuchsiaResourceDialect,
12245            >,
12246            offset: usize,
12247            _depth: fidl::encoding::Depth,
12248        ) -> fidl::Result<()> {
12249            decoder.debug_check_bounds::<Self>(offset);
12250            // Verify that padding bytes are zero.
12251            fidl::decode!(
12252                fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>>,
12253                fidl::encoding::DefaultFuchsiaResourceDialect,
12254                &mut self.origins,
12255                decoder,
12256                offset + 0,
12257                _depth
12258            )?;
12259            fidl::decode!(
12260                fidl_fuchsia_mem::Buffer,
12261                fidl::encoding::DefaultFuchsiaResourceDialect,
12262                &mut self.script,
12263                decoder,
12264                offset + 16,
12265                _depth
12266            )?;
12267            Ok(())
12268        }
12269    }
12270
12271    impl fidl::encoding::ResourceTypeMarker for FrameGetMediaPlayerRequest {
12272        type Borrowed<'a> = &'a mut Self;
12273        fn take_or_borrow<'a>(
12274            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12275        ) -> Self::Borrowed<'a> {
12276            value
12277        }
12278    }
12279
12280    unsafe impl fidl::encoding::TypeMarker for FrameGetMediaPlayerRequest {
12281        type Owned = Self;
12282
12283        #[inline(always)]
12284        fn inline_align(_context: fidl::encoding::Context) -> usize {
12285            4
12286        }
12287
12288        #[inline(always)]
12289        fn inline_size(_context: fidl::encoding::Context) -> usize {
12290            4
12291        }
12292    }
12293
12294    unsafe impl
12295        fidl::encoding::Encode<
12296            FrameGetMediaPlayerRequest,
12297            fidl::encoding::DefaultFuchsiaResourceDialect,
12298        > for &mut FrameGetMediaPlayerRequest
12299    {
12300        #[inline]
12301        unsafe fn encode(
12302            self,
12303            encoder: &mut fidl::encoding::Encoder<
12304                '_,
12305                fidl::encoding::DefaultFuchsiaResourceDialect,
12306            >,
12307            offset: usize,
12308            _depth: fidl::encoding::Depth,
12309        ) -> fidl::Result<()> {
12310            encoder.debug_check_bounds::<FrameGetMediaPlayerRequest>(offset);
12311            // Delegate to tuple encoding.
12312            fidl::encoding::Encode::<
12313                FrameGetMediaPlayerRequest,
12314                fidl::encoding::DefaultFuchsiaResourceDialect,
12315            >::encode(
12316                (<fidl::encoding::Endpoint<
12317                    fidl::endpoints::ServerEnd<fidl_fuchsia_media_sessions2::PlayerMarker>,
12318                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12319                    &mut self.player
12320                ),),
12321                encoder,
12322                offset,
12323                _depth,
12324            )
12325        }
12326    }
12327    unsafe impl<
12328        T0: fidl::encoding::Encode<
12329                fidl::encoding::Endpoint<
12330                    fidl::endpoints::ServerEnd<fidl_fuchsia_media_sessions2::PlayerMarker>,
12331                >,
12332                fidl::encoding::DefaultFuchsiaResourceDialect,
12333            >,
12334    >
12335        fidl::encoding::Encode<
12336            FrameGetMediaPlayerRequest,
12337            fidl::encoding::DefaultFuchsiaResourceDialect,
12338        > for (T0,)
12339    {
12340        #[inline]
12341        unsafe fn encode(
12342            self,
12343            encoder: &mut fidl::encoding::Encoder<
12344                '_,
12345                fidl::encoding::DefaultFuchsiaResourceDialect,
12346            >,
12347            offset: usize,
12348            depth: fidl::encoding::Depth,
12349        ) -> fidl::Result<()> {
12350            encoder.debug_check_bounds::<FrameGetMediaPlayerRequest>(offset);
12351            // Zero out padding regions. There's no need to apply masks
12352            // because the unmasked parts will be overwritten by fields.
12353            // Write the fields.
12354            self.0.encode(encoder, offset + 0, depth)?;
12355            Ok(())
12356        }
12357    }
12358
12359    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12360        for FrameGetMediaPlayerRequest
12361    {
12362        #[inline(always)]
12363        fn new_empty() -> Self {
12364            Self {
12365                player: fidl::new_empty!(
12366                    fidl::encoding::Endpoint<
12367                        fidl::endpoints::ServerEnd<fidl_fuchsia_media_sessions2::PlayerMarker>,
12368                    >,
12369                    fidl::encoding::DefaultFuchsiaResourceDialect
12370                ),
12371            }
12372        }
12373
12374        #[inline]
12375        unsafe fn decode(
12376            &mut self,
12377            decoder: &mut fidl::encoding::Decoder<
12378                '_,
12379                fidl::encoding::DefaultFuchsiaResourceDialect,
12380            >,
12381            offset: usize,
12382            _depth: fidl::encoding::Depth,
12383        ) -> fidl::Result<()> {
12384            decoder.debug_check_bounds::<Self>(offset);
12385            // Verify that padding bytes are zero.
12386            fidl::decode!(
12387                fidl::encoding::Endpoint<
12388                    fidl::endpoints::ServerEnd<fidl_fuchsia_media_sessions2::PlayerMarker>,
12389                >,
12390                fidl::encoding::DefaultFuchsiaResourceDialect,
12391                &mut self.player,
12392                decoder,
12393                offset + 0,
12394                _depth
12395            )?;
12396            Ok(())
12397        }
12398    }
12399
12400    impl fidl::encoding::ResourceTypeMarker for FrameGetNavigationControllerRequest {
12401        type Borrowed<'a> = &'a mut Self;
12402        fn take_or_borrow<'a>(
12403            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12404        ) -> Self::Borrowed<'a> {
12405            value
12406        }
12407    }
12408
12409    unsafe impl fidl::encoding::TypeMarker for FrameGetNavigationControllerRequest {
12410        type Owned = Self;
12411
12412        #[inline(always)]
12413        fn inline_align(_context: fidl::encoding::Context) -> usize {
12414            4
12415        }
12416
12417        #[inline(always)]
12418        fn inline_size(_context: fidl::encoding::Context) -> usize {
12419            4
12420        }
12421    }
12422
12423    unsafe impl
12424        fidl::encoding::Encode<
12425            FrameGetNavigationControllerRequest,
12426            fidl::encoding::DefaultFuchsiaResourceDialect,
12427        > for &mut FrameGetNavigationControllerRequest
12428    {
12429        #[inline]
12430        unsafe fn encode(
12431            self,
12432            encoder: &mut fidl::encoding::Encoder<
12433                '_,
12434                fidl::encoding::DefaultFuchsiaResourceDialect,
12435            >,
12436            offset: usize,
12437            _depth: fidl::encoding::Depth,
12438        ) -> fidl::Result<()> {
12439            encoder.debug_check_bounds::<FrameGetNavigationControllerRequest>(offset);
12440            // Delegate to tuple encoding.
12441            fidl::encoding::Encode::<
12442                FrameGetNavigationControllerRequest,
12443                fidl::encoding::DefaultFuchsiaResourceDialect,
12444            >::encode(
12445                (
12446                    <fidl::encoding::Endpoint<
12447                        fidl::endpoints::ServerEnd<NavigationControllerMarker>,
12448                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12449                        &mut self.controller
12450                    ),
12451                ),
12452                encoder,
12453                offset,
12454                _depth,
12455            )
12456        }
12457    }
12458    unsafe impl<
12459        T0: fidl::encoding::Encode<
12460                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NavigationControllerMarker>>,
12461                fidl::encoding::DefaultFuchsiaResourceDialect,
12462            >,
12463    >
12464        fidl::encoding::Encode<
12465            FrameGetNavigationControllerRequest,
12466            fidl::encoding::DefaultFuchsiaResourceDialect,
12467        > for (T0,)
12468    {
12469        #[inline]
12470        unsafe fn encode(
12471            self,
12472            encoder: &mut fidl::encoding::Encoder<
12473                '_,
12474                fidl::encoding::DefaultFuchsiaResourceDialect,
12475            >,
12476            offset: usize,
12477            depth: fidl::encoding::Depth,
12478        ) -> fidl::Result<()> {
12479            encoder.debug_check_bounds::<FrameGetNavigationControllerRequest>(offset);
12480            // Zero out padding regions. There's no need to apply masks
12481            // because the unmasked parts will be overwritten by fields.
12482            // Write the fields.
12483            self.0.encode(encoder, offset + 0, depth)?;
12484            Ok(())
12485        }
12486    }
12487
12488    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12489        for FrameGetNavigationControllerRequest
12490    {
12491        #[inline(always)]
12492        fn new_empty() -> Self {
12493            Self {
12494                controller: fidl::new_empty!(
12495                    fidl::encoding::Endpoint<
12496                        fidl::endpoints::ServerEnd<NavigationControllerMarker>,
12497                    >,
12498                    fidl::encoding::DefaultFuchsiaResourceDialect
12499                ),
12500            }
12501        }
12502
12503        #[inline]
12504        unsafe fn decode(
12505            &mut self,
12506            decoder: &mut fidl::encoding::Decoder<
12507                '_,
12508                fidl::encoding::DefaultFuchsiaResourceDialect,
12509            >,
12510            offset: usize,
12511            _depth: fidl::encoding::Depth,
12512        ) -> fidl::Result<()> {
12513            decoder.debug_check_bounds::<Self>(offset);
12514            // Verify that padding bytes are zero.
12515            fidl::decode!(
12516                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NavigationControllerMarker>>,
12517                fidl::encoding::DefaultFuchsiaResourceDialect,
12518                &mut self.controller,
12519                decoder,
12520                offset + 0,
12521                _depth
12522            )?;
12523            Ok(())
12524        }
12525    }
12526
12527    impl fidl::encoding::ResourceTypeMarker for FrameHostCreateFrameWithParamsRequest {
12528        type Borrowed<'a> = &'a mut Self;
12529        fn take_or_borrow<'a>(
12530            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12531        ) -> Self::Borrowed<'a> {
12532            value
12533        }
12534    }
12535
12536    unsafe impl fidl::encoding::TypeMarker for FrameHostCreateFrameWithParamsRequest {
12537        type Owned = Self;
12538
12539        #[inline(always)]
12540        fn inline_align(_context: fidl::encoding::Context) -> usize {
12541            8
12542        }
12543
12544        #[inline(always)]
12545        fn inline_size(_context: fidl::encoding::Context) -> usize {
12546            24
12547        }
12548    }
12549
12550    unsafe impl
12551        fidl::encoding::Encode<
12552            FrameHostCreateFrameWithParamsRequest,
12553            fidl::encoding::DefaultFuchsiaResourceDialect,
12554        > for &mut FrameHostCreateFrameWithParamsRequest
12555    {
12556        #[inline]
12557        unsafe fn encode(
12558            self,
12559            encoder: &mut fidl::encoding::Encoder<
12560                '_,
12561                fidl::encoding::DefaultFuchsiaResourceDialect,
12562            >,
12563            offset: usize,
12564            _depth: fidl::encoding::Depth,
12565        ) -> fidl::Result<()> {
12566            encoder.debug_check_bounds::<FrameHostCreateFrameWithParamsRequest>(offset);
12567            // Delegate to tuple encoding.
12568            fidl::encoding::Encode::<FrameHostCreateFrameWithParamsRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
12569                (
12570                    <CreateFrameParams as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.params),
12571                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FrameMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.frame),
12572                ),
12573                encoder, offset, _depth
12574            )
12575        }
12576    }
12577    unsafe impl<
12578        T0: fidl::encoding::Encode<CreateFrameParams, fidl::encoding::DefaultFuchsiaResourceDialect>,
12579        T1: fidl::encoding::Encode<
12580                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FrameMarker>>,
12581                fidl::encoding::DefaultFuchsiaResourceDialect,
12582            >,
12583    >
12584        fidl::encoding::Encode<
12585            FrameHostCreateFrameWithParamsRequest,
12586            fidl::encoding::DefaultFuchsiaResourceDialect,
12587        > for (T0, T1)
12588    {
12589        #[inline]
12590        unsafe fn encode(
12591            self,
12592            encoder: &mut fidl::encoding::Encoder<
12593                '_,
12594                fidl::encoding::DefaultFuchsiaResourceDialect,
12595            >,
12596            offset: usize,
12597            depth: fidl::encoding::Depth,
12598        ) -> fidl::Result<()> {
12599            encoder.debug_check_bounds::<FrameHostCreateFrameWithParamsRequest>(offset);
12600            // Zero out padding regions. There's no need to apply masks
12601            // because the unmasked parts will be overwritten by fields.
12602            unsafe {
12603                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
12604                (ptr as *mut u64).write_unaligned(0);
12605            }
12606            // Write the fields.
12607            self.0.encode(encoder, offset + 0, depth)?;
12608            self.1.encode(encoder, offset + 16, depth)?;
12609            Ok(())
12610        }
12611    }
12612
12613    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12614        for FrameHostCreateFrameWithParamsRequest
12615    {
12616        #[inline(always)]
12617        fn new_empty() -> Self {
12618            Self {
12619                params: fidl::new_empty!(
12620                    CreateFrameParams,
12621                    fidl::encoding::DefaultFuchsiaResourceDialect
12622                ),
12623                frame: fidl::new_empty!(
12624                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FrameMarker>>,
12625                    fidl::encoding::DefaultFuchsiaResourceDialect
12626                ),
12627            }
12628        }
12629
12630        #[inline]
12631        unsafe fn decode(
12632            &mut self,
12633            decoder: &mut fidl::encoding::Decoder<
12634                '_,
12635                fidl::encoding::DefaultFuchsiaResourceDialect,
12636            >,
12637            offset: usize,
12638            _depth: fidl::encoding::Depth,
12639        ) -> fidl::Result<()> {
12640            decoder.debug_check_bounds::<Self>(offset);
12641            // Verify that padding bytes are zero.
12642            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
12643            let padval = unsafe { (ptr as *const u64).read_unaligned() };
12644            let mask = 0xffffffff00000000u64;
12645            let maskedval = padval & mask;
12646            if maskedval != 0 {
12647                return Err(fidl::Error::NonZeroPadding {
12648                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
12649                });
12650            }
12651            fidl::decode!(
12652                CreateFrameParams,
12653                fidl::encoding::DefaultFuchsiaResourceDialect,
12654                &mut self.params,
12655                decoder,
12656                offset + 0,
12657                _depth
12658            )?;
12659            fidl::decode!(
12660                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FrameMarker>>,
12661                fidl::encoding::DefaultFuchsiaResourceDialect,
12662                &mut self.frame,
12663                decoder,
12664                offset + 16,
12665                _depth
12666            )?;
12667            Ok(())
12668        }
12669    }
12670
12671    impl fidl::encoding::ResourceTypeMarker for FramePostMessageRequest {
12672        type Borrowed<'a> = &'a mut Self;
12673        fn take_or_borrow<'a>(
12674            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12675        ) -> Self::Borrowed<'a> {
12676            value
12677        }
12678    }
12679
12680    unsafe impl fidl::encoding::TypeMarker for FramePostMessageRequest {
12681        type Owned = Self;
12682
12683        #[inline(always)]
12684        fn inline_align(_context: fidl::encoding::Context) -> usize {
12685            8
12686        }
12687
12688        #[inline(always)]
12689        fn inline_size(_context: fidl::encoding::Context) -> usize {
12690            32
12691        }
12692    }
12693
12694    unsafe impl
12695        fidl::encoding::Encode<
12696            FramePostMessageRequest,
12697            fidl::encoding::DefaultFuchsiaResourceDialect,
12698        > for &mut FramePostMessageRequest
12699    {
12700        #[inline]
12701        unsafe fn encode(
12702            self,
12703            encoder: &mut fidl::encoding::Encoder<
12704                '_,
12705                fidl::encoding::DefaultFuchsiaResourceDialect,
12706            >,
12707            offset: usize,
12708            _depth: fidl::encoding::Depth,
12709        ) -> fidl::Result<()> {
12710            encoder.debug_check_bounds::<FramePostMessageRequest>(offset);
12711            // Delegate to tuple encoding.
12712            fidl::encoding::Encode::<FramePostMessageRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
12713                (
12714                    <fidl::encoding::BoundedString<65536> as fidl::encoding::ValueTypeMarker>::borrow(&self.target_origin),
12715                    <WebMessage as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.message),
12716                ),
12717                encoder, offset, _depth
12718            )
12719        }
12720    }
12721    unsafe impl<
12722        T0: fidl::encoding::Encode<
12723                fidl::encoding::BoundedString<65536>,
12724                fidl::encoding::DefaultFuchsiaResourceDialect,
12725            >,
12726        T1: fidl::encoding::Encode<WebMessage, fidl::encoding::DefaultFuchsiaResourceDialect>,
12727    >
12728        fidl::encoding::Encode<
12729            FramePostMessageRequest,
12730            fidl::encoding::DefaultFuchsiaResourceDialect,
12731        > for (T0, T1)
12732    {
12733        #[inline]
12734        unsafe fn encode(
12735            self,
12736            encoder: &mut fidl::encoding::Encoder<
12737                '_,
12738                fidl::encoding::DefaultFuchsiaResourceDialect,
12739            >,
12740            offset: usize,
12741            depth: fidl::encoding::Depth,
12742        ) -> fidl::Result<()> {
12743            encoder.debug_check_bounds::<FramePostMessageRequest>(offset);
12744            // Zero out padding regions. There's no need to apply masks
12745            // because the unmasked parts will be overwritten by fields.
12746            // Write the fields.
12747            self.0.encode(encoder, offset + 0, depth)?;
12748            self.1.encode(encoder, offset + 16, depth)?;
12749            Ok(())
12750        }
12751    }
12752
12753    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12754        for FramePostMessageRequest
12755    {
12756        #[inline(always)]
12757        fn new_empty() -> Self {
12758            Self {
12759                target_origin: fidl::new_empty!(
12760                    fidl::encoding::BoundedString<65536>,
12761                    fidl::encoding::DefaultFuchsiaResourceDialect
12762                ),
12763                message: fidl::new_empty!(
12764                    WebMessage,
12765                    fidl::encoding::DefaultFuchsiaResourceDialect
12766                ),
12767            }
12768        }
12769
12770        #[inline]
12771        unsafe fn decode(
12772            &mut self,
12773            decoder: &mut fidl::encoding::Decoder<
12774                '_,
12775                fidl::encoding::DefaultFuchsiaResourceDialect,
12776            >,
12777            offset: usize,
12778            _depth: fidl::encoding::Depth,
12779        ) -> fidl::Result<()> {
12780            decoder.debug_check_bounds::<Self>(offset);
12781            // Verify that padding bytes are zero.
12782            fidl::decode!(
12783                fidl::encoding::BoundedString<65536>,
12784                fidl::encoding::DefaultFuchsiaResourceDialect,
12785                &mut self.target_origin,
12786                decoder,
12787                offset + 0,
12788                _depth
12789            )?;
12790            fidl::decode!(
12791                WebMessage,
12792                fidl::encoding::DefaultFuchsiaResourceDialect,
12793                &mut self.message,
12794                decoder,
12795                offset + 16,
12796                _depth
12797            )?;
12798            Ok(())
12799        }
12800    }
12801
12802    impl fidl::encoding::ResourceTypeMarker for FrameSetConsoleLogSinkRequest {
12803        type Borrowed<'a> = &'a mut Self;
12804        fn take_or_borrow<'a>(
12805            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12806        ) -> Self::Borrowed<'a> {
12807            value
12808        }
12809    }
12810
12811    unsafe impl fidl::encoding::TypeMarker for FrameSetConsoleLogSinkRequest {
12812        type Owned = Self;
12813
12814        #[inline(always)]
12815        fn inline_align(_context: fidl::encoding::Context) -> usize {
12816            4
12817        }
12818
12819        #[inline(always)]
12820        fn inline_size(_context: fidl::encoding::Context) -> usize {
12821            4
12822        }
12823    }
12824
12825    unsafe impl
12826        fidl::encoding::Encode<
12827            FrameSetConsoleLogSinkRequest,
12828            fidl::encoding::DefaultFuchsiaResourceDialect,
12829        > for &mut FrameSetConsoleLogSinkRequest
12830    {
12831        #[inline]
12832        unsafe fn encode(
12833            self,
12834            encoder: &mut fidl::encoding::Encoder<
12835                '_,
12836                fidl::encoding::DefaultFuchsiaResourceDialect,
12837            >,
12838            offset: usize,
12839            _depth: fidl::encoding::Depth,
12840        ) -> fidl::Result<()> {
12841            encoder.debug_check_bounds::<FrameSetConsoleLogSinkRequest>(offset);
12842            // Delegate to tuple encoding.
12843            fidl::encoding::Encode::<
12844                FrameSetConsoleLogSinkRequest,
12845                fidl::encoding::DefaultFuchsiaResourceDialect,
12846            >::encode(
12847                (<fidl::encoding::Optional<
12848                    fidl::encoding::Endpoint<
12849                        fidl::endpoints::ClientEnd<fidl_fuchsia_logger::LogSinkMarker>,
12850                    >,
12851                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12852                    &mut self.sink
12853                ),),
12854                encoder,
12855                offset,
12856                _depth,
12857            )
12858        }
12859    }
12860    unsafe impl<
12861        T0: fidl::encoding::Encode<
12862                fidl::encoding::Optional<
12863                    fidl::encoding::Endpoint<
12864                        fidl::endpoints::ClientEnd<fidl_fuchsia_logger::LogSinkMarker>,
12865                    >,
12866                >,
12867                fidl::encoding::DefaultFuchsiaResourceDialect,
12868            >,
12869    >
12870        fidl::encoding::Encode<
12871            FrameSetConsoleLogSinkRequest,
12872            fidl::encoding::DefaultFuchsiaResourceDialect,
12873        > for (T0,)
12874    {
12875        #[inline]
12876        unsafe fn encode(
12877            self,
12878            encoder: &mut fidl::encoding::Encoder<
12879                '_,
12880                fidl::encoding::DefaultFuchsiaResourceDialect,
12881            >,
12882            offset: usize,
12883            depth: fidl::encoding::Depth,
12884        ) -> fidl::Result<()> {
12885            encoder.debug_check_bounds::<FrameSetConsoleLogSinkRequest>(offset);
12886            // Zero out padding regions. There's no need to apply masks
12887            // because the unmasked parts will be overwritten by fields.
12888            // Write the fields.
12889            self.0.encode(encoder, offset + 0, depth)?;
12890            Ok(())
12891        }
12892    }
12893
12894    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12895        for FrameSetConsoleLogSinkRequest
12896    {
12897        #[inline(always)]
12898        fn new_empty() -> Self {
12899            Self {
12900                sink: fidl::new_empty!(
12901                    fidl::encoding::Optional<
12902                        fidl::encoding::Endpoint<
12903                            fidl::endpoints::ClientEnd<fidl_fuchsia_logger::LogSinkMarker>,
12904                        >,
12905                    >,
12906                    fidl::encoding::DefaultFuchsiaResourceDialect
12907                ),
12908            }
12909        }
12910
12911        #[inline]
12912        unsafe fn decode(
12913            &mut self,
12914            decoder: &mut fidl::encoding::Decoder<
12915                '_,
12916                fidl::encoding::DefaultFuchsiaResourceDialect,
12917            >,
12918            offset: usize,
12919            _depth: fidl::encoding::Depth,
12920        ) -> fidl::Result<()> {
12921            decoder.debug_check_bounds::<Self>(offset);
12922            // Verify that padding bytes are zero.
12923            fidl::decode!(
12924                fidl::encoding::Optional<
12925                    fidl::encoding::Endpoint<
12926                        fidl::endpoints::ClientEnd<fidl_fuchsia_logger::LogSinkMarker>,
12927                    >,
12928                >,
12929                fidl::encoding::DefaultFuchsiaResourceDialect,
12930                &mut self.sink,
12931                decoder,
12932                offset + 0,
12933                _depth
12934            )?;
12935            Ok(())
12936        }
12937    }
12938
12939    impl fidl::encoding::ResourceTypeMarker for FrameSetNavigationEventListener2Request {
12940        type Borrowed<'a> = &'a mut Self;
12941        fn take_or_borrow<'a>(
12942            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12943        ) -> Self::Borrowed<'a> {
12944            value
12945        }
12946    }
12947
12948    unsafe impl fidl::encoding::TypeMarker for FrameSetNavigationEventListener2Request {
12949        type Owned = Self;
12950
12951        #[inline(always)]
12952        fn inline_align(_context: fidl::encoding::Context) -> usize {
12953            8
12954        }
12955
12956        #[inline(always)]
12957        fn inline_size(_context: fidl::encoding::Context) -> usize {
12958            16
12959        }
12960    }
12961
12962    unsafe impl
12963        fidl::encoding::Encode<
12964            FrameSetNavigationEventListener2Request,
12965            fidl::encoding::DefaultFuchsiaResourceDialect,
12966        > for &mut FrameSetNavigationEventListener2Request
12967    {
12968        #[inline]
12969        unsafe fn encode(
12970            self,
12971            encoder: &mut fidl::encoding::Encoder<
12972                '_,
12973                fidl::encoding::DefaultFuchsiaResourceDialect,
12974            >,
12975            offset: usize,
12976            _depth: fidl::encoding::Depth,
12977        ) -> fidl::Result<()> {
12978            encoder.debug_check_bounds::<FrameSetNavigationEventListener2Request>(offset);
12979            // Delegate to tuple encoding.
12980            fidl::encoding::Encode::<
12981                FrameSetNavigationEventListener2Request,
12982                fidl::encoding::DefaultFuchsiaResourceDialect,
12983            >::encode(
12984                (
12985                    <fidl::encoding::Optional<
12986                        fidl::encoding::Endpoint<
12987                            fidl::endpoints::ClientEnd<NavigationEventListenerMarker>,
12988                        >,
12989                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12990                        &mut self.listener
12991                    ),
12992                    <NavigationEventListenerFlags as fidl::encoding::ValueTypeMarker>::borrow(
12993                        &self.flags,
12994                    ),
12995                ),
12996                encoder,
12997                offset,
12998                _depth,
12999            )
13000        }
13001    }
13002    unsafe impl<
13003        T0: fidl::encoding::Encode<
13004                fidl::encoding::Optional<
13005                    fidl::encoding::Endpoint<
13006                        fidl::endpoints::ClientEnd<NavigationEventListenerMarker>,
13007                    >,
13008                >,
13009                fidl::encoding::DefaultFuchsiaResourceDialect,
13010            >,
13011        T1: fidl::encoding::Encode<
13012                NavigationEventListenerFlags,
13013                fidl::encoding::DefaultFuchsiaResourceDialect,
13014            >,
13015    >
13016        fidl::encoding::Encode<
13017            FrameSetNavigationEventListener2Request,
13018            fidl::encoding::DefaultFuchsiaResourceDialect,
13019        > for (T0, T1)
13020    {
13021        #[inline]
13022        unsafe fn encode(
13023            self,
13024            encoder: &mut fidl::encoding::Encoder<
13025                '_,
13026                fidl::encoding::DefaultFuchsiaResourceDialect,
13027            >,
13028            offset: usize,
13029            depth: fidl::encoding::Depth,
13030        ) -> fidl::Result<()> {
13031            encoder.debug_check_bounds::<FrameSetNavigationEventListener2Request>(offset);
13032            // Zero out padding regions. There's no need to apply masks
13033            // because the unmasked parts will be overwritten by fields.
13034            unsafe {
13035                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
13036                (ptr as *mut u64).write_unaligned(0);
13037            }
13038            // Write the fields.
13039            self.0.encode(encoder, offset + 0, depth)?;
13040            self.1.encode(encoder, offset + 8, depth)?;
13041            Ok(())
13042        }
13043    }
13044
13045    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13046        for FrameSetNavigationEventListener2Request
13047    {
13048        #[inline(always)]
13049        fn new_empty() -> Self {
13050            Self {
13051                listener: fidl::new_empty!(
13052                    fidl::encoding::Optional<
13053                        fidl::encoding::Endpoint<
13054                            fidl::endpoints::ClientEnd<NavigationEventListenerMarker>,
13055                        >,
13056                    >,
13057                    fidl::encoding::DefaultFuchsiaResourceDialect
13058                ),
13059                flags: fidl::new_empty!(
13060                    NavigationEventListenerFlags,
13061                    fidl::encoding::DefaultFuchsiaResourceDialect
13062                ),
13063            }
13064        }
13065
13066        #[inline]
13067        unsafe fn decode(
13068            &mut self,
13069            decoder: &mut fidl::encoding::Decoder<
13070                '_,
13071                fidl::encoding::DefaultFuchsiaResourceDialect,
13072            >,
13073            offset: usize,
13074            _depth: fidl::encoding::Depth,
13075        ) -> fidl::Result<()> {
13076            decoder.debug_check_bounds::<Self>(offset);
13077            // Verify that padding bytes are zero.
13078            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
13079            let padval = unsafe { (ptr as *const u64).read_unaligned() };
13080            let mask = 0xffffffff00000000u64;
13081            let maskedval = padval & mask;
13082            if maskedval != 0 {
13083                return Err(fidl::Error::NonZeroPadding {
13084                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
13085                });
13086            }
13087            fidl::decode!(
13088                fidl::encoding::Optional<
13089                    fidl::encoding::Endpoint<
13090                        fidl::endpoints::ClientEnd<NavigationEventListenerMarker>,
13091                    >,
13092                >,
13093                fidl::encoding::DefaultFuchsiaResourceDialect,
13094                &mut self.listener,
13095                decoder,
13096                offset + 0,
13097                _depth
13098            )?;
13099            fidl::decode!(
13100                NavigationEventListenerFlags,
13101                fidl::encoding::DefaultFuchsiaResourceDialect,
13102                &mut self.flags,
13103                decoder,
13104                offset + 8,
13105                _depth
13106            )?;
13107            Ok(())
13108        }
13109    }
13110
13111    impl fidl::encoding::ResourceTypeMarker for FrameSetNavigationEventListenerRequest {
13112        type Borrowed<'a> = &'a mut Self;
13113        fn take_or_borrow<'a>(
13114            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13115        ) -> Self::Borrowed<'a> {
13116            value
13117        }
13118    }
13119
13120    unsafe impl fidl::encoding::TypeMarker for FrameSetNavigationEventListenerRequest {
13121        type Owned = Self;
13122
13123        #[inline(always)]
13124        fn inline_align(_context: fidl::encoding::Context) -> usize {
13125            4
13126        }
13127
13128        #[inline(always)]
13129        fn inline_size(_context: fidl::encoding::Context) -> usize {
13130            4
13131        }
13132    }
13133
13134    unsafe impl
13135        fidl::encoding::Encode<
13136            FrameSetNavigationEventListenerRequest,
13137            fidl::encoding::DefaultFuchsiaResourceDialect,
13138        > for &mut FrameSetNavigationEventListenerRequest
13139    {
13140        #[inline]
13141        unsafe fn encode(
13142            self,
13143            encoder: &mut fidl::encoding::Encoder<
13144                '_,
13145                fidl::encoding::DefaultFuchsiaResourceDialect,
13146            >,
13147            offset: usize,
13148            _depth: fidl::encoding::Depth,
13149        ) -> fidl::Result<()> {
13150            encoder.debug_check_bounds::<FrameSetNavigationEventListenerRequest>(offset);
13151            // Delegate to tuple encoding.
13152            fidl::encoding::Encode::<
13153                FrameSetNavigationEventListenerRequest,
13154                fidl::encoding::DefaultFuchsiaResourceDialect,
13155            >::encode(
13156                (<fidl::encoding::Optional<
13157                    fidl::encoding::Endpoint<
13158                        fidl::endpoints::ClientEnd<NavigationEventListenerMarker>,
13159                    >,
13160                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13161                    &mut self.listener
13162                ),),
13163                encoder,
13164                offset,
13165                _depth,
13166            )
13167        }
13168    }
13169    unsafe impl<
13170        T0: fidl::encoding::Encode<
13171                fidl::encoding::Optional<
13172                    fidl::encoding::Endpoint<
13173                        fidl::endpoints::ClientEnd<NavigationEventListenerMarker>,
13174                    >,
13175                >,
13176                fidl::encoding::DefaultFuchsiaResourceDialect,
13177            >,
13178    >
13179        fidl::encoding::Encode<
13180            FrameSetNavigationEventListenerRequest,
13181            fidl::encoding::DefaultFuchsiaResourceDialect,
13182        > for (T0,)
13183    {
13184        #[inline]
13185        unsafe fn encode(
13186            self,
13187            encoder: &mut fidl::encoding::Encoder<
13188                '_,
13189                fidl::encoding::DefaultFuchsiaResourceDialect,
13190            >,
13191            offset: usize,
13192            depth: fidl::encoding::Depth,
13193        ) -> fidl::Result<()> {
13194            encoder.debug_check_bounds::<FrameSetNavigationEventListenerRequest>(offset);
13195            // Zero out padding regions. There's no need to apply masks
13196            // because the unmasked parts will be overwritten by fields.
13197            // Write the fields.
13198            self.0.encode(encoder, offset + 0, depth)?;
13199            Ok(())
13200        }
13201    }
13202
13203    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13204        for FrameSetNavigationEventListenerRequest
13205    {
13206        #[inline(always)]
13207        fn new_empty() -> Self {
13208            Self {
13209                listener: fidl::new_empty!(
13210                    fidl::encoding::Optional<
13211                        fidl::encoding::Endpoint<
13212                            fidl::endpoints::ClientEnd<NavigationEventListenerMarker>,
13213                        >,
13214                    >,
13215                    fidl::encoding::DefaultFuchsiaResourceDialect
13216                ),
13217            }
13218        }
13219
13220        #[inline]
13221        unsafe fn decode(
13222            &mut self,
13223            decoder: &mut fidl::encoding::Decoder<
13224                '_,
13225                fidl::encoding::DefaultFuchsiaResourceDialect,
13226            >,
13227            offset: usize,
13228            _depth: fidl::encoding::Depth,
13229        ) -> fidl::Result<()> {
13230            decoder.debug_check_bounds::<Self>(offset);
13231            // Verify that padding bytes are zero.
13232            fidl::decode!(
13233                fidl::encoding::Optional<
13234                    fidl::encoding::Endpoint<
13235                        fidl::endpoints::ClientEnd<NavigationEventListenerMarker>,
13236                    >,
13237                >,
13238                fidl::encoding::DefaultFuchsiaResourceDialect,
13239                &mut self.listener,
13240                decoder,
13241                offset + 0,
13242                _depth
13243            )?;
13244            Ok(())
13245        }
13246    }
13247
13248    impl fidl::encoding::ResourceTypeMarker for FrameSetNavigationPolicyProviderRequest {
13249        type Borrowed<'a> = &'a mut Self;
13250        fn take_or_borrow<'a>(
13251            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13252        ) -> Self::Borrowed<'a> {
13253            value
13254        }
13255    }
13256
13257    unsafe impl fidl::encoding::TypeMarker for FrameSetNavigationPolicyProviderRequest {
13258        type Owned = Self;
13259
13260        #[inline(always)]
13261        fn inline_align(_context: fidl::encoding::Context) -> usize {
13262            8
13263        }
13264
13265        #[inline(always)]
13266        fn inline_size(_context: fidl::encoding::Context) -> usize {
13267            24
13268        }
13269    }
13270
13271    unsafe impl
13272        fidl::encoding::Encode<
13273            FrameSetNavigationPolicyProviderRequest,
13274            fidl::encoding::DefaultFuchsiaResourceDialect,
13275        > for &mut FrameSetNavigationPolicyProviderRequest
13276    {
13277        #[inline]
13278        unsafe fn encode(
13279            self,
13280            encoder: &mut fidl::encoding::Encoder<
13281                '_,
13282                fidl::encoding::DefaultFuchsiaResourceDialect,
13283            >,
13284            offset: usize,
13285            _depth: fidl::encoding::Depth,
13286        ) -> fidl::Result<()> {
13287            encoder.debug_check_bounds::<FrameSetNavigationPolicyProviderRequest>(offset);
13288            // Delegate to tuple encoding.
13289            fidl::encoding::Encode::<
13290                FrameSetNavigationPolicyProviderRequest,
13291                fidl::encoding::DefaultFuchsiaResourceDialect,
13292            >::encode(
13293                (
13294                    <NavigationPolicyProviderParams as fidl::encoding::ValueTypeMarker>::borrow(
13295                        &self.params,
13296                    ),
13297                    <fidl::encoding::Endpoint<
13298                        fidl::endpoints::ClientEnd<NavigationPolicyProviderMarker>,
13299                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13300                        &mut self.provider
13301                    ),
13302                ),
13303                encoder,
13304                offset,
13305                _depth,
13306            )
13307        }
13308    }
13309    unsafe impl<
13310        T0: fidl::encoding::Encode<
13311                NavigationPolicyProviderParams,
13312                fidl::encoding::DefaultFuchsiaResourceDialect,
13313            >,
13314        T1: fidl::encoding::Encode<
13315                fidl::encoding::Endpoint<
13316                    fidl::endpoints::ClientEnd<NavigationPolicyProviderMarker>,
13317                >,
13318                fidl::encoding::DefaultFuchsiaResourceDialect,
13319            >,
13320    >
13321        fidl::encoding::Encode<
13322            FrameSetNavigationPolicyProviderRequest,
13323            fidl::encoding::DefaultFuchsiaResourceDialect,
13324        > for (T0, T1)
13325    {
13326        #[inline]
13327        unsafe fn encode(
13328            self,
13329            encoder: &mut fidl::encoding::Encoder<
13330                '_,
13331                fidl::encoding::DefaultFuchsiaResourceDialect,
13332            >,
13333            offset: usize,
13334            depth: fidl::encoding::Depth,
13335        ) -> fidl::Result<()> {
13336            encoder.debug_check_bounds::<FrameSetNavigationPolicyProviderRequest>(offset);
13337            // Zero out padding regions. There's no need to apply masks
13338            // because the unmasked parts will be overwritten by fields.
13339            unsafe {
13340                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
13341                (ptr as *mut u64).write_unaligned(0);
13342            }
13343            // Write the fields.
13344            self.0.encode(encoder, offset + 0, depth)?;
13345            self.1.encode(encoder, offset + 16, depth)?;
13346            Ok(())
13347        }
13348    }
13349
13350    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13351        for FrameSetNavigationPolicyProviderRequest
13352    {
13353        #[inline(always)]
13354        fn new_empty() -> Self {
13355            Self {
13356                params: fidl::new_empty!(
13357                    NavigationPolicyProviderParams,
13358                    fidl::encoding::DefaultFuchsiaResourceDialect
13359                ),
13360                provider: fidl::new_empty!(
13361                    fidl::encoding::Endpoint<
13362                        fidl::endpoints::ClientEnd<NavigationPolicyProviderMarker>,
13363                    >,
13364                    fidl::encoding::DefaultFuchsiaResourceDialect
13365                ),
13366            }
13367        }
13368
13369        #[inline]
13370        unsafe fn decode(
13371            &mut self,
13372            decoder: &mut fidl::encoding::Decoder<
13373                '_,
13374                fidl::encoding::DefaultFuchsiaResourceDialect,
13375            >,
13376            offset: usize,
13377            _depth: fidl::encoding::Depth,
13378        ) -> fidl::Result<()> {
13379            decoder.debug_check_bounds::<Self>(offset);
13380            // Verify that padding bytes are zero.
13381            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
13382            let padval = unsafe { (ptr as *const u64).read_unaligned() };
13383            let mask = 0xffffffff00000000u64;
13384            let maskedval = padval & mask;
13385            if maskedval != 0 {
13386                return Err(fidl::Error::NonZeroPadding {
13387                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
13388                });
13389            }
13390            fidl::decode!(
13391                NavigationPolicyProviderParams,
13392                fidl::encoding::DefaultFuchsiaResourceDialect,
13393                &mut self.params,
13394                decoder,
13395                offset + 0,
13396                _depth
13397            )?;
13398            fidl::decode!(
13399                fidl::encoding::Endpoint<
13400                    fidl::endpoints::ClientEnd<NavigationPolicyProviderMarker>,
13401                >,
13402                fidl::encoding::DefaultFuchsiaResourceDialect,
13403                &mut self.provider,
13404                decoder,
13405                offset + 16,
13406                _depth
13407            )?;
13408            Ok(())
13409        }
13410    }
13411
13412    impl fidl::encoding::ResourceTypeMarker for FrameSetPopupFrameCreationListenerRequest {
13413        type Borrowed<'a> = &'a mut Self;
13414        fn take_or_borrow<'a>(
13415            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13416        ) -> Self::Borrowed<'a> {
13417            value
13418        }
13419    }
13420
13421    unsafe impl fidl::encoding::TypeMarker for FrameSetPopupFrameCreationListenerRequest {
13422        type Owned = Self;
13423
13424        #[inline(always)]
13425        fn inline_align(_context: fidl::encoding::Context) -> usize {
13426            4
13427        }
13428
13429        #[inline(always)]
13430        fn inline_size(_context: fidl::encoding::Context) -> usize {
13431            4
13432        }
13433    }
13434
13435    unsafe impl
13436        fidl::encoding::Encode<
13437            FrameSetPopupFrameCreationListenerRequest,
13438            fidl::encoding::DefaultFuchsiaResourceDialect,
13439        > for &mut FrameSetPopupFrameCreationListenerRequest
13440    {
13441        #[inline]
13442        unsafe fn encode(
13443            self,
13444            encoder: &mut fidl::encoding::Encoder<
13445                '_,
13446                fidl::encoding::DefaultFuchsiaResourceDialect,
13447            >,
13448            offset: usize,
13449            _depth: fidl::encoding::Depth,
13450        ) -> fidl::Result<()> {
13451            encoder.debug_check_bounds::<FrameSetPopupFrameCreationListenerRequest>(offset);
13452            // Delegate to tuple encoding.
13453            fidl::encoding::Encode::<
13454                FrameSetPopupFrameCreationListenerRequest,
13455                fidl::encoding::DefaultFuchsiaResourceDialect,
13456            >::encode(
13457                (<fidl::encoding::Optional<
13458                    fidl::encoding::Endpoint<
13459                        fidl::endpoints::ClientEnd<PopupFrameCreationListenerMarker>,
13460                    >,
13461                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13462                    &mut self.listener
13463                ),),
13464                encoder,
13465                offset,
13466                _depth,
13467            )
13468        }
13469    }
13470    unsafe impl<
13471        T0: fidl::encoding::Encode<
13472                fidl::encoding::Optional<
13473                    fidl::encoding::Endpoint<
13474                        fidl::endpoints::ClientEnd<PopupFrameCreationListenerMarker>,
13475                    >,
13476                >,
13477                fidl::encoding::DefaultFuchsiaResourceDialect,
13478            >,
13479    >
13480        fidl::encoding::Encode<
13481            FrameSetPopupFrameCreationListenerRequest,
13482            fidl::encoding::DefaultFuchsiaResourceDialect,
13483        > for (T0,)
13484    {
13485        #[inline]
13486        unsafe fn encode(
13487            self,
13488            encoder: &mut fidl::encoding::Encoder<
13489                '_,
13490                fidl::encoding::DefaultFuchsiaResourceDialect,
13491            >,
13492            offset: usize,
13493            depth: fidl::encoding::Depth,
13494        ) -> fidl::Result<()> {
13495            encoder.debug_check_bounds::<FrameSetPopupFrameCreationListenerRequest>(offset);
13496            // Zero out padding regions. There's no need to apply masks
13497            // because the unmasked parts will be overwritten by fields.
13498            // Write the fields.
13499            self.0.encode(encoder, offset + 0, depth)?;
13500            Ok(())
13501        }
13502    }
13503
13504    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13505        for FrameSetPopupFrameCreationListenerRequest
13506    {
13507        #[inline(always)]
13508        fn new_empty() -> Self {
13509            Self {
13510                listener: fidl::new_empty!(
13511                    fidl::encoding::Optional<
13512                        fidl::encoding::Endpoint<
13513                            fidl::endpoints::ClientEnd<PopupFrameCreationListenerMarker>,
13514                        >,
13515                    >,
13516                    fidl::encoding::DefaultFuchsiaResourceDialect
13517                ),
13518            }
13519        }
13520
13521        #[inline]
13522        unsafe fn decode(
13523            &mut self,
13524            decoder: &mut fidl::encoding::Decoder<
13525                '_,
13526                fidl::encoding::DefaultFuchsiaResourceDialect,
13527            >,
13528            offset: usize,
13529            _depth: fidl::encoding::Depth,
13530        ) -> fidl::Result<()> {
13531            decoder.debug_check_bounds::<Self>(offset);
13532            // Verify that padding bytes are zero.
13533            fidl::decode!(
13534                fidl::encoding::Optional<
13535                    fidl::encoding::Endpoint<
13536                        fidl::endpoints::ClientEnd<PopupFrameCreationListenerMarker>,
13537                    >,
13538                >,
13539                fidl::encoding::DefaultFuchsiaResourceDialect,
13540                &mut self.listener,
13541                decoder,
13542                offset + 0,
13543                _depth
13544            )?;
13545            Ok(())
13546        }
13547    }
13548
13549    impl fidl::encoding::ResourceTypeMarker for FrameExecuteJavaScriptResponse {
13550        type Borrowed<'a> = &'a mut Self;
13551        fn take_or_borrow<'a>(
13552            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13553        ) -> Self::Borrowed<'a> {
13554            value
13555        }
13556    }
13557
13558    unsafe impl fidl::encoding::TypeMarker for FrameExecuteJavaScriptResponse {
13559        type Owned = Self;
13560
13561        #[inline(always)]
13562        fn inline_align(_context: fidl::encoding::Context) -> usize {
13563            8
13564        }
13565
13566        #[inline(always)]
13567        fn inline_size(_context: fidl::encoding::Context) -> usize {
13568            16
13569        }
13570    }
13571
13572    unsafe impl
13573        fidl::encoding::Encode<
13574            FrameExecuteJavaScriptResponse,
13575            fidl::encoding::DefaultFuchsiaResourceDialect,
13576        > for &mut FrameExecuteJavaScriptResponse
13577    {
13578        #[inline]
13579        unsafe fn encode(
13580            self,
13581            encoder: &mut fidl::encoding::Encoder<
13582                '_,
13583                fidl::encoding::DefaultFuchsiaResourceDialect,
13584            >,
13585            offset: usize,
13586            _depth: fidl::encoding::Depth,
13587        ) -> fidl::Result<()> {
13588            encoder.debug_check_bounds::<FrameExecuteJavaScriptResponse>(offset);
13589            // Delegate to tuple encoding.
13590            fidl::encoding::Encode::<
13591                FrameExecuteJavaScriptResponse,
13592                fidl::encoding::DefaultFuchsiaResourceDialect,
13593            >::encode(
13594                (<fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13595                    &mut self.result,
13596                ),),
13597                encoder,
13598                offset,
13599                _depth,
13600            )
13601        }
13602    }
13603    unsafe impl<
13604        T0: fidl::encoding::Encode<
13605                fidl_fuchsia_mem::Buffer,
13606                fidl::encoding::DefaultFuchsiaResourceDialect,
13607            >,
13608    >
13609        fidl::encoding::Encode<
13610            FrameExecuteJavaScriptResponse,
13611            fidl::encoding::DefaultFuchsiaResourceDialect,
13612        > for (T0,)
13613    {
13614        #[inline]
13615        unsafe fn encode(
13616            self,
13617            encoder: &mut fidl::encoding::Encoder<
13618                '_,
13619                fidl::encoding::DefaultFuchsiaResourceDialect,
13620            >,
13621            offset: usize,
13622            depth: fidl::encoding::Depth,
13623        ) -> fidl::Result<()> {
13624            encoder.debug_check_bounds::<FrameExecuteJavaScriptResponse>(offset);
13625            // Zero out padding regions. There's no need to apply masks
13626            // because the unmasked parts will be overwritten by fields.
13627            // Write the fields.
13628            self.0.encode(encoder, offset + 0, depth)?;
13629            Ok(())
13630        }
13631    }
13632
13633    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13634        for FrameExecuteJavaScriptResponse
13635    {
13636        #[inline(always)]
13637        fn new_empty() -> Self {
13638            Self {
13639                result: fidl::new_empty!(
13640                    fidl_fuchsia_mem::Buffer,
13641                    fidl::encoding::DefaultFuchsiaResourceDialect
13642                ),
13643            }
13644        }
13645
13646        #[inline]
13647        unsafe fn decode(
13648            &mut self,
13649            decoder: &mut fidl::encoding::Decoder<
13650                '_,
13651                fidl::encoding::DefaultFuchsiaResourceDialect,
13652            >,
13653            offset: usize,
13654            _depth: fidl::encoding::Depth,
13655        ) -> fidl::Result<()> {
13656            decoder.debug_check_bounds::<Self>(offset);
13657            // Verify that padding bytes are zero.
13658            fidl::decode!(
13659                fidl_fuchsia_mem::Buffer,
13660                fidl::encoding::DefaultFuchsiaResourceDialect,
13661                &mut self.result,
13662                decoder,
13663                offset + 0,
13664                _depth
13665            )?;
13666            Ok(())
13667        }
13668    }
13669
13670    impl fidl::encoding::ResourceTypeMarker for MessagePortPostMessageRequest {
13671        type Borrowed<'a> = &'a mut Self;
13672        fn take_or_borrow<'a>(
13673            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13674        ) -> Self::Borrowed<'a> {
13675            value
13676        }
13677    }
13678
13679    unsafe impl fidl::encoding::TypeMarker for MessagePortPostMessageRequest {
13680        type Owned = Self;
13681
13682        #[inline(always)]
13683        fn inline_align(_context: fidl::encoding::Context) -> usize {
13684            8
13685        }
13686
13687        #[inline(always)]
13688        fn inline_size(_context: fidl::encoding::Context) -> usize {
13689            16
13690        }
13691    }
13692
13693    unsafe impl
13694        fidl::encoding::Encode<
13695            MessagePortPostMessageRequest,
13696            fidl::encoding::DefaultFuchsiaResourceDialect,
13697        > for &mut MessagePortPostMessageRequest
13698    {
13699        #[inline]
13700        unsafe fn encode(
13701            self,
13702            encoder: &mut fidl::encoding::Encoder<
13703                '_,
13704                fidl::encoding::DefaultFuchsiaResourceDialect,
13705            >,
13706            offset: usize,
13707            _depth: fidl::encoding::Depth,
13708        ) -> fidl::Result<()> {
13709            encoder.debug_check_bounds::<MessagePortPostMessageRequest>(offset);
13710            // Delegate to tuple encoding.
13711            fidl::encoding::Encode::<
13712                MessagePortPostMessageRequest,
13713                fidl::encoding::DefaultFuchsiaResourceDialect,
13714            >::encode(
13715                (<WebMessage as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13716                    &mut self.message,
13717                ),),
13718                encoder,
13719                offset,
13720                _depth,
13721            )
13722        }
13723    }
13724    unsafe impl<
13725        T0: fidl::encoding::Encode<WebMessage, fidl::encoding::DefaultFuchsiaResourceDialect>,
13726    >
13727        fidl::encoding::Encode<
13728            MessagePortPostMessageRequest,
13729            fidl::encoding::DefaultFuchsiaResourceDialect,
13730        > for (T0,)
13731    {
13732        #[inline]
13733        unsafe fn encode(
13734            self,
13735            encoder: &mut fidl::encoding::Encoder<
13736                '_,
13737                fidl::encoding::DefaultFuchsiaResourceDialect,
13738            >,
13739            offset: usize,
13740            depth: fidl::encoding::Depth,
13741        ) -> fidl::Result<()> {
13742            encoder.debug_check_bounds::<MessagePortPostMessageRequest>(offset);
13743            // Zero out padding regions. There's no need to apply masks
13744            // because the unmasked parts will be overwritten by fields.
13745            // Write the fields.
13746            self.0.encode(encoder, offset + 0, depth)?;
13747            Ok(())
13748        }
13749    }
13750
13751    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13752        for MessagePortPostMessageRequest
13753    {
13754        #[inline(always)]
13755        fn new_empty() -> Self {
13756            Self {
13757                message: fidl::new_empty!(
13758                    WebMessage,
13759                    fidl::encoding::DefaultFuchsiaResourceDialect
13760                ),
13761            }
13762        }
13763
13764        #[inline]
13765        unsafe fn decode(
13766            &mut self,
13767            decoder: &mut fidl::encoding::Decoder<
13768                '_,
13769                fidl::encoding::DefaultFuchsiaResourceDialect,
13770            >,
13771            offset: usize,
13772            _depth: fidl::encoding::Depth,
13773        ) -> fidl::Result<()> {
13774            decoder.debug_check_bounds::<Self>(offset);
13775            // Verify that padding bytes are zero.
13776            fidl::decode!(
13777                WebMessage,
13778                fidl::encoding::DefaultFuchsiaResourceDialect,
13779                &mut self.message,
13780                decoder,
13781                offset + 0,
13782                _depth
13783            )?;
13784            Ok(())
13785        }
13786    }
13787
13788    impl fidl::encoding::ResourceTypeMarker for MessagePortReceiveMessageResponse {
13789        type Borrowed<'a> = &'a mut Self;
13790        fn take_or_borrow<'a>(
13791            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13792        ) -> Self::Borrowed<'a> {
13793            value
13794        }
13795    }
13796
13797    unsafe impl fidl::encoding::TypeMarker for MessagePortReceiveMessageResponse {
13798        type Owned = Self;
13799
13800        #[inline(always)]
13801        fn inline_align(_context: fidl::encoding::Context) -> usize {
13802            8
13803        }
13804
13805        #[inline(always)]
13806        fn inline_size(_context: fidl::encoding::Context) -> usize {
13807            16
13808        }
13809    }
13810
13811    unsafe impl
13812        fidl::encoding::Encode<
13813            MessagePortReceiveMessageResponse,
13814            fidl::encoding::DefaultFuchsiaResourceDialect,
13815        > for &mut MessagePortReceiveMessageResponse
13816    {
13817        #[inline]
13818        unsafe fn encode(
13819            self,
13820            encoder: &mut fidl::encoding::Encoder<
13821                '_,
13822                fidl::encoding::DefaultFuchsiaResourceDialect,
13823            >,
13824            offset: usize,
13825            _depth: fidl::encoding::Depth,
13826        ) -> fidl::Result<()> {
13827            encoder.debug_check_bounds::<MessagePortReceiveMessageResponse>(offset);
13828            // Delegate to tuple encoding.
13829            fidl::encoding::Encode::<
13830                MessagePortReceiveMessageResponse,
13831                fidl::encoding::DefaultFuchsiaResourceDialect,
13832            >::encode(
13833                (<WebMessage as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13834                    &mut self.message,
13835                ),),
13836                encoder,
13837                offset,
13838                _depth,
13839            )
13840        }
13841    }
13842    unsafe impl<
13843        T0: fidl::encoding::Encode<WebMessage, fidl::encoding::DefaultFuchsiaResourceDialect>,
13844    >
13845        fidl::encoding::Encode<
13846            MessagePortReceiveMessageResponse,
13847            fidl::encoding::DefaultFuchsiaResourceDialect,
13848        > for (T0,)
13849    {
13850        #[inline]
13851        unsafe fn encode(
13852            self,
13853            encoder: &mut fidl::encoding::Encoder<
13854                '_,
13855                fidl::encoding::DefaultFuchsiaResourceDialect,
13856            >,
13857            offset: usize,
13858            depth: fidl::encoding::Depth,
13859        ) -> fidl::Result<()> {
13860            encoder.debug_check_bounds::<MessagePortReceiveMessageResponse>(offset);
13861            // Zero out padding regions. There's no need to apply masks
13862            // because the unmasked parts will be overwritten by fields.
13863            // Write the fields.
13864            self.0.encode(encoder, offset + 0, depth)?;
13865            Ok(())
13866        }
13867    }
13868
13869    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13870        for MessagePortReceiveMessageResponse
13871    {
13872        #[inline(always)]
13873        fn new_empty() -> Self {
13874            Self {
13875                message: fidl::new_empty!(
13876                    WebMessage,
13877                    fidl::encoding::DefaultFuchsiaResourceDialect
13878                ),
13879            }
13880        }
13881
13882        #[inline]
13883        unsafe fn decode(
13884            &mut self,
13885            decoder: &mut fidl::encoding::Decoder<
13886                '_,
13887                fidl::encoding::DefaultFuchsiaResourceDialect,
13888            >,
13889            offset: usize,
13890            _depth: fidl::encoding::Depth,
13891        ) -> fidl::Result<()> {
13892            decoder.debug_check_bounds::<Self>(offset);
13893            // Verify that padding bytes are zero.
13894            fidl::decode!(
13895                WebMessage,
13896                fidl::encoding::DefaultFuchsiaResourceDialect,
13897                &mut self.message,
13898                decoder,
13899                offset + 0,
13900                _depth
13901            )?;
13902            Ok(())
13903        }
13904    }
13905
13906    impl fidl::encoding::ResourceTypeMarker for NavigationControllerLoadUrlRequest {
13907        type Borrowed<'a> = &'a mut Self;
13908        fn take_or_borrow<'a>(
13909            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13910        ) -> Self::Borrowed<'a> {
13911            value
13912        }
13913    }
13914
13915    unsafe impl fidl::encoding::TypeMarker for NavigationControllerLoadUrlRequest {
13916        type Owned = Self;
13917
13918        #[inline(always)]
13919        fn inline_align(_context: fidl::encoding::Context) -> usize {
13920            8
13921        }
13922
13923        #[inline(always)]
13924        fn inline_size(_context: fidl::encoding::Context) -> usize {
13925            32
13926        }
13927    }
13928
13929    unsafe impl
13930        fidl::encoding::Encode<
13931            NavigationControllerLoadUrlRequest,
13932            fidl::encoding::DefaultFuchsiaResourceDialect,
13933        > for &mut NavigationControllerLoadUrlRequest
13934    {
13935        #[inline]
13936        unsafe fn encode(
13937            self,
13938            encoder: &mut fidl::encoding::Encoder<
13939                '_,
13940                fidl::encoding::DefaultFuchsiaResourceDialect,
13941            >,
13942            offset: usize,
13943            _depth: fidl::encoding::Depth,
13944        ) -> fidl::Result<()> {
13945            encoder.debug_check_bounds::<NavigationControllerLoadUrlRequest>(offset);
13946            // Delegate to tuple encoding.
13947            fidl::encoding::Encode::<NavigationControllerLoadUrlRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
13948                (
13949                    <fidl::encoding::BoundedString<65536> as fidl::encoding::ValueTypeMarker>::borrow(&self.url),
13950                    <LoadUrlParams as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.params),
13951                ),
13952                encoder, offset, _depth
13953            )
13954        }
13955    }
13956    unsafe impl<
13957        T0: fidl::encoding::Encode<
13958                fidl::encoding::BoundedString<65536>,
13959                fidl::encoding::DefaultFuchsiaResourceDialect,
13960            >,
13961        T1: fidl::encoding::Encode<LoadUrlParams, fidl::encoding::DefaultFuchsiaResourceDialect>,
13962    >
13963        fidl::encoding::Encode<
13964            NavigationControllerLoadUrlRequest,
13965            fidl::encoding::DefaultFuchsiaResourceDialect,
13966        > for (T0, T1)
13967    {
13968        #[inline]
13969        unsafe fn encode(
13970            self,
13971            encoder: &mut fidl::encoding::Encoder<
13972                '_,
13973                fidl::encoding::DefaultFuchsiaResourceDialect,
13974            >,
13975            offset: usize,
13976            depth: fidl::encoding::Depth,
13977        ) -> fidl::Result<()> {
13978            encoder.debug_check_bounds::<NavigationControllerLoadUrlRequest>(offset);
13979            // Zero out padding regions. There's no need to apply masks
13980            // because the unmasked parts will be overwritten by fields.
13981            // Write the fields.
13982            self.0.encode(encoder, offset + 0, depth)?;
13983            self.1.encode(encoder, offset + 16, depth)?;
13984            Ok(())
13985        }
13986    }
13987
13988    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13989        for NavigationControllerLoadUrlRequest
13990    {
13991        #[inline(always)]
13992        fn new_empty() -> Self {
13993            Self {
13994                url: fidl::new_empty!(
13995                    fidl::encoding::BoundedString<65536>,
13996                    fidl::encoding::DefaultFuchsiaResourceDialect
13997                ),
13998                params: fidl::new_empty!(
13999                    LoadUrlParams,
14000                    fidl::encoding::DefaultFuchsiaResourceDialect
14001                ),
14002            }
14003        }
14004
14005        #[inline]
14006        unsafe fn decode(
14007            &mut self,
14008            decoder: &mut fidl::encoding::Decoder<
14009                '_,
14010                fidl::encoding::DefaultFuchsiaResourceDialect,
14011            >,
14012            offset: usize,
14013            _depth: fidl::encoding::Depth,
14014        ) -> fidl::Result<()> {
14015            decoder.debug_check_bounds::<Self>(offset);
14016            // Verify that padding bytes are zero.
14017            fidl::decode!(
14018                fidl::encoding::BoundedString<65536>,
14019                fidl::encoding::DefaultFuchsiaResourceDialect,
14020                &mut self.url,
14021                decoder,
14022                offset + 0,
14023                _depth
14024            )?;
14025            fidl::decode!(
14026                LoadUrlParams,
14027                fidl::encoding::DefaultFuchsiaResourceDialect,
14028                &mut self.params,
14029                decoder,
14030                offset + 16,
14031                _depth
14032            )?;
14033            Ok(())
14034        }
14035    }
14036
14037    impl fidl::encoding::ResourceTypeMarker for NavigationEventListenerOnNavigationStateChangedRequest {
14038        type Borrowed<'a> = &'a mut Self;
14039        fn take_or_borrow<'a>(
14040            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14041        ) -> Self::Borrowed<'a> {
14042            value
14043        }
14044    }
14045
14046    unsafe impl fidl::encoding::TypeMarker for NavigationEventListenerOnNavigationStateChangedRequest {
14047        type Owned = Self;
14048
14049        #[inline(always)]
14050        fn inline_align(_context: fidl::encoding::Context) -> usize {
14051            8
14052        }
14053
14054        #[inline(always)]
14055        fn inline_size(_context: fidl::encoding::Context) -> usize {
14056            16
14057        }
14058    }
14059
14060    unsafe impl
14061        fidl::encoding::Encode<
14062            NavigationEventListenerOnNavigationStateChangedRequest,
14063            fidl::encoding::DefaultFuchsiaResourceDialect,
14064        > for &mut NavigationEventListenerOnNavigationStateChangedRequest
14065    {
14066        #[inline]
14067        unsafe fn encode(
14068            self,
14069            encoder: &mut fidl::encoding::Encoder<
14070                '_,
14071                fidl::encoding::DefaultFuchsiaResourceDialect,
14072            >,
14073            offset: usize,
14074            _depth: fidl::encoding::Depth,
14075        ) -> fidl::Result<()> {
14076            encoder.debug_check_bounds::<NavigationEventListenerOnNavigationStateChangedRequest>(
14077                offset,
14078            );
14079            // Delegate to tuple encoding.
14080            fidl::encoding::Encode::<
14081                NavigationEventListenerOnNavigationStateChangedRequest,
14082                fidl::encoding::DefaultFuchsiaResourceDialect,
14083            >::encode(
14084                (<NavigationState as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
14085                    &mut self.change,
14086                ),),
14087                encoder,
14088                offset,
14089                _depth,
14090            )
14091        }
14092    }
14093    unsafe impl<
14094        T0: fidl::encoding::Encode<NavigationState, fidl::encoding::DefaultFuchsiaResourceDialect>,
14095    >
14096        fidl::encoding::Encode<
14097            NavigationEventListenerOnNavigationStateChangedRequest,
14098            fidl::encoding::DefaultFuchsiaResourceDialect,
14099        > for (T0,)
14100    {
14101        #[inline]
14102        unsafe fn encode(
14103            self,
14104            encoder: &mut fidl::encoding::Encoder<
14105                '_,
14106                fidl::encoding::DefaultFuchsiaResourceDialect,
14107            >,
14108            offset: usize,
14109            depth: fidl::encoding::Depth,
14110        ) -> fidl::Result<()> {
14111            encoder.debug_check_bounds::<NavigationEventListenerOnNavigationStateChangedRequest>(
14112                offset,
14113            );
14114            // Zero out padding regions. There's no need to apply masks
14115            // because the unmasked parts will be overwritten by fields.
14116            // Write the fields.
14117            self.0.encode(encoder, offset + 0, depth)?;
14118            Ok(())
14119        }
14120    }
14121
14122    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14123        for NavigationEventListenerOnNavigationStateChangedRequest
14124    {
14125        #[inline(always)]
14126        fn new_empty() -> Self {
14127            Self {
14128                change: fidl::new_empty!(
14129                    NavigationState,
14130                    fidl::encoding::DefaultFuchsiaResourceDialect
14131                ),
14132            }
14133        }
14134
14135        #[inline]
14136        unsafe fn decode(
14137            &mut self,
14138            decoder: &mut fidl::encoding::Decoder<
14139                '_,
14140                fidl::encoding::DefaultFuchsiaResourceDialect,
14141            >,
14142            offset: usize,
14143            _depth: fidl::encoding::Depth,
14144        ) -> fidl::Result<()> {
14145            decoder.debug_check_bounds::<Self>(offset);
14146            // Verify that padding bytes are zero.
14147            fidl::decode!(
14148                NavigationState,
14149                fidl::encoding::DefaultFuchsiaResourceDialect,
14150                &mut self.change,
14151                decoder,
14152                offset + 0,
14153                _depth
14154            )?;
14155            Ok(())
14156        }
14157    }
14158
14159    impl fidl::encoding::ResourceTypeMarker
14160        for NavigationPolicyProviderEvaluateRequestedNavigationResponse
14161    {
14162        type Borrowed<'a> = &'a mut Self;
14163        fn take_or_borrow<'a>(
14164            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14165        ) -> Self::Borrowed<'a> {
14166            value
14167        }
14168    }
14169
14170    unsafe impl fidl::encoding::TypeMarker
14171        for NavigationPolicyProviderEvaluateRequestedNavigationResponse
14172    {
14173        type Owned = Self;
14174
14175        #[inline(always)]
14176        fn inline_align(_context: fidl::encoding::Context) -> usize {
14177            8
14178        }
14179
14180        #[inline(always)]
14181        fn inline_size(_context: fidl::encoding::Context) -> usize {
14182            16
14183        }
14184    }
14185
14186    unsafe impl
14187        fidl::encoding::Encode<
14188            NavigationPolicyProviderEvaluateRequestedNavigationResponse,
14189            fidl::encoding::DefaultFuchsiaResourceDialect,
14190        > for &mut NavigationPolicyProviderEvaluateRequestedNavigationResponse
14191    {
14192        #[inline]
14193        unsafe fn encode(
14194            self,
14195            encoder: &mut fidl::encoding::Encoder<
14196                '_,
14197                fidl::encoding::DefaultFuchsiaResourceDialect,
14198            >,
14199            offset: usize,
14200            _depth: fidl::encoding::Depth,
14201        ) -> fidl::Result<()> {
14202            encoder
14203                .debug_check_bounds::<NavigationPolicyProviderEvaluateRequestedNavigationResponse>(
14204                    offset,
14205                );
14206            // Delegate to tuple encoding.
14207            fidl::encoding::Encode::<
14208                NavigationPolicyProviderEvaluateRequestedNavigationResponse,
14209                fidl::encoding::DefaultFuchsiaResourceDialect,
14210            >::encode(
14211                (<NavigationDecision as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
14212                    &mut self.decision,
14213                ),),
14214                encoder,
14215                offset,
14216                _depth,
14217            )
14218        }
14219    }
14220    unsafe impl<
14221        T0: fidl::encoding::Encode<NavigationDecision, fidl::encoding::DefaultFuchsiaResourceDialect>,
14222    >
14223        fidl::encoding::Encode<
14224            NavigationPolicyProviderEvaluateRequestedNavigationResponse,
14225            fidl::encoding::DefaultFuchsiaResourceDialect,
14226        > for (T0,)
14227    {
14228        #[inline]
14229        unsafe fn encode(
14230            self,
14231            encoder: &mut fidl::encoding::Encoder<
14232                '_,
14233                fidl::encoding::DefaultFuchsiaResourceDialect,
14234            >,
14235            offset: usize,
14236            depth: fidl::encoding::Depth,
14237        ) -> fidl::Result<()> {
14238            encoder
14239                .debug_check_bounds::<NavigationPolicyProviderEvaluateRequestedNavigationResponse>(
14240                    offset,
14241                );
14242            // Zero out padding regions. There's no need to apply masks
14243            // because the unmasked parts will be overwritten by fields.
14244            // Write the fields.
14245            self.0.encode(encoder, offset + 0, depth)?;
14246            Ok(())
14247        }
14248    }
14249
14250    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14251        for NavigationPolicyProviderEvaluateRequestedNavigationResponse
14252    {
14253        #[inline(always)]
14254        fn new_empty() -> Self {
14255            Self {
14256                decision: fidl::new_empty!(
14257                    NavigationDecision,
14258                    fidl::encoding::DefaultFuchsiaResourceDialect
14259                ),
14260            }
14261        }
14262
14263        #[inline]
14264        unsafe fn decode(
14265            &mut self,
14266            decoder: &mut fidl::encoding::Decoder<
14267                '_,
14268                fidl::encoding::DefaultFuchsiaResourceDialect,
14269            >,
14270            offset: usize,
14271            _depth: fidl::encoding::Depth,
14272        ) -> fidl::Result<()> {
14273            decoder.debug_check_bounds::<Self>(offset);
14274            // Verify that padding bytes are zero.
14275            fidl::decode!(
14276                NavigationDecision,
14277                fidl::encoding::DefaultFuchsiaResourceDialect,
14278                &mut self.decision,
14279                decoder,
14280                offset + 0,
14281                _depth
14282            )?;
14283            Ok(())
14284        }
14285    }
14286
14287    impl fidl::encoding::ResourceTypeMarker for PopupFrameCreationListenerOnPopupFrameCreatedRequest {
14288        type Borrowed<'a> = &'a mut Self;
14289        fn take_or_borrow<'a>(
14290            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14291        ) -> Self::Borrowed<'a> {
14292            value
14293        }
14294    }
14295
14296    unsafe impl fidl::encoding::TypeMarker for PopupFrameCreationListenerOnPopupFrameCreatedRequest {
14297        type Owned = Self;
14298
14299        #[inline(always)]
14300        fn inline_align(_context: fidl::encoding::Context) -> usize {
14301            8
14302        }
14303
14304        #[inline(always)]
14305        fn inline_size(_context: fidl::encoding::Context) -> usize {
14306            24
14307        }
14308    }
14309
14310    unsafe impl
14311        fidl::encoding::Encode<
14312            PopupFrameCreationListenerOnPopupFrameCreatedRequest,
14313            fidl::encoding::DefaultFuchsiaResourceDialect,
14314        > for &mut PopupFrameCreationListenerOnPopupFrameCreatedRequest
14315    {
14316        #[inline]
14317        unsafe fn encode(
14318            self,
14319            encoder: &mut fidl::encoding::Encoder<
14320                '_,
14321                fidl::encoding::DefaultFuchsiaResourceDialect,
14322            >,
14323            offset: usize,
14324            _depth: fidl::encoding::Depth,
14325        ) -> fidl::Result<()> {
14326            encoder
14327                .debug_check_bounds::<PopupFrameCreationListenerOnPopupFrameCreatedRequest>(offset);
14328            // Delegate to tuple encoding.
14329            fidl::encoding::Encode::<PopupFrameCreationListenerOnPopupFrameCreatedRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
14330                (
14331                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<FrameMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.frame),
14332                    <PopupFrameCreationInfo as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.info),
14333                ),
14334                encoder, offset, _depth
14335            )
14336        }
14337    }
14338    unsafe impl<
14339        T0: fidl::encoding::Encode<
14340                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<FrameMarker>>,
14341                fidl::encoding::DefaultFuchsiaResourceDialect,
14342            >,
14343        T1: fidl::encoding::Encode<
14344                PopupFrameCreationInfo,
14345                fidl::encoding::DefaultFuchsiaResourceDialect,
14346            >,
14347    >
14348        fidl::encoding::Encode<
14349            PopupFrameCreationListenerOnPopupFrameCreatedRequest,
14350            fidl::encoding::DefaultFuchsiaResourceDialect,
14351        > for (T0, T1)
14352    {
14353        #[inline]
14354        unsafe fn encode(
14355            self,
14356            encoder: &mut fidl::encoding::Encoder<
14357                '_,
14358                fidl::encoding::DefaultFuchsiaResourceDialect,
14359            >,
14360            offset: usize,
14361            depth: fidl::encoding::Depth,
14362        ) -> fidl::Result<()> {
14363            encoder
14364                .debug_check_bounds::<PopupFrameCreationListenerOnPopupFrameCreatedRequest>(offset);
14365            // Zero out padding regions. There's no need to apply masks
14366            // because the unmasked parts will be overwritten by fields.
14367            unsafe {
14368                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
14369                (ptr as *mut u64).write_unaligned(0);
14370            }
14371            // Write the fields.
14372            self.0.encode(encoder, offset + 0, depth)?;
14373            self.1.encode(encoder, offset + 8, depth)?;
14374            Ok(())
14375        }
14376    }
14377
14378    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14379        for PopupFrameCreationListenerOnPopupFrameCreatedRequest
14380    {
14381        #[inline(always)]
14382        fn new_empty() -> Self {
14383            Self {
14384                frame: fidl::new_empty!(
14385                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<FrameMarker>>,
14386                    fidl::encoding::DefaultFuchsiaResourceDialect
14387                ),
14388                info: fidl::new_empty!(
14389                    PopupFrameCreationInfo,
14390                    fidl::encoding::DefaultFuchsiaResourceDialect
14391                ),
14392            }
14393        }
14394
14395        #[inline]
14396        unsafe fn decode(
14397            &mut self,
14398            decoder: &mut fidl::encoding::Decoder<
14399                '_,
14400                fidl::encoding::DefaultFuchsiaResourceDialect,
14401            >,
14402            offset: usize,
14403            _depth: fidl::encoding::Depth,
14404        ) -> fidl::Result<()> {
14405            decoder.debug_check_bounds::<Self>(offset);
14406            // Verify that padding bytes are zero.
14407            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
14408            let padval = unsafe { (ptr as *const u64).read_unaligned() };
14409            let mask = 0xffffffff00000000u64;
14410            let maskedval = padval & mask;
14411            if maskedval != 0 {
14412                return Err(fidl::Error::NonZeroPadding {
14413                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
14414                });
14415            }
14416            fidl::decode!(
14417                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<FrameMarker>>,
14418                fidl::encoding::DefaultFuchsiaResourceDialect,
14419                &mut self.frame,
14420                decoder,
14421                offset + 0,
14422                _depth
14423            )?;
14424            fidl::decode!(
14425                PopupFrameCreationInfo,
14426                fidl::encoding::DefaultFuchsiaResourceDialect,
14427                &mut self.info,
14428                decoder,
14429                offset + 8,
14430                _depth
14431            )?;
14432            Ok(())
14433        }
14434    }
14435
14436    impl ContentDirectoryProvider {
14437        #[inline(always)]
14438        fn max_ordinal_present(&self) -> u64 {
14439            if let Some(_) = self.directory {
14440                return 2;
14441            }
14442            if let Some(_) = self.name {
14443                return 1;
14444            }
14445            0
14446        }
14447    }
14448
14449    impl fidl::encoding::ResourceTypeMarker for ContentDirectoryProvider {
14450        type Borrowed<'a> = &'a mut Self;
14451        fn take_or_borrow<'a>(
14452            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14453        ) -> Self::Borrowed<'a> {
14454            value
14455        }
14456    }
14457
14458    unsafe impl fidl::encoding::TypeMarker for ContentDirectoryProvider {
14459        type Owned = Self;
14460
14461        #[inline(always)]
14462        fn inline_align(_context: fidl::encoding::Context) -> usize {
14463            8
14464        }
14465
14466        #[inline(always)]
14467        fn inline_size(_context: fidl::encoding::Context) -> usize {
14468            16
14469        }
14470    }
14471
14472    unsafe impl
14473        fidl::encoding::Encode<
14474            ContentDirectoryProvider,
14475            fidl::encoding::DefaultFuchsiaResourceDialect,
14476        > for &mut ContentDirectoryProvider
14477    {
14478        unsafe fn encode(
14479            self,
14480            encoder: &mut fidl::encoding::Encoder<
14481                '_,
14482                fidl::encoding::DefaultFuchsiaResourceDialect,
14483            >,
14484            offset: usize,
14485            mut depth: fidl::encoding::Depth,
14486        ) -> fidl::Result<()> {
14487            encoder.debug_check_bounds::<ContentDirectoryProvider>(offset);
14488            // Vector header
14489            let max_ordinal: u64 = self.max_ordinal_present();
14490            encoder.write_num(max_ordinal, offset);
14491            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
14492            // Calling encoder.out_of_line_offset(0) is not allowed.
14493            if max_ordinal == 0 {
14494                return Ok(());
14495            }
14496            depth.increment()?;
14497            let envelope_size = 8;
14498            let bytes_len = max_ordinal as usize * envelope_size;
14499            #[allow(unused_variables)]
14500            let offset = encoder.out_of_line_offset(bytes_len);
14501            let mut _prev_end_offset: usize = 0;
14502            if 1 > max_ordinal {
14503                return Ok(());
14504            }
14505
14506            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14507            // are envelope_size bytes.
14508            let cur_offset: usize = (1 - 1) * envelope_size;
14509
14510            // Zero reserved fields.
14511            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14512
14513            // Safety:
14514            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14515            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14516            //   envelope_size bytes, there is always sufficient room.
14517            fidl::encoding::encode_in_envelope_optional::<
14518                fidl::encoding::BoundedString<255>,
14519                fidl::encoding::DefaultFuchsiaResourceDialect,
14520            >(
14521                self.name.as_ref().map(
14522                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow,
14523                ),
14524                encoder,
14525                offset + cur_offset,
14526                depth,
14527            )?;
14528
14529            _prev_end_offset = cur_offset + envelope_size;
14530            if 2 > max_ordinal {
14531                return Ok(());
14532            }
14533
14534            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14535            // are envelope_size bytes.
14536            let cur_offset: usize = (2 - 1) * envelope_size;
14537
14538            // Zero reserved fields.
14539            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14540
14541            // Safety:
14542            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14543            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14544            //   envelope_size bytes, there is always sufficient room.
14545            fidl::encoding::encode_in_envelope_optional::<
14546                fidl::encoding::Endpoint<
14547                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
14548                >,
14549                fidl::encoding::DefaultFuchsiaResourceDialect,
14550            >(
14551                self.directory.as_mut().map(
14552                    <fidl::encoding::Endpoint<
14553                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
14554                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
14555                ),
14556                encoder,
14557                offset + cur_offset,
14558                depth,
14559            )?;
14560
14561            _prev_end_offset = cur_offset + envelope_size;
14562
14563            Ok(())
14564        }
14565    }
14566
14567    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14568        for ContentDirectoryProvider
14569    {
14570        #[inline(always)]
14571        fn new_empty() -> Self {
14572            Self::default()
14573        }
14574
14575        unsafe fn decode(
14576            &mut self,
14577            decoder: &mut fidl::encoding::Decoder<
14578                '_,
14579                fidl::encoding::DefaultFuchsiaResourceDialect,
14580            >,
14581            offset: usize,
14582            mut depth: fidl::encoding::Depth,
14583        ) -> fidl::Result<()> {
14584            decoder.debug_check_bounds::<Self>(offset);
14585            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
14586                None => return Err(fidl::Error::NotNullable),
14587                Some(len) => len,
14588            };
14589            // Calling decoder.out_of_line_offset(0) is not allowed.
14590            if len == 0 {
14591                return Ok(());
14592            };
14593            depth.increment()?;
14594            let envelope_size = 8;
14595            let bytes_len = len * envelope_size;
14596            let offset = decoder.out_of_line_offset(bytes_len)?;
14597            // Decode the envelope for each type.
14598            let mut _next_ordinal_to_read = 0;
14599            let mut next_offset = offset;
14600            let end_offset = offset + bytes_len;
14601            _next_ordinal_to_read += 1;
14602            if next_offset >= end_offset {
14603                return Ok(());
14604            }
14605
14606            // Decode unknown envelopes for gaps in ordinals.
14607            while _next_ordinal_to_read < 1 {
14608                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14609                _next_ordinal_to_read += 1;
14610                next_offset += envelope_size;
14611            }
14612
14613            let next_out_of_line = decoder.next_out_of_line();
14614            let handles_before = decoder.remaining_handles();
14615            if let Some((inlined, num_bytes, num_handles)) =
14616                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14617            {
14618                let member_inline_size =
14619                    <fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
14620                        decoder.context,
14621                    );
14622                if inlined != (member_inline_size <= 4) {
14623                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14624                }
14625                let inner_offset;
14626                let mut inner_depth = depth.clone();
14627                if inlined {
14628                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14629                    inner_offset = next_offset;
14630                } else {
14631                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14632                    inner_depth.increment()?;
14633                }
14634                let val_ref = self.name.get_or_insert_with(|| {
14635                    fidl::new_empty!(
14636                        fidl::encoding::BoundedString<255>,
14637                        fidl::encoding::DefaultFuchsiaResourceDialect
14638                    )
14639                });
14640                fidl::decode!(
14641                    fidl::encoding::BoundedString<255>,
14642                    fidl::encoding::DefaultFuchsiaResourceDialect,
14643                    val_ref,
14644                    decoder,
14645                    inner_offset,
14646                    inner_depth
14647                )?;
14648                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14649                {
14650                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14651                }
14652                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14653                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14654                }
14655            }
14656
14657            next_offset += envelope_size;
14658            _next_ordinal_to_read += 1;
14659            if next_offset >= end_offset {
14660                return Ok(());
14661            }
14662
14663            // Decode unknown envelopes for gaps in ordinals.
14664            while _next_ordinal_to_read < 2 {
14665                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14666                _next_ordinal_to_read += 1;
14667                next_offset += envelope_size;
14668            }
14669
14670            let next_out_of_line = decoder.next_out_of_line();
14671            let handles_before = decoder.remaining_handles();
14672            if let Some((inlined, num_bytes, num_handles)) =
14673                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14674            {
14675                let member_inline_size = <fidl::encoding::Endpoint<
14676                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
14677                > as fidl::encoding::TypeMarker>::inline_size(
14678                    decoder.context
14679                );
14680                if inlined != (member_inline_size <= 4) {
14681                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14682                }
14683                let inner_offset;
14684                let mut inner_depth = depth.clone();
14685                if inlined {
14686                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14687                    inner_offset = next_offset;
14688                } else {
14689                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14690                    inner_depth.increment()?;
14691                }
14692                let val_ref = self.directory.get_or_insert_with(|| {
14693                    fidl::new_empty!(
14694                        fidl::encoding::Endpoint<
14695                            fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
14696                        >,
14697                        fidl::encoding::DefaultFuchsiaResourceDialect
14698                    )
14699                });
14700                fidl::decode!(
14701                    fidl::encoding::Endpoint<
14702                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
14703                    >,
14704                    fidl::encoding::DefaultFuchsiaResourceDialect,
14705                    val_ref,
14706                    decoder,
14707                    inner_offset,
14708                    inner_depth
14709                )?;
14710                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14711                {
14712                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14713                }
14714                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14715                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14716                }
14717            }
14718
14719            next_offset += envelope_size;
14720
14721            // Decode the remaining unknown envelopes.
14722            while next_offset < end_offset {
14723                _next_ordinal_to_read += 1;
14724                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14725                next_offset += envelope_size;
14726            }
14727
14728            Ok(())
14729        }
14730    }
14731
14732    impl Cookie {
14733        #[inline(always)]
14734        fn max_ordinal_present(&self) -> u64 {
14735            if let Some(_) = self.value {
14736                return 2;
14737            }
14738            if let Some(_) = self.id {
14739                return 1;
14740            }
14741            0
14742        }
14743    }
14744
14745    impl fidl::encoding::ResourceTypeMarker for Cookie {
14746        type Borrowed<'a> = &'a mut Self;
14747        fn take_or_borrow<'a>(
14748            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14749        ) -> Self::Borrowed<'a> {
14750            value
14751        }
14752    }
14753
14754    unsafe impl fidl::encoding::TypeMarker for Cookie {
14755        type Owned = Self;
14756
14757        #[inline(always)]
14758        fn inline_align(_context: fidl::encoding::Context) -> usize {
14759            8
14760        }
14761
14762        #[inline(always)]
14763        fn inline_size(_context: fidl::encoding::Context) -> usize {
14764            16
14765        }
14766    }
14767
14768    unsafe impl fidl::encoding::Encode<Cookie, fidl::encoding::DefaultFuchsiaResourceDialect>
14769        for &mut Cookie
14770    {
14771        unsafe fn encode(
14772            self,
14773            encoder: &mut fidl::encoding::Encoder<
14774                '_,
14775                fidl::encoding::DefaultFuchsiaResourceDialect,
14776            >,
14777            offset: usize,
14778            mut depth: fidl::encoding::Depth,
14779        ) -> fidl::Result<()> {
14780            encoder.debug_check_bounds::<Cookie>(offset);
14781            // Vector header
14782            let max_ordinal: u64 = self.max_ordinal_present();
14783            encoder.write_num(max_ordinal, offset);
14784            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
14785            // Calling encoder.out_of_line_offset(0) is not allowed.
14786            if max_ordinal == 0 {
14787                return Ok(());
14788            }
14789            depth.increment()?;
14790            let envelope_size = 8;
14791            let bytes_len = max_ordinal as usize * envelope_size;
14792            #[allow(unused_variables)]
14793            let offset = encoder.out_of_line_offset(bytes_len);
14794            let mut _prev_end_offset: usize = 0;
14795            if 1 > max_ordinal {
14796                return Ok(());
14797            }
14798
14799            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14800            // are envelope_size bytes.
14801            let cur_offset: usize = (1 - 1) * envelope_size;
14802
14803            // Zero reserved fields.
14804            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14805
14806            // Safety:
14807            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14808            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14809            //   envelope_size bytes, there is always sufficient room.
14810            fidl::encoding::encode_in_envelope_optional::<
14811                CookieId,
14812                fidl::encoding::DefaultFuchsiaResourceDialect,
14813            >(
14814                self.id.as_ref().map(<CookieId as fidl::encoding::ValueTypeMarker>::borrow),
14815                encoder,
14816                offset + cur_offset,
14817                depth,
14818            )?;
14819
14820            _prev_end_offset = cur_offset + envelope_size;
14821            if 2 > max_ordinal {
14822                return Ok(());
14823            }
14824
14825            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14826            // are envelope_size bytes.
14827            let cur_offset: usize = (2 - 1) * envelope_size;
14828
14829            // Zero reserved fields.
14830            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14831
14832            // Safety:
14833            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14834            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14835            //   envelope_size bytes, there is always sufficient room.
14836            fidl::encoding::encode_in_envelope_optional::<
14837                fidl::encoding::UnboundedString,
14838                fidl::encoding::DefaultFuchsiaResourceDialect,
14839            >(
14840                self.value.as_ref().map(
14841                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
14842                ),
14843                encoder,
14844                offset + cur_offset,
14845                depth,
14846            )?;
14847
14848            _prev_end_offset = cur_offset + envelope_size;
14849
14850            Ok(())
14851        }
14852    }
14853
14854    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Cookie {
14855        #[inline(always)]
14856        fn new_empty() -> Self {
14857            Self::default()
14858        }
14859
14860        unsafe fn decode(
14861            &mut self,
14862            decoder: &mut fidl::encoding::Decoder<
14863                '_,
14864                fidl::encoding::DefaultFuchsiaResourceDialect,
14865            >,
14866            offset: usize,
14867            mut depth: fidl::encoding::Depth,
14868        ) -> fidl::Result<()> {
14869            decoder.debug_check_bounds::<Self>(offset);
14870            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
14871                None => return Err(fidl::Error::NotNullable),
14872                Some(len) => len,
14873            };
14874            // Calling decoder.out_of_line_offset(0) is not allowed.
14875            if len == 0 {
14876                return Ok(());
14877            };
14878            depth.increment()?;
14879            let envelope_size = 8;
14880            let bytes_len = len * envelope_size;
14881            let offset = decoder.out_of_line_offset(bytes_len)?;
14882            // Decode the envelope for each type.
14883            let mut _next_ordinal_to_read = 0;
14884            let mut next_offset = offset;
14885            let end_offset = offset + bytes_len;
14886            _next_ordinal_to_read += 1;
14887            if next_offset >= end_offset {
14888                return Ok(());
14889            }
14890
14891            // Decode unknown envelopes for gaps in ordinals.
14892            while _next_ordinal_to_read < 1 {
14893                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14894                _next_ordinal_to_read += 1;
14895                next_offset += envelope_size;
14896            }
14897
14898            let next_out_of_line = decoder.next_out_of_line();
14899            let handles_before = decoder.remaining_handles();
14900            if let Some((inlined, num_bytes, num_handles)) =
14901                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14902            {
14903                let member_inline_size =
14904                    <CookieId as fidl::encoding::TypeMarker>::inline_size(decoder.context);
14905                if inlined != (member_inline_size <= 4) {
14906                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14907                }
14908                let inner_offset;
14909                let mut inner_depth = depth.clone();
14910                if inlined {
14911                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14912                    inner_offset = next_offset;
14913                } else {
14914                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14915                    inner_depth.increment()?;
14916                }
14917                let val_ref = self.id.get_or_insert_with(|| {
14918                    fidl::new_empty!(CookieId, fidl::encoding::DefaultFuchsiaResourceDialect)
14919                });
14920                fidl::decode!(
14921                    CookieId,
14922                    fidl::encoding::DefaultFuchsiaResourceDialect,
14923                    val_ref,
14924                    decoder,
14925                    inner_offset,
14926                    inner_depth
14927                )?;
14928                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14929                {
14930                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14931                }
14932                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14933                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14934                }
14935            }
14936
14937            next_offset += envelope_size;
14938            _next_ordinal_to_read += 1;
14939            if next_offset >= end_offset {
14940                return Ok(());
14941            }
14942
14943            // Decode unknown envelopes for gaps in ordinals.
14944            while _next_ordinal_to_read < 2 {
14945                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14946                _next_ordinal_to_read += 1;
14947                next_offset += envelope_size;
14948            }
14949
14950            let next_out_of_line = decoder.next_out_of_line();
14951            let handles_before = decoder.remaining_handles();
14952            if let Some((inlined, num_bytes, num_handles)) =
14953                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14954            {
14955                let member_inline_size =
14956                    <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
14957                        decoder.context,
14958                    );
14959                if inlined != (member_inline_size <= 4) {
14960                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14961                }
14962                let inner_offset;
14963                let mut inner_depth = depth.clone();
14964                if inlined {
14965                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14966                    inner_offset = next_offset;
14967                } else {
14968                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14969                    inner_depth.increment()?;
14970                }
14971                let val_ref = self.value.get_or_insert_with(|| {
14972                    fidl::new_empty!(
14973                        fidl::encoding::UnboundedString,
14974                        fidl::encoding::DefaultFuchsiaResourceDialect
14975                    )
14976                });
14977                fidl::decode!(
14978                    fidl::encoding::UnboundedString,
14979                    fidl::encoding::DefaultFuchsiaResourceDialect,
14980                    val_ref,
14981                    decoder,
14982                    inner_offset,
14983                    inner_depth
14984                )?;
14985                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14986                {
14987                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14988                }
14989                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14990                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14991                }
14992            }
14993
14994            next_offset += envelope_size;
14995
14996            // Decode the remaining unknown envelopes.
14997            while next_offset < end_offset {
14998                _next_ordinal_to_read += 1;
14999                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15000                next_offset += envelope_size;
15001            }
15002
15003            Ok(())
15004        }
15005    }
15006
15007    impl CreateContextParams {
15008        #[inline(always)]
15009        fn max_ordinal_present(&self) -> u64 {
15010            if let Some(_) = self.data_quota_bytes {
15011                return 13;
15012            }
15013            if let Some(_) = self.cdm_data_quota_bytes {
15014                return 12;
15015            }
15016            if let Some(_) = self.cdm_data_directory {
15017                return 11;
15018            }
15019            if let Some(_) = self.cors_exempt_headers {
15020                return 10;
15021            }
15022            if let Some(_) = self.unsafely_treat_insecure_origins_as_secure {
15023                return 9;
15024            }
15025            if let Some(_) = self.playready_key_system {
15026                return 8;
15027            }
15028            if let Some(_) = self.features {
15029                return 7;
15030            }
15031            if let Some(_) = self.content_directories {
15032                return 6;
15033            }
15034            if let Some(_) = self.remote_debugging_port {
15035                return 5;
15036            }
15037            if let Some(_) = self.user_agent_version {
15038                return 4;
15039            }
15040            if let Some(_) = self.user_agent_product {
15041                return 3;
15042            }
15043            if let Some(_) = self.data_directory {
15044                return 2;
15045            }
15046            if let Some(_) = self.service_directory {
15047                return 1;
15048            }
15049            0
15050        }
15051    }
15052
15053    impl fidl::encoding::ResourceTypeMarker for CreateContextParams {
15054        type Borrowed<'a> = &'a mut Self;
15055        fn take_or_borrow<'a>(
15056            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
15057        ) -> Self::Borrowed<'a> {
15058            value
15059        }
15060    }
15061
15062    unsafe impl fidl::encoding::TypeMarker for CreateContextParams {
15063        type Owned = Self;
15064
15065        #[inline(always)]
15066        fn inline_align(_context: fidl::encoding::Context) -> usize {
15067            8
15068        }
15069
15070        #[inline(always)]
15071        fn inline_size(_context: fidl::encoding::Context) -> usize {
15072            16
15073        }
15074    }
15075
15076    unsafe impl
15077        fidl::encoding::Encode<CreateContextParams, fidl::encoding::DefaultFuchsiaResourceDialect>
15078        for &mut CreateContextParams
15079    {
15080        unsafe fn encode(
15081            self,
15082            encoder: &mut fidl::encoding::Encoder<
15083                '_,
15084                fidl::encoding::DefaultFuchsiaResourceDialect,
15085            >,
15086            offset: usize,
15087            mut depth: fidl::encoding::Depth,
15088        ) -> fidl::Result<()> {
15089            encoder.debug_check_bounds::<CreateContextParams>(offset);
15090            // Vector header
15091            let max_ordinal: u64 = self.max_ordinal_present();
15092            encoder.write_num(max_ordinal, offset);
15093            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
15094            // Calling encoder.out_of_line_offset(0) is not allowed.
15095            if max_ordinal == 0 {
15096                return Ok(());
15097            }
15098            depth.increment()?;
15099            let envelope_size = 8;
15100            let bytes_len = max_ordinal as usize * envelope_size;
15101            #[allow(unused_variables)]
15102            let offset = encoder.out_of_line_offset(bytes_len);
15103            let mut _prev_end_offset: usize = 0;
15104            if 1 > max_ordinal {
15105                return Ok(());
15106            }
15107
15108            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15109            // are envelope_size bytes.
15110            let cur_offset: usize = (1 - 1) * envelope_size;
15111
15112            // Zero reserved fields.
15113            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15114
15115            // Safety:
15116            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15117            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15118            //   envelope_size bytes, there is always sufficient room.
15119            fidl::encoding::encode_in_envelope_optional::<
15120                fidl::encoding::Endpoint<
15121                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15122                >,
15123                fidl::encoding::DefaultFuchsiaResourceDialect,
15124            >(
15125                self.service_directory.as_mut().map(
15126                    <fidl::encoding::Endpoint<
15127                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15128                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
15129                ),
15130                encoder,
15131                offset + cur_offset,
15132                depth,
15133            )?;
15134
15135            _prev_end_offset = cur_offset + envelope_size;
15136            if 2 > max_ordinal {
15137                return Ok(());
15138            }
15139
15140            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15141            // are envelope_size bytes.
15142            let cur_offset: usize = (2 - 1) * envelope_size;
15143
15144            // Zero reserved fields.
15145            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15146
15147            // Safety:
15148            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15149            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15150            //   envelope_size bytes, there is always sufficient room.
15151            fidl::encoding::encode_in_envelope_optional::<
15152                fidl::encoding::Endpoint<
15153                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15154                >,
15155                fidl::encoding::DefaultFuchsiaResourceDialect,
15156            >(
15157                self.data_directory.as_mut().map(
15158                    <fidl::encoding::Endpoint<
15159                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15160                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
15161                ),
15162                encoder,
15163                offset + cur_offset,
15164                depth,
15165            )?;
15166
15167            _prev_end_offset = cur_offset + envelope_size;
15168            if 3 > max_ordinal {
15169                return Ok(());
15170            }
15171
15172            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15173            // are envelope_size bytes.
15174            let cur_offset: usize = (3 - 1) * envelope_size;
15175
15176            // Zero reserved fields.
15177            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15178
15179            // Safety:
15180            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15181            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15182            //   envelope_size bytes, there is always sufficient room.
15183            fidl::encoding::encode_in_envelope_optional::<
15184                fidl::encoding::BoundedString<128>,
15185                fidl::encoding::DefaultFuchsiaResourceDialect,
15186            >(
15187                self.user_agent_product.as_ref().map(
15188                    <fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow,
15189                ),
15190                encoder,
15191                offset + cur_offset,
15192                depth,
15193            )?;
15194
15195            _prev_end_offset = cur_offset + envelope_size;
15196            if 4 > max_ordinal {
15197                return Ok(());
15198            }
15199
15200            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15201            // are envelope_size bytes.
15202            let cur_offset: usize = (4 - 1) * envelope_size;
15203
15204            // Zero reserved fields.
15205            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15206
15207            // Safety:
15208            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15209            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15210            //   envelope_size bytes, there is always sufficient room.
15211            fidl::encoding::encode_in_envelope_optional::<
15212                fidl::encoding::BoundedString<128>,
15213                fidl::encoding::DefaultFuchsiaResourceDialect,
15214            >(
15215                self.user_agent_version.as_ref().map(
15216                    <fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow,
15217                ),
15218                encoder,
15219                offset + cur_offset,
15220                depth,
15221            )?;
15222
15223            _prev_end_offset = cur_offset + envelope_size;
15224            if 5 > max_ordinal {
15225                return Ok(());
15226            }
15227
15228            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15229            // are envelope_size bytes.
15230            let cur_offset: usize = (5 - 1) * envelope_size;
15231
15232            // Zero reserved fields.
15233            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15234
15235            // Safety:
15236            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15237            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15238            //   envelope_size bytes, there is always sufficient room.
15239            fidl::encoding::encode_in_envelope_optional::<
15240                u16,
15241                fidl::encoding::DefaultFuchsiaResourceDialect,
15242            >(
15243                self.remote_debugging_port
15244                    .as_ref()
15245                    .map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
15246                encoder,
15247                offset + cur_offset,
15248                depth,
15249            )?;
15250
15251            _prev_end_offset = cur_offset + envelope_size;
15252            if 6 > max_ordinal {
15253                return Ok(());
15254            }
15255
15256            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15257            // are envelope_size bytes.
15258            let cur_offset: usize = (6 - 1) * envelope_size;
15259
15260            // Zero reserved fields.
15261            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15262
15263            // Safety:
15264            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15265            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15266            //   envelope_size bytes, there is always sufficient room.
15267            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<ContentDirectoryProvider, 100>, fidl::encoding::DefaultFuchsiaResourceDialect>(
15268            self.content_directories.as_mut().map(<fidl::encoding::Vector<ContentDirectoryProvider, 100> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
15269            encoder, offset + cur_offset, depth
15270        )?;
15271
15272            _prev_end_offset = cur_offset + envelope_size;
15273            if 7 > max_ordinal {
15274                return Ok(());
15275            }
15276
15277            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15278            // are envelope_size bytes.
15279            let cur_offset: usize = (7 - 1) * envelope_size;
15280
15281            // Zero reserved fields.
15282            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15283
15284            // Safety:
15285            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15286            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15287            //   envelope_size bytes, there is always sufficient room.
15288            fidl::encoding::encode_in_envelope_optional::<
15289                ContextFeatureFlags,
15290                fidl::encoding::DefaultFuchsiaResourceDialect,
15291            >(
15292                self.features
15293                    .as_ref()
15294                    .map(<ContextFeatureFlags as fidl::encoding::ValueTypeMarker>::borrow),
15295                encoder,
15296                offset + cur_offset,
15297                depth,
15298            )?;
15299
15300            _prev_end_offset = cur_offset + envelope_size;
15301            if 8 > max_ordinal {
15302                return Ok(());
15303            }
15304
15305            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15306            // are envelope_size bytes.
15307            let cur_offset: usize = (8 - 1) * envelope_size;
15308
15309            // Zero reserved fields.
15310            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15311
15312            // Safety:
15313            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15314            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15315            //   envelope_size bytes, there is always sufficient room.
15316            fidl::encoding::encode_in_envelope_optional::<
15317                fidl::encoding::BoundedString<128>,
15318                fidl::encoding::DefaultFuchsiaResourceDialect,
15319            >(
15320                self.playready_key_system.as_ref().map(
15321                    <fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow,
15322                ),
15323                encoder,
15324                offset + cur_offset,
15325                depth,
15326            )?;
15327
15328            _prev_end_offset = cur_offset + envelope_size;
15329            if 9 > max_ordinal {
15330                return Ok(());
15331            }
15332
15333            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15334            // are envelope_size bytes.
15335            let cur_offset: usize = (9 - 1) * envelope_size;
15336
15337            // Zero reserved fields.
15338            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15339
15340            // Safety:
15341            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15342            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15343            //   envelope_size bytes, there is always sufficient room.
15344            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl::encoding::BoundedString<513>, 100>, fidl::encoding::DefaultFuchsiaResourceDialect>(
15345            self.unsafely_treat_insecure_origins_as_secure.as_ref().map(<fidl::encoding::Vector<fidl::encoding::BoundedString<513>, 100> as fidl::encoding::ValueTypeMarker>::borrow),
15346            encoder, offset + cur_offset, depth
15347        )?;
15348
15349            _prev_end_offset = cur_offset + envelope_size;
15350            if 10 > max_ordinal {
15351                return Ok(());
15352            }
15353
15354            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15355            // are envelope_size bytes.
15356            let cur_offset: usize = (10 - 1) * envelope_size;
15357
15358            // Zero reserved fields.
15359            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15360
15361            // Safety:
15362            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15363            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15364            //   envelope_size bytes, there is always sufficient room.
15365            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedVector<u8>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
15366            self.cors_exempt_headers.as_ref().map(<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedVector<u8>> as fidl::encoding::ValueTypeMarker>::borrow),
15367            encoder, offset + cur_offset, depth
15368        )?;
15369
15370            _prev_end_offset = cur_offset + envelope_size;
15371            if 11 > max_ordinal {
15372                return Ok(());
15373            }
15374
15375            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15376            // are envelope_size bytes.
15377            let cur_offset: usize = (11 - 1) * envelope_size;
15378
15379            // Zero reserved fields.
15380            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15381
15382            // Safety:
15383            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15384            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15385            //   envelope_size bytes, there is always sufficient room.
15386            fidl::encoding::encode_in_envelope_optional::<
15387                fidl::encoding::Endpoint<
15388                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15389                >,
15390                fidl::encoding::DefaultFuchsiaResourceDialect,
15391            >(
15392                self.cdm_data_directory.as_mut().map(
15393                    <fidl::encoding::Endpoint<
15394                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15395                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
15396                ),
15397                encoder,
15398                offset + cur_offset,
15399                depth,
15400            )?;
15401
15402            _prev_end_offset = cur_offset + envelope_size;
15403            if 12 > max_ordinal {
15404                return Ok(());
15405            }
15406
15407            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15408            // are envelope_size bytes.
15409            let cur_offset: usize = (12 - 1) * envelope_size;
15410
15411            // Zero reserved fields.
15412            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15413
15414            // Safety:
15415            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15416            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15417            //   envelope_size bytes, there is always sufficient room.
15418            fidl::encoding::encode_in_envelope_optional::<
15419                u64,
15420                fidl::encoding::DefaultFuchsiaResourceDialect,
15421            >(
15422                self.cdm_data_quota_bytes
15423                    .as_ref()
15424                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
15425                encoder,
15426                offset + cur_offset,
15427                depth,
15428            )?;
15429
15430            _prev_end_offset = cur_offset + envelope_size;
15431            if 13 > max_ordinal {
15432                return Ok(());
15433            }
15434
15435            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15436            // are envelope_size bytes.
15437            let cur_offset: usize = (13 - 1) * envelope_size;
15438
15439            // Zero reserved fields.
15440            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15441
15442            // Safety:
15443            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15444            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15445            //   envelope_size bytes, there is always sufficient room.
15446            fidl::encoding::encode_in_envelope_optional::<
15447                u64,
15448                fidl::encoding::DefaultFuchsiaResourceDialect,
15449            >(
15450                self.data_quota_bytes
15451                    .as_ref()
15452                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
15453                encoder,
15454                offset + cur_offset,
15455                depth,
15456            )?;
15457
15458            _prev_end_offset = cur_offset + envelope_size;
15459
15460            Ok(())
15461        }
15462    }
15463
15464    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
15465        for CreateContextParams
15466    {
15467        #[inline(always)]
15468        fn new_empty() -> Self {
15469            Self::default()
15470        }
15471
15472        unsafe fn decode(
15473            &mut self,
15474            decoder: &mut fidl::encoding::Decoder<
15475                '_,
15476                fidl::encoding::DefaultFuchsiaResourceDialect,
15477            >,
15478            offset: usize,
15479            mut depth: fidl::encoding::Depth,
15480        ) -> fidl::Result<()> {
15481            decoder.debug_check_bounds::<Self>(offset);
15482            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
15483                None => return Err(fidl::Error::NotNullable),
15484                Some(len) => len,
15485            };
15486            // Calling decoder.out_of_line_offset(0) is not allowed.
15487            if len == 0 {
15488                return Ok(());
15489            };
15490            depth.increment()?;
15491            let envelope_size = 8;
15492            let bytes_len = len * envelope_size;
15493            let offset = decoder.out_of_line_offset(bytes_len)?;
15494            // Decode the envelope for each type.
15495            let mut _next_ordinal_to_read = 0;
15496            let mut next_offset = offset;
15497            let end_offset = offset + bytes_len;
15498            _next_ordinal_to_read += 1;
15499            if next_offset >= end_offset {
15500                return Ok(());
15501            }
15502
15503            // Decode unknown envelopes for gaps in ordinals.
15504            while _next_ordinal_to_read < 1 {
15505                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15506                _next_ordinal_to_read += 1;
15507                next_offset += envelope_size;
15508            }
15509
15510            let next_out_of_line = decoder.next_out_of_line();
15511            let handles_before = decoder.remaining_handles();
15512            if let Some((inlined, num_bytes, num_handles)) =
15513                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15514            {
15515                let member_inline_size = <fidl::encoding::Endpoint<
15516                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15517                > as fidl::encoding::TypeMarker>::inline_size(
15518                    decoder.context
15519                );
15520                if inlined != (member_inline_size <= 4) {
15521                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15522                }
15523                let inner_offset;
15524                let mut inner_depth = depth.clone();
15525                if inlined {
15526                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15527                    inner_offset = next_offset;
15528                } else {
15529                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15530                    inner_depth.increment()?;
15531                }
15532                let val_ref = self.service_directory.get_or_insert_with(|| {
15533                    fidl::new_empty!(
15534                        fidl::encoding::Endpoint<
15535                            fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15536                        >,
15537                        fidl::encoding::DefaultFuchsiaResourceDialect
15538                    )
15539                });
15540                fidl::decode!(
15541                    fidl::encoding::Endpoint<
15542                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15543                    >,
15544                    fidl::encoding::DefaultFuchsiaResourceDialect,
15545                    val_ref,
15546                    decoder,
15547                    inner_offset,
15548                    inner_depth
15549                )?;
15550                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15551                {
15552                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15553                }
15554                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15555                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15556                }
15557            }
15558
15559            next_offset += envelope_size;
15560            _next_ordinal_to_read += 1;
15561            if next_offset >= end_offset {
15562                return Ok(());
15563            }
15564
15565            // Decode unknown envelopes for gaps in ordinals.
15566            while _next_ordinal_to_read < 2 {
15567                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15568                _next_ordinal_to_read += 1;
15569                next_offset += envelope_size;
15570            }
15571
15572            let next_out_of_line = decoder.next_out_of_line();
15573            let handles_before = decoder.remaining_handles();
15574            if let Some((inlined, num_bytes, num_handles)) =
15575                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15576            {
15577                let member_inline_size = <fidl::encoding::Endpoint<
15578                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15579                > as fidl::encoding::TypeMarker>::inline_size(
15580                    decoder.context
15581                );
15582                if inlined != (member_inline_size <= 4) {
15583                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15584                }
15585                let inner_offset;
15586                let mut inner_depth = depth.clone();
15587                if inlined {
15588                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15589                    inner_offset = next_offset;
15590                } else {
15591                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15592                    inner_depth.increment()?;
15593                }
15594                let val_ref = self.data_directory.get_or_insert_with(|| {
15595                    fidl::new_empty!(
15596                        fidl::encoding::Endpoint<
15597                            fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15598                        >,
15599                        fidl::encoding::DefaultFuchsiaResourceDialect
15600                    )
15601                });
15602                fidl::decode!(
15603                    fidl::encoding::Endpoint<
15604                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15605                    >,
15606                    fidl::encoding::DefaultFuchsiaResourceDialect,
15607                    val_ref,
15608                    decoder,
15609                    inner_offset,
15610                    inner_depth
15611                )?;
15612                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15613                {
15614                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15615                }
15616                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15617                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15618                }
15619            }
15620
15621            next_offset += envelope_size;
15622            _next_ordinal_to_read += 1;
15623            if next_offset >= end_offset {
15624                return Ok(());
15625            }
15626
15627            // Decode unknown envelopes for gaps in ordinals.
15628            while _next_ordinal_to_read < 3 {
15629                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15630                _next_ordinal_to_read += 1;
15631                next_offset += envelope_size;
15632            }
15633
15634            let next_out_of_line = decoder.next_out_of_line();
15635            let handles_before = decoder.remaining_handles();
15636            if let Some((inlined, num_bytes, num_handles)) =
15637                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15638            {
15639                let member_inline_size =
15640                    <fidl::encoding::BoundedString<128> as fidl::encoding::TypeMarker>::inline_size(
15641                        decoder.context,
15642                    );
15643                if inlined != (member_inline_size <= 4) {
15644                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15645                }
15646                let inner_offset;
15647                let mut inner_depth = depth.clone();
15648                if inlined {
15649                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15650                    inner_offset = next_offset;
15651                } else {
15652                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15653                    inner_depth.increment()?;
15654                }
15655                let val_ref = self.user_agent_product.get_or_insert_with(|| {
15656                    fidl::new_empty!(
15657                        fidl::encoding::BoundedString<128>,
15658                        fidl::encoding::DefaultFuchsiaResourceDialect
15659                    )
15660                });
15661                fidl::decode!(
15662                    fidl::encoding::BoundedString<128>,
15663                    fidl::encoding::DefaultFuchsiaResourceDialect,
15664                    val_ref,
15665                    decoder,
15666                    inner_offset,
15667                    inner_depth
15668                )?;
15669                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15670                {
15671                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15672                }
15673                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15674                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15675                }
15676            }
15677
15678            next_offset += envelope_size;
15679            _next_ordinal_to_read += 1;
15680            if next_offset >= end_offset {
15681                return Ok(());
15682            }
15683
15684            // Decode unknown envelopes for gaps in ordinals.
15685            while _next_ordinal_to_read < 4 {
15686                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15687                _next_ordinal_to_read += 1;
15688                next_offset += envelope_size;
15689            }
15690
15691            let next_out_of_line = decoder.next_out_of_line();
15692            let handles_before = decoder.remaining_handles();
15693            if let Some((inlined, num_bytes, num_handles)) =
15694                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15695            {
15696                let member_inline_size =
15697                    <fidl::encoding::BoundedString<128> as fidl::encoding::TypeMarker>::inline_size(
15698                        decoder.context,
15699                    );
15700                if inlined != (member_inline_size <= 4) {
15701                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15702                }
15703                let inner_offset;
15704                let mut inner_depth = depth.clone();
15705                if inlined {
15706                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15707                    inner_offset = next_offset;
15708                } else {
15709                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15710                    inner_depth.increment()?;
15711                }
15712                let val_ref = self.user_agent_version.get_or_insert_with(|| {
15713                    fidl::new_empty!(
15714                        fidl::encoding::BoundedString<128>,
15715                        fidl::encoding::DefaultFuchsiaResourceDialect
15716                    )
15717                });
15718                fidl::decode!(
15719                    fidl::encoding::BoundedString<128>,
15720                    fidl::encoding::DefaultFuchsiaResourceDialect,
15721                    val_ref,
15722                    decoder,
15723                    inner_offset,
15724                    inner_depth
15725                )?;
15726                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15727                {
15728                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15729                }
15730                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15731                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15732                }
15733            }
15734
15735            next_offset += envelope_size;
15736            _next_ordinal_to_read += 1;
15737            if next_offset >= end_offset {
15738                return Ok(());
15739            }
15740
15741            // Decode unknown envelopes for gaps in ordinals.
15742            while _next_ordinal_to_read < 5 {
15743                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15744                _next_ordinal_to_read += 1;
15745                next_offset += envelope_size;
15746            }
15747
15748            let next_out_of_line = decoder.next_out_of_line();
15749            let handles_before = decoder.remaining_handles();
15750            if let Some((inlined, num_bytes, num_handles)) =
15751                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15752            {
15753                let member_inline_size =
15754                    <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
15755                if inlined != (member_inline_size <= 4) {
15756                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15757                }
15758                let inner_offset;
15759                let mut inner_depth = depth.clone();
15760                if inlined {
15761                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15762                    inner_offset = next_offset;
15763                } else {
15764                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15765                    inner_depth.increment()?;
15766                }
15767                let val_ref = self.remote_debugging_port.get_or_insert_with(|| {
15768                    fidl::new_empty!(u16, fidl::encoding::DefaultFuchsiaResourceDialect)
15769                });
15770                fidl::decode!(
15771                    u16,
15772                    fidl::encoding::DefaultFuchsiaResourceDialect,
15773                    val_ref,
15774                    decoder,
15775                    inner_offset,
15776                    inner_depth
15777                )?;
15778                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15779                {
15780                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15781                }
15782                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15783                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15784                }
15785            }
15786
15787            next_offset += envelope_size;
15788            _next_ordinal_to_read += 1;
15789            if next_offset >= end_offset {
15790                return Ok(());
15791            }
15792
15793            // Decode unknown envelopes for gaps in ordinals.
15794            while _next_ordinal_to_read < 6 {
15795                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15796                _next_ordinal_to_read += 1;
15797                next_offset += envelope_size;
15798            }
15799
15800            let next_out_of_line = decoder.next_out_of_line();
15801            let handles_before = decoder.remaining_handles();
15802            if let Some((inlined, num_bytes, num_handles)) =
15803                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15804            {
15805                let member_inline_size = <fidl::encoding::Vector<ContentDirectoryProvider, 100> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
15806                if inlined != (member_inline_size <= 4) {
15807                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15808                }
15809                let inner_offset;
15810                let mut inner_depth = depth.clone();
15811                if inlined {
15812                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15813                    inner_offset = next_offset;
15814                } else {
15815                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15816                    inner_depth.increment()?;
15817                }
15818                let val_ref =
15819                self.content_directories.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<ContentDirectoryProvider, 100>, fidl::encoding::DefaultFuchsiaResourceDialect));
15820                fidl::decode!(fidl::encoding::Vector<ContentDirectoryProvider, 100>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
15821                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15822                {
15823                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15824                }
15825                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15826                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15827                }
15828            }
15829
15830            next_offset += envelope_size;
15831            _next_ordinal_to_read += 1;
15832            if next_offset >= end_offset {
15833                return Ok(());
15834            }
15835
15836            // Decode unknown envelopes for gaps in ordinals.
15837            while _next_ordinal_to_read < 7 {
15838                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15839                _next_ordinal_to_read += 1;
15840                next_offset += envelope_size;
15841            }
15842
15843            let next_out_of_line = decoder.next_out_of_line();
15844            let handles_before = decoder.remaining_handles();
15845            if let Some((inlined, num_bytes, num_handles)) =
15846                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15847            {
15848                let member_inline_size =
15849                    <ContextFeatureFlags as fidl::encoding::TypeMarker>::inline_size(
15850                        decoder.context,
15851                    );
15852                if inlined != (member_inline_size <= 4) {
15853                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15854                }
15855                let inner_offset;
15856                let mut inner_depth = depth.clone();
15857                if inlined {
15858                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15859                    inner_offset = next_offset;
15860                } else {
15861                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15862                    inner_depth.increment()?;
15863                }
15864                let val_ref = self.features.get_or_insert_with(|| {
15865                    fidl::new_empty!(
15866                        ContextFeatureFlags,
15867                        fidl::encoding::DefaultFuchsiaResourceDialect
15868                    )
15869                });
15870                fidl::decode!(
15871                    ContextFeatureFlags,
15872                    fidl::encoding::DefaultFuchsiaResourceDialect,
15873                    val_ref,
15874                    decoder,
15875                    inner_offset,
15876                    inner_depth
15877                )?;
15878                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15879                {
15880                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15881                }
15882                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15883                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15884                }
15885            }
15886
15887            next_offset += envelope_size;
15888            _next_ordinal_to_read += 1;
15889            if next_offset >= end_offset {
15890                return Ok(());
15891            }
15892
15893            // Decode unknown envelopes for gaps in ordinals.
15894            while _next_ordinal_to_read < 8 {
15895                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15896                _next_ordinal_to_read += 1;
15897                next_offset += envelope_size;
15898            }
15899
15900            let next_out_of_line = decoder.next_out_of_line();
15901            let handles_before = decoder.remaining_handles();
15902            if let Some((inlined, num_bytes, num_handles)) =
15903                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15904            {
15905                let member_inline_size =
15906                    <fidl::encoding::BoundedString<128> as fidl::encoding::TypeMarker>::inline_size(
15907                        decoder.context,
15908                    );
15909                if inlined != (member_inline_size <= 4) {
15910                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15911                }
15912                let inner_offset;
15913                let mut inner_depth = depth.clone();
15914                if inlined {
15915                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15916                    inner_offset = next_offset;
15917                } else {
15918                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15919                    inner_depth.increment()?;
15920                }
15921                let val_ref = self.playready_key_system.get_or_insert_with(|| {
15922                    fidl::new_empty!(
15923                        fidl::encoding::BoundedString<128>,
15924                        fidl::encoding::DefaultFuchsiaResourceDialect
15925                    )
15926                });
15927                fidl::decode!(
15928                    fidl::encoding::BoundedString<128>,
15929                    fidl::encoding::DefaultFuchsiaResourceDialect,
15930                    val_ref,
15931                    decoder,
15932                    inner_offset,
15933                    inner_depth
15934                )?;
15935                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15936                {
15937                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15938                }
15939                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15940                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15941                }
15942            }
15943
15944            next_offset += envelope_size;
15945            _next_ordinal_to_read += 1;
15946            if next_offset >= end_offset {
15947                return Ok(());
15948            }
15949
15950            // Decode unknown envelopes for gaps in ordinals.
15951            while _next_ordinal_to_read < 9 {
15952                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15953                _next_ordinal_to_read += 1;
15954                next_offset += envelope_size;
15955            }
15956
15957            let next_out_of_line = decoder.next_out_of_line();
15958            let handles_before = decoder.remaining_handles();
15959            if let Some((inlined, num_bytes, num_handles)) =
15960                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15961            {
15962                let member_inline_size = <fidl::encoding::Vector<
15963                    fidl::encoding::BoundedString<513>,
15964                    100,
15965                > as fidl::encoding::TypeMarker>::inline_size(
15966                    decoder.context
15967                );
15968                if inlined != (member_inline_size <= 4) {
15969                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15970                }
15971                let inner_offset;
15972                let mut inner_depth = depth.clone();
15973                if inlined {
15974                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15975                    inner_offset = next_offset;
15976                } else {
15977                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15978                    inner_depth.increment()?;
15979                }
15980                let val_ref =
15981                    self.unsafely_treat_insecure_origins_as_secure.get_or_insert_with(|| {
15982                        fidl::new_empty!(
15983                            fidl::encoding::Vector<fidl::encoding::BoundedString<513>, 100>,
15984                            fidl::encoding::DefaultFuchsiaResourceDialect
15985                        )
15986                    });
15987                fidl::decode!(
15988                    fidl::encoding::Vector<fidl::encoding::BoundedString<513>, 100>,
15989                    fidl::encoding::DefaultFuchsiaResourceDialect,
15990                    val_ref,
15991                    decoder,
15992                    inner_offset,
15993                    inner_depth
15994                )?;
15995                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15996                {
15997                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15998                }
15999                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16000                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16001                }
16002            }
16003
16004            next_offset += envelope_size;
16005            _next_ordinal_to_read += 1;
16006            if next_offset >= end_offset {
16007                return Ok(());
16008            }
16009
16010            // Decode unknown envelopes for gaps in ordinals.
16011            while _next_ordinal_to_read < 10 {
16012                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16013                _next_ordinal_to_read += 1;
16014                next_offset += envelope_size;
16015            }
16016
16017            let next_out_of_line = decoder.next_out_of_line();
16018            let handles_before = decoder.remaining_handles();
16019            if let Some((inlined, num_bytes, num_handles)) =
16020                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16021            {
16022                let member_inline_size = <fidl::encoding::UnboundedVector<
16023                    fidl::encoding::UnboundedVector<u8>,
16024                > as fidl::encoding::TypeMarker>::inline_size(
16025                    decoder.context
16026                );
16027                if inlined != (member_inline_size <= 4) {
16028                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16029                }
16030                let inner_offset;
16031                let mut inner_depth = depth.clone();
16032                if inlined {
16033                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16034                    inner_offset = next_offset;
16035                } else {
16036                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16037                    inner_depth.increment()?;
16038                }
16039                let val_ref = self.cors_exempt_headers.get_or_insert_with(|| {
16040                    fidl::new_empty!(
16041                        fidl::encoding::UnboundedVector<fidl::encoding::UnboundedVector<u8>>,
16042                        fidl::encoding::DefaultFuchsiaResourceDialect
16043                    )
16044                });
16045                fidl::decode!(
16046                    fidl::encoding::UnboundedVector<fidl::encoding::UnboundedVector<u8>>,
16047                    fidl::encoding::DefaultFuchsiaResourceDialect,
16048                    val_ref,
16049                    decoder,
16050                    inner_offset,
16051                    inner_depth
16052                )?;
16053                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16054                {
16055                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16056                }
16057                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16058                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16059                }
16060            }
16061
16062            next_offset += envelope_size;
16063            _next_ordinal_to_read += 1;
16064            if next_offset >= end_offset {
16065                return Ok(());
16066            }
16067
16068            // Decode unknown envelopes for gaps in ordinals.
16069            while _next_ordinal_to_read < 11 {
16070                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16071                _next_ordinal_to_read += 1;
16072                next_offset += envelope_size;
16073            }
16074
16075            let next_out_of_line = decoder.next_out_of_line();
16076            let handles_before = decoder.remaining_handles();
16077            if let Some((inlined, num_bytes, num_handles)) =
16078                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16079            {
16080                let member_inline_size = <fidl::encoding::Endpoint<
16081                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
16082                > as fidl::encoding::TypeMarker>::inline_size(
16083                    decoder.context
16084                );
16085                if inlined != (member_inline_size <= 4) {
16086                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16087                }
16088                let inner_offset;
16089                let mut inner_depth = depth.clone();
16090                if inlined {
16091                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16092                    inner_offset = next_offset;
16093                } else {
16094                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16095                    inner_depth.increment()?;
16096                }
16097                let val_ref = self.cdm_data_directory.get_or_insert_with(|| {
16098                    fidl::new_empty!(
16099                        fidl::encoding::Endpoint<
16100                            fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
16101                        >,
16102                        fidl::encoding::DefaultFuchsiaResourceDialect
16103                    )
16104                });
16105                fidl::decode!(
16106                    fidl::encoding::Endpoint<
16107                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
16108                    >,
16109                    fidl::encoding::DefaultFuchsiaResourceDialect,
16110                    val_ref,
16111                    decoder,
16112                    inner_offset,
16113                    inner_depth
16114                )?;
16115                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16116                {
16117                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16118                }
16119                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16120                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16121                }
16122            }
16123
16124            next_offset += envelope_size;
16125            _next_ordinal_to_read += 1;
16126            if next_offset >= end_offset {
16127                return Ok(());
16128            }
16129
16130            // Decode unknown envelopes for gaps in ordinals.
16131            while _next_ordinal_to_read < 12 {
16132                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16133                _next_ordinal_to_read += 1;
16134                next_offset += envelope_size;
16135            }
16136
16137            let next_out_of_line = decoder.next_out_of_line();
16138            let handles_before = decoder.remaining_handles();
16139            if let Some((inlined, num_bytes, num_handles)) =
16140                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16141            {
16142                let member_inline_size =
16143                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16144                if inlined != (member_inline_size <= 4) {
16145                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16146                }
16147                let inner_offset;
16148                let mut inner_depth = depth.clone();
16149                if inlined {
16150                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16151                    inner_offset = next_offset;
16152                } else {
16153                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16154                    inner_depth.increment()?;
16155                }
16156                let val_ref = self.cdm_data_quota_bytes.get_or_insert_with(|| {
16157                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
16158                });
16159                fidl::decode!(
16160                    u64,
16161                    fidl::encoding::DefaultFuchsiaResourceDialect,
16162                    val_ref,
16163                    decoder,
16164                    inner_offset,
16165                    inner_depth
16166                )?;
16167                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16168                {
16169                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16170                }
16171                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16172                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16173                }
16174            }
16175
16176            next_offset += envelope_size;
16177            _next_ordinal_to_read += 1;
16178            if next_offset >= end_offset {
16179                return Ok(());
16180            }
16181
16182            // Decode unknown envelopes for gaps in ordinals.
16183            while _next_ordinal_to_read < 13 {
16184                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16185                _next_ordinal_to_read += 1;
16186                next_offset += envelope_size;
16187            }
16188
16189            let next_out_of_line = decoder.next_out_of_line();
16190            let handles_before = decoder.remaining_handles();
16191            if let Some((inlined, num_bytes, num_handles)) =
16192                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16193            {
16194                let member_inline_size =
16195                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16196                if inlined != (member_inline_size <= 4) {
16197                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16198                }
16199                let inner_offset;
16200                let mut inner_depth = depth.clone();
16201                if inlined {
16202                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16203                    inner_offset = next_offset;
16204                } else {
16205                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16206                    inner_depth.increment()?;
16207                }
16208                let val_ref = self.data_quota_bytes.get_or_insert_with(|| {
16209                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
16210                });
16211                fidl::decode!(
16212                    u64,
16213                    fidl::encoding::DefaultFuchsiaResourceDialect,
16214                    val_ref,
16215                    decoder,
16216                    inner_offset,
16217                    inner_depth
16218                )?;
16219                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16220                {
16221                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16222                }
16223                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16224                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16225                }
16226            }
16227
16228            next_offset += envelope_size;
16229
16230            // Decode the remaining unknown envelopes.
16231            while next_offset < end_offset {
16232                _next_ordinal_to_read += 1;
16233                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16234                next_offset += envelope_size;
16235            }
16236
16237            Ok(())
16238        }
16239    }
16240
16241    impl CreateFrameParams {
16242        #[inline(always)]
16243        fn max_ordinal_present(&self) -> u64 {
16244            if let Some(_) = self.explicit_sites_filter_error_page {
16245                return 4;
16246            }
16247            if let Some(_) = self.debug_name {
16248                return 2;
16249            }
16250            if let Some(_) = self.enable_remote_debugging {
16251                return 1;
16252            }
16253            0
16254        }
16255    }
16256
16257    impl fidl::encoding::ResourceTypeMarker for CreateFrameParams {
16258        type Borrowed<'a> = &'a mut Self;
16259        fn take_or_borrow<'a>(
16260            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
16261        ) -> Self::Borrowed<'a> {
16262            value
16263        }
16264    }
16265
16266    unsafe impl fidl::encoding::TypeMarker for CreateFrameParams {
16267        type Owned = Self;
16268
16269        #[inline(always)]
16270        fn inline_align(_context: fidl::encoding::Context) -> usize {
16271            8
16272        }
16273
16274        #[inline(always)]
16275        fn inline_size(_context: fidl::encoding::Context) -> usize {
16276            16
16277        }
16278    }
16279
16280    unsafe impl
16281        fidl::encoding::Encode<CreateFrameParams, fidl::encoding::DefaultFuchsiaResourceDialect>
16282        for &mut CreateFrameParams
16283    {
16284        unsafe fn encode(
16285            self,
16286            encoder: &mut fidl::encoding::Encoder<
16287                '_,
16288                fidl::encoding::DefaultFuchsiaResourceDialect,
16289            >,
16290            offset: usize,
16291            mut depth: fidl::encoding::Depth,
16292        ) -> fidl::Result<()> {
16293            encoder.debug_check_bounds::<CreateFrameParams>(offset);
16294            // Vector header
16295            let max_ordinal: u64 = self.max_ordinal_present();
16296            encoder.write_num(max_ordinal, offset);
16297            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
16298            // Calling encoder.out_of_line_offset(0) is not allowed.
16299            if max_ordinal == 0 {
16300                return Ok(());
16301            }
16302            depth.increment()?;
16303            let envelope_size = 8;
16304            let bytes_len = max_ordinal as usize * envelope_size;
16305            #[allow(unused_variables)]
16306            let offset = encoder.out_of_line_offset(bytes_len);
16307            let mut _prev_end_offset: usize = 0;
16308            if 1 > max_ordinal {
16309                return Ok(());
16310            }
16311
16312            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16313            // are envelope_size bytes.
16314            let cur_offset: usize = (1 - 1) * envelope_size;
16315
16316            // Zero reserved fields.
16317            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16318
16319            // Safety:
16320            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16321            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16322            //   envelope_size bytes, there is always sufficient room.
16323            fidl::encoding::encode_in_envelope_optional::<
16324                bool,
16325                fidl::encoding::DefaultFuchsiaResourceDialect,
16326            >(
16327                self.enable_remote_debugging
16328                    .as_ref()
16329                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
16330                encoder,
16331                offset + cur_offset,
16332                depth,
16333            )?;
16334
16335            _prev_end_offset = cur_offset + envelope_size;
16336            if 2 > max_ordinal {
16337                return Ok(());
16338            }
16339
16340            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16341            // are envelope_size bytes.
16342            let cur_offset: usize = (2 - 1) * envelope_size;
16343
16344            // Zero reserved fields.
16345            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16346
16347            // Safety:
16348            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16349            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16350            //   envelope_size bytes, there is always sufficient room.
16351            fidl::encoding::encode_in_envelope_optional::<
16352                fidl::encoding::UnboundedString,
16353                fidl::encoding::DefaultFuchsiaResourceDialect,
16354            >(
16355                self.debug_name.as_ref().map(
16356                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
16357                ),
16358                encoder,
16359                offset + cur_offset,
16360                depth,
16361            )?;
16362
16363            _prev_end_offset = cur_offset + envelope_size;
16364            if 4 > max_ordinal {
16365                return Ok(());
16366            }
16367
16368            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16369            // are envelope_size bytes.
16370            let cur_offset: usize = (4 - 1) * envelope_size;
16371
16372            // Zero reserved fields.
16373            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16374
16375            // Safety:
16376            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16377            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16378            //   envelope_size bytes, there is always sufficient room.
16379            fidl::encoding::encode_in_envelope_optional::<
16380                fidl_fuchsia_mem::Data,
16381                fidl::encoding::DefaultFuchsiaResourceDialect,
16382            >(
16383                self.explicit_sites_filter_error_page.as_mut().map(
16384                    <fidl_fuchsia_mem::Data as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
16385                ),
16386                encoder,
16387                offset + cur_offset,
16388                depth,
16389            )?;
16390
16391            _prev_end_offset = cur_offset + envelope_size;
16392
16393            Ok(())
16394        }
16395    }
16396
16397    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
16398        for CreateFrameParams
16399    {
16400        #[inline(always)]
16401        fn new_empty() -> Self {
16402            Self::default()
16403        }
16404
16405        unsafe fn decode(
16406            &mut self,
16407            decoder: &mut fidl::encoding::Decoder<
16408                '_,
16409                fidl::encoding::DefaultFuchsiaResourceDialect,
16410            >,
16411            offset: usize,
16412            mut depth: fidl::encoding::Depth,
16413        ) -> fidl::Result<()> {
16414            decoder.debug_check_bounds::<Self>(offset);
16415            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
16416                None => return Err(fidl::Error::NotNullable),
16417                Some(len) => len,
16418            };
16419            // Calling decoder.out_of_line_offset(0) is not allowed.
16420            if len == 0 {
16421                return Ok(());
16422            };
16423            depth.increment()?;
16424            let envelope_size = 8;
16425            let bytes_len = len * envelope_size;
16426            let offset = decoder.out_of_line_offset(bytes_len)?;
16427            // Decode the envelope for each type.
16428            let mut _next_ordinal_to_read = 0;
16429            let mut next_offset = offset;
16430            let end_offset = offset + bytes_len;
16431            _next_ordinal_to_read += 1;
16432            if next_offset >= end_offset {
16433                return Ok(());
16434            }
16435
16436            // Decode unknown envelopes for gaps in ordinals.
16437            while _next_ordinal_to_read < 1 {
16438                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16439                _next_ordinal_to_read += 1;
16440                next_offset += envelope_size;
16441            }
16442
16443            let next_out_of_line = decoder.next_out_of_line();
16444            let handles_before = decoder.remaining_handles();
16445            if let Some((inlined, num_bytes, num_handles)) =
16446                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16447            {
16448                let member_inline_size =
16449                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16450                if inlined != (member_inline_size <= 4) {
16451                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16452                }
16453                let inner_offset;
16454                let mut inner_depth = depth.clone();
16455                if inlined {
16456                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16457                    inner_offset = next_offset;
16458                } else {
16459                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16460                    inner_depth.increment()?;
16461                }
16462                let val_ref = self.enable_remote_debugging.get_or_insert_with(|| {
16463                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
16464                });
16465                fidl::decode!(
16466                    bool,
16467                    fidl::encoding::DefaultFuchsiaResourceDialect,
16468                    val_ref,
16469                    decoder,
16470                    inner_offset,
16471                    inner_depth
16472                )?;
16473                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16474                {
16475                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16476                }
16477                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16478                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16479                }
16480            }
16481
16482            next_offset += envelope_size;
16483            _next_ordinal_to_read += 1;
16484            if next_offset >= end_offset {
16485                return Ok(());
16486            }
16487
16488            // Decode unknown envelopes for gaps in ordinals.
16489            while _next_ordinal_to_read < 2 {
16490                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16491                _next_ordinal_to_read += 1;
16492                next_offset += envelope_size;
16493            }
16494
16495            let next_out_of_line = decoder.next_out_of_line();
16496            let handles_before = decoder.remaining_handles();
16497            if let Some((inlined, num_bytes, num_handles)) =
16498                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16499            {
16500                let member_inline_size =
16501                    <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
16502                        decoder.context,
16503                    );
16504                if inlined != (member_inline_size <= 4) {
16505                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16506                }
16507                let inner_offset;
16508                let mut inner_depth = depth.clone();
16509                if inlined {
16510                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16511                    inner_offset = next_offset;
16512                } else {
16513                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16514                    inner_depth.increment()?;
16515                }
16516                let val_ref = self.debug_name.get_or_insert_with(|| {
16517                    fidl::new_empty!(
16518                        fidl::encoding::UnboundedString,
16519                        fidl::encoding::DefaultFuchsiaResourceDialect
16520                    )
16521                });
16522                fidl::decode!(
16523                    fidl::encoding::UnboundedString,
16524                    fidl::encoding::DefaultFuchsiaResourceDialect,
16525                    val_ref,
16526                    decoder,
16527                    inner_offset,
16528                    inner_depth
16529                )?;
16530                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16531                {
16532                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16533                }
16534                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16535                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16536                }
16537            }
16538
16539            next_offset += envelope_size;
16540            _next_ordinal_to_read += 1;
16541            if next_offset >= end_offset {
16542                return Ok(());
16543            }
16544
16545            // Decode unknown envelopes for gaps in ordinals.
16546            while _next_ordinal_to_read < 4 {
16547                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16548                _next_ordinal_to_read += 1;
16549                next_offset += envelope_size;
16550            }
16551
16552            let next_out_of_line = decoder.next_out_of_line();
16553            let handles_before = decoder.remaining_handles();
16554            if let Some((inlined, num_bytes, num_handles)) =
16555                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16556            {
16557                let member_inline_size =
16558                    <fidl_fuchsia_mem::Data as fidl::encoding::TypeMarker>::inline_size(
16559                        decoder.context,
16560                    );
16561                if inlined != (member_inline_size <= 4) {
16562                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16563                }
16564                let inner_offset;
16565                let mut inner_depth = depth.clone();
16566                if inlined {
16567                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16568                    inner_offset = next_offset;
16569                } else {
16570                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16571                    inner_depth.increment()?;
16572                }
16573                let val_ref = self.explicit_sites_filter_error_page.get_or_insert_with(|| {
16574                    fidl::new_empty!(
16575                        fidl_fuchsia_mem::Data,
16576                        fidl::encoding::DefaultFuchsiaResourceDialect
16577                    )
16578                });
16579                fidl::decode!(
16580                    fidl_fuchsia_mem::Data,
16581                    fidl::encoding::DefaultFuchsiaResourceDialect,
16582                    val_ref,
16583                    decoder,
16584                    inner_offset,
16585                    inner_depth
16586                )?;
16587                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16588                {
16589                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16590                }
16591                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16592                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16593                }
16594            }
16595
16596            next_offset += envelope_size;
16597
16598            // Decode the remaining unknown envelopes.
16599            while next_offset < end_offset {
16600                _next_ordinal_to_read += 1;
16601                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16602                next_offset += envelope_size;
16603            }
16604
16605            Ok(())
16606        }
16607    }
16608
16609    impl CreateView2Args {
16610        #[inline(always)]
16611        fn max_ordinal_present(&self) -> u64 {
16612            if let Some(_) = self.view_creation_token {
16613                return 1;
16614            }
16615            0
16616        }
16617    }
16618
16619    impl fidl::encoding::ResourceTypeMarker for CreateView2Args {
16620        type Borrowed<'a> = &'a mut Self;
16621        fn take_or_borrow<'a>(
16622            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
16623        ) -> Self::Borrowed<'a> {
16624            value
16625        }
16626    }
16627
16628    unsafe impl fidl::encoding::TypeMarker for CreateView2Args {
16629        type Owned = Self;
16630
16631        #[inline(always)]
16632        fn inline_align(_context: fidl::encoding::Context) -> usize {
16633            8
16634        }
16635
16636        #[inline(always)]
16637        fn inline_size(_context: fidl::encoding::Context) -> usize {
16638            16
16639        }
16640    }
16641
16642    unsafe impl
16643        fidl::encoding::Encode<CreateView2Args, fidl::encoding::DefaultFuchsiaResourceDialect>
16644        for &mut CreateView2Args
16645    {
16646        unsafe fn encode(
16647            self,
16648            encoder: &mut fidl::encoding::Encoder<
16649                '_,
16650                fidl::encoding::DefaultFuchsiaResourceDialect,
16651            >,
16652            offset: usize,
16653            mut depth: fidl::encoding::Depth,
16654        ) -> fidl::Result<()> {
16655            encoder.debug_check_bounds::<CreateView2Args>(offset);
16656            // Vector header
16657            let max_ordinal: u64 = self.max_ordinal_present();
16658            encoder.write_num(max_ordinal, offset);
16659            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
16660            // Calling encoder.out_of_line_offset(0) is not allowed.
16661            if max_ordinal == 0 {
16662                return Ok(());
16663            }
16664            depth.increment()?;
16665            let envelope_size = 8;
16666            let bytes_len = max_ordinal as usize * envelope_size;
16667            #[allow(unused_variables)]
16668            let offset = encoder.out_of_line_offset(bytes_len);
16669            let mut _prev_end_offset: usize = 0;
16670            if 1 > max_ordinal {
16671                return Ok(());
16672            }
16673
16674            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16675            // are envelope_size bytes.
16676            let cur_offset: usize = (1 - 1) * envelope_size;
16677
16678            // Zero reserved fields.
16679            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16680
16681            // Safety:
16682            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16683            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16684            //   envelope_size bytes, there is always sufficient room.
16685            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_ui_views::ViewCreationToken, fidl::encoding::DefaultFuchsiaResourceDialect>(
16686            self.view_creation_token.as_mut().map(<fidl_fuchsia_ui_views::ViewCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
16687            encoder, offset + cur_offset, depth
16688        )?;
16689
16690            _prev_end_offset = cur_offset + envelope_size;
16691
16692            Ok(())
16693        }
16694    }
16695
16696    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
16697        for CreateView2Args
16698    {
16699        #[inline(always)]
16700        fn new_empty() -> Self {
16701            Self::default()
16702        }
16703
16704        unsafe fn decode(
16705            &mut self,
16706            decoder: &mut fidl::encoding::Decoder<
16707                '_,
16708                fidl::encoding::DefaultFuchsiaResourceDialect,
16709            >,
16710            offset: usize,
16711            mut depth: fidl::encoding::Depth,
16712        ) -> fidl::Result<()> {
16713            decoder.debug_check_bounds::<Self>(offset);
16714            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
16715                None => return Err(fidl::Error::NotNullable),
16716                Some(len) => len,
16717            };
16718            // Calling decoder.out_of_line_offset(0) is not allowed.
16719            if len == 0 {
16720                return Ok(());
16721            };
16722            depth.increment()?;
16723            let envelope_size = 8;
16724            let bytes_len = len * envelope_size;
16725            let offset = decoder.out_of_line_offset(bytes_len)?;
16726            // Decode the envelope for each type.
16727            let mut _next_ordinal_to_read = 0;
16728            let mut next_offset = offset;
16729            let end_offset = offset + bytes_len;
16730            _next_ordinal_to_read += 1;
16731            if next_offset >= end_offset {
16732                return Ok(());
16733            }
16734
16735            // Decode unknown envelopes for gaps in ordinals.
16736            while _next_ordinal_to_read < 1 {
16737                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16738                _next_ordinal_to_read += 1;
16739                next_offset += envelope_size;
16740            }
16741
16742            let next_out_of_line = decoder.next_out_of_line();
16743            let handles_before = decoder.remaining_handles();
16744            if let Some((inlined, num_bytes, num_handles)) =
16745                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16746            {
16747                let member_inline_size = <fidl_fuchsia_ui_views::ViewCreationToken as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16748                if inlined != (member_inline_size <= 4) {
16749                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16750                }
16751                let inner_offset;
16752                let mut inner_depth = depth.clone();
16753                if inlined {
16754                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16755                    inner_offset = next_offset;
16756                } else {
16757                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16758                    inner_depth.increment()?;
16759                }
16760                let val_ref = self.view_creation_token.get_or_insert_with(|| {
16761                    fidl::new_empty!(
16762                        fidl_fuchsia_ui_views::ViewCreationToken,
16763                        fidl::encoding::DefaultFuchsiaResourceDialect
16764                    )
16765                });
16766                fidl::decode!(
16767                    fidl_fuchsia_ui_views::ViewCreationToken,
16768                    fidl::encoding::DefaultFuchsiaResourceDialect,
16769                    val_ref,
16770                    decoder,
16771                    inner_offset,
16772                    inner_depth
16773                )?;
16774                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16775                {
16776                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16777                }
16778                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16779                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16780                }
16781            }
16782
16783            next_offset += envelope_size;
16784
16785            // Decode the remaining unknown envelopes.
16786            while next_offset < end_offset {
16787                _next_ordinal_to_read += 1;
16788                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16789                next_offset += envelope_size;
16790            }
16791
16792            Ok(())
16793        }
16794    }
16795
16796    impl Favicon {
16797        #[inline(always)]
16798        fn max_ordinal_present(&self) -> u64 {
16799            if let Some(_) = self.height {
16800                return 3;
16801            }
16802            if let Some(_) = self.width {
16803                return 2;
16804            }
16805            if let Some(_) = self.data {
16806                return 1;
16807            }
16808            0
16809        }
16810    }
16811
16812    impl fidl::encoding::ResourceTypeMarker for Favicon {
16813        type Borrowed<'a> = &'a mut Self;
16814        fn take_or_borrow<'a>(
16815            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
16816        ) -> Self::Borrowed<'a> {
16817            value
16818        }
16819    }
16820
16821    unsafe impl fidl::encoding::TypeMarker for Favicon {
16822        type Owned = Self;
16823
16824        #[inline(always)]
16825        fn inline_align(_context: fidl::encoding::Context) -> usize {
16826            8
16827        }
16828
16829        #[inline(always)]
16830        fn inline_size(_context: fidl::encoding::Context) -> usize {
16831            16
16832        }
16833    }
16834
16835    unsafe impl fidl::encoding::Encode<Favicon, fidl::encoding::DefaultFuchsiaResourceDialect>
16836        for &mut Favicon
16837    {
16838        unsafe fn encode(
16839            self,
16840            encoder: &mut fidl::encoding::Encoder<
16841                '_,
16842                fidl::encoding::DefaultFuchsiaResourceDialect,
16843            >,
16844            offset: usize,
16845            mut depth: fidl::encoding::Depth,
16846        ) -> fidl::Result<()> {
16847            encoder.debug_check_bounds::<Favicon>(offset);
16848            // Vector header
16849            let max_ordinal: u64 = self.max_ordinal_present();
16850            encoder.write_num(max_ordinal, offset);
16851            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
16852            // Calling encoder.out_of_line_offset(0) is not allowed.
16853            if max_ordinal == 0 {
16854                return Ok(());
16855            }
16856            depth.increment()?;
16857            let envelope_size = 8;
16858            let bytes_len = max_ordinal as usize * envelope_size;
16859            #[allow(unused_variables)]
16860            let offset = encoder.out_of_line_offset(bytes_len);
16861            let mut _prev_end_offset: usize = 0;
16862            if 1 > max_ordinal {
16863                return Ok(());
16864            }
16865
16866            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16867            // are envelope_size bytes.
16868            let cur_offset: usize = (1 - 1) * envelope_size;
16869
16870            // Zero reserved fields.
16871            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16872
16873            // Safety:
16874            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16875            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16876            //   envelope_size bytes, there is always sufficient room.
16877            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_mem::Buffer, fidl::encoding::DefaultFuchsiaResourceDialect>(
16878            self.data.as_mut().map(<fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
16879            encoder, offset + cur_offset, depth
16880        )?;
16881
16882            _prev_end_offset = cur_offset + envelope_size;
16883            if 2 > max_ordinal {
16884                return Ok(());
16885            }
16886
16887            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16888            // are envelope_size bytes.
16889            let cur_offset: usize = (2 - 1) * envelope_size;
16890
16891            // Zero reserved fields.
16892            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16893
16894            // Safety:
16895            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16896            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16897            //   envelope_size bytes, there is always sufficient room.
16898            fidl::encoding::encode_in_envelope_optional::<
16899                u32,
16900                fidl::encoding::DefaultFuchsiaResourceDialect,
16901            >(
16902                self.width.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
16903                encoder,
16904                offset + cur_offset,
16905                depth,
16906            )?;
16907
16908            _prev_end_offset = cur_offset + envelope_size;
16909            if 3 > max_ordinal {
16910                return Ok(());
16911            }
16912
16913            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16914            // are envelope_size bytes.
16915            let cur_offset: usize = (3 - 1) * envelope_size;
16916
16917            // Zero reserved fields.
16918            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16919
16920            // Safety:
16921            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16922            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16923            //   envelope_size bytes, there is always sufficient room.
16924            fidl::encoding::encode_in_envelope_optional::<
16925                u32,
16926                fidl::encoding::DefaultFuchsiaResourceDialect,
16927            >(
16928                self.height.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
16929                encoder,
16930                offset + cur_offset,
16931                depth,
16932            )?;
16933
16934            _prev_end_offset = cur_offset + envelope_size;
16935
16936            Ok(())
16937        }
16938    }
16939
16940    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Favicon {
16941        #[inline(always)]
16942        fn new_empty() -> Self {
16943            Self::default()
16944        }
16945
16946        unsafe fn decode(
16947            &mut self,
16948            decoder: &mut fidl::encoding::Decoder<
16949                '_,
16950                fidl::encoding::DefaultFuchsiaResourceDialect,
16951            >,
16952            offset: usize,
16953            mut depth: fidl::encoding::Depth,
16954        ) -> fidl::Result<()> {
16955            decoder.debug_check_bounds::<Self>(offset);
16956            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
16957                None => return Err(fidl::Error::NotNullable),
16958                Some(len) => len,
16959            };
16960            // Calling decoder.out_of_line_offset(0) is not allowed.
16961            if len == 0 {
16962                return Ok(());
16963            };
16964            depth.increment()?;
16965            let envelope_size = 8;
16966            let bytes_len = len * envelope_size;
16967            let offset = decoder.out_of_line_offset(bytes_len)?;
16968            // Decode the envelope for each type.
16969            let mut _next_ordinal_to_read = 0;
16970            let mut next_offset = offset;
16971            let end_offset = offset + bytes_len;
16972            _next_ordinal_to_read += 1;
16973            if next_offset >= end_offset {
16974                return Ok(());
16975            }
16976
16977            // Decode unknown envelopes for gaps in ordinals.
16978            while _next_ordinal_to_read < 1 {
16979                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16980                _next_ordinal_to_read += 1;
16981                next_offset += envelope_size;
16982            }
16983
16984            let next_out_of_line = decoder.next_out_of_line();
16985            let handles_before = decoder.remaining_handles();
16986            if let Some((inlined, num_bytes, num_handles)) =
16987                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16988            {
16989                let member_inline_size =
16990                    <fidl_fuchsia_mem::Buffer as fidl::encoding::TypeMarker>::inline_size(
16991                        decoder.context,
16992                    );
16993                if inlined != (member_inline_size <= 4) {
16994                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16995                }
16996                let inner_offset;
16997                let mut inner_depth = depth.clone();
16998                if inlined {
16999                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17000                    inner_offset = next_offset;
17001                } else {
17002                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17003                    inner_depth.increment()?;
17004                }
17005                let val_ref = self.data.get_or_insert_with(|| {
17006                    fidl::new_empty!(
17007                        fidl_fuchsia_mem::Buffer,
17008                        fidl::encoding::DefaultFuchsiaResourceDialect
17009                    )
17010                });
17011                fidl::decode!(
17012                    fidl_fuchsia_mem::Buffer,
17013                    fidl::encoding::DefaultFuchsiaResourceDialect,
17014                    val_ref,
17015                    decoder,
17016                    inner_offset,
17017                    inner_depth
17018                )?;
17019                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17020                {
17021                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17022                }
17023                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17024                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17025                }
17026            }
17027
17028            next_offset += envelope_size;
17029            _next_ordinal_to_read += 1;
17030            if next_offset >= end_offset {
17031                return Ok(());
17032            }
17033
17034            // Decode unknown envelopes for gaps in ordinals.
17035            while _next_ordinal_to_read < 2 {
17036                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17037                _next_ordinal_to_read += 1;
17038                next_offset += envelope_size;
17039            }
17040
17041            let next_out_of_line = decoder.next_out_of_line();
17042            let handles_before = decoder.remaining_handles();
17043            if let Some((inlined, num_bytes, num_handles)) =
17044                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17045            {
17046                let member_inline_size =
17047                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
17048                if inlined != (member_inline_size <= 4) {
17049                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17050                }
17051                let inner_offset;
17052                let mut inner_depth = depth.clone();
17053                if inlined {
17054                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17055                    inner_offset = next_offset;
17056                } else {
17057                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17058                    inner_depth.increment()?;
17059                }
17060                let val_ref = self.width.get_or_insert_with(|| {
17061                    fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
17062                });
17063                fidl::decode!(
17064                    u32,
17065                    fidl::encoding::DefaultFuchsiaResourceDialect,
17066                    val_ref,
17067                    decoder,
17068                    inner_offset,
17069                    inner_depth
17070                )?;
17071                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17072                {
17073                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17074                }
17075                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17076                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17077                }
17078            }
17079
17080            next_offset += envelope_size;
17081            _next_ordinal_to_read += 1;
17082            if next_offset >= end_offset {
17083                return Ok(());
17084            }
17085
17086            // Decode unknown envelopes for gaps in ordinals.
17087            while _next_ordinal_to_read < 3 {
17088                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17089                _next_ordinal_to_read += 1;
17090                next_offset += envelope_size;
17091            }
17092
17093            let next_out_of_line = decoder.next_out_of_line();
17094            let handles_before = decoder.remaining_handles();
17095            if let Some((inlined, num_bytes, num_handles)) =
17096                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17097            {
17098                let member_inline_size =
17099                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
17100                if inlined != (member_inline_size <= 4) {
17101                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17102                }
17103                let inner_offset;
17104                let mut inner_depth = depth.clone();
17105                if inlined {
17106                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17107                    inner_offset = next_offset;
17108                } else {
17109                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17110                    inner_depth.increment()?;
17111                }
17112                let val_ref = self.height.get_or_insert_with(|| {
17113                    fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
17114                });
17115                fidl::decode!(
17116                    u32,
17117                    fidl::encoding::DefaultFuchsiaResourceDialect,
17118                    val_ref,
17119                    decoder,
17120                    inner_offset,
17121                    inner_depth
17122                )?;
17123                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17124                {
17125                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17126                }
17127                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17128                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17129                }
17130            }
17131
17132            next_offset += envelope_size;
17133
17134            // Decode the remaining unknown envelopes.
17135            while next_offset < end_offset {
17136                _next_ordinal_to_read += 1;
17137                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17138                next_offset += envelope_size;
17139            }
17140
17141            Ok(())
17142        }
17143    }
17144
17145    impl LoadUrlParams {
17146        #[inline(always)]
17147        fn max_ordinal_present(&self) -> u64 {
17148            if let Some(_) = self.headers {
17149                return 4;
17150            }
17151            if let Some(_) = self.was_user_activated {
17152                return 3;
17153            }
17154            if let Some(_) = self.referrer_url {
17155                return 2;
17156            }
17157            if let Some(_) = self.type_ {
17158                return 1;
17159            }
17160            0
17161        }
17162    }
17163
17164    impl fidl::encoding::ResourceTypeMarker for LoadUrlParams {
17165        type Borrowed<'a> = &'a mut Self;
17166        fn take_or_borrow<'a>(
17167            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
17168        ) -> Self::Borrowed<'a> {
17169            value
17170        }
17171    }
17172
17173    unsafe impl fidl::encoding::TypeMarker for LoadUrlParams {
17174        type Owned = Self;
17175
17176        #[inline(always)]
17177        fn inline_align(_context: fidl::encoding::Context) -> usize {
17178            8
17179        }
17180
17181        #[inline(always)]
17182        fn inline_size(_context: fidl::encoding::Context) -> usize {
17183            16
17184        }
17185    }
17186
17187    unsafe impl fidl::encoding::Encode<LoadUrlParams, fidl::encoding::DefaultFuchsiaResourceDialect>
17188        for &mut LoadUrlParams
17189    {
17190        unsafe fn encode(
17191            self,
17192            encoder: &mut fidl::encoding::Encoder<
17193                '_,
17194                fidl::encoding::DefaultFuchsiaResourceDialect,
17195            >,
17196            offset: usize,
17197            mut depth: fidl::encoding::Depth,
17198        ) -> fidl::Result<()> {
17199            encoder.debug_check_bounds::<LoadUrlParams>(offset);
17200            // Vector header
17201            let max_ordinal: u64 = self.max_ordinal_present();
17202            encoder.write_num(max_ordinal, offset);
17203            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
17204            // Calling encoder.out_of_line_offset(0) is not allowed.
17205            if max_ordinal == 0 {
17206                return Ok(());
17207            }
17208            depth.increment()?;
17209            let envelope_size = 8;
17210            let bytes_len = max_ordinal as usize * envelope_size;
17211            #[allow(unused_variables)]
17212            let offset = encoder.out_of_line_offset(bytes_len);
17213            let mut _prev_end_offset: usize = 0;
17214            if 1 > max_ordinal {
17215                return Ok(());
17216            }
17217
17218            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17219            // are envelope_size bytes.
17220            let cur_offset: usize = (1 - 1) * envelope_size;
17221
17222            // Zero reserved fields.
17223            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17224
17225            // Safety:
17226            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17227            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17228            //   envelope_size bytes, there is always sufficient room.
17229            fidl::encoding::encode_in_envelope_optional::<
17230                LoadUrlReason,
17231                fidl::encoding::DefaultFuchsiaResourceDialect,
17232            >(
17233                self.type_.as_ref().map(<LoadUrlReason as fidl::encoding::ValueTypeMarker>::borrow),
17234                encoder,
17235                offset + cur_offset,
17236                depth,
17237            )?;
17238
17239            _prev_end_offset = cur_offset + envelope_size;
17240            if 2 > max_ordinal {
17241                return Ok(());
17242            }
17243
17244            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17245            // are envelope_size bytes.
17246            let cur_offset: usize = (2 - 1) * envelope_size;
17247
17248            // Zero reserved fields.
17249            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17250
17251            // Safety:
17252            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17253            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17254            //   envelope_size bytes, there is always sufficient room.
17255            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<65536>, fidl::encoding::DefaultFuchsiaResourceDialect>(
17256            self.referrer_url.as_ref().map(<fidl::encoding::BoundedString<65536> as fidl::encoding::ValueTypeMarker>::borrow),
17257            encoder, offset + cur_offset, depth
17258        )?;
17259
17260            _prev_end_offset = cur_offset + envelope_size;
17261            if 3 > max_ordinal {
17262                return Ok(());
17263            }
17264
17265            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17266            // are envelope_size bytes.
17267            let cur_offset: usize = (3 - 1) * envelope_size;
17268
17269            // Zero reserved fields.
17270            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17271
17272            // Safety:
17273            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17274            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17275            //   envelope_size bytes, there is always sufficient room.
17276            fidl::encoding::encode_in_envelope_optional::<
17277                bool,
17278                fidl::encoding::DefaultFuchsiaResourceDialect,
17279            >(
17280                self.was_user_activated
17281                    .as_ref()
17282                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
17283                encoder,
17284                offset + cur_offset,
17285                depth,
17286            )?;
17287
17288            _prev_end_offset = cur_offset + envelope_size;
17289            if 4 > max_ordinal {
17290                return Ok(());
17291            }
17292
17293            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17294            // are envelope_size bytes.
17295            let cur_offset: usize = (4 - 1) * envelope_size;
17296
17297            // Zero reserved fields.
17298            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17299
17300            // Safety:
17301            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17302            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17303            //   envelope_size bytes, there is always sufficient room.
17304            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl_fuchsia_net_http::Header>, fidl::encoding::DefaultFuchsiaResourceDialect>(
17305            self.headers.as_ref().map(<fidl::encoding::UnboundedVector<fidl_fuchsia_net_http::Header> as fidl::encoding::ValueTypeMarker>::borrow),
17306            encoder, offset + cur_offset, depth
17307        )?;
17308
17309            _prev_end_offset = cur_offset + envelope_size;
17310
17311            Ok(())
17312        }
17313    }
17314
17315    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for LoadUrlParams {
17316        #[inline(always)]
17317        fn new_empty() -> Self {
17318            Self::default()
17319        }
17320
17321        unsafe fn decode(
17322            &mut self,
17323            decoder: &mut fidl::encoding::Decoder<
17324                '_,
17325                fidl::encoding::DefaultFuchsiaResourceDialect,
17326            >,
17327            offset: usize,
17328            mut depth: fidl::encoding::Depth,
17329        ) -> fidl::Result<()> {
17330            decoder.debug_check_bounds::<Self>(offset);
17331            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
17332                None => return Err(fidl::Error::NotNullable),
17333                Some(len) => len,
17334            };
17335            // Calling decoder.out_of_line_offset(0) is not allowed.
17336            if len == 0 {
17337                return Ok(());
17338            };
17339            depth.increment()?;
17340            let envelope_size = 8;
17341            let bytes_len = len * envelope_size;
17342            let offset = decoder.out_of_line_offset(bytes_len)?;
17343            // Decode the envelope for each type.
17344            let mut _next_ordinal_to_read = 0;
17345            let mut next_offset = offset;
17346            let end_offset = offset + bytes_len;
17347            _next_ordinal_to_read += 1;
17348            if next_offset >= end_offset {
17349                return Ok(());
17350            }
17351
17352            // Decode unknown envelopes for gaps in ordinals.
17353            while _next_ordinal_to_read < 1 {
17354                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17355                _next_ordinal_to_read += 1;
17356                next_offset += envelope_size;
17357            }
17358
17359            let next_out_of_line = decoder.next_out_of_line();
17360            let handles_before = decoder.remaining_handles();
17361            if let Some((inlined, num_bytes, num_handles)) =
17362                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17363            {
17364                let member_inline_size =
17365                    <LoadUrlReason as fidl::encoding::TypeMarker>::inline_size(decoder.context);
17366                if inlined != (member_inline_size <= 4) {
17367                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17368                }
17369                let inner_offset;
17370                let mut inner_depth = depth.clone();
17371                if inlined {
17372                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17373                    inner_offset = next_offset;
17374                } else {
17375                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17376                    inner_depth.increment()?;
17377                }
17378                let val_ref = self.type_.get_or_insert_with(|| {
17379                    fidl::new_empty!(LoadUrlReason, fidl::encoding::DefaultFuchsiaResourceDialect)
17380                });
17381                fidl::decode!(
17382                    LoadUrlReason,
17383                    fidl::encoding::DefaultFuchsiaResourceDialect,
17384                    val_ref,
17385                    decoder,
17386                    inner_offset,
17387                    inner_depth
17388                )?;
17389                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17390                {
17391                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17392                }
17393                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17394                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17395                }
17396            }
17397
17398            next_offset += envelope_size;
17399            _next_ordinal_to_read += 1;
17400            if next_offset >= end_offset {
17401                return Ok(());
17402            }
17403
17404            // Decode unknown envelopes for gaps in ordinals.
17405            while _next_ordinal_to_read < 2 {
17406                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17407                _next_ordinal_to_read += 1;
17408                next_offset += envelope_size;
17409            }
17410
17411            let next_out_of_line = decoder.next_out_of_line();
17412            let handles_before = decoder.remaining_handles();
17413            if let Some((inlined, num_bytes, num_handles)) =
17414                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17415            {
17416                let member_inline_size = <fidl::encoding::BoundedString<65536> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
17417                if inlined != (member_inline_size <= 4) {
17418                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17419                }
17420                let inner_offset;
17421                let mut inner_depth = depth.clone();
17422                if inlined {
17423                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17424                    inner_offset = next_offset;
17425                } else {
17426                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17427                    inner_depth.increment()?;
17428                }
17429                let val_ref = self.referrer_url.get_or_insert_with(|| {
17430                    fidl::new_empty!(
17431                        fidl::encoding::BoundedString<65536>,
17432                        fidl::encoding::DefaultFuchsiaResourceDialect
17433                    )
17434                });
17435                fidl::decode!(
17436                    fidl::encoding::BoundedString<65536>,
17437                    fidl::encoding::DefaultFuchsiaResourceDialect,
17438                    val_ref,
17439                    decoder,
17440                    inner_offset,
17441                    inner_depth
17442                )?;
17443                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17444                {
17445                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17446                }
17447                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17448                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17449                }
17450            }
17451
17452            next_offset += envelope_size;
17453            _next_ordinal_to_read += 1;
17454            if next_offset >= end_offset {
17455                return Ok(());
17456            }
17457
17458            // Decode unknown envelopes for gaps in ordinals.
17459            while _next_ordinal_to_read < 3 {
17460                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17461                _next_ordinal_to_read += 1;
17462                next_offset += envelope_size;
17463            }
17464
17465            let next_out_of_line = decoder.next_out_of_line();
17466            let handles_before = decoder.remaining_handles();
17467            if let Some((inlined, num_bytes, num_handles)) =
17468                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17469            {
17470                let member_inline_size =
17471                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
17472                if inlined != (member_inline_size <= 4) {
17473                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17474                }
17475                let inner_offset;
17476                let mut inner_depth = depth.clone();
17477                if inlined {
17478                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17479                    inner_offset = next_offset;
17480                } else {
17481                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17482                    inner_depth.increment()?;
17483                }
17484                let val_ref = self.was_user_activated.get_or_insert_with(|| {
17485                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
17486                });
17487                fidl::decode!(
17488                    bool,
17489                    fidl::encoding::DefaultFuchsiaResourceDialect,
17490                    val_ref,
17491                    decoder,
17492                    inner_offset,
17493                    inner_depth
17494                )?;
17495                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17496                {
17497                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17498                }
17499                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17500                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17501                }
17502            }
17503
17504            next_offset += envelope_size;
17505            _next_ordinal_to_read += 1;
17506            if next_offset >= end_offset {
17507                return Ok(());
17508            }
17509
17510            // Decode unknown envelopes for gaps in ordinals.
17511            while _next_ordinal_to_read < 4 {
17512                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17513                _next_ordinal_to_read += 1;
17514                next_offset += envelope_size;
17515            }
17516
17517            let next_out_of_line = decoder.next_out_of_line();
17518            let handles_before = decoder.remaining_handles();
17519            if let Some((inlined, num_bytes, num_handles)) =
17520                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17521            {
17522                let member_inline_size = <fidl::encoding::UnboundedVector<
17523                    fidl_fuchsia_net_http::Header,
17524                > as fidl::encoding::TypeMarker>::inline_size(
17525                    decoder.context
17526                );
17527                if inlined != (member_inline_size <= 4) {
17528                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17529                }
17530                let inner_offset;
17531                let mut inner_depth = depth.clone();
17532                if inlined {
17533                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17534                    inner_offset = next_offset;
17535                } else {
17536                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17537                    inner_depth.increment()?;
17538                }
17539                let val_ref = self.headers.get_or_insert_with(|| {
17540                    fidl::new_empty!(
17541                        fidl::encoding::UnboundedVector<fidl_fuchsia_net_http::Header>,
17542                        fidl::encoding::DefaultFuchsiaResourceDialect
17543                    )
17544                });
17545                fidl::decode!(
17546                    fidl::encoding::UnboundedVector<fidl_fuchsia_net_http::Header>,
17547                    fidl::encoding::DefaultFuchsiaResourceDialect,
17548                    val_ref,
17549                    decoder,
17550                    inner_offset,
17551                    inner_depth
17552                )?;
17553                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17554                {
17555                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17556                }
17557                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17558                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17559                }
17560            }
17561
17562            next_offset += envelope_size;
17563
17564            // Decode the remaining unknown envelopes.
17565            while next_offset < end_offset {
17566                _next_ordinal_to_read += 1;
17567                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17568                next_offset += envelope_size;
17569            }
17570
17571            Ok(())
17572        }
17573    }
17574
17575    impl NavigationState {
17576        #[inline(always)]
17577        fn max_ordinal_present(&self) -> u64 {
17578            if let Some(_) = self.error_detail {
17579                return 8;
17580            }
17581            if let Some(_) = self.favicon {
17582                return 7;
17583            }
17584            if let Some(_) = self.is_main_document_loaded {
17585                return 6;
17586            }
17587            if let Some(_) = self.can_go_back {
17588                return 5;
17589            }
17590            if let Some(_) = self.can_go_forward {
17591                return 4;
17592            }
17593            if let Some(_) = self.page_type {
17594                return 3;
17595            }
17596            if let Some(_) = self.title {
17597                return 2;
17598            }
17599            if let Some(_) = self.url {
17600                return 1;
17601            }
17602            0
17603        }
17604    }
17605
17606    impl fidl::encoding::ResourceTypeMarker for NavigationState {
17607        type Borrowed<'a> = &'a mut Self;
17608        fn take_or_borrow<'a>(
17609            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
17610        ) -> Self::Borrowed<'a> {
17611            value
17612        }
17613    }
17614
17615    unsafe impl fidl::encoding::TypeMarker for NavigationState {
17616        type Owned = Self;
17617
17618        #[inline(always)]
17619        fn inline_align(_context: fidl::encoding::Context) -> usize {
17620            8
17621        }
17622
17623        #[inline(always)]
17624        fn inline_size(_context: fidl::encoding::Context) -> usize {
17625            16
17626        }
17627    }
17628
17629    unsafe impl
17630        fidl::encoding::Encode<NavigationState, fidl::encoding::DefaultFuchsiaResourceDialect>
17631        for &mut NavigationState
17632    {
17633        unsafe fn encode(
17634            self,
17635            encoder: &mut fidl::encoding::Encoder<
17636                '_,
17637                fidl::encoding::DefaultFuchsiaResourceDialect,
17638            >,
17639            offset: usize,
17640            mut depth: fidl::encoding::Depth,
17641        ) -> fidl::Result<()> {
17642            encoder.debug_check_bounds::<NavigationState>(offset);
17643            // Vector header
17644            let max_ordinal: u64 = self.max_ordinal_present();
17645            encoder.write_num(max_ordinal, offset);
17646            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
17647            // Calling encoder.out_of_line_offset(0) is not allowed.
17648            if max_ordinal == 0 {
17649                return Ok(());
17650            }
17651            depth.increment()?;
17652            let envelope_size = 8;
17653            let bytes_len = max_ordinal as usize * envelope_size;
17654            #[allow(unused_variables)]
17655            let offset = encoder.out_of_line_offset(bytes_len);
17656            let mut _prev_end_offset: usize = 0;
17657            if 1 > max_ordinal {
17658                return Ok(());
17659            }
17660
17661            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17662            // are envelope_size bytes.
17663            let cur_offset: usize = (1 - 1) * envelope_size;
17664
17665            // Zero reserved fields.
17666            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17667
17668            // Safety:
17669            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17670            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17671            //   envelope_size bytes, there is always sufficient room.
17672            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<65536>, fidl::encoding::DefaultFuchsiaResourceDialect>(
17673            self.url.as_ref().map(<fidl::encoding::BoundedString<65536> as fidl::encoding::ValueTypeMarker>::borrow),
17674            encoder, offset + cur_offset, depth
17675        )?;
17676
17677            _prev_end_offset = cur_offset + envelope_size;
17678            if 2 > max_ordinal {
17679                return Ok(());
17680            }
17681
17682            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17683            // are envelope_size bytes.
17684            let cur_offset: usize = (2 - 1) * envelope_size;
17685
17686            // Zero reserved fields.
17687            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17688
17689            // Safety:
17690            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17691            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17692            //   envelope_size bytes, there is always sufficient room.
17693            fidl::encoding::encode_in_envelope_optional::<
17694                fidl::encoding::UnboundedString,
17695                fidl::encoding::DefaultFuchsiaResourceDialect,
17696            >(
17697                self.title.as_ref().map(
17698                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
17699                ),
17700                encoder,
17701                offset + cur_offset,
17702                depth,
17703            )?;
17704
17705            _prev_end_offset = cur_offset + envelope_size;
17706            if 3 > max_ordinal {
17707                return Ok(());
17708            }
17709
17710            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17711            // are envelope_size bytes.
17712            let cur_offset: usize = (3 - 1) * envelope_size;
17713
17714            // Zero reserved fields.
17715            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17716
17717            // Safety:
17718            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17719            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17720            //   envelope_size bytes, there is always sufficient room.
17721            fidl::encoding::encode_in_envelope_optional::<
17722                PageType,
17723                fidl::encoding::DefaultFuchsiaResourceDialect,
17724            >(
17725                self.page_type.as_ref().map(<PageType as fidl::encoding::ValueTypeMarker>::borrow),
17726                encoder,
17727                offset + cur_offset,
17728                depth,
17729            )?;
17730
17731            _prev_end_offset = cur_offset + envelope_size;
17732            if 4 > max_ordinal {
17733                return Ok(());
17734            }
17735
17736            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17737            // are envelope_size bytes.
17738            let cur_offset: usize = (4 - 1) * envelope_size;
17739
17740            // Zero reserved fields.
17741            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17742
17743            // Safety:
17744            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17745            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17746            //   envelope_size bytes, there is always sufficient room.
17747            fidl::encoding::encode_in_envelope_optional::<
17748                bool,
17749                fidl::encoding::DefaultFuchsiaResourceDialect,
17750            >(
17751                self.can_go_forward.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
17752                encoder,
17753                offset + cur_offset,
17754                depth,
17755            )?;
17756
17757            _prev_end_offset = cur_offset + envelope_size;
17758            if 5 > max_ordinal {
17759                return Ok(());
17760            }
17761
17762            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17763            // are envelope_size bytes.
17764            let cur_offset: usize = (5 - 1) * envelope_size;
17765
17766            // Zero reserved fields.
17767            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17768
17769            // Safety:
17770            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17771            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17772            //   envelope_size bytes, there is always sufficient room.
17773            fidl::encoding::encode_in_envelope_optional::<
17774                bool,
17775                fidl::encoding::DefaultFuchsiaResourceDialect,
17776            >(
17777                self.can_go_back.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
17778                encoder,
17779                offset + cur_offset,
17780                depth,
17781            )?;
17782
17783            _prev_end_offset = cur_offset + envelope_size;
17784            if 6 > max_ordinal {
17785                return Ok(());
17786            }
17787
17788            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17789            // are envelope_size bytes.
17790            let cur_offset: usize = (6 - 1) * envelope_size;
17791
17792            // Zero reserved fields.
17793            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17794
17795            // Safety:
17796            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17797            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17798            //   envelope_size bytes, there is always sufficient room.
17799            fidl::encoding::encode_in_envelope_optional::<
17800                bool,
17801                fidl::encoding::DefaultFuchsiaResourceDialect,
17802            >(
17803                self.is_main_document_loaded
17804                    .as_ref()
17805                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
17806                encoder,
17807                offset + cur_offset,
17808                depth,
17809            )?;
17810
17811            _prev_end_offset = cur_offset + envelope_size;
17812            if 7 > max_ordinal {
17813                return Ok(());
17814            }
17815
17816            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17817            // are envelope_size bytes.
17818            let cur_offset: usize = (7 - 1) * envelope_size;
17819
17820            // Zero reserved fields.
17821            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17822
17823            // Safety:
17824            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17825            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17826            //   envelope_size bytes, there is always sufficient room.
17827            fidl::encoding::encode_in_envelope_optional::<
17828                Favicon,
17829                fidl::encoding::DefaultFuchsiaResourceDialect,
17830            >(
17831                self.favicon
17832                    .as_mut()
17833                    .map(<Favicon as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
17834                encoder,
17835                offset + cur_offset,
17836                depth,
17837            )?;
17838
17839            _prev_end_offset = cur_offset + envelope_size;
17840            if 8 > max_ordinal {
17841                return Ok(());
17842            }
17843
17844            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17845            // are envelope_size bytes.
17846            let cur_offset: usize = (8 - 1) * envelope_size;
17847
17848            // Zero reserved fields.
17849            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17850
17851            // Safety:
17852            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17853            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17854            //   envelope_size bytes, there is always sufficient room.
17855            fidl::encoding::encode_in_envelope_optional::<
17856                ErrorDetail,
17857                fidl::encoding::DefaultFuchsiaResourceDialect,
17858            >(
17859                self.error_detail
17860                    .as_ref()
17861                    .map(<ErrorDetail as fidl::encoding::ValueTypeMarker>::borrow),
17862                encoder,
17863                offset + cur_offset,
17864                depth,
17865            )?;
17866
17867            _prev_end_offset = cur_offset + envelope_size;
17868
17869            Ok(())
17870        }
17871    }
17872
17873    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
17874        for NavigationState
17875    {
17876        #[inline(always)]
17877        fn new_empty() -> Self {
17878            Self::default()
17879        }
17880
17881        unsafe fn decode(
17882            &mut self,
17883            decoder: &mut fidl::encoding::Decoder<
17884                '_,
17885                fidl::encoding::DefaultFuchsiaResourceDialect,
17886            >,
17887            offset: usize,
17888            mut depth: fidl::encoding::Depth,
17889        ) -> fidl::Result<()> {
17890            decoder.debug_check_bounds::<Self>(offset);
17891            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
17892                None => return Err(fidl::Error::NotNullable),
17893                Some(len) => len,
17894            };
17895            // Calling decoder.out_of_line_offset(0) is not allowed.
17896            if len == 0 {
17897                return Ok(());
17898            };
17899            depth.increment()?;
17900            let envelope_size = 8;
17901            let bytes_len = len * envelope_size;
17902            let offset = decoder.out_of_line_offset(bytes_len)?;
17903            // Decode the envelope for each type.
17904            let mut _next_ordinal_to_read = 0;
17905            let mut next_offset = offset;
17906            let end_offset = offset + bytes_len;
17907            _next_ordinal_to_read += 1;
17908            if next_offset >= end_offset {
17909                return Ok(());
17910            }
17911
17912            // Decode unknown envelopes for gaps in ordinals.
17913            while _next_ordinal_to_read < 1 {
17914                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17915                _next_ordinal_to_read += 1;
17916                next_offset += envelope_size;
17917            }
17918
17919            let next_out_of_line = decoder.next_out_of_line();
17920            let handles_before = decoder.remaining_handles();
17921            if let Some((inlined, num_bytes, num_handles)) =
17922                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17923            {
17924                let member_inline_size = <fidl::encoding::BoundedString<65536> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
17925                if inlined != (member_inline_size <= 4) {
17926                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17927                }
17928                let inner_offset;
17929                let mut inner_depth = depth.clone();
17930                if inlined {
17931                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17932                    inner_offset = next_offset;
17933                } else {
17934                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17935                    inner_depth.increment()?;
17936                }
17937                let val_ref = self.url.get_or_insert_with(|| {
17938                    fidl::new_empty!(
17939                        fidl::encoding::BoundedString<65536>,
17940                        fidl::encoding::DefaultFuchsiaResourceDialect
17941                    )
17942                });
17943                fidl::decode!(
17944                    fidl::encoding::BoundedString<65536>,
17945                    fidl::encoding::DefaultFuchsiaResourceDialect,
17946                    val_ref,
17947                    decoder,
17948                    inner_offset,
17949                    inner_depth
17950                )?;
17951                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17952                {
17953                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17954                }
17955                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17956                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17957                }
17958            }
17959
17960            next_offset += envelope_size;
17961            _next_ordinal_to_read += 1;
17962            if next_offset >= end_offset {
17963                return Ok(());
17964            }
17965
17966            // Decode unknown envelopes for gaps in ordinals.
17967            while _next_ordinal_to_read < 2 {
17968                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17969                _next_ordinal_to_read += 1;
17970                next_offset += envelope_size;
17971            }
17972
17973            let next_out_of_line = decoder.next_out_of_line();
17974            let handles_before = decoder.remaining_handles();
17975            if let Some((inlined, num_bytes, num_handles)) =
17976                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17977            {
17978                let member_inline_size =
17979                    <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
17980                        decoder.context,
17981                    );
17982                if inlined != (member_inline_size <= 4) {
17983                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17984                }
17985                let inner_offset;
17986                let mut inner_depth = depth.clone();
17987                if inlined {
17988                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17989                    inner_offset = next_offset;
17990                } else {
17991                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17992                    inner_depth.increment()?;
17993                }
17994                let val_ref = self.title.get_or_insert_with(|| {
17995                    fidl::new_empty!(
17996                        fidl::encoding::UnboundedString,
17997                        fidl::encoding::DefaultFuchsiaResourceDialect
17998                    )
17999                });
18000                fidl::decode!(
18001                    fidl::encoding::UnboundedString,
18002                    fidl::encoding::DefaultFuchsiaResourceDialect,
18003                    val_ref,
18004                    decoder,
18005                    inner_offset,
18006                    inner_depth
18007                )?;
18008                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18009                {
18010                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18011                }
18012                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18013                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18014                }
18015            }
18016
18017            next_offset += envelope_size;
18018            _next_ordinal_to_read += 1;
18019            if next_offset >= end_offset {
18020                return Ok(());
18021            }
18022
18023            // Decode unknown envelopes for gaps in ordinals.
18024            while _next_ordinal_to_read < 3 {
18025                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18026                _next_ordinal_to_read += 1;
18027                next_offset += envelope_size;
18028            }
18029
18030            let next_out_of_line = decoder.next_out_of_line();
18031            let handles_before = decoder.remaining_handles();
18032            if let Some((inlined, num_bytes, num_handles)) =
18033                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18034            {
18035                let member_inline_size =
18036                    <PageType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18037                if inlined != (member_inline_size <= 4) {
18038                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18039                }
18040                let inner_offset;
18041                let mut inner_depth = depth.clone();
18042                if inlined {
18043                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18044                    inner_offset = next_offset;
18045                } else {
18046                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18047                    inner_depth.increment()?;
18048                }
18049                let val_ref = self.page_type.get_or_insert_with(|| {
18050                    fidl::new_empty!(PageType, fidl::encoding::DefaultFuchsiaResourceDialect)
18051                });
18052                fidl::decode!(
18053                    PageType,
18054                    fidl::encoding::DefaultFuchsiaResourceDialect,
18055                    val_ref,
18056                    decoder,
18057                    inner_offset,
18058                    inner_depth
18059                )?;
18060                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18061                {
18062                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18063                }
18064                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18065                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18066                }
18067            }
18068
18069            next_offset += envelope_size;
18070            _next_ordinal_to_read += 1;
18071            if next_offset >= end_offset {
18072                return Ok(());
18073            }
18074
18075            // Decode unknown envelopes for gaps in ordinals.
18076            while _next_ordinal_to_read < 4 {
18077                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18078                _next_ordinal_to_read += 1;
18079                next_offset += envelope_size;
18080            }
18081
18082            let next_out_of_line = decoder.next_out_of_line();
18083            let handles_before = decoder.remaining_handles();
18084            if let Some((inlined, num_bytes, num_handles)) =
18085                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18086            {
18087                let member_inline_size =
18088                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18089                if inlined != (member_inline_size <= 4) {
18090                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18091                }
18092                let inner_offset;
18093                let mut inner_depth = depth.clone();
18094                if inlined {
18095                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18096                    inner_offset = next_offset;
18097                } else {
18098                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18099                    inner_depth.increment()?;
18100                }
18101                let val_ref = self.can_go_forward.get_or_insert_with(|| {
18102                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
18103                });
18104                fidl::decode!(
18105                    bool,
18106                    fidl::encoding::DefaultFuchsiaResourceDialect,
18107                    val_ref,
18108                    decoder,
18109                    inner_offset,
18110                    inner_depth
18111                )?;
18112                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18113                {
18114                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18115                }
18116                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18117                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18118                }
18119            }
18120
18121            next_offset += envelope_size;
18122            _next_ordinal_to_read += 1;
18123            if next_offset >= end_offset {
18124                return Ok(());
18125            }
18126
18127            // Decode unknown envelopes for gaps in ordinals.
18128            while _next_ordinal_to_read < 5 {
18129                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18130                _next_ordinal_to_read += 1;
18131                next_offset += envelope_size;
18132            }
18133
18134            let next_out_of_line = decoder.next_out_of_line();
18135            let handles_before = decoder.remaining_handles();
18136            if let Some((inlined, num_bytes, num_handles)) =
18137                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18138            {
18139                let member_inline_size =
18140                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18141                if inlined != (member_inline_size <= 4) {
18142                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18143                }
18144                let inner_offset;
18145                let mut inner_depth = depth.clone();
18146                if inlined {
18147                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18148                    inner_offset = next_offset;
18149                } else {
18150                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18151                    inner_depth.increment()?;
18152                }
18153                let val_ref = self.can_go_back.get_or_insert_with(|| {
18154                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
18155                });
18156                fidl::decode!(
18157                    bool,
18158                    fidl::encoding::DefaultFuchsiaResourceDialect,
18159                    val_ref,
18160                    decoder,
18161                    inner_offset,
18162                    inner_depth
18163                )?;
18164                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18165                {
18166                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18167                }
18168                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18169                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18170                }
18171            }
18172
18173            next_offset += envelope_size;
18174            _next_ordinal_to_read += 1;
18175            if next_offset >= end_offset {
18176                return Ok(());
18177            }
18178
18179            // Decode unknown envelopes for gaps in ordinals.
18180            while _next_ordinal_to_read < 6 {
18181                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18182                _next_ordinal_to_read += 1;
18183                next_offset += envelope_size;
18184            }
18185
18186            let next_out_of_line = decoder.next_out_of_line();
18187            let handles_before = decoder.remaining_handles();
18188            if let Some((inlined, num_bytes, num_handles)) =
18189                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18190            {
18191                let member_inline_size =
18192                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18193                if inlined != (member_inline_size <= 4) {
18194                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18195                }
18196                let inner_offset;
18197                let mut inner_depth = depth.clone();
18198                if inlined {
18199                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18200                    inner_offset = next_offset;
18201                } else {
18202                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18203                    inner_depth.increment()?;
18204                }
18205                let val_ref = self.is_main_document_loaded.get_or_insert_with(|| {
18206                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
18207                });
18208                fidl::decode!(
18209                    bool,
18210                    fidl::encoding::DefaultFuchsiaResourceDialect,
18211                    val_ref,
18212                    decoder,
18213                    inner_offset,
18214                    inner_depth
18215                )?;
18216                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18217                {
18218                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18219                }
18220                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18221                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18222                }
18223            }
18224
18225            next_offset += envelope_size;
18226            _next_ordinal_to_read += 1;
18227            if next_offset >= end_offset {
18228                return Ok(());
18229            }
18230
18231            // Decode unknown envelopes for gaps in ordinals.
18232            while _next_ordinal_to_read < 7 {
18233                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18234                _next_ordinal_to_read += 1;
18235                next_offset += envelope_size;
18236            }
18237
18238            let next_out_of_line = decoder.next_out_of_line();
18239            let handles_before = decoder.remaining_handles();
18240            if let Some((inlined, num_bytes, num_handles)) =
18241                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18242            {
18243                let member_inline_size =
18244                    <Favicon as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18245                if inlined != (member_inline_size <= 4) {
18246                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18247                }
18248                let inner_offset;
18249                let mut inner_depth = depth.clone();
18250                if inlined {
18251                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18252                    inner_offset = next_offset;
18253                } else {
18254                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18255                    inner_depth.increment()?;
18256                }
18257                let val_ref = self.favicon.get_or_insert_with(|| {
18258                    fidl::new_empty!(Favicon, fidl::encoding::DefaultFuchsiaResourceDialect)
18259                });
18260                fidl::decode!(
18261                    Favicon,
18262                    fidl::encoding::DefaultFuchsiaResourceDialect,
18263                    val_ref,
18264                    decoder,
18265                    inner_offset,
18266                    inner_depth
18267                )?;
18268                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18269                {
18270                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18271                }
18272                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18273                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18274                }
18275            }
18276
18277            next_offset += envelope_size;
18278            _next_ordinal_to_read += 1;
18279            if next_offset >= end_offset {
18280                return Ok(());
18281            }
18282
18283            // Decode unknown envelopes for gaps in ordinals.
18284            while _next_ordinal_to_read < 8 {
18285                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18286                _next_ordinal_to_read += 1;
18287                next_offset += envelope_size;
18288            }
18289
18290            let next_out_of_line = decoder.next_out_of_line();
18291            let handles_before = decoder.remaining_handles();
18292            if let Some((inlined, num_bytes, num_handles)) =
18293                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18294            {
18295                let member_inline_size =
18296                    <ErrorDetail as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18297                if inlined != (member_inline_size <= 4) {
18298                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18299                }
18300                let inner_offset;
18301                let mut inner_depth = depth.clone();
18302                if inlined {
18303                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18304                    inner_offset = next_offset;
18305                } else {
18306                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18307                    inner_depth.increment()?;
18308                }
18309                let val_ref = self.error_detail.get_or_insert_with(|| {
18310                    fidl::new_empty!(ErrorDetail, fidl::encoding::DefaultFuchsiaResourceDialect)
18311                });
18312                fidl::decode!(
18313                    ErrorDetail,
18314                    fidl::encoding::DefaultFuchsiaResourceDialect,
18315                    val_ref,
18316                    decoder,
18317                    inner_offset,
18318                    inner_depth
18319                )?;
18320                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18321                {
18322                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18323                }
18324                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18325                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18326                }
18327            }
18328
18329            next_offset += envelope_size;
18330
18331            // Decode the remaining unknown envelopes.
18332            while next_offset < end_offset {
18333                _next_ordinal_to_read += 1;
18334                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18335                next_offset += envelope_size;
18336            }
18337
18338            Ok(())
18339        }
18340    }
18341
18342    impl PopupFrameCreationInfo {
18343        #[inline(always)]
18344        fn max_ordinal_present(&self) -> u64 {
18345            if let Some(_) = self.initiated_by_user {
18346                return 2;
18347            }
18348            if let Some(_) = self.initial_url {
18349                return 1;
18350            }
18351            0
18352        }
18353    }
18354
18355    impl fidl::encoding::ResourceTypeMarker for PopupFrameCreationInfo {
18356        type Borrowed<'a> = &'a mut Self;
18357        fn take_or_borrow<'a>(
18358            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
18359        ) -> Self::Borrowed<'a> {
18360            value
18361        }
18362    }
18363
18364    unsafe impl fidl::encoding::TypeMarker for PopupFrameCreationInfo {
18365        type Owned = Self;
18366
18367        #[inline(always)]
18368        fn inline_align(_context: fidl::encoding::Context) -> usize {
18369            8
18370        }
18371
18372        #[inline(always)]
18373        fn inline_size(_context: fidl::encoding::Context) -> usize {
18374            16
18375        }
18376    }
18377
18378    unsafe impl
18379        fidl::encoding::Encode<
18380            PopupFrameCreationInfo,
18381            fidl::encoding::DefaultFuchsiaResourceDialect,
18382        > for &mut PopupFrameCreationInfo
18383    {
18384        unsafe fn encode(
18385            self,
18386            encoder: &mut fidl::encoding::Encoder<
18387                '_,
18388                fidl::encoding::DefaultFuchsiaResourceDialect,
18389            >,
18390            offset: usize,
18391            mut depth: fidl::encoding::Depth,
18392        ) -> fidl::Result<()> {
18393            encoder.debug_check_bounds::<PopupFrameCreationInfo>(offset);
18394            // Vector header
18395            let max_ordinal: u64 = self.max_ordinal_present();
18396            encoder.write_num(max_ordinal, offset);
18397            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
18398            // Calling encoder.out_of_line_offset(0) is not allowed.
18399            if max_ordinal == 0 {
18400                return Ok(());
18401            }
18402            depth.increment()?;
18403            let envelope_size = 8;
18404            let bytes_len = max_ordinal as usize * envelope_size;
18405            #[allow(unused_variables)]
18406            let offset = encoder.out_of_line_offset(bytes_len);
18407            let mut _prev_end_offset: usize = 0;
18408            if 1 > max_ordinal {
18409                return Ok(());
18410            }
18411
18412            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
18413            // are envelope_size bytes.
18414            let cur_offset: usize = (1 - 1) * envelope_size;
18415
18416            // Zero reserved fields.
18417            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
18418
18419            // Safety:
18420            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
18421            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
18422            //   envelope_size bytes, there is always sufficient room.
18423            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<65536>, fidl::encoding::DefaultFuchsiaResourceDialect>(
18424            self.initial_url.as_ref().map(<fidl::encoding::BoundedString<65536> as fidl::encoding::ValueTypeMarker>::borrow),
18425            encoder, offset + cur_offset, depth
18426        )?;
18427
18428            _prev_end_offset = cur_offset + envelope_size;
18429            if 2 > max_ordinal {
18430                return Ok(());
18431            }
18432
18433            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
18434            // are envelope_size bytes.
18435            let cur_offset: usize = (2 - 1) * envelope_size;
18436
18437            // Zero reserved fields.
18438            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
18439
18440            // Safety:
18441            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
18442            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
18443            //   envelope_size bytes, there is always sufficient room.
18444            fidl::encoding::encode_in_envelope_optional::<
18445                bool,
18446                fidl::encoding::DefaultFuchsiaResourceDialect,
18447            >(
18448                self.initiated_by_user
18449                    .as_ref()
18450                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
18451                encoder,
18452                offset + cur_offset,
18453                depth,
18454            )?;
18455
18456            _prev_end_offset = cur_offset + envelope_size;
18457
18458            Ok(())
18459        }
18460    }
18461
18462    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
18463        for PopupFrameCreationInfo
18464    {
18465        #[inline(always)]
18466        fn new_empty() -> Self {
18467            Self::default()
18468        }
18469
18470        unsafe fn decode(
18471            &mut self,
18472            decoder: &mut fidl::encoding::Decoder<
18473                '_,
18474                fidl::encoding::DefaultFuchsiaResourceDialect,
18475            >,
18476            offset: usize,
18477            mut depth: fidl::encoding::Depth,
18478        ) -> fidl::Result<()> {
18479            decoder.debug_check_bounds::<Self>(offset);
18480            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
18481                None => return Err(fidl::Error::NotNullable),
18482                Some(len) => len,
18483            };
18484            // Calling decoder.out_of_line_offset(0) is not allowed.
18485            if len == 0 {
18486                return Ok(());
18487            };
18488            depth.increment()?;
18489            let envelope_size = 8;
18490            let bytes_len = len * envelope_size;
18491            let offset = decoder.out_of_line_offset(bytes_len)?;
18492            // Decode the envelope for each type.
18493            let mut _next_ordinal_to_read = 0;
18494            let mut next_offset = offset;
18495            let end_offset = offset + bytes_len;
18496            _next_ordinal_to_read += 1;
18497            if next_offset >= end_offset {
18498                return Ok(());
18499            }
18500
18501            // Decode unknown envelopes for gaps in ordinals.
18502            while _next_ordinal_to_read < 1 {
18503                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18504                _next_ordinal_to_read += 1;
18505                next_offset += envelope_size;
18506            }
18507
18508            let next_out_of_line = decoder.next_out_of_line();
18509            let handles_before = decoder.remaining_handles();
18510            if let Some((inlined, num_bytes, num_handles)) =
18511                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18512            {
18513                let member_inline_size = <fidl::encoding::BoundedString<65536> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18514                if inlined != (member_inline_size <= 4) {
18515                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18516                }
18517                let inner_offset;
18518                let mut inner_depth = depth.clone();
18519                if inlined {
18520                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18521                    inner_offset = next_offset;
18522                } else {
18523                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18524                    inner_depth.increment()?;
18525                }
18526                let val_ref = self.initial_url.get_or_insert_with(|| {
18527                    fidl::new_empty!(
18528                        fidl::encoding::BoundedString<65536>,
18529                        fidl::encoding::DefaultFuchsiaResourceDialect
18530                    )
18531                });
18532                fidl::decode!(
18533                    fidl::encoding::BoundedString<65536>,
18534                    fidl::encoding::DefaultFuchsiaResourceDialect,
18535                    val_ref,
18536                    decoder,
18537                    inner_offset,
18538                    inner_depth
18539                )?;
18540                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18541                {
18542                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18543                }
18544                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18545                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18546                }
18547            }
18548
18549            next_offset += envelope_size;
18550            _next_ordinal_to_read += 1;
18551            if next_offset >= end_offset {
18552                return Ok(());
18553            }
18554
18555            // Decode unknown envelopes for gaps in ordinals.
18556            while _next_ordinal_to_read < 2 {
18557                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18558                _next_ordinal_to_read += 1;
18559                next_offset += envelope_size;
18560            }
18561
18562            let next_out_of_line = decoder.next_out_of_line();
18563            let handles_before = decoder.remaining_handles();
18564            if let Some((inlined, num_bytes, num_handles)) =
18565                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18566            {
18567                let member_inline_size =
18568                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18569                if inlined != (member_inline_size <= 4) {
18570                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18571                }
18572                let inner_offset;
18573                let mut inner_depth = depth.clone();
18574                if inlined {
18575                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18576                    inner_offset = next_offset;
18577                } else {
18578                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18579                    inner_depth.increment()?;
18580                }
18581                let val_ref = self.initiated_by_user.get_or_insert_with(|| {
18582                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
18583                });
18584                fidl::decode!(
18585                    bool,
18586                    fidl::encoding::DefaultFuchsiaResourceDialect,
18587                    val_ref,
18588                    decoder,
18589                    inner_offset,
18590                    inner_depth
18591                )?;
18592                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18593                {
18594                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18595                }
18596                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18597                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18598                }
18599            }
18600
18601            next_offset += envelope_size;
18602
18603            // Decode the remaining unknown envelopes.
18604            while next_offset < end_offset {
18605                _next_ordinal_to_read += 1;
18606                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18607                next_offset += envelope_size;
18608            }
18609
18610            Ok(())
18611        }
18612    }
18613
18614    impl WebMessage {
18615        #[inline(always)]
18616        fn max_ordinal_present(&self) -> u64 {
18617            if let Some(_) = self.outgoing_transfer {
18618                return 3;
18619            }
18620            if let Some(_) = self.incoming_transfer {
18621                return 2;
18622            }
18623            if let Some(_) = self.data {
18624                return 1;
18625            }
18626            0
18627        }
18628    }
18629
18630    impl fidl::encoding::ResourceTypeMarker for WebMessage {
18631        type Borrowed<'a> = &'a mut Self;
18632        fn take_or_borrow<'a>(
18633            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
18634        ) -> Self::Borrowed<'a> {
18635            value
18636        }
18637    }
18638
18639    unsafe impl fidl::encoding::TypeMarker for WebMessage {
18640        type Owned = Self;
18641
18642        #[inline(always)]
18643        fn inline_align(_context: fidl::encoding::Context) -> usize {
18644            8
18645        }
18646
18647        #[inline(always)]
18648        fn inline_size(_context: fidl::encoding::Context) -> usize {
18649            16
18650        }
18651    }
18652
18653    unsafe impl fidl::encoding::Encode<WebMessage, fidl::encoding::DefaultFuchsiaResourceDialect>
18654        for &mut WebMessage
18655    {
18656        unsafe fn encode(
18657            self,
18658            encoder: &mut fidl::encoding::Encoder<
18659                '_,
18660                fidl::encoding::DefaultFuchsiaResourceDialect,
18661            >,
18662            offset: usize,
18663            mut depth: fidl::encoding::Depth,
18664        ) -> fidl::Result<()> {
18665            encoder.debug_check_bounds::<WebMessage>(offset);
18666            // Vector header
18667            let max_ordinal: u64 = self.max_ordinal_present();
18668            encoder.write_num(max_ordinal, offset);
18669            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
18670            // Calling encoder.out_of_line_offset(0) is not allowed.
18671            if max_ordinal == 0 {
18672                return Ok(());
18673            }
18674            depth.increment()?;
18675            let envelope_size = 8;
18676            let bytes_len = max_ordinal as usize * envelope_size;
18677            #[allow(unused_variables)]
18678            let offset = encoder.out_of_line_offset(bytes_len);
18679            let mut _prev_end_offset: usize = 0;
18680            if 1 > max_ordinal {
18681                return Ok(());
18682            }
18683
18684            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
18685            // are envelope_size bytes.
18686            let cur_offset: usize = (1 - 1) * envelope_size;
18687
18688            // Zero reserved fields.
18689            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
18690
18691            // Safety:
18692            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
18693            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
18694            //   envelope_size bytes, there is always sufficient room.
18695            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_mem::Buffer, fidl::encoding::DefaultFuchsiaResourceDialect>(
18696            self.data.as_mut().map(<fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
18697            encoder, offset + cur_offset, depth
18698        )?;
18699
18700            _prev_end_offset = cur_offset + envelope_size;
18701            if 2 > max_ordinal {
18702                return Ok(());
18703            }
18704
18705            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
18706            // are envelope_size bytes.
18707            let cur_offset: usize = (2 - 1) * envelope_size;
18708
18709            // Zero reserved fields.
18710            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
18711
18712            // Safety:
18713            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
18714            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
18715            //   envelope_size bytes, there is always sufficient room.
18716            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<IncomingTransferable>, fidl::encoding::DefaultFuchsiaResourceDialect>(
18717            self.incoming_transfer.as_mut().map(<fidl::encoding::UnboundedVector<IncomingTransferable> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
18718            encoder, offset + cur_offset, depth
18719        )?;
18720
18721            _prev_end_offset = cur_offset + envelope_size;
18722            if 3 > max_ordinal {
18723                return Ok(());
18724            }
18725
18726            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
18727            // are envelope_size bytes.
18728            let cur_offset: usize = (3 - 1) * envelope_size;
18729
18730            // Zero reserved fields.
18731            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
18732
18733            // Safety:
18734            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
18735            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
18736            //   envelope_size bytes, there is always sufficient room.
18737            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<OutgoingTransferable>, fidl::encoding::DefaultFuchsiaResourceDialect>(
18738            self.outgoing_transfer.as_mut().map(<fidl::encoding::UnboundedVector<OutgoingTransferable> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
18739            encoder, offset + cur_offset, depth
18740        )?;
18741
18742            _prev_end_offset = cur_offset + envelope_size;
18743
18744            Ok(())
18745        }
18746    }
18747
18748    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for WebMessage {
18749        #[inline(always)]
18750        fn new_empty() -> Self {
18751            Self::default()
18752        }
18753
18754        unsafe fn decode(
18755            &mut self,
18756            decoder: &mut fidl::encoding::Decoder<
18757                '_,
18758                fidl::encoding::DefaultFuchsiaResourceDialect,
18759            >,
18760            offset: usize,
18761            mut depth: fidl::encoding::Depth,
18762        ) -> fidl::Result<()> {
18763            decoder.debug_check_bounds::<Self>(offset);
18764            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
18765                None => return Err(fidl::Error::NotNullable),
18766                Some(len) => len,
18767            };
18768            // Calling decoder.out_of_line_offset(0) is not allowed.
18769            if len == 0 {
18770                return Ok(());
18771            };
18772            depth.increment()?;
18773            let envelope_size = 8;
18774            let bytes_len = len * envelope_size;
18775            let offset = decoder.out_of_line_offset(bytes_len)?;
18776            // Decode the envelope for each type.
18777            let mut _next_ordinal_to_read = 0;
18778            let mut next_offset = offset;
18779            let end_offset = offset + bytes_len;
18780            _next_ordinal_to_read += 1;
18781            if next_offset >= end_offset {
18782                return Ok(());
18783            }
18784
18785            // Decode unknown envelopes for gaps in ordinals.
18786            while _next_ordinal_to_read < 1 {
18787                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18788                _next_ordinal_to_read += 1;
18789                next_offset += envelope_size;
18790            }
18791
18792            let next_out_of_line = decoder.next_out_of_line();
18793            let handles_before = decoder.remaining_handles();
18794            if let Some((inlined, num_bytes, num_handles)) =
18795                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18796            {
18797                let member_inline_size =
18798                    <fidl_fuchsia_mem::Buffer as fidl::encoding::TypeMarker>::inline_size(
18799                        decoder.context,
18800                    );
18801                if inlined != (member_inline_size <= 4) {
18802                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18803                }
18804                let inner_offset;
18805                let mut inner_depth = depth.clone();
18806                if inlined {
18807                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18808                    inner_offset = next_offset;
18809                } else {
18810                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18811                    inner_depth.increment()?;
18812                }
18813                let val_ref = self.data.get_or_insert_with(|| {
18814                    fidl::new_empty!(
18815                        fidl_fuchsia_mem::Buffer,
18816                        fidl::encoding::DefaultFuchsiaResourceDialect
18817                    )
18818                });
18819                fidl::decode!(
18820                    fidl_fuchsia_mem::Buffer,
18821                    fidl::encoding::DefaultFuchsiaResourceDialect,
18822                    val_ref,
18823                    decoder,
18824                    inner_offset,
18825                    inner_depth
18826                )?;
18827                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18828                {
18829                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18830                }
18831                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18832                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18833                }
18834            }
18835
18836            next_offset += envelope_size;
18837            _next_ordinal_to_read += 1;
18838            if next_offset >= end_offset {
18839                return Ok(());
18840            }
18841
18842            // Decode unknown envelopes for gaps in ordinals.
18843            while _next_ordinal_to_read < 2 {
18844                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18845                _next_ordinal_to_read += 1;
18846                next_offset += envelope_size;
18847            }
18848
18849            let next_out_of_line = decoder.next_out_of_line();
18850            let handles_before = decoder.remaining_handles();
18851            if let Some((inlined, num_bytes, num_handles)) =
18852                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18853            {
18854                let member_inline_size = <fidl::encoding::UnboundedVector<IncomingTransferable> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18855                if inlined != (member_inline_size <= 4) {
18856                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18857                }
18858                let inner_offset;
18859                let mut inner_depth = depth.clone();
18860                if inlined {
18861                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18862                    inner_offset = next_offset;
18863                } else {
18864                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18865                    inner_depth.increment()?;
18866                }
18867                let val_ref = self.incoming_transfer.get_or_insert_with(|| {
18868                    fidl::new_empty!(
18869                        fidl::encoding::UnboundedVector<IncomingTransferable>,
18870                        fidl::encoding::DefaultFuchsiaResourceDialect
18871                    )
18872                });
18873                fidl::decode!(
18874                    fidl::encoding::UnboundedVector<IncomingTransferable>,
18875                    fidl::encoding::DefaultFuchsiaResourceDialect,
18876                    val_ref,
18877                    decoder,
18878                    inner_offset,
18879                    inner_depth
18880                )?;
18881                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18882                {
18883                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18884                }
18885                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18886                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18887                }
18888            }
18889
18890            next_offset += envelope_size;
18891            _next_ordinal_to_read += 1;
18892            if next_offset >= end_offset {
18893                return Ok(());
18894            }
18895
18896            // Decode unknown envelopes for gaps in ordinals.
18897            while _next_ordinal_to_read < 3 {
18898                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18899                _next_ordinal_to_read += 1;
18900                next_offset += envelope_size;
18901            }
18902
18903            let next_out_of_line = decoder.next_out_of_line();
18904            let handles_before = decoder.remaining_handles();
18905            if let Some((inlined, num_bytes, num_handles)) =
18906                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18907            {
18908                let member_inline_size = <fidl::encoding::UnboundedVector<OutgoingTransferable> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18909                if inlined != (member_inline_size <= 4) {
18910                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18911                }
18912                let inner_offset;
18913                let mut inner_depth = depth.clone();
18914                if inlined {
18915                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18916                    inner_offset = next_offset;
18917                } else {
18918                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18919                    inner_depth.increment()?;
18920                }
18921                let val_ref = self.outgoing_transfer.get_or_insert_with(|| {
18922                    fidl::new_empty!(
18923                        fidl::encoding::UnboundedVector<OutgoingTransferable>,
18924                        fidl::encoding::DefaultFuchsiaResourceDialect
18925                    )
18926                });
18927                fidl::decode!(
18928                    fidl::encoding::UnboundedVector<OutgoingTransferable>,
18929                    fidl::encoding::DefaultFuchsiaResourceDialect,
18930                    val_ref,
18931                    decoder,
18932                    inner_offset,
18933                    inner_depth
18934                )?;
18935                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18936                {
18937                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18938                }
18939                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18940                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18941                }
18942            }
18943
18944            next_offset += envelope_size;
18945
18946            // Decode the remaining unknown envelopes.
18947            while next_offset < end_offset {
18948                _next_ordinal_to_read += 1;
18949                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18950                next_offset += envelope_size;
18951            }
18952
18953            Ok(())
18954        }
18955    }
18956
18957    impl fidl::encoding::ResourceTypeMarker for IncomingTransferable {
18958        type Borrowed<'a> = &'a mut Self;
18959        fn take_or_borrow<'a>(
18960            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
18961        ) -> Self::Borrowed<'a> {
18962            value
18963        }
18964    }
18965
18966    unsafe impl fidl::encoding::TypeMarker for IncomingTransferable {
18967        type Owned = Self;
18968
18969        #[inline(always)]
18970        fn inline_align(_context: fidl::encoding::Context) -> usize {
18971            8
18972        }
18973
18974        #[inline(always)]
18975        fn inline_size(_context: fidl::encoding::Context) -> usize {
18976            16
18977        }
18978    }
18979
18980    unsafe impl
18981        fidl::encoding::Encode<IncomingTransferable, fidl::encoding::DefaultFuchsiaResourceDialect>
18982        for &mut IncomingTransferable
18983    {
18984        #[inline]
18985        unsafe fn encode(
18986            self,
18987            encoder: &mut fidl::encoding::Encoder<
18988                '_,
18989                fidl::encoding::DefaultFuchsiaResourceDialect,
18990            >,
18991            offset: usize,
18992            _depth: fidl::encoding::Depth,
18993        ) -> fidl::Result<()> {
18994            encoder.debug_check_bounds::<IncomingTransferable>(offset);
18995            encoder.write_num::<u64>(self.ordinal(), offset);
18996            match self {
18997            IncomingTransferable::MessagePort(ref mut val) => {
18998                fidl::encoding::encode_in_envelope::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<MessagePortMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
18999                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<MessagePortMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
19000                    encoder, offset + 8, _depth
19001                )
19002            }
19003            IncomingTransferable::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
19004        }
19005        }
19006    }
19007
19008    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
19009        for IncomingTransferable
19010    {
19011        #[inline(always)]
19012        fn new_empty() -> Self {
19013            Self::__SourceBreaking { unknown_ordinal: 0 }
19014        }
19015
19016        #[inline]
19017        unsafe fn decode(
19018            &mut self,
19019            decoder: &mut fidl::encoding::Decoder<
19020                '_,
19021                fidl::encoding::DefaultFuchsiaResourceDialect,
19022            >,
19023            offset: usize,
19024            mut depth: fidl::encoding::Depth,
19025        ) -> fidl::Result<()> {
19026            decoder.debug_check_bounds::<Self>(offset);
19027            #[allow(unused_variables)]
19028            let next_out_of_line = decoder.next_out_of_line();
19029            let handles_before = decoder.remaining_handles();
19030            let (ordinal, inlined, num_bytes, num_handles) =
19031                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
19032
19033            let member_inline_size = match ordinal {
19034            1 => <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<MessagePortMarker>> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
19035            0 => return Err(fidl::Error::UnknownUnionTag),
19036            _ => num_bytes as usize,
19037        };
19038
19039            if inlined != (member_inline_size <= 4) {
19040                return Err(fidl::Error::InvalidInlineBitInEnvelope);
19041            }
19042            let _inner_offset;
19043            if inlined {
19044                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
19045                _inner_offset = offset + 8;
19046            } else {
19047                depth.increment()?;
19048                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
19049            }
19050            match ordinal {
19051                1 => {
19052                    #[allow(irrefutable_let_patterns)]
19053                    if let IncomingTransferable::MessagePort(_) = self {
19054                        // Do nothing, read the value into the object
19055                    } else {
19056                        // Initialize `self` to the right variant
19057                        *self = IncomingTransferable::MessagePort(fidl::new_empty!(
19058                            fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<MessagePortMarker>>,
19059                            fidl::encoding::DefaultFuchsiaResourceDialect
19060                        ));
19061                    }
19062                    #[allow(irrefutable_let_patterns)]
19063                    if let IncomingTransferable::MessagePort(ref mut val) = self {
19064                        fidl::decode!(
19065                            fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<MessagePortMarker>>,
19066                            fidl::encoding::DefaultFuchsiaResourceDialect,
19067                            val,
19068                            decoder,
19069                            _inner_offset,
19070                            depth
19071                        )?;
19072                    } else {
19073                        unreachable!()
19074                    }
19075                }
19076                #[allow(deprecated)]
19077                ordinal => {
19078                    for _ in 0..num_handles {
19079                        decoder.drop_next_handle()?;
19080                    }
19081                    *self = IncomingTransferable::__SourceBreaking { unknown_ordinal: ordinal };
19082                }
19083            }
19084            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
19085                return Err(fidl::Error::InvalidNumBytesInEnvelope);
19086            }
19087            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
19088                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
19089            }
19090            Ok(())
19091        }
19092    }
19093
19094    impl fidl::encoding::ResourceTypeMarker for NavigationDecision {
19095        type Borrowed<'a> = &'a mut Self;
19096        fn take_or_borrow<'a>(
19097            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
19098        ) -> Self::Borrowed<'a> {
19099            value
19100        }
19101    }
19102
19103    unsafe impl fidl::encoding::TypeMarker for NavigationDecision {
19104        type Owned = Self;
19105
19106        #[inline(always)]
19107        fn inline_align(_context: fidl::encoding::Context) -> usize {
19108            8
19109        }
19110
19111        #[inline(always)]
19112        fn inline_size(_context: fidl::encoding::Context) -> usize {
19113            16
19114        }
19115    }
19116
19117    unsafe impl
19118        fidl::encoding::Encode<NavigationDecision, fidl::encoding::DefaultFuchsiaResourceDialect>
19119        for &mut NavigationDecision
19120    {
19121        #[inline]
19122        unsafe fn encode(
19123            self,
19124            encoder: &mut fidl::encoding::Encoder<
19125                '_,
19126                fidl::encoding::DefaultFuchsiaResourceDialect,
19127            >,
19128            offset: usize,
19129            _depth: fidl::encoding::Depth,
19130        ) -> fidl::Result<()> {
19131            encoder.debug_check_bounds::<NavigationDecision>(offset);
19132            encoder.write_num::<u64>(self.ordinal(), offset);
19133            match self {
19134                NavigationDecision::Proceed(ref val) => fidl::encoding::encode_in_envelope::<
19135                    NoArgumentsAction,
19136                    fidl::encoding::DefaultFuchsiaResourceDialect,
19137                >(
19138                    <NoArgumentsAction as fidl::encoding::ValueTypeMarker>::borrow(val),
19139                    encoder,
19140                    offset + 8,
19141                    _depth,
19142                ),
19143                NavigationDecision::Abort(ref val) => fidl::encoding::encode_in_envelope::<
19144                    NoArgumentsAction,
19145                    fidl::encoding::DefaultFuchsiaResourceDialect,
19146                >(
19147                    <NoArgumentsAction as fidl::encoding::ValueTypeMarker>::borrow(val),
19148                    encoder,
19149                    offset + 8,
19150                    _depth,
19151                ),
19152            }
19153        }
19154    }
19155
19156    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
19157        for NavigationDecision
19158    {
19159        #[inline(always)]
19160        fn new_empty() -> Self {
19161            Self::Proceed(fidl::new_empty!(
19162                NoArgumentsAction,
19163                fidl::encoding::DefaultFuchsiaResourceDialect
19164            ))
19165        }
19166
19167        #[inline]
19168        unsafe fn decode(
19169            &mut self,
19170            decoder: &mut fidl::encoding::Decoder<
19171                '_,
19172                fidl::encoding::DefaultFuchsiaResourceDialect,
19173            >,
19174            offset: usize,
19175            mut depth: fidl::encoding::Depth,
19176        ) -> fidl::Result<()> {
19177            decoder.debug_check_bounds::<Self>(offset);
19178            #[allow(unused_variables)]
19179            let next_out_of_line = decoder.next_out_of_line();
19180            let handles_before = decoder.remaining_handles();
19181            let (ordinal, inlined, num_bytes, num_handles) =
19182                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
19183
19184            let member_inline_size = match ordinal {
19185                1 => {
19186                    <NoArgumentsAction as fidl::encoding::TypeMarker>::inline_size(decoder.context)
19187                }
19188                2 => {
19189                    <NoArgumentsAction as fidl::encoding::TypeMarker>::inline_size(decoder.context)
19190                }
19191                _ => return Err(fidl::Error::UnknownUnionTag),
19192            };
19193
19194            if inlined != (member_inline_size <= 4) {
19195                return Err(fidl::Error::InvalidInlineBitInEnvelope);
19196            }
19197            let _inner_offset;
19198            if inlined {
19199                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
19200                _inner_offset = offset + 8;
19201            } else {
19202                depth.increment()?;
19203                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
19204            }
19205            match ordinal {
19206                1 => {
19207                    #[allow(irrefutable_let_patterns)]
19208                    if let NavigationDecision::Proceed(_) = self {
19209                        // Do nothing, read the value into the object
19210                    } else {
19211                        // Initialize `self` to the right variant
19212                        *self = NavigationDecision::Proceed(fidl::new_empty!(
19213                            NoArgumentsAction,
19214                            fidl::encoding::DefaultFuchsiaResourceDialect
19215                        ));
19216                    }
19217                    #[allow(irrefutable_let_patterns)]
19218                    if let NavigationDecision::Proceed(ref mut val) = self {
19219                        fidl::decode!(
19220                            NoArgumentsAction,
19221                            fidl::encoding::DefaultFuchsiaResourceDialect,
19222                            val,
19223                            decoder,
19224                            _inner_offset,
19225                            depth
19226                        )?;
19227                    } else {
19228                        unreachable!()
19229                    }
19230                }
19231                2 => {
19232                    #[allow(irrefutable_let_patterns)]
19233                    if let NavigationDecision::Abort(_) = self {
19234                        // Do nothing, read the value into the object
19235                    } else {
19236                        // Initialize `self` to the right variant
19237                        *self = NavigationDecision::Abort(fidl::new_empty!(
19238                            NoArgumentsAction,
19239                            fidl::encoding::DefaultFuchsiaResourceDialect
19240                        ));
19241                    }
19242                    #[allow(irrefutable_let_patterns)]
19243                    if let NavigationDecision::Abort(ref mut val) = self {
19244                        fidl::decode!(
19245                            NoArgumentsAction,
19246                            fidl::encoding::DefaultFuchsiaResourceDialect,
19247                            val,
19248                            decoder,
19249                            _inner_offset,
19250                            depth
19251                        )?;
19252                    } else {
19253                        unreachable!()
19254                    }
19255                }
19256                ordinal => panic!("unexpected ordinal {:?}", ordinal),
19257            }
19258            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
19259                return Err(fidl::Error::InvalidNumBytesInEnvelope);
19260            }
19261            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
19262                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
19263            }
19264            Ok(())
19265        }
19266    }
19267
19268    impl fidl::encoding::ResourceTypeMarker for OutgoingTransferable {
19269        type Borrowed<'a> = &'a mut Self;
19270        fn take_or_borrow<'a>(
19271            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
19272        ) -> Self::Borrowed<'a> {
19273            value
19274        }
19275    }
19276
19277    unsafe impl fidl::encoding::TypeMarker for OutgoingTransferable {
19278        type Owned = Self;
19279
19280        #[inline(always)]
19281        fn inline_align(_context: fidl::encoding::Context) -> usize {
19282            8
19283        }
19284
19285        #[inline(always)]
19286        fn inline_size(_context: fidl::encoding::Context) -> usize {
19287            16
19288        }
19289    }
19290
19291    unsafe impl
19292        fidl::encoding::Encode<OutgoingTransferable, fidl::encoding::DefaultFuchsiaResourceDialect>
19293        for &mut OutgoingTransferable
19294    {
19295        #[inline]
19296        unsafe fn encode(
19297            self,
19298            encoder: &mut fidl::encoding::Encoder<
19299                '_,
19300                fidl::encoding::DefaultFuchsiaResourceDialect,
19301            >,
19302            offset: usize,
19303            _depth: fidl::encoding::Depth,
19304        ) -> fidl::Result<()> {
19305            encoder.debug_check_bounds::<OutgoingTransferable>(offset);
19306            encoder.write_num::<u64>(self.ordinal(), offset);
19307            match self {
19308            OutgoingTransferable::MessagePort(ref mut val) => {
19309                fidl::encoding::encode_in_envelope::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MessagePortMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
19310                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MessagePortMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
19311                    encoder, offset + 8, _depth
19312                )
19313            }
19314            OutgoingTransferable::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
19315        }
19316        }
19317    }
19318
19319    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
19320        for OutgoingTransferable
19321    {
19322        #[inline(always)]
19323        fn new_empty() -> Self {
19324            Self::__SourceBreaking { unknown_ordinal: 0 }
19325        }
19326
19327        #[inline]
19328        unsafe fn decode(
19329            &mut self,
19330            decoder: &mut fidl::encoding::Decoder<
19331                '_,
19332                fidl::encoding::DefaultFuchsiaResourceDialect,
19333            >,
19334            offset: usize,
19335            mut depth: fidl::encoding::Depth,
19336        ) -> fidl::Result<()> {
19337            decoder.debug_check_bounds::<Self>(offset);
19338            #[allow(unused_variables)]
19339            let next_out_of_line = decoder.next_out_of_line();
19340            let handles_before = decoder.remaining_handles();
19341            let (ordinal, inlined, num_bytes, num_handles) =
19342                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
19343
19344            let member_inline_size = match ordinal {
19345            1 => <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MessagePortMarker>> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
19346            0 => return Err(fidl::Error::UnknownUnionTag),
19347            _ => num_bytes as usize,
19348        };
19349
19350            if inlined != (member_inline_size <= 4) {
19351                return Err(fidl::Error::InvalidInlineBitInEnvelope);
19352            }
19353            let _inner_offset;
19354            if inlined {
19355                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
19356                _inner_offset = offset + 8;
19357            } else {
19358                depth.increment()?;
19359                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
19360            }
19361            match ordinal {
19362                1 => {
19363                    #[allow(irrefutable_let_patterns)]
19364                    if let OutgoingTransferable::MessagePort(_) = self {
19365                        // Do nothing, read the value into the object
19366                    } else {
19367                        // Initialize `self` to the right variant
19368                        *self = OutgoingTransferable::MessagePort(fidl::new_empty!(
19369                            fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MessagePortMarker>>,
19370                            fidl::encoding::DefaultFuchsiaResourceDialect
19371                        ));
19372                    }
19373                    #[allow(irrefutable_let_patterns)]
19374                    if let OutgoingTransferable::MessagePort(ref mut val) = self {
19375                        fidl::decode!(
19376                            fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MessagePortMarker>>,
19377                            fidl::encoding::DefaultFuchsiaResourceDialect,
19378                            val,
19379                            decoder,
19380                            _inner_offset,
19381                            depth
19382                        )?;
19383                    } else {
19384                        unreachable!()
19385                    }
19386                }
19387                #[allow(deprecated)]
19388                ordinal => {
19389                    for _ in 0..num_handles {
19390                        decoder.drop_next_handle()?;
19391                    }
19392                    *self = OutgoingTransferable::__SourceBreaking { unknown_ordinal: ordinal };
19393                }
19394            }
19395            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
19396                return Err(fidl::Error::InvalidNumBytesInEnvelope);
19397            }
19398            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
19399                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
19400            }
19401            Ok(())
19402        }
19403    }
19404}