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<
10428                CreateFrameParams,
10429                fidl::encoding::DefaultFuchsiaResourceDialect,
10430            >,
10431            T1: fidl::encoding::Encode<
10432                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FrameMarker>>,
10433                fidl::encoding::DefaultFuchsiaResourceDialect,
10434            >,
10435        >
10436        fidl::encoding::Encode<
10437            ContextCreateFrameWithParamsRequest,
10438            fidl::encoding::DefaultFuchsiaResourceDialect,
10439        > for (T0, T1)
10440    {
10441        #[inline]
10442        unsafe fn encode(
10443            self,
10444            encoder: &mut fidl::encoding::Encoder<
10445                '_,
10446                fidl::encoding::DefaultFuchsiaResourceDialect,
10447            >,
10448            offset: usize,
10449            depth: fidl::encoding::Depth,
10450        ) -> fidl::Result<()> {
10451            encoder.debug_check_bounds::<ContextCreateFrameWithParamsRequest>(offset);
10452            // Zero out padding regions. There's no need to apply masks
10453            // because the unmasked parts will be overwritten by fields.
10454            unsafe {
10455                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
10456                (ptr as *mut u64).write_unaligned(0);
10457            }
10458            // Write the fields.
10459            self.0.encode(encoder, offset + 0, depth)?;
10460            self.1.encode(encoder, offset + 16, depth)?;
10461            Ok(())
10462        }
10463    }
10464
10465    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10466        for ContextCreateFrameWithParamsRequest
10467    {
10468        #[inline(always)]
10469        fn new_empty() -> Self {
10470            Self {
10471                params: fidl::new_empty!(
10472                    CreateFrameParams,
10473                    fidl::encoding::DefaultFuchsiaResourceDialect
10474                ),
10475                frame: fidl::new_empty!(
10476                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FrameMarker>>,
10477                    fidl::encoding::DefaultFuchsiaResourceDialect
10478                ),
10479            }
10480        }
10481
10482        #[inline]
10483        unsafe fn decode(
10484            &mut self,
10485            decoder: &mut fidl::encoding::Decoder<
10486                '_,
10487                fidl::encoding::DefaultFuchsiaResourceDialect,
10488            >,
10489            offset: usize,
10490            _depth: fidl::encoding::Depth,
10491        ) -> fidl::Result<()> {
10492            decoder.debug_check_bounds::<Self>(offset);
10493            // Verify that padding bytes are zero.
10494            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
10495            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10496            let mask = 0xffffffff00000000u64;
10497            let maskedval = padval & mask;
10498            if maskedval != 0 {
10499                return Err(fidl::Error::NonZeroPadding {
10500                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
10501                });
10502            }
10503            fidl::decode!(
10504                CreateFrameParams,
10505                fidl::encoding::DefaultFuchsiaResourceDialect,
10506                &mut self.params,
10507                decoder,
10508                offset + 0,
10509                _depth
10510            )?;
10511            fidl::decode!(
10512                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FrameMarker>>,
10513                fidl::encoding::DefaultFuchsiaResourceDialect,
10514                &mut self.frame,
10515                decoder,
10516                offset + 16,
10517                _depth
10518            )?;
10519            Ok(())
10520        }
10521    }
10522
10523    impl fidl::encoding::ResourceTypeMarker for ContextGetCookieManagerRequest {
10524        type Borrowed<'a> = &'a mut Self;
10525        fn take_or_borrow<'a>(
10526            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10527        ) -> Self::Borrowed<'a> {
10528            value
10529        }
10530    }
10531
10532    unsafe impl fidl::encoding::TypeMarker for ContextGetCookieManagerRequest {
10533        type Owned = Self;
10534
10535        #[inline(always)]
10536        fn inline_align(_context: fidl::encoding::Context) -> usize {
10537            4
10538        }
10539
10540        #[inline(always)]
10541        fn inline_size(_context: fidl::encoding::Context) -> usize {
10542            4
10543        }
10544    }
10545
10546    unsafe impl
10547        fidl::encoding::Encode<
10548            ContextGetCookieManagerRequest,
10549            fidl::encoding::DefaultFuchsiaResourceDialect,
10550        > for &mut ContextGetCookieManagerRequest
10551    {
10552        #[inline]
10553        unsafe fn encode(
10554            self,
10555            encoder: &mut fidl::encoding::Encoder<
10556                '_,
10557                fidl::encoding::DefaultFuchsiaResourceDialect,
10558            >,
10559            offset: usize,
10560            _depth: fidl::encoding::Depth,
10561        ) -> fidl::Result<()> {
10562            encoder.debug_check_bounds::<ContextGetCookieManagerRequest>(offset);
10563            // Delegate to tuple encoding.
10564            fidl::encoding::Encode::<ContextGetCookieManagerRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10565                (
10566                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookieManagerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.manager),
10567                ),
10568                encoder, offset, _depth
10569            )
10570        }
10571    }
10572    unsafe impl<
10573            T0: fidl::encoding::Encode<
10574                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookieManagerMarker>>,
10575                fidl::encoding::DefaultFuchsiaResourceDialect,
10576            >,
10577        >
10578        fidl::encoding::Encode<
10579            ContextGetCookieManagerRequest,
10580            fidl::encoding::DefaultFuchsiaResourceDialect,
10581        > for (T0,)
10582    {
10583        #[inline]
10584        unsafe fn encode(
10585            self,
10586            encoder: &mut fidl::encoding::Encoder<
10587                '_,
10588                fidl::encoding::DefaultFuchsiaResourceDialect,
10589            >,
10590            offset: usize,
10591            depth: fidl::encoding::Depth,
10592        ) -> fidl::Result<()> {
10593            encoder.debug_check_bounds::<ContextGetCookieManagerRequest>(offset);
10594            // Zero out padding regions. There's no need to apply masks
10595            // because the unmasked parts will be overwritten by fields.
10596            // Write the fields.
10597            self.0.encode(encoder, offset + 0, depth)?;
10598            Ok(())
10599        }
10600    }
10601
10602    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10603        for ContextGetCookieManagerRequest
10604    {
10605        #[inline(always)]
10606        fn new_empty() -> Self {
10607            Self {
10608                manager: fidl::new_empty!(
10609                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookieManagerMarker>>,
10610                    fidl::encoding::DefaultFuchsiaResourceDialect
10611                ),
10612            }
10613        }
10614
10615        #[inline]
10616        unsafe fn decode(
10617            &mut self,
10618            decoder: &mut fidl::encoding::Decoder<
10619                '_,
10620                fidl::encoding::DefaultFuchsiaResourceDialect,
10621            >,
10622            offset: usize,
10623            _depth: fidl::encoding::Depth,
10624        ) -> fidl::Result<()> {
10625            decoder.debug_check_bounds::<Self>(offset);
10626            // Verify that padding bytes are zero.
10627            fidl::decode!(
10628                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookieManagerMarker>>,
10629                fidl::encoding::DefaultFuchsiaResourceDialect,
10630                &mut self.manager,
10631                decoder,
10632                offset + 0,
10633                _depth
10634            )?;
10635            Ok(())
10636        }
10637    }
10638
10639    impl fidl::encoding::ResourceTypeMarker for ContextProviderCreateRequest {
10640        type Borrowed<'a> = &'a mut Self;
10641        fn take_or_borrow<'a>(
10642            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10643        ) -> Self::Borrowed<'a> {
10644            value
10645        }
10646    }
10647
10648    unsafe impl fidl::encoding::TypeMarker for ContextProviderCreateRequest {
10649        type Owned = Self;
10650
10651        #[inline(always)]
10652        fn inline_align(_context: fidl::encoding::Context) -> usize {
10653            8
10654        }
10655
10656        #[inline(always)]
10657        fn inline_size(_context: fidl::encoding::Context) -> usize {
10658            24
10659        }
10660    }
10661
10662    unsafe impl
10663        fidl::encoding::Encode<
10664            ContextProviderCreateRequest,
10665            fidl::encoding::DefaultFuchsiaResourceDialect,
10666        > for &mut ContextProviderCreateRequest
10667    {
10668        #[inline]
10669        unsafe fn encode(
10670            self,
10671            encoder: &mut fidl::encoding::Encoder<
10672                '_,
10673                fidl::encoding::DefaultFuchsiaResourceDialect,
10674            >,
10675            offset: usize,
10676            _depth: fidl::encoding::Depth,
10677        ) -> fidl::Result<()> {
10678            encoder.debug_check_bounds::<ContextProviderCreateRequest>(offset);
10679            // Delegate to tuple encoding.
10680            fidl::encoding::Encode::<ContextProviderCreateRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10681                (
10682                    <CreateContextParams as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.params),
10683                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ContextMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.context),
10684                ),
10685                encoder, offset, _depth
10686            )
10687        }
10688    }
10689    unsafe impl<
10690            T0: fidl::encoding::Encode<
10691                CreateContextParams,
10692                fidl::encoding::DefaultFuchsiaResourceDialect,
10693            >,
10694            T1: fidl::encoding::Encode<
10695                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ContextMarker>>,
10696                fidl::encoding::DefaultFuchsiaResourceDialect,
10697            >,
10698        >
10699        fidl::encoding::Encode<
10700            ContextProviderCreateRequest,
10701            fidl::encoding::DefaultFuchsiaResourceDialect,
10702        > for (T0, T1)
10703    {
10704        #[inline]
10705        unsafe fn encode(
10706            self,
10707            encoder: &mut fidl::encoding::Encoder<
10708                '_,
10709                fidl::encoding::DefaultFuchsiaResourceDialect,
10710            >,
10711            offset: usize,
10712            depth: fidl::encoding::Depth,
10713        ) -> fidl::Result<()> {
10714            encoder.debug_check_bounds::<ContextProviderCreateRequest>(offset);
10715            // Zero out padding regions. There's no need to apply masks
10716            // because the unmasked parts will be overwritten by fields.
10717            unsafe {
10718                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
10719                (ptr as *mut u64).write_unaligned(0);
10720            }
10721            // Write the fields.
10722            self.0.encode(encoder, offset + 0, depth)?;
10723            self.1.encode(encoder, offset + 16, depth)?;
10724            Ok(())
10725        }
10726    }
10727
10728    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10729        for ContextProviderCreateRequest
10730    {
10731        #[inline(always)]
10732        fn new_empty() -> Self {
10733            Self {
10734                params: fidl::new_empty!(
10735                    CreateContextParams,
10736                    fidl::encoding::DefaultFuchsiaResourceDialect
10737                ),
10738                context: fidl::new_empty!(
10739                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ContextMarker>>,
10740                    fidl::encoding::DefaultFuchsiaResourceDialect
10741                ),
10742            }
10743        }
10744
10745        #[inline]
10746        unsafe fn decode(
10747            &mut self,
10748            decoder: &mut fidl::encoding::Decoder<
10749                '_,
10750                fidl::encoding::DefaultFuchsiaResourceDialect,
10751            >,
10752            offset: usize,
10753            _depth: fidl::encoding::Depth,
10754        ) -> fidl::Result<()> {
10755            decoder.debug_check_bounds::<Self>(offset);
10756            // Verify that padding bytes are zero.
10757            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
10758            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10759            let mask = 0xffffffff00000000u64;
10760            let maskedval = padval & mask;
10761            if maskedval != 0 {
10762                return Err(fidl::Error::NonZeroPadding {
10763                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
10764                });
10765            }
10766            fidl::decode!(
10767                CreateContextParams,
10768                fidl::encoding::DefaultFuchsiaResourceDialect,
10769                &mut self.params,
10770                decoder,
10771                offset + 0,
10772                _depth
10773            )?;
10774            fidl::decode!(
10775                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ContextMarker>>,
10776                fidl::encoding::DefaultFuchsiaResourceDialect,
10777                &mut self.context,
10778                decoder,
10779                offset + 16,
10780                _depth
10781            )?;
10782            Ok(())
10783        }
10784    }
10785
10786    impl fidl::encoding::ResourceTypeMarker for CookieManagerGetCookieListRequest {
10787        type Borrowed<'a> = &'a mut Self;
10788        fn take_or_borrow<'a>(
10789            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10790        ) -> Self::Borrowed<'a> {
10791            value
10792        }
10793    }
10794
10795    unsafe impl fidl::encoding::TypeMarker for CookieManagerGetCookieListRequest {
10796        type Owned = Self;
10797
10798        #[inline(always)]
10799        fn inline_align(_context: fidl::encoding::Context) -> usize {
10800            8
10801        }
10802
10803        #[inline(always)]
10804        fn inline_size(_context: fidl::encoding::Context) -> usize {
10805            40
10806        }
10807    }
10808
10809    unsafe impl
10810        fidl::encoding::Encode<
10811            CookieManagerGetCookieListRequest,
10812            fidl::encoding::DefaultFuchsiaResourceDialect,
10813        > for &mut CookieManagerGetCookieListRequest
10814    {
10815        #[inline]
10816        unsafe fn encode(
10817            self,
10818            encoder: &mut fidl::encoding::Encoder<
10819                '_,
10820                fidl::encoding::DefaultFuchsiaResourceDialect,
10821            >,
10822            offset: usize,
10823            _depth: fidl::encoding::Depth,
10824        ) -> fidl::Result<()> {
10825            encoder.debug_check_bounds::<CookieManagerGetCookieListRequest>(offset);
10826            // Delegate to tuple encoding.
10827            fidl::encoding::Encode::<CookieManagerGetCookieListRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10828                (
10829                    <fidl::encoding::Optional<fidl::encoding::BoundedString<65536>> as fidl::encoding::ValueTypeMarker>::borrow(&self.url),
10830                    <fidl::encoding::Optional<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
10831                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookiesIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.cookies),
10832                ),
10833                encoder, offset, _depth
10834            )
10835        }
10836    }
10837    unsafe impl<
10838            T0: fidl::encoding::Encode<
10839                fidl::encoding::Optional<fidl::encoding::BoundedString<65536>>,
10840                fidl::encoding::DefaultFuchsiaResourceDialect,
10841            >,
10842            T1: fidl::encoding::Encode<
10843                fidl::encoding::Optional<fidl::encoding::UnboundedString>,
10844                fidl::encoding::DefaultFuchsiaResourceDialect,
10845            >,
10846            T2: fidl::encoding::Encode<
10847                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookiesIteratorMarker>>,
10848                fidl::encoding::DefaultFuchsiaResourceDialect,
10849            >,
10850        >
10851        fidl::encoding::Encode<
10852            CookieManagerGetCookieListRequest,
10853            fidl::encoding::DefaultFuchsiaResourceDialect,
10854        > for (T0, T1, T2)
10855    {
10856        #[inline]
10857        unsafe fn encode(
10858            self,
10859            encoder: &mut fidl::encoding::Encoder<
10860                '_,
10861                fidl::encoding::DefaultFuchsiaResourceDialect,
10862            >,
10863            offset: usize,
10864            depth: fidl::encoding::Depth,
10865        ) -> fidl::Result<()> {
10866            encoder.debug_check_bounds::<CookieManagerGetCookieListRequest>(offset);
10867            // Zero out padding regions. There's no need to apply masks
10868            // because the unmasked parts will be overwritten by fields.
10869            unsafe {
10870                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
10871                (ptr as *mut u64).write_unaligned(0);
10872            }
10873            // Write the fields.
10874            self.0.encode(encoder, offset + 0, depth)?;
10875            self.1.encode(encoder, offset + 16, depth)?;
10876            self.2.encode(encoder, offset + 32, depth)?;
10877            Ok(())
10878        }
10879    }
10880
10881    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10882        for CookieManagerGetCookieListRequest
10883    {
10884        #[inline(always)]
10885        fn new_empty() -> Self {
10886            Self {
10887                url: fidl::new_empty!(
10888                    fidl::encoding::Optional<fidl::encoding::BoundedString<65536>>,
10889                    fidl::encoding::DefaultFuchsiaResourceDialect
10890                ),
10891                name: fidl::new_empty!(
10892                    fidl::encoding::Optional<fidl::encoding::UnboundedString>,
10893                    fidl::encoding::DefaultFuchsiaResourceDialect
10894                ),
10895                cookies: fidl::new_empty!(
10896                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookiesIteratorMarker>>,
10897                    fidl::encoding::DefaultFuchsiaResourceDialect
10898                ),
10899            }
10900        }
10901
10902        #[inline]
10903        unsafe fn decode(
10904            &mut self,
10905            decoder: &mut fidl::encoding::Decoder<
10906                '_,
10907                fidl::encoding::DefaultFuchsiaResourceDialect,
10908            >,
10909            offset: usize,
10910            _depth: fidl::encoding::Depth,
10911        ) -> fidl::Result<()> {
10912            decoder.debug_check_bounds::<Self>(offset);
10913            // Verify that padding bytes are zero.
10914            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
10915            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10916            let mask = 0xffffffff00000000u64;
10917            let maskedval = padval & mask;
10918            if maskedval != 0 {
10919                return Err(fidl::Error::NonZeroPadding {
10920                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
10921                });
10922            }
10923            fidl::decode!(
10924                fidl::encoding::Optional<fidl::encoding::BoundedString<65536>>,
10925                fidl::encoding::DefaultFuchsiaResourceDialect,
10926                &mut self.url,
10927                decoder,
10928                offset + 0,
10929                _depth
10930            )?;
10931            fidl::decode!(
10932                fidl::encoding::Optional<fidl::encoding::UnboundedString>,
10933                fidl::encoding::DefaultFuchsiaResourceDialect,
10934                &mut self.name,
10935                decoder,
10936                offset + 16,
10937                _depth
10938            )?;
10939            fidl::decode!(
10940                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookiesIteratorMarker>>,
10941                fidl::encoding::DefaultFuchsiaResourceDialect,
10942                &mut self.cookies,
10943                decoder,
10944                offset + 32,
10945                _depth
10946            )?;
10947            Ok(())
10948        }
10949    }
10950
10951    impl fidl::encoding::ResourceTypeMarker for CookieManagerObserveCookieChangesRequest {
10952        type Borrowed<'a> = &'a mut Self;
10953        fn take_or_borrow<'a>(
10954            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10955        ) -> Self::Borrowed<'a> {
10956            value
10957        }
10958    }
10959
10960    unsafe impl fidl::encoding::TypeMarker for CookieManagerObserveCookieChangesRequest {
10961        type Owned = Self;
10962
10963        #[inline(always)]
10964        fn inline_align(_context: fidl::encoding::Context) -> usize {
10965            8
10966        }
10967
10968        #[inline(always)]
10969        fn inline_size(_context: fidl::encoding::Context) -> usize {
10970            40
10971        }
10972    }
10973
10974    unsafe impl
10975        fidl::encoding::Encode<
10976            CookieManagerObserveCookieChangesRequest,
10977            fidl::encoding::DefaultFuchsiaResourceDialect,
10978        > for &mut CookieManagerObserveCookieChangesRequest
10979    {
10980        #[inline]
10981        unsafe fn encode(
10982            self,
10983            encoder: &mut fidl::encoding::Encoder<
10984                '_,
10985                fidl::encoding::DefaultFuchsiaResourceDialect,
10986            >,
10987            offset: usize,
10988            _depth: fidl::encoding::Depth,
10989        ) -> fidl::Result<()> {
10990            encoder.debug_check_bounds::<CookieManagerObserveCookieChangesRequest>(offset);
10991            // Delegate to tuple encoding.
10992            fidl::encoding::Encode::<CookieManagerObserveCookieChangesRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10993                (
10994                    <fidl::encoding::Optional<fidl::encoding::BoundedString<65536>> as fidl::encoding::ValueTypeMarker>::borrow(&self.url),
10995                    <fidl::encoding::Optional<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
10996                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookiesIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.changes),
10997                ),
10998                encoder, offset, _depth
10999            )
11000        }
11001    }
11002    unsafe impl<
11003            T0: fidl::encoding::Encode<
11004                fidl::encoding::Optional<fidl::encoding::BoundedString<65536>>,
11005                fidl::encoding::DefaultFuchsiaResourceDialect,
11006            >,
11007            T1: fidl::encoding::Encode<
11008                fidl::encoding::Optional<fidl::encoding::UnboundedString>,
11009                fidl::encoding::DefaultFuchsiaResourceDialect,
11010            >,
11011            T2: fidl::encoding::Encode<
11012                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookiesIteratorMarker>>,
11013                fidl::encoding::DefaultFuchsiaResourceDialect,
11014            >,
11015        >
11016        fidl::encoding::Encode<
11017            CookieManagerObserveCookieChangesRequest,
11018            fidl::encoding::DefaultFuchsiaResourceDialect,
11019        > for (T0, T1, T2)
11020    {
11021        #[inline]
11022        unsafe fn encode(
11023            self,
11024            encoder: &mut fidl::encoding::Encoder<
11025                '_,
11026                fidl::encoding::DefaultFuchsiaResourceDialect,
11027            >,
11028            offset: usize,
11029            depth: fidl::encoding::Depth,
11030        ) -> fidl::Result<()> {
11031            encoder.debug_check_bounds::<CookieManagerObserveCookieChangesRequest>(offset);
11032            // Zero out padding regions. There's no need to apply masks
11033            // because the unmasked parts will be overwritten by fields.
11034            unsafe {
11035                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
11036                (ptr as *mut u64).write_unaligned(0);
11037            }
11038            // Write the fields.
11039            self.0.encode(encoder, offset + 0, depth)?;
11040            self.1.encode(encoder, offset + 16, depth)?;
11041            self.2.encode(encoder, offset + 32, depth)?;
11042            Ok(())
11043        }
11044    }
11045
11046    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11047        for CookieManagerObserveCookieChangesRequest
11048    {
11049        #[inline(always)]
11050        fn new_empty() -> Self {
11051            Self {
11052                url: fidl::new_empty!(
11053                    fidl::encoding::Optional<fidl::encoding::BoundedString<65536>>,
11054                    fidl::encoding::DefaultFuchsiaResourceDialect
11055                ),
11056                name: fidl::new_empty!(
11057                    fidl::encoding::Optional<fidl::encoding::UnboundedString>,
11058                    fidl::encoding::DefaultFuchsiaResourceDialect
11059                ),
11060                changes: fidl::new_empty!(
11061                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookiesIteratorMarker>>,
11062                    fidl::encoding::DefaultFuchsiaResourceDialect
11063                ),
11064            }
11065        }
11066
11067        #[inline]
11068        unsafe fn decode(
11069            &mut self,
11070            decoder: &mut fidl::encoding::Decoder<
11071                '_,
11072                fidl::encoding::DefaultFuchsiaResourceDialect,
11073            >,
11074            offset: usize,
11075            _depth: fidl::encoding::Depth,
11076        ) -> fidl::Result<()> {
11077            decoder.debug_check_bounds::<Self>(offset);
11078            // Verify that padding bytes are zero.
11079            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
11080            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11081            let mask = 0xffffffff00000000u64;
11082            let maskedval = padval & mask;
11083            if maskedval != 0 {
11084                return Err(fidl::Error::NonZeroPadding {
11085                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
11086                });
11087            }
11088            fidl::decode!(
11089                fidl::encoding::Optional<fidl::encoding::BoundedString<65536>>,
11090                fidl::encoding::DefaultFuchsiaResourceDialect,
11091                &mut self.url,
11092                decoder,
11093                offset + 0,
11094                _depth
11095            )?;
11096            fidl::decode!(
11097                fidl::encoding::Optional<fidl::encoding::UnboundedString>,
11098                fidl::encoding::DefaultFuchsiaResourceDialect,
11099                &mut self.name,
11100                decoder,
11101                offset + 16,
11102                _depth
11103            )?;
11104            fidl::decode!(
11105                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookiesIteratorMarker>>,
11106                fidl::encoding::DefaultFuchsiaResourceDialect,
11107                &mut self.changes,
11108                decoder,
11109                offset + 32,
11110                _depth
11111            )?;
11112            Ok(())
11113        }
11114    }
11115
11116    impl fidl::encoding::ResourceTypeMarker for CookiesIteratorGetNextResponse {
11117        type Borrowed<'a> = &'a mut Self;
11118        fn take_or_borrow<'a>(
11119            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11120        ) -> Self::Borrowed<'a> {
11121            value
11122        }
11123    }
11124
11125    unsafe impl fidl::encoding::TypeMarker for CookiesIteratorGetNextResponse {
11126        type Owned = Self;
11127
11128        #[inline(always)]
11129        fn inline_align(_context: fidl::encoding::Context) -> usize {
11130            8
11131        }
11132
11133        #[inline(always)]
11134        fn inline_size(_context: fidl::encoding::Context) -> usize {
11135            16
11136        }
11137    }
11138
11139    unsafe impl
11140        fidl::encoding::Encode<
11141            CookiesIteratorGetNextResponse,
11142            fidl::encoding::DefaultFuchsiaResourceDialect,
11143        > for &mut CookiesIteratorGetNextResponse
11144    {
11145        #[inline]
11146        unsafe fn encode(
11147            self,
11148            encoder: &mut fidl::encoding::Encoder<
11149                '_,
11150                fidl::encoding::DefaultFuchsiaResourceDialect,
11151            >,
11152            offset: usize,
11153            _depth: fidl::encoding::Depth,
11154        ) -> fidl::Result<()> {
11155            encoder.debug_check_bounds::<CookiesIteratorGetNextResponse>(offset);
11156            // Delegate to tuple encoding.
11157            fidl::encoding::Encode::<CookiesIteratorGetNextResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11158                (
11159                    <fidl::encoding::UnboundedVector<Cookie> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.changed_cookies),
11160                ),
11161                encoder, offset, _depth
11162            )
11163        }
11164    }
11165    unsafe impl<
11166            T0: fidl::encoding::Encode<
11167                fidl::encoding::UnboundedVector<Cookie>,
11168                fidl::encoding::DefaultFuchsiaResourceDialect,
11169            >,
11170        >
11171        fidl::encoding::Encode<
11172            CookiesIteratorGetNextResponse,
11173            fidl::encoding::DefaultFuchsiaResourceDialect,
11174        > for (T0,)
11175    {
11176        #[inline]
11177        unsafe fn encode(
11178            self,
11179            encoder: &mut fidl::encoding::Encoder<
11180                '_,
11181                fidl::encoding::DefaultFuchsiaResourceDialect,
11182            >,
11183            offset: usize,
11184            depth: fidl::encoding::Depth,
11185        ) -> fidl::Result<()> {
11186            encoder.debug_check_bounds::<CookiesIteratorGetNextResponse>(offset);
11187            // Zero out padding regions. There's no need to apply masks
11188            // because the unmasked parts will be overwritten by fields.
11189            // Write the fields.
11190            self.0.encode(encoder, offset + 0, depth)?;
11191            Ok(())
11192        }
11193    }
11194
11195    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11196        for CookiesIteratorGetNextResponse
11197    {
11198        #[inline(always)]
11199        fn new_empty() -> Self {
11200            Self {
11201                changed_cookies: fidl::new_empty!(
11202                    fidl::encoding::UnboundedVector<Cookie>,
11203                    fidl::encoding::DefaultFuchsiaResourceDialect
11204                ),
11205            }
11206        }
11207
11208        #[inline]
11209        unsafe fn decode(
11210            &mut self,
11211            decoder: &mut fidl::encoding::Decoder<
11212                '_,
11213                fidl::encoding::DefaultFuchsiaResourceDialect,
11214            >,
11215            offset: usize,
11216            _depth: fidl::encoding::Depth,
11217        ) -> fidl::Result<()> {
11218            decoder.debug_check_bounds::<Self>(offset);
11219            // Verify that padding bytes are zero.
11220            fidl::decode!(
11221                fidl::encoding::UnboundedVector<Cookie>,
11222                fidl::encoding::DefaultFuchsiaResourceDialect,
11223                &mut self.changed_cookies,
11224                decoder,
11225                offset + 0,
11226                _depth
11227            )?;
11228            Ok(())
11229        }
11230    }
11231
11232    impl fidl::encoding::ResourceTypeMarker for DebugEnableDevToolsRequest {
11233        type Borrowed<'a> = &'a mut Self;
11234        fn take_or_borrow<'a>(
11235            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11236        ) -> Self::Borrowed<'a> {
11237            value
11238        }
11239    }
11240
11241    unsafe impl fidl::encoding::TypeMarker for DebugEnableDevToolsRequest {
11242        type Owned = Self;
11243
11244        #[inline(always)]
11245        fn inline_align(_context: fidl::encoding::Context) -> usize {
11246            4
11247        }
11248
11249        #[inline(always)]
11250        fn inline_size(_context: fidl::encoding::Context) -> usize {
11251            4
11252        }
11253    }
11254
11255    unsafe impl
11256        fidl::encoding::Encode<
11257            DebugEnableDevToolsRequest,
11258            fidl::encoding::DefaultFuchsiaResourceDialect,
11259        > for &mut DebugEnableDevToolsRequest
11260    {
11261        #[inline]
11262        unsafe fn encode(
11263            self,
11264            encoder: &mut fidl::encoding::Encoder<
11265                '_,
11266                fidl::encoding::DefaultFuchsiaResourceDialect,
11267            >,
11268            offset: usize,
11269            _depth: fidl::encoding::Depth,
11270        ) -> fidl::Result<()> {
11271            encoder.debug_check_bounds::<DebugEnableDevToolsRequest>(offset);
11272            // Delegate to tuple encoding.
11273            fidl::encoding::Encode::<DebugEnableDevToolsRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11274                (
11275                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DevToolsListenerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.listener),
11276                ),
11277                encoder, offset, _depth
11278            )
11279        }
11280    }
11281    unsafe impl<
11282            T0: fidl::encoding::Encode<
11283                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DevToolsListenerMarker>>,
11284                fidl::encoding::DefaultFuchsiaResourceDialect,
11285            >,
11286        >
11287        fidl::encoding::Encode<
11288            DebugEnableDevToolsRequest,
11289            fidl::encoding::DefaultFuchsiaResourceDialect,
11290        > for (T0,)
11291    {
11292        #[inline]
11293        unsafe fn encode(
11294            self,
11295            encoder: &mut fidl::encoding::Encoder<
11296                '_,
11297                fidl::encoding::DefaultFuchsiaResourceDialect,
11298            >,
11299            offset: usize,
11300            depth: fidl::encoding::Depth,
11301        ) -> fidl::Result<()> {
11302            encoder.debug_check_bounds::<DebugEnableDevToolsRequest>(offset);
11303            // Zero out padding regions. There's no need to apply masks
11304            // because the unmasked parts will be overwritten by fields.
11305            // Write the fields.
11306            self.0.encode(encoder, offset + 0, depth)?;
11307            Ok(())
11308        }
11309    }
11310
11311    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11312        for DebugEnableDevToolsRequest
11313    {
11314        #[inline(always)]
11315        fn new_empty() -> Self {
11316            Self {
11317                listener: fidl::new_empty!(
11318                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DevToolsListenerMarker>>,
11319                    fidl::encoding::DefaultFuchsiaResourceDialect
11320                ),
11321            }
11322        }
11323
11324        #[inline]
11325        unsafe fn decode(
11326            &mut self,
11327            decoder: &mut fidl::encoding::Decoder<
11328                '_,
11329                fidl::encoding::DefaultFuchsiaResourceDialect,
11330            >,
11331            offset: usize,
11332            _depth: fidl::encoding::Depth,
11333        ) -> fidl::Result<()> {
11334            decoder.debug_check_bounds::<Self>(offset);
11335            // Verify that padding bytes are zero.
11336            fidl::decode!(
11337                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DevToolsListenerMarker>>,
11338                fidl::encoding::DefaultFuchsiaResourceDialect,
11339                &mut self.listener,
11340                decoder,
11341                offset + 0,
11342                _depth
11343            )?;
11344            Ok(())
11345        }
11346    }
11347
11348    impl fidl::encoding::ResourceTypeMarker for DevToolsListenerOnContextDevToolsAvailableRequest {
11349        type Borrowed<'a> = &'a mut Self;
11350        fn take_or_borrow<'a>(
11351            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11352        ) -> Self::Borrowed<'a> {
11353            value
11354        }
11355    }
11356
11357    unsafe impl fidl::encoding::TypeMarker for DevToolsListenerOnContextDevToolsAvailableRequest {
11358        type Owned = Self;
11359
11360        #[inline(always)]
11361        fn inline_align(_context: fidl::encoding::Context) -> usize {
11362            4
11363        }
11364
11365        #[inline(always)]
11366        fn inline_size(_context: fidl::encoding::Context) -> usize {
11367            4
11368        }
11369    }
11370
11371    unsafe impl
11372        fidl::encoding::Encode<
11373            DevToolsListenerOnContextDevToolsAvailableRequest,
11374            fidl::encoding::DefaultFuchsiaResourceDialect,
11375        > for &mut DevToolsListenerOnContextDevToolsAvailableRequest
11376    {
11377        #[inline]
11378        unsafe fn encode(
11379            self,
11380            encoder: &mut fidl::encoding::Encoder<
11381                '_,
11382                fidl::encoding::DefaultFuchsiaResourceDialect,
11383            >,
11384            offset: usize,
11385            _depth: fidl::encoding::Depth,
11386        ) -> fidl::Result<()> {
11387            encoder.debug_check_bounds::<DevToolsListenerOnContextDevToolsAvailableRequest>(offset);
11388            // Delegate to tuple encoding.
11389            fidl::encoding::Encode::<
11390                DevToolsListenerOnContextDevToolsAvailableRequest,
11391                fidl::encoding::DefaultFuchsiaResourceDialect,
11392            >::encode(
11393                (<fidl::encoding::Endpoint<
11394                    fidl::endpoints::ServerEnd<DevToolsPerContextListenerMarker>,
11395                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11396                    &mut self.listener
11397                ),),
11398                encoder,
11399                offset,
11400                _depth,
11401            )
11402        }
11403    }
11404    unsafe impl<
11405            T0: fidl::encoding::Encode<
11406                fidl::encoding::Endpoint<
11407                    fidl::endpoints::ServerEnd<DevToolsPerContextListenerMarker>,
11408                >,
11409                fidl::encoding::DefaultFuchsiaResourceDialect,
11410            >,
11411        >
11412        fidl::encoding::Encode<
11413            DevToolsListenerOnContextDevToolsAvailableRequest,
11414            fidl::encoding::DefaultFuchsiaResourceDialect,
11415        > for (T0,)
11416    {
11417        #[inline]
11418        unsafe fn encode(
11419            self,
11420            encoder: &mut fidl::encoding::Encoder<
11421                '_,
11422                fidl::encoding::DefaultFuchsiaResourceDialect,
11423            >,
11424            offset: usize,
11425            depth: fidl::encoding::Depth,
11426        ) -> fidl::Result<()> {
11427            encoder.debug_check_bounds::<DevToolsListenerOnContextDevToolsAvailableRequest>(offset);
11428            // Zero out padding regions. There's no need to apply masks
11429            // because the unmasked parts will be overwritten by fields.
11430            // Write the fields.
11431            self.0.encode(encoder, offset + 0, depth)?;
11432            Ok(())
11433        }
11434    }
11435
11436    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11437        for DevToolsListenerOnContextDevToolsAvailableRequest
11438    {
11439        #[inline(always)]
11440        fn new_empty() -> Self {
11441            Self {
11442                listener: fidl::new_empty!(
11443                    fidl::encoding::Endpoint<
11444                        fidl::endpoints::ServerEnd<DevToolsPerContextListenerMarker>,
11445                    >,
11446                    fidl::encoding::DefaultFuchsiaResourceDialect
11447                ),
11448            }
11449        }
11450
11451        #[inline]
11452        unsafe fn decode(
11453            &mut self,
11454            decoder: &mut fidl::encoding::Decoder<
11455                '_,
11456                fidl::encoding::DefaultFuchsiaResourceDialect,
11457            >,
11458            offset: usize,
11459            _depth: fidl::encoding::Depth,
11460        ) -> fidl::Result<()> {
11461            decoder.debug_check_bounds::<Self>(offset);
11462            // Verify that padding bytes are zero.
11463            fidl::decode!(
11464                fidl::encoding::Endpoint<
11465                    fidl::endpoints::ServerEnd<DevToolsPerContextListenerMarker>,
11466                >,
11467                fidl::encoding::DefaultFuchsiaResourceDialect,
11468                &mut self.listener,
11469                decoder,
11470                offset + 0,
11471                _depth
11472            )?;
11473            Ok(())
11474        }
11475    }
11476
11477    impl fidl::encoding::ResourceTypeMarker for FrameAddBeforeLoadJavaScriptRequest {
11478        type Borrowed<'a> = &'a mut Self;
11479        fn take_or_borrow<'a>(
11480            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11481        ) -> Self::Borrowed<'a> {
11482            value
11483        }
11484    }
11485
11486    unsafe impl fidl::encoding::TypeMarker for FrameAddBeforeLoadJavaScriptRequest {
11487        type Owned = Self;
11488
11489        #[inline(always)]
11490        fn inline_align(_context: fidl::encoding::Context) -> usize {
11491            8
11492        }
11493
11494        #[inline(always)]
11495        fn inline_size(_context: fidl::encoding::Context) -> usize {
11496            40
11497        }
11498    }
11499
11500    unsafe impl
11501        fidl::encoding::Encode<
11502            FrameAddBeforeLoadJavaScriptRequest,
11503            fidl::encoding::DefaultFuchsiaResourceDialect,
11504        > for &mut FrameAddBeforeLoadJavaScriptRequest
11505    {
11506        #[inline]
11507        unsafe fn encode(
11508            self,
11509            encoder: &mut fidl::encoding::Encoder<
11510                '_,
11511                fidl::encoding::DefaultFuchsiaResourceDialect,
11512            >,
11513            offset: usize,
11514            _depth: fidl::encoding::Depth,
11515        ) -> fidl::Result<()> {
11516            encoder.debug_check_bounds::<FrameAddBeforeLoadJavaScriptRequest>(offset);
11517            // Delegate to tuple encoding.
11518            fidl::encoding::Encode::<FrameAddBeforeLoadJavaScriptRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11519                (
11520                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
11521                    <fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>> as fidl::encoding::ValueTypeMarker>::borrow(&self.origins),
11522                    <fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.script),
11523                ),
11524                encoder, offset, _depth
11525            )
11526        }
11527    }
11528    unsafe impl<
11529            T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
11530            T1: fidl::encoding::Encode<
11531                fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>>,
11532                fidl::encoding::DefaultFuchsiaResourceDialect,
11533            >,
11534            T2: fidl::encoding::Encode<
11535                fidl_fuchsia_mem::Buffer,
11536                fidl::encoding::DefaultFuchsiaResourceDialect,
11537            >,
11538        >
11539        fidl::encoding::Encode<
11540            FrameAddBeforeLoadJavaScriptRequest,
11541            fidl::encoding::DefaultFuchsiaResourceDialect,
11542        > for (T0, T1, T2)
11543    {
11544        #[inline]
11545        unsafe fn encode(
11546            self,
11547            encoder: &mut fidl::encoding::Encoder<
11548                '_,
11549                fidl::encoding::DefaultFuchsiaResourceDialect,
11550            >,
11551            offset: usize,
11552            depth: fidl::encoding::Depth,
11553        ) -> fidl::Result<()> {
11554            encoder.debug_check_bounds::<FrameAddBeforeLoadJavaScriptRequest>(offset);
11555            // Zero out padding regions. There's no need to apply masks
11556            // because the unmasked parts will be overwritten by fields.
11557            // Write the fields.
11558            self.0.encode(encoder, offset + 0, depth)?;
11559            self.1.encode(encoder, offset + 8, depth)?;
11560            self.2.encode(encoder, offset + 24, depth)?;
11561            Ok(())
11562        }
11563    }
11564
11565    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11566        for FrameAddBeforeLoadJavaScriptRequest
11567    {
11568        #[inline(always)]
11569        fn new_empty() -> Self {
11570            Self {
11571                id: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
11572                origins: fidl::new_empty!(
11573                    fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>>,
11574                    fidl::encoding::DefaultFuchsiaResourceDialect
11575                ),
11576                script: fidl::new_empty!(
11577                    fidl_fuchsia_mem::Buffer,
11578                    fidl::encoding::DefaultFuchsiaResourceDialect
11579                ),
11580            }
11581        }
11582
11583        #[inline]
11584        unsafe fn decode(
11585            &mut self,
11586            decoder: &mut fidl::encoding::Decoder<
11587                '_,
11588                fidl::encoding::DefaultFuchsiaResourceDialect,
11589            >,
11590            offset: usize,
11591            _depth: fidl::encoding::Depth,
11592        ) -> fidl::Result<()> {
11593            decoder.debug_check_bounds::<Self>(offset);
11594            // Verify that padding bytes are zero.
11595            fidl::decode!(
11596                u64,
11597                fidl::encoding::DefaultFuchsiaResourceDialect,
11598                &mut self.id,
11599                decoder,
11600                offset + 0,
11601                _depth
11602            )?;
11603            fidl::decode!(
11604                fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>>,
11605                fidl::encoding::DefaultFuchsiaResourceDialect,
11606                &mut self.origins,
11607                decoder,
11608                offset + 8,
11609                _depth
11610            )?;
11611            fidl::decode!(
11612                fidl_fuchsia_mem::Buffer,
11613                fidl::encoding::DefaultFuchsiaResourceDialect,
11614                &mut self.script,
11615                decoder,
11616                offset + 24,
11617                _depth
11618            )?;
11619            Ok(())
11620        }
11621    }
11622
11623    impl fidl::encoding::ResourceTypeMarker for FrameCreateView2Request {
11624        type Borrowed<'a> = &'a mut Self;
11625        fn take_or_borrow<'a>(
11626            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11627        ) -> Self::Borrowed<'a> {
11628            value
11629        }
11630    }
11631
11632    unsafe impl fidl::encoding::TypeMarker for FrameCreateView2Request {
11633        type Owned = Self;
11634
11635        #[inline(always)]
11636        fn inline_align(_context: fidl::encoding::Context) -> usize {
11637            8
11638        }
11639
11640        #[inline(always)]
11641        fn inline_size(_context: fidl::encoding::Context) -> usize {
11642            16
11643        }
11644    }
11645
11646    unsafe impl
11647        fidl::encoding::Encode<
11648            FrameCreateView2Request,
11649            fidl::encoding::DefaultFuchsiaResourceDialect,
11650        > for &mut FrameCreateView2Request
11651    {
11652        #[inline]
11653        unsafe fn encode(
11654            self,
11655            encoder: &mut fidl::encoding::Encoder<
11656                '_,
11657                fidl::encoding::DefaultFuchsiaResourceDialect,
11658            >,
11659            offset: usize,
11660            _depth: fidl::encoding::Depth,
11661        ) -> fidl::Result<()> {
11662            encoder.debug_check_bounds::<FrameCreateView2Request>(offset);
11663            // Delegate to tuple encoding.
11664            fidl::encoding::Encode::<
11665                FrameCreateView2Request,
11666                fidl::encoding::DefaultFuchsiaResourceDialect,
11667            >::encode(
11668                (<CreateView2Args as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11669                    &mut self.args,
11670                ),),
11671                encoder,
11672                offset,
11673                _depth,
11674            )
11675        }
11676    }
11677    unsafe impl<
11678            T0: fidl::encoding::Encode<CreateView2Args, fidl::encoding::DefaultFuchsiaResourceDialect>,
11679        >
11680        fidl::encoding::Encode<
11681            FrameCreateView2Request,
11682            fidl::encoding::DefaultFuchsiaResourceDialect,
11683        > for (T0,)
11684    {
11685        #[inline]
11686        unsafe fn encode(
11687            self,
11688            encoder: &mut fidl::encoding::Encoder<
11689                '_,
11690                fidl::encoding::DefaultFuchsiaResourceDialect,
11691            >,
11692            offset: usize,
11693            depth: fidl::encoding::Depth,
11694        ) -> fidl::Result<()> {
11695            encoder.debug_check_bounds::<FrameCreateView2Request>(offset);
11696            // Zero out padding regions. There's no need to apply masks
11697            // because the unmasked parts will be overwritten by fields.
11698            // Write the fields.
11699            self.0.encode(encoder, offset + 0, depth)?;
11700            Ok(())
11701        }
11702    }
11703
11704    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11705        for FrameCreateView2Request
11706    {
11707        #[inline(always)]
11708        fn new_empty() -> Self {
11709            Self {
11710                args: fidl::new_empty!(
11711                    CreateView2Args,
11712                    fidl::encoding::DefaultFuchsiaResourceDialect
11713                ),
11714            }
11715        }
11716
11717        #[inline]
11718        unsafe fn decode(
11719            &mut self,
11720            decoder: &mut fidl::encoding::Decoder<
11721                '_,
11722                fidl::encoding::DefaultFuchsiaResourceDialect,
11723            >,
11724            offset: usize,
11725            _depth: fidl::encoding::Depth,
11726        ) -> fidl::Result<()> {
11727            decoder.debug_check_bounds::<Self>(offset);
11728            // Verify that padding bytes are zero.
11729            fidl::decode!(
11730                CreateView2Args,
11731                fidl::encoding::DefaultFuchsiaResourceDialect,
11732                &mut self.args,
11733                decoder,
11734                offset + 0,
11735                _depth
11736            )?;
11737            Ok(())
11738        }
11739    }
11740
11741    impl fidl::encoding::ResourceTypeMarker for FrameCreateViewRequest {
11742        type Borrowed<'a> = &'a mut Self;
11743        fn take_or_borrow<'a>(
11744            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11745        ) -> Self::Borrowed<'a> {
11746            value
11747        }
11748    }
11749
11750    unsafe impl fidl::encoding::TypeMarker for FrameCreateViewRequest {
11751        type Owned = Self;
11752
11753        #[inline(always)]
11754        fn inline_align(_context: fidl::encoding::Context) -> usize {
11755            4
11756        }
11757
11758        #[inline(always)]
11759        fn inline_size(_context: fidl::encoding::Context) -> usize {
11760            4
11761        }
11762    }
11763
11764    unsafe impl
11765        fidl::encoding::Encode<
11766            FrameCreateViewRequest,
11767            fidl::encoding::DefaultFuchsiaResourceDialect,
11768        > for &mut FrameCreateViewRequest
11769    {
11770        #[inline]
11771        unsafe fn encode(
11772            self,
11773            encoder: &mut fidl::encoding::Encoder<
11774                '_,
11775                fidl::encoding::DefaultFuchsiaResourceDialect,
11776            >,
11777            offset: usize,
11778            _depth: fidl::encoding::Depth,
11779        ) -> fidl::Result<()> {
11780            encoder.debug_check_bounds::<FrameCreateViewRequest>(offset);
11781            // Delegate to tuple encoding.
11782            fidl::encoding::Encode::<FrameCreateViewRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11783                (
11784                    <fidl_fuchsia_ui_views::ViewToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.view_token),
11785                ),
11786                encoder, offset, _depth
11787            )
11788        }
11789    }
11790    unsafe impl<
11791            T0: fidl::encoding::Encode<
11792                fidl_fuchsia_ui_views::ViewToken,
11793                fidl::encoding::DefaultFuchsiaResourceDialect,
11794            >,
11795        >
11796        fidl::encoding::Encode<
11797            FrameCreateViewRequest,
11798            fidl::encoding::DefaultFuchsiaResourceDialect,
11799        > for (T0,)
11800    {
11801        #[inline]
11802        unsafe fn encode(
11803            self,
11804            encoder: &mut fidl::encoding::Encoder<
11805                '_,
11806                fidl::encoding::DefaultFuchsiaResourceDialect,
11807            >,
11808            offset: usize,
11809            depth: fidl::encoding::Depth,
11810        ) -> fidl::Result<()> {
11811            encoder.debug_check_bounds::<FrameCreateViewRequest>(offset);
11812            // Zero out padding regions. There's no need to apply masks
11813            // because the unmasked parts will be overwritten by fields.
11814            // Write the fields.
11815            self.0.encode(encoder, offset + 0, depth)?;
11816            Ok(())
11817        }
11818    }
11819
11820    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11821        for FrameCreateViewRequest
11822    {
11823        #[inline(always)]
11824        fn new_empty() -> Self {
11825            Self {
11826                view_token: fidl::new_empty!(
11827                    fidl_fuchsia_ui_views::ViewToken,
11828                    fidl::encoding::DefaultFuchsiaResourceDialect
11829                ),
11830            }
11831        }
11832
11833        #[inline]
11834        unsafe fn decode(
11835            &mut self,
11836            decoder: &mut fidl::encoding::Decoder<
11837                '_,
11838                fidl::encoding::DefaultFuchsiaResourceDialect,
11839            >,
11840            offset: usize,
11841            _depth: fidl::encoding::Depth,
11842        ) -> fidl::Result<()> {
11843            decoder.debug_check_bounds::<Self>(offset);
11844            // Verify that padding bytes are zero.
11845            fidl::decode!(
11846                fidl_fuchsia_ui_views::ViewToken,
11847                fidl::encoding::DefaultFuchsiaResourceDialect,
11848                &mut self.view_token,
11849                decoder,
11850                offset + 0,
11851                _depth
11852            )?;
11853            Ok(())
11854        }
11855    }
11856
11857    impl fidl::encoding::ResourceTypeMarker for FrameCreateViewWithViewRefRequest {
11858        type Borrowed<'a> = &'a mut Self;
11859        fn take_or_borrow<'a>(
11860            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11861        ) -> Self::Borrowed<'a> {
11862            value
11863        }
11864    }
11865
11866    unsafe impl fidl::encoding::TypeMarker for FrameCreateViewWithViewRefRequest {
11867        type Owned = Self;
11868
11869        #[inline(always)]
11870        fn inline_align(_context: fidl::encoding::Context) -> usize {
11871            4
11872        }
11873
11874        #[inline(always)]
11875        fn inline_size(_context: fidl::encoding::Context) -> usize {
11876            12
11877        }
11878    }
11879
11880    unsafe impl
11881        fidl::encoding::Encode<
11882            FrameCreateViewWithViewRefRequest,
11883            fidl::encoding::DefaultFuchsiaResourceDialect,
11884        > for &mut FrameCreateViewWithViewRefRequest
11885    {
11886        #[inline]
11887        unsafe fn encode(
11888            self,
11889            encoder: &mut fidl::encoding::Encoder<
11890                '_,
11891                fidl::encoding::DefaultFuchsiaResourceDialect,
11892            >,
11893            offset: usize,
11894            _depth: fidl::encoding::Depth,
11895        ) -> fidl::Result<()> {
11896            encoder.debug_check_bounds::<FrameCreateViewWithViewRefRequest>(offset);
11897            // Delegate to tuple encoding.
11898            fidl::encoding::Encode::<FrameCreateViewWithViewRefRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11899                (
11900                    <fidl_fuchsia_ui_views::ViewToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.view_token),
11901                    <fidl_fuchsia_ui_views::ViewRefControl as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.view_ref_control),
11902                    <fidl_fuchsia_ui_views::ViewRef as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.view_ref),
11903                ),
11904                encoder, offset, _depth
11905            )
11906        }
11907    }
11908    unsafe impl<
11909            T0: fidl::encoding::Encode<
11910                fidl_fuchsia_ui_views::ViewToken,
11911                fidl::encoding::DefaultFuchsiaResourceDialect,
11912            >,
11913            T1: fidl::encoding::Encode<
11914                fidl_fuchsia_ui_views::ViewRefControl,
11915                fidl::encoding::DefaultFuchsiaResourceDialect,
11916            >,
11917            T2: fidl::encoding::Encode<
11918                fidl_fuchsia_ui_views::ViewRef,
11919                fidl::encoding::DefaultFuchsiaResourceDialect,
11920            >,
11921        >
11922        fidl::encoding::Encode<
11923            FrameCreateViewWithViewRefRequest,
11924            fidl::encoding::DefaultFuchsiaResourceDialect,
11925        > for (T0, T1, T2)
11926    {
11927        #[inline]
11928        unsafe fn encode(
11929            self,
11930            encoder: &mut fidl::encoding::Encoder<
11931                '_,
11932                fidl::encoding::DefaultFuchsiaResourceDialect,
11933            >,
11934            offset: usize,
11935            depth: fidl::encoding::Depth,
11936        ) -> fidl::Result<()> {
11937            encoder.debug_check_bounds::<FrameCreateViewWithViewRefRequest>(offset);
11938            // Zero out padding regions. There's no need to apply masks
11939            // because the unmasked parts will be overwritten by fields.
11940            // Write the fields.
11941            self.0.encode(encoder, offset + 0, depth)?;
11942            self.1.encode(encoder, offset + 4, depth)?;
11943            self.2.encode(encoder, offset + 8, depth)?;
11944            Ok(())
11945        }
11946    }
11947
11948    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11949        for FrameCreateViewWithViewRefRequest
11950    {
11951        #[inline(always)]
11952        fn new_empty() -> Self {
11953            Self {
11954                view_token: fidl::new_empty!(
11955                    fidl_fuchsia_ui_views::ViewToken,
11956                    fidl::encoding::DefaultFuchsiaResourceDialect
11957                ),
11958                view_ref_control: fidl::new_empty!(
11959                    fidl_fuchsia_ui_views::ViewRefControl,
11960                    fidl::encoding::DefaultFuchsiaResourceDialect
11961                ),
11962                view_ref: fidl::new_empty!(
11963                    fidl_fuchsia_ui_views::ViewRef,
11964                    fidl::encoding::DefaultFuchsiaResourceDialect
11965                ),
11966            }
11967        }
11968
11969        #[inline]
11970        unsafe fn decode(
11971            &mut self,
11972            decoder: &mut fidl::encoding::Decoder<
11973                '_,
11974                fidl::encoding::DefaultFuchsiaResourceDialect,
11975            >,
11976            offset: usize,
11977            _depth: fidl::encoding::Depth,
11978        ) -> fidl::Result<()> {
11979            decoder.debug_check_bounds::<Self>(offset);
11980            // Verify that padding bytes are zero.
11981            fidl::decode!(
11982                fidl_fuchsia_ui_views::ViewToken,
11983                fidl::encoding::DefaultFuchsiaResourceDialect,
11984                &mut self.view_token,
11985                decoder,
11986                offset + 0,
11987                _depth
11988            )?;
11989            fidl::decode!(
11990                fidl_fuchsia_ui_views::ViewRefControl,
11991                fidl::encoding::DefaultFuchsiaResourceDialect,
11992                &mut self.view_ref_control,
11993                decoder,
11994                offset + 4,
11995                _depth
11996            )?;
11997            fidl::decode!(
11998                fidl_fuchsia_ui_views::ViewRef,
11999                fidl::encoding::DefaultFuchsiaResourceDialect,
12000                &mut self.view_ref,
12001                decoder,
12002                offset + 8,
12003                _depth
12004            )?;
12005            Ok(())
12006        }
12007    }
12008
12009    impl fidl::encoding::ResourceTypeMarker for FrameExecuteJavaScriptNoResultRequest {
12010        type Borrowed<'a> = &'a mut Self;
12011        fn take_or_borrow<'a>(
12012            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12013        ) -> Self::Borrowed<'a> {
12014            value
12015        }
12016    }
12017
12018    unsafe impl fidl::encoding::TypeMarker for FrameExecuteJavaScriptNoResultRequest {
12019        type Owned = Self;
12020
12021        #[inline(always)]
12022        fn inline_align(_context: fidl::encoding::Context) -> usize {
12023            8
12024        }
12025
12026        #[inline(always)]
12027        fn inline_size(_context: fidl::encoding::Context) -> usize {
12028            32
12029        }
12030    }
12031
12032    unsafe impl
12033        fidl::encoding::Encode<
12034            FrameExecuteJavaScriptNoResultRequest,
12035            fidl::encoding::DefaultFuchsiaResourceDialect,
12036        > for &mut FrameExecuteJavaScriptNoResultRequest
12037    {
12038        #[inline]
12039        unsafe fn encode(
12040            self,
12041            encoder: &mut fidl::encoding::Encoder<
12042                '_,
12043                fidl::encoding::DefaultFuchsiaResourceDialect,
12044            >,
12045            offset: usize,
12046            _depth: fidl::encoding::Depth,
12047        ) -> fidl::Result<()> {
12048            encoder.debug_check_bounds::<FrameExecuteJavaScriptNoResultRequest>(offset);
12049            // Delegate to tuple encoding.
12050            fidl::encoding::Encode::<FrameExecuteJavaScriptNoResultRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
12051                (
12052                    <fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>> as fidl::encoding::ValueTypeMarker>::borrow(&self.origins),
12053                    <fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.script),
12054                ),
12055                encoder, offset, _depth
12056            )
12057        }
12058    }
12059    unsafe impl<
12060            T0: fidl::encoding::Encode<
12061                fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>>,
12062                fidl::encoding::DefaultFuchsiaResourceDialect,
12063            >,
12064            T1: fidl::encoding::Encode<
12065                fidl_fuchsia_mem::Buffer,
12066                fidl::encoding::DefaultFuchsiaResourceDialect,
12067            >,
12068        >
12069        fidl::encoding::Encode<
12070            FrameExecuteJavaScriptNoResultRequest,
12071            fidl::encoding::DefaultFuchsiaResourceDialect,
12072        > for (T0, T1)
12073    {
12074        #[inline]
12075        unsafe fn encode(
12076            self,
12077            encoder: &mut fidl::encoding::Encoder<
12078                '_,
12079                fidl::encoding::DefaultFuchsiaResourceDialect,
12080            >,
12081            offset: usize,
12082            depth: fidl::encoding::Depth,
12083        ) -> fidl::Result<()> {
12084            encoder.debug_check_bounds::<FrameExecuteJavaScriptNoResultRequest>(offset);
12085            // Zero out padding regions. There's no need to apply masks
12086            // because the unmasked parts will be overwritten by fields.
12087            // Write the fields.
12088            self.0.encode(encoder, offset + 0, depth)?;
12089            self.1.encode(encoder, offset + 16, depth)?;
12090            Ok(())
12091        }
12092    }
12093
12094    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12095        for FrameExecuteJavaScriptNoResultRequest
12096    {
12097        #[inline(always)]
12098        fn new_empty() -> Self {
12099            Self {
12100                origins: fidl::new_empty!(
12101                    fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>>,
12102                    fidl::encoding::DefaultFuchsiaResourceDialect
12103                ),
12104                script: fidl::new_empty!(
12105                    fidl_fuchsia_mem::Buffer,
12106                    fidl::encoding::DefaultFuchsiaResourceDialect
12107                ),
12108            }
12109        }
12110
12111        #[inline]
12112        unsafe fn decode(
12113            &mut self,
12114            decoder: &mut fidl::encoding::Decoder<
12115                '_,
12116                fidl::encoding::DefaultFuchsiaResourceDialect,
12117            >,
12118            offset: usize,
12119            _depth: fidl::encoding::Depth,
12120        ) -> fidl::Result<()> {
12121            decoder.debug_check_bounds::<Self>(offset);
12122            // Verify that padding bytes are zero.
12123            fidl::decode!(
12124                fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>>,
12125                fidl::encoding::DefaultFuchsiaResourceDialect,
12126                &mut self.origins,
12127                decoder,
12128                offset + 0,
12129                _depth
12130            )?;
12131            fidl::decode!(
12132                fidl_fuchsia_mem::Buffer,
12133                fidl::encoding::DefaultFuchsiaResourceDialect,
12134                &mut self.script,
12135                decoder,
12136                offset + 16,
12137                _depth
12138            )?;
12139            Ok(())
12140        }
12141    }
12142
12143    impl fidl::encoding::ResourceTypeMarker for FrameExecuteJavaScriptRequest {
12144        type Borrowed<'a> = &'a mut Self;
12145        fn take_or_borrow<'a>(
12146            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12147        ) -> Self::Borrowed<'a> {
12148            value
12149        }
12150    }
12151
12152    unsafe impl fidl::encoding::TypeMarker for FrameExecuteJavaScriptRequest {
12153        type Owned = Self;
12154
12155        #[inline(always)]
12156        fn inline_align(_context: fidl::encoding::Context) -> usize {
12157            8
12158        }
12159
12160        #[inline(always)]
12161        fn inline_size(_context: fidl::encoding::Context) -> usize {
12162            32
12163        }
12164    }
12165
12166    unsafe impl
12167        fidl::encoding::Encode<
12168            FrameExecuteJavaScriptRequest,
12169            fidl::encoding::DefaultFuchsiaResourceDialect,
12170        > for &mut FrameExecuteJavaScriptRequest
12171    {
12172        #[inline]
12173        unsafe fn encode(
12174            self,
12175            encoder: &mut fidl::encoding::Encoder<
12176                '_,
12177                fidl::encoding::DefaultFuchsiaResourceDialect,
12178            >,
12179            offset: usize,
12180            _depth: fidl::encoding::Depth,
12181        ) -> fidl::Result<()> {
12182            encoder.debug_check_bounds::<FrameExecuteJavaScriptRequest>(offset);
12183            // Delegate to tuple encoding.
12184            fidl::encoding::Encode::<FrameExecuteJavaScriptRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
12185                (
12186                    <fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>> as fidl::encoding::ValueTypeMarker>::borrow(&self.origins),
12187                    <fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.script),
12188                ),
12189                encoder, offset, _depth
12190            )
12191        }
12192    }
12193    unsafe impl<
12194            T0: fidl::encoding::Encode<
12195                fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>>,
12196                fidl::encoding::DefaultFuchsiaResourceDialect,
12197            >,
12198            T1: fidl::encoding::Encode<
12199                fidl_fuchsia_mem::Buffer,
12200                fidl::encoding::DefaultFuchsiaResourceDialect,
12201            >,
12202        >
12203        fidl::encoding::Encode<
12204            FrameExecuteJavaScriptRequest,
12205            fidl::encoding::DefaultFuchsiaResourceDialect,
12206        > for (T0, T1)
12207    {
12208        #[inline]
12209        unsafe fn encode(
12210            self,
12211            encoder: &mut fidl::encoding::Encoder<
12212                '_,
12213                fidl::encoding::DefaultFuchsiaResourceDialect,
12214            >,
12215            offset: usize,
12216            depth: fidl::encoding::Depth,
12217        ) -> fidl::Result<()> {
12218            encoder.debug_check_bounds::<FrameExecuteJavaScriptRequest>(offset);
12219            // Zero out padding regions. There's no need to apply masks
12220            // because the unmasked parts will be overwritten by fields.
12221            // Write the fields.
12222            self.0.encode(encoder, offset + 0, depth)?;
12223            self.1.encode(encoder, offset + 16, depth)?;
12224            Ok(())
12225        }
12226    }
12227
12228    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12229        for FrameExecuteJavaScriptRequest
12230    {
12231        #[inline(always)]
12232        fn new_empty() -> Self {
12233            Self {
12234                origins: fidl::new_empty!(
12235                    fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>>,
12236                    fidl::encoding::DefaultFuchsiaResourceDialect
12237                ),
12238                script: fidl::new_empty!(
12239                    fidl_fuchsia_mem::Buffer,
12240                    fidl::encoding::DefaultFuchsiaResourceDialect
12241                ),
12242            }
12243        }
12244
12245        #[inline]
12246        unsafe fn decode(
12247            &mut self,
12248            decoder: &mut fidl::encoding::Decoder<
12249                '_,
12250                fidl::encoding::DefaultFuchsiaResourceDialect,
12251            >,
12252            offset: usize,
12253            _depth: fidl::encoding::Depth,
12254        ) -> fidl::Result<()> {
12255            decoder.debug_check_bounds::<Self>(offset);
12256            // Verify that padding bytes are zero.
12257            fidl::decode!(
12258                fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>>,
12259                fidl::encoding::DefaultFuchsiaResourceDialect,
12260                &mut self.origins,
12261                decoder,
12262                offset + 0,
12263                _depth
12264            )?;
12265            fidl::decode!(
12266                fidl_fuchsia_mem::Buffer,
12267                fidl::encoding::DefaultFuchsiaResourceDialect,
12268                &mut self.script,
12269                decoder,
12270                offset + 16,
12271                _depth
12272            )?;
12273            Ok(())
12274        }
12275    }
12276
12277    impl fidl::encoding::ResourceTypeMarker for FrameGetMediaPlayerRequest {
12278        type Borrowed<'a> = &'a mut Self;
12279        fn take_or_borrow<'a>(
12280            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12281        ) -> Self::Borrowed<'a> {
12282            value
12283        }
12284    }
12285
12286    unsafe impl fidl::encoding::TypeMarker for FrameGetMediaPlayerRequest {
12287        type Owned = Self;
12288
12289        #[inline(always)]
12290        fn inline_align(_context: fidl::encoding::Context) -> usize {
12291            4
12292        }
12293
12294        #[inline(always)]
12295        fn inline_size(_context: fidl::encoding::Context) -> usize {
12296            4
12297        }
12298    }
12299
12300    unsafe impl
12301        fidl::encoding::Encode<
12302            FrameGetMediaPlayerRequest,
12303            fidl::encoding::DefaultFuchsiaResourceDialect,
12304        > for &mut FrameGetMediaPlayerRequest
12305    {
12306        #[inline]
12307        unsafe fn encode(
12308            self,
12309            encoder: &mut fidl::encoding::Encoder<
12310                '_,
12311                fidl::encoding::DefaultFuchsiaResourceDialect,
12312            >,
12313            offset: usize,
12314            _depth: fidl::encoding::Depth,
12315        ) -> fidl::Result<()> {
12316            encoder.debug_check_bounds::<FrameGetMediaPlayerRequest>(offset);
12317            // Delegate to tuple encoding.
12318            fidl::encoding::Encode::<
12319                FrameGetMediaPlayerRequest,
12320                fidl::encoding::DefaultFuchsiaResourceDialect,
12321            >::encode(
12322                (<fidl::encoding::Endpoint<
12323                    fidl::endpoints::ServerEnd<fidl_fuchsia_media_sessions2::PlayerMarker>,
12324                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12325                    &mut self.player
12326                ),),
12327                encoder,
12328                offset,
12329                _depth,
12330            )
12331        }
12332    }
12333    unsafe impl<
12334            T0: fidl::encoding::Encode<
12335                fidl::encoding::Endpoint<
12336                    fidl::endpoints::ServerEnd<fidl_fuchsia_media_sessions2::PlayerMarker>,
12337                >,
12338                fidl::encoding::DefaultFuchsiaResourceDialect,
12339            >,
12340        >
12341        fidl::encoding::Encode<
12342            FrameGetMediaPlayerRequest,
12343            fidl::encoding::DefaultFuchsiaResourceDialect,
12344        > for (T0,)
12345    {
12346        #[inline]
12347        unsafe fn encode(
12348            self,
12349            encoder: &mut fidl::encoding::Encoder<
12350                '_,
12351                fidl::encoding::DefaultFuchsiaResourceDialect,
12352            >,
12353            offset: usize,
12354            depth: fidl::encoding::Depth,
12355        ) -> fidl::Result<()> {
12356            encoder.debug_check_bounds::<FrameGetMediaPlayerRequest>(offset);
12357            // Zero out padding regions. There's no need to apply masks
12358            // because the unmasked parts will be overwritten by fields.
12359            // Write the fields.
12360            self.0.encode(encoder, offset + 0, depth)?;
12361            Ok(())
12362        }
12363    }
12364
12365    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12366        for FrameGetMediaPlayerRequest
12367    {
12368        #[inline(always)]
12369        fn new_empty() -> Self {
12370            Self {
12371                player: fidl::new_empty!(
12372                    fidl::encoding::Endpoint<
12373                        fidl::endpoints::ServerEnd<fidl_fuchsia_media_sessions2::PlayerMarker>,
12374                    >,
12375                    fidl::encoding::DefaultFuchsiaResourceDialect
12376                ),
12377            }
12378        }
12379
12380        #[inline]
12381        unsafe fn decode(
12382            &mut self,
12383            decoder: &mut fidl::encoding::Decoder<
12384                '_,
12385                fidl::encoding::DefaultFuchsiaResourceDialect,
12386            >,
12387            offset: usize,
12388            _depth: fidl::encoding::Depth,
12389        ) -> fidl::Result<()> {
12390            decoder.debug_check_bounds::<Self>(offset);
12391            // Verify that padding bytes are zero.
12392            fidl::decode!(
12393                fidl::encoding::Endpoint<
12394                    fidl::endpoints::ServerEnd<fidl_fuchsia_media_sessions2::PlayerMarker>,
12395                >,
12396                fidl::encoding::DefaultFuchsiaResourceDialect,
12397                &mut self.player,
12398                decoder,
12399                offset + 0,
12400                _depth
12401            )?;
12402            Ok(())
12403        }
12404    }
12405
12406    impl fidl::encoding::ResourceTypeMarker for FrameGetNavigationControllerRequest {
12407        type Borrowed<'a> = &'a mut Self;
12408        fn take_or_borrow<'a>(
12409            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12410        ) -> Self::Borrowed<'a> {
12411            value
12412        }
12413    }
12414
12415    unsafe impl fidl::encoding::TypeMarker for FrameGetNavigationControllerRequest {
12416        type Owned = Self;
12417
12418        #[inline(always)]
12419        fn inline_align(_context: fidl::encoding::Context) -> usize {
12420            4
12421        }
12422
12423        #[inline(always)]
12424        fn inline_size(_context: fidl::encoding::Context) -> usize {
12425            4
12426        }
12427    }
12428
12429    unsafe impl
12430        fidl::encoding::Encode<
12431            FrameGetNavigationControllerRequest,
12432            fidl::encoding::DefaultFuchsiaResourceDialect,
12433        > for &mut FrameGetNavigationControllerRequest
12434    {
12435        #[inline]
12436        unsafe fn encode(
12437            self,
12438            encoder: &mut fidl::encoding::Encoder<
12439                '_,
12440                fidl::encoding::DefaultFuchsiaResourceDialect,
12441            >,
12442            offset: usize,
12443            _depth: fidl::encoding::Depth,
12444        ) -> fidl::Result<()> {
12445            encoder.debug_check_bounds::<FrameGetNavigationControllerRequest>(offset);
12446            // Delegate to tuple encoding.
12447            fidl::encoding::Encode::<
12448                FrameGetNavigationControllerRequest,
12449                fidl::encoding::DefaultFuchsiaResourceDialect,
12450            >::encode(
12451                (
12452                    <fidl::encoding::Endpoint<
12453                        fidl::endpoints::ServerEnd<NavigationControllerMarker>,
12454                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12455                        &mut self.controller
12456                    ),
12457                ),
12458                encoder,
12459                offset,
12460                _depth,
12461            )
12462        }
12463    }
12464    unsafe impl<
12465            T0: fidl::encoding::Encode<
12466                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NavigationControllerMarker>>,
12467                fidl::encoding::DefaultFuchsiaResourceDialect,
12468            >,
12469        >
12470        fidl::encoding::Encode<
12471            FrameGetNavigationControllerRequest,
12472            fidl::encoding::DefaultFuchsiaResourceDialect,
12473        > for (T0,)
12474    {
12475        #[inline]
12476        unsafe fn encode(
12477            self,
12478            encoder: &mut fidl::encoding::Encoder<
12479                '_,
12480                fidl::encoding::DefaultFuchsiaResourceDialect,
12481            >,
12482            offset: usize,
12483            depth: fidl::encoding::Depth,
12484        ) -> fidl::Result<()> {
12485            encoder.debug_check_bounds::<FrameGetNavigationControllerRequest>(offset);
12486            // Zero out padding regions. There's no need to apply masks
12487            // because the unmasked parts will be overwritten by fields.
12488            // Write the fields.
12489            self.0.encode(encoder, offset + 0, depth)?;
12490            Ok(())
12491        }
12492    }
12493
12494    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12495        for FrameGetNavigationControllerRequest
12496    {
12497        #[inline(always)]
12498        fn new_empty() -> Self {
12499            Self {
12500                controller: fidl::new_empty!(
12501                    fidl::encoding::Endpoint<
12502                        fidl::endpoints::ServerEnd<NavigationControllerMarker>,
12503                    >,
12504                    fidl::encoding::DefaultFuchsiaResourceDialect
12505                ),
12506            }
12507        }
12508
12509        #[inline]
12510        unsafe fn decode(
12511            &mut self,
12512            decoder: &mut fidl::encoding::Decoder<
12513                '_,
12514                fidl::encoding::DefaultFuchsiaResourceDialect,
12515            >,
12516            offset: usize,
12517            _depth: fidl::encoding::Depth,
12518        ) -> fidl::Result<()> {
12519            decoder.debug_check_bounds::<Self>(offset);
12520            // Verify that padding bytes are zero.
12521            fidl::decode!(
12522                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NavigationControllerMarker>>,
12523                fidl::encoding::DefaultFuchsiaResourceDialect,
12524                &mut self.controller,
12525                decoder,
12526                offset + 0,
12527                _depth
12528            )?;
12529            Ok(())
12530        }
12531    }
12532
12533    impl fidl::encoding::ResourceTypeMarker for FrameHostCreateFrameWithParamsRequest {
12534        type Borrowed<'a> = &'a mut Self;
12535        fn take_or_borrow<'a>(
12536            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12537        ) -> Self::Borrowed<'a> {
12538            value
12539        }
12540    }
12541
12542    unsafe impl fidl::encoding::TypeMarker for FrameHostCreateFrameWithParamsRequest {
12543        type Owned = Self;
12544
12545        #[inline(always)]
12546        fn inline_align(_context: fidl::encoding::Context) -> usize {
12547            8
12548        }
12549
12550        #[inline(always)]
12551        fn inline_size(_context: fidl::encoding::Context) -> usize {
12552            24
12553        }
12554    }
12555
12556    unsafe impl
12557        fidl::encoding::Encode<
12558            FrameHostCreateFrameWithParamsRequest,
12559            fidl::encoding::DefaultFuchsiaResourceDialect,
12560        > for &mut FrameHostCreateFrameWithParamsRequest
12561    {
12562        #[inline]
12563        unsafe fn encode(
12564            self,
12565            encoder: &mut fidl::encoding::Encoder<
12566                '_,
12567                fidl::encoding::DefaultFuchsiaResourceDialect,
12568            >,
12569            offset: usize,
12570            _depth: fidl::encoding::Depth,
12571        ) -> fidl::Result<()> {
12572            encoder.debug_check_bounds::<FrameHostCreateFrameWithParamsRequest>(offset);
12573            // Delegate to tuple encoding.
12574            fidl::encoding::Encode::<FrameHostCreateFrameWithParamsRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
12575                (
12576                    <CreateFrameParams as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.params),
12577                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FrameMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.frame),
12578                ),
12579                encoder, offset, _depth
12580            )
12581        }
12582    }
12583    unsafe impl<
12584            T0: fidl::encoding::Encode<
12585                CreateFrameParams,
12586                fidl::encoding::DefaultFuchsiaResourceDialect,
12587            >,
12588            T1: fidl::encoding::Encode<
12589                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FrameMarker>>,
12590                fidl::encoding::DefaultFuchsiaResourceDialect,
12591            >,
12592        >
12593        fidl::encoding::Encode<
12594            FrameHostCreateFrameWithParamsRequest,
12595            fidl::encoding::DefaultFuchsiaResourceDialect,
12596        > for (T0, T1)
12597    {
12598        #[inline]
12599        unsafe fn encode(
12600            self,
12601            encoder: &mut fidl::encoding::Encoder<
12602                '_,
12603                fidl::encoding::DefaultFuchsiaResourceDialect,
12604            >,
12605            offset: usize,
12606            depth: fidl::encoding::Depth,
12607        ) -> fidl::Result<()> {
12608            encoder.debug_check_bounds::<FrameHostCreateFrameWithParamsRequest>(offset);
12609            // Zero out padding regions. There's no need to apply masks
12610            // because the unmasked parts will be overwritten by fields.
12611            unsafe {
12612                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
12613                (ptr as *mut u64).write_unaligned(0);
12614            }
12615            // Write the fields.
12616            self.0.encode(encoder, offset + 0, depth)?;
12617            self.1.encode(encoder, offset + 16, depth)?;
12618            Ok(())
12619        }
12620    }
12621
12622    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12623        for FrameHostCreateFrameWithParamsRequest
12624    {
12625        #[inline(always)]
12626        fn new_empty() -> Self {
12627            Self {
12628                params: fidl::new_empty!(
12629                    CreateFrameParams,
12630                    fidl::encoding::DefaultFuchsiaResourceDialect
12631                ),
12632                frame: fidl::new_empty!(
12633                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FrameMarker>>,
12634                    fidl::encoding::DefaultFuchsiaResourceDialect
12635                ),
12636            }
12637        }
12638
12639        #[inline]
12640        unsafe fn decode(
12641            &mut self,
12642            decoder: &mut fidl::encoding::Decoder<
12643                '_,
12644                fidl::encoding::DefaultFuchsiaResourceDialect,
12645            >,
12646            offset: usize,
12647            _depth: fidl::encoding::Depth,
12648        ) -> fidl::Result<()> {
12649            decoder.debug_check_bounds::<Self>(offset);
12650            // Verify that padding bytes are zero.
12651            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
12652            let padval = unsafe { (ptr as *const u64).read_unaligned() };
12653            let mask = 0xffffffff00000000u64;
12654            let maskedval = padval & mask;
12655            if maskedval != 0 {
12656                return Err(fidl::Error::NonZeroPadding {
12657                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
12658                });
12659            }
12660            fidl::decode!(
12661                CreateFrameParams,
12662                fidl::encoding::DefaultFuchsiaResourceDialect,
12663                &mut self.params,
12664                decoder,
12665                offset + 0,
12666                _depth
12667            )?;
12668            fidl::decode!(
12669                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FrameMarker>>,
12670                fidl::encoding::DefaultFuchsiaResourceDialect,
12671                &mut self.frame,
12672                decoder,
12673                offset + 16,
12674                _depth
12675            )?;
12676            Ok(())
12677        }
12678    }
12679
12680    impl fidl::encoding::ResourceTypeMarker for FramePostMessageRequest {
12681        type Borrowed<'a> = &'a mut Self;
12682        fn take_or_borrow<'a>(
12683            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12684        ) -> Self::Borrowed<'a> {
12685            value
12686        }
12687    }
12688
12689    unsafe impl fidl::encoding::TypeMarker for FramePostMessageRequest {
12690        type Owned = Self;
12691
12692        #[inline(always)]
12693        fn inline_align(_context: fidl::encoding::Context) -> usize {
12694            8
12695        }
12696
12697        #[inline(always)]
12698        fn inline_size(_context: fidl::encoding::Context) -> usize {
12699            32
12700        }
12701    }
12702
12703    unsafe impl
12704        fidl::encoding::Encode<
12705            FramePostMessageRequest,
12706            fidl::encoding::DefaultFuchsiaResourceDialect,
12707        > for &mut FramePostMessageRequest
12708    {
12709        #[inline]
12710        unsafe fn encode(
12711            self,
12712            encoder: &mut fidl::encoding::Encoder<
12713                '_,
12714                fidl::encoding::DefaultFuchsiaResourceDialect,
12715            >,
12716            offset: usize,
12717            _depth: fidl::encoding::Depth,
12718        ) -> fidl::Result<()> {
12719            encoder.debug_check_bounds::<FramePostMessageRequest>(offset);
12720            // Delegate to tuple encoding.
12721            fidl::encoding::Encode::<FramePostMessageRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
12722                (
12723                    <fidl::encoding::BoundedString<65536> as fidl::encoding::ValueTypeMarker>::borrow(&self.target_origin),
12724                    <WebMessage as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.message),
12725                ),
12726                encoder, offset, _depth
12727            )
12728        }
12729    }
12730    unsafe impl<
12731            T0: fidl::encoding::Encode<
12732                fidl::encoding::BoundedString<65536>,
12733                fidl::encoding::DefaultFuchsiaResourceDialect,
12734            >,
12735            T1: fidl::encoding::Encode<WebMessage, fidl::encoding::DefaultFuchsiaResourceDialect>,
12736        >
12737        fidl::encoding::Encode<
12738            FramePostMessageRequest,
12739            fidl::encoding::DefaultFuchsiaResourceDialect,
12740        > for (T0, T1)
12741    {
12742        #[inline]
12743        unsafe fn encode(
12744            self,
12745            encoder: &mut fidl::encoding::Encoder<
12746                '_,
12747                fidl::encoding::DefaultFuchsiaResourceDialect,
12748            >,
12749            offset: usize,
12750            depth: fidl::encoding::Depth,
12751        ) -> fidl::Result<()> {
12752            encoder.debug_check_bounds::<FramePostMessageRequest>(offset);
12753            // Zero out padding regions. There's no need to apply masks
12754            // because the unmasked parts will be overwritten by fields.
12755            // Write the fields.
12756            self.0.encode(encoder, offset + 0, depth)?;
12757            self.1.encode(encoder, offset + 16, depth)?;
12758            Ok(())
12759        }
12760    }
12761
12762    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12763        for FramePostMessageRequest
12764    {
12765        #[inline(always)]
12766        fn new_empty() -> Self {
12767            Self {
12768                target_origin: fidl::new_empty!(
12769                    fidl::encoding::BoundedString<65536>,
12770                    fidl::encoding::DefaultFuchsiaResourceDialect
12771                ),
12772                message: fidl::new_empty!(
12773                    WebMessage,
12774                    fidl::encoding::DefaultFuchsiaResourceDialect
12775                ),
12776            }
12777        }
12778
12779        #[inline]
12780        unsafe fn decode(
12781            &mut self,
12782            decoder: &mut fidl::encoding::Decoder<
12783                '_,
12784                fidl::encoding::DefaultFuchsiaResourceDialect,
12785            >,
12786            offset: usize,
12787            _depth: fidl::encoding::Depth,
12788        ) -> fidl::Result<()> {
12789            decoder.debug_check_bounds::<Self>(offset);
12790            // Verify that padding bytes are zero.
12791            fidl::decode!(
12792                fidl::encoding::BoundedString<65536>,
12793                fidl::encoding::DefaultFuchsiaResourceDialect,
12794                &mut self.target_origin,
12795                decoder,
12796                offset + 0,
12797                _depth
12798            )?;
12799            fidl::decode!(
12800                WebMessage,
12801                fidl::encoding::DefaultFuchsiaResourceDialect,
12802                &mut self.message,
12803                decoder,
12804                offset + 16,
12805                _depth
12806            )?;
12807            Ok(())
12808        }
12809    }
12810
12811    impl fidl::encoding::ResourceTypeMarker for FrameSetConsoleLogSinkRequest {
12812        type Borrowed<'a> = &'a mut Self;
12813        fn take_or_borrow<'a>(
12814            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12815        ) -> Self::Borrowed<'a> {
12816            value
12817        }
12818    }
12819
12820    unsafe impl fidl::encoding::TypeMarker for FrameSetConsoleLogSinkRequest {
12821        type Owned = Self;
12822
12823        #[inline(always)]
12824        fn inline_align(_context: fidl::encoding::Context) -> usize {
12825            4
12826        }
12827
12828        #[inline(always)]
12829        fn inline_size(_context: fidl::encoding::Context) -> usize {
12830            4
12831        }
12832    }
12833
12834    unsafe impl
12835        fidl::encoding::Encode<
12836            FrameSetConsoleLogSinkRequest,
12837            fidl::encoding::DefaultFuchsiaResourceDialect,
12838        > for &mut FrameSetConsoleLogSinkRequest
12839    {
12840        #[inline]
12841        unsafe fn encode(
12842            self,
12843            encoder: &mut fidl::encoding::Encoder<
12844                '_,
12845                fidl::encoding::DefaultFuchsiaResourceDialect,
12846            >,
12847            offset: usize,
12848            _depth: fidl::encoding::Depth,
12849        ) -> fidl::Result<()> {
12850            encoder.debug_check_bounds::<FrameSetConsoleLogSinkRequest>(offset);
12851            // Delegate to tuple encoding.
12852            fidl::encoding::Encode::<
12853                FrameSetConsoleLogSinkRequest,
12854                fidl::encoding::DefaultFuchsiaResourceDialect,
12855            >::encode(
12856                (<fidl::encoding::Optional<
12857                    fidl::encoding::Endpoint<
12858                        fidl::endpoints::ClientEnd<fidl_fuchsia_logger::LogSinkMarker>,
12859                    >,
12860                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12861                    &mut self.sink
12862                ),),
12863                encoder,
12864                offset,
12865                _depth,
12866            )
12867        }
12868    }
12869    unsafe impl<
12870            T0: fidl::encoding::Encode<
12871                fidl::encoding::Optional<
12872                    fidl::encoding::Endpoint<
12873                        fidl::endpoints::ClientEnd<fidl_fuchsia_logger::LogSinkMarker>,
12874                    >,
12875                >,
12876                fidl::encoding::DefaultFuchsiaResourceDialect,
12877            >,
12878        >
12879        fidl::encoding::Encode<
12880            FrameSetConsoleLogSinkRequest,
12881            fidl::encoding::DefaultFuchsiaResourceDialect,
12882        > for (T0,)
12883    {
12884        #[inline]
12885        unsafe fn encode(
12886            self,
12887            encoder: &mut fidl::encoding::Encoder<
12888                '_,
12889                fidl::encoding::DefaultFuchsiaResourceDialect,
12890            >,
12891            offset: usize,
12892            depth: fidl::encoding::Depth,
12893        ) -> fidl::Result<()> {
12894            encoder.debug_check_bounds::<FrameSetConsoleLogSinkRequest>(offset);
12895            // Zero out padding regions. There's no need to apply masks
12896            // because the unmasked parts will be overwritten by fields.
12897            // Write the fields.
12898            self.0.encode(encoder, offset + 0, depth)?;
12899            Ok(())
12900        }
12901    }
12902
12903    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12904        for FrameSetConsoleLogSinkRequest
12905    {
12906        #[inline(always)]
12907        fn new_empty() -> Self {
12908            Self {
12909                sink: fidl::new_empty!(
12910                    fidl::encoding::Optional<
12911                        fidl::encoding::Endpoint<
12912                            fidl::endpoints::ClientEnd<fidl_fuchsia_logger::LogSinkMarker>,
12913                        >,
12914                    >,
12915                    fidl::encoding::DefaultFuchsiaResourceDialect
12916                ),
12917            }
12918        }
12919
12920        #[inline]
12921        unsafe fn decode(
12922            &mut self,
12923            decoder: &mut fidl::encoding::Decoder<
12924                '_,
12925                fidl::encoding::DefaultFuchsiaResourceDialect,
12926            >,
12927            offset: usize,
12928            _depth: fidl::encoding::Depth,
12929        ) -> fidl::Result<()> {
12930            decoder.debug_check_bounds::<Self>(offset);
12931            // Verify that padding bytes are zero.
12932            fidl::decode!(
12933                fidl::encoding::Optional<
12934                    fidl::encoding::Endpoint<
12935                        fidl::endpoints::ClientEnd<fidl_fuchsia_logger::LogSinkMarker>,
12936                    >,
12937                >,
12938                fidl::encoding::DefaultFuchsiaResourceDialect,
12939                &mut self.sink,
12940                decoder,
12941                offset + 0,
12942                _depth
12943            )?;
12944            Ok(())
12945        }
12946    }
12947
12948    impl fidl::encoding::ResourceTypeMarker for FrameSetNavigationEventListener2Request {
12949        type Borrowed<'a> = &'a mut Self;
12950        fn take_or_borrow<'a>(
12951            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12952        ) -> Self::Borrowed<'a> {
12953            value
12954        }
12955    }
12956
12957    unsafe impl fidl::encoding::TypeMarker for FrameSetNavigationEventListener2Request {
12958        type Owned = Self;
12959
12960        #[inline(always)]
12961        fn inline_align(_context: fidl::encoding::Context) -> usize {
12962            8
12963        }
12964
12965        #[inline(always)]
12966        fn inline_size(_context: fidl::encoding::Context) -> usize {
12967            16
12968        }
12969    }
12970
12971    unsafe impl
12972        fidl::encoding::Encode<
12973            FrameSetNavigationEventListener2Request,
12974            fidl::encoding::DefaultFuchsiaResourceDialect,
12975        > for &mut FrameSetNavigationEventListener2Request
12976    {
12977        #[inline]
12978        unsafe fn encode(
12979            self,
12980            encoder: &mut fidl::encoding::Encoder<
12981                '_,
12982                fidl::encoding::DefaultFuchsiaResourceDialect,
12983            >,
12984            offset: usize,
12985            _depth: fidl::encoding::Depth,
12986        ) -> fidl::Result<()> {
12987            encoder.debug_check_bounds::<FrameSetNavigationEventListener2Request>(offset);
12988            // Delegate to tuple encoding.
12989            fidl::encoding::Encode::<
12990                FrameSetNavigationEventListener2Request,
12991                fidl::encoding::DefaultFuchsiaResourceDialect,
12992            >::encode(
12993                (
12994                    <fidl::encoding::Optional<
12995                        fidl::encoding::Endpoint<
12996                            fidl::endpoints::ClientEnd<NavigationEventListenerMarker>,
12997                        >,
12998                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12999                        &mut self.listener
13000                    ),
13001                    <NavigationEventListenerFlags as fidl::encoding::ValueTypeMarker>::borrow(
13002                        &self.flags,
13003                    ),
13004                ),
13005                encoder,
13006                offset,
13007                _depth,
13008            )
13009        }
13010    }
13011    unsafe impl<
13012            T0: fidl::encoding::Encode<
13013                fidl::encoding::Optional<
13014                    fidl::encoding::Endpoint<
13015                        fidl::endpoints::ClientEnd<NavigationEventListenerMarker>,
13016                    >,
13017                >,
13018                fidl::encoding::DefaultFuchsiaResourceDialect,
13019            >,
13020            T1: fidl::encoding::Encode<
13021                NavigationEventListenerFlags,
13022                fidl::encoding::DefaultFuchsiaResourceDialect,
13023            >,
13024        >
13025        fidl::encoding::Encode<
13026            FrameSetNavigationEventListener2Request,
13027            fidl::encoding::DefaultFuchsiaResourceDialect,
13028        > for (T0, T1)
13029    {
13030        #[inline]
13031        unsafe fn encode(
13032            self,
13033            encoder: &mut fidl::encoding::Encoder<
13034                '_,
13035                fidl::encoding::DefaultFuchsiaResourceDialect,
13036            >,
13037            offset: usize,
13038            depth: fidl::encoding::Depth,
13039        ) -> fidl::Result<()> {
13040            encoder.debug_check_bounds::<FrameSetNavigationEventListener2Request>(offset);
13041            // Zero out padding regions. There's no need to apply masks
13042            // because the unmasked parts will be overwritten by fields.
13043            unsafe {
13044                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
13045                (ptr as *mut u64).write_unaligned(0);
13046            }
13047            // Write the fields.
13048            self.0.encode(encoder, offset + 0, depth)?;
13049            self.1.encode(encoder, offset + 8, depth)?;
13050            Ok(())
13051        }
13052    }
13053
13054    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13055        for FrameSetNavigationEventListener2Request
13056    {
13057        #[inline(always)]
13058        fn new_empty() -> Self {
13059            Self {
13060                listener: fidl::new_empty!(
13061                    fidl::encoding::Optional<
13062                        fidl::encoding::Endpoint<
13063                            fidl::endpoints::ClientEnd<NavigationEventListenerMarker>,
13064                        >,
13065                    >,
13066                    fidl::encoding::DefaultFuchsiaResourceDialect
13067                ),
13068                flags: fidl::new_empty!(
13069                    NavigationEventListenerFlags,
13070                    fidl::encoding::DefaultFuchsiaResourceDialect
13071                ),
13072            }
13073        }
13074
13075        #[inline]
13076        unsafe fn decode(
13077            &mut self,
13078            decoder: &mut fidl::encoding::Decoder<
13079                '_,
13080                fidl::encoding::DefaultFuchsiaResourceDialect,
13081            >,
13082            offset: usize,
13083            _depth: fidl::encoding::Depth,
13084        ) -> fidl::Result<()> {
13085            decoder.debug_check_bounds::<Self>(offset);
13086            // Verify that padding bytes are zero.
13087            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
13088            let padval = unsafe { (ptr as *const u64).read_unaligned() };
13089            let mask = 0xffffffff00000000u64;
13090            let maskedval = padval & mask;
13091            if maskedval != 0 {
13092                return Err(fidl::Error::NonZeroPadding {
13093                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
13094                });
13095            }
13096            fidl::decode!(
13097                fidl::encoding::Optional<
13098                    fidl::encoding::Endpoint<
13099                        fidl::endpoints::ClientEnd<NavigationEventListenerMarker>,
13100                    >,
13101                >,
13102                fidl::encoding::DefaultFuchsiaResourceDialect,
13103                &mut self.listener,
13104                decoder,
13105                offset + 0,
13106                _depth
13107            )?;
13108            fidl::decode!(
13109                NavigationEventListenerFlags,
13110                fidl::encoding::DefaultFuchsiaResourceDialect,
13111                &mut self.flags,
13112                decoder,
13113                offset + 8,
13114                _depth
13115            )?;
13116            Ok(())
13117        }
13118    }
13119
13120    impl fidl::encoding::ResourceTypeMarker for FrameSetNavigationEventListenerRequest {
13121        type Borrowed<'a> = &'a mut Self;
13122        fn take_or_borrow<'a>(
13123            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13124        ) -> Self::Borrowed<'a> {
13125            value
13126        }
13127    }
13128
13129    unsafe impl fidl::encoding::TypeMarker for FrameSetNavigationEventListenerRequest {
13130        type Owned = Self;
13131
13132        #[inline(always)]
13133        fn inline_align(_context: fidl::encoding::Context) -> usize {
13134            4
13135        }
13136
13137        #[inline(always)]
13138        fn inline_size(_context: fidl::encoding::Context) -> usize {
13139            4
13140        }
13141    }
13142
13143    unsafe impl
13144        fidl::encoding::Encode<
13145            FrameSetNavigationEventListenerRequest,
13146            fidl::encoding::DefaultFuchsiaResourceDialect,
13147        > for &mut FrameSetNavigationEventListenerRequest
13148    {
13149        #[inline]
13150        unsafe fn encode(
13151            self,
13152            encoder: &mut fidl::encoding::Encoder<
13153                '_,
13154                fidl::encoding::DefaultFuchsiaResourceDialect,
13155            >,
13156            offset: usize,
13157            _depth: fidl::encoding::Depth,
13158        ) -> fidl::Result<()> {
13159            encoder.debug_check_bounds::<FrameSetNavigationEventListenerRequest>(offset);
13160            // Delegate to tuple encoding.
13161            fidl::encoding::Encode::<
13162                FrameSetNavigationEventListenerRequest,
13163                fidl::encoding::DefaultFuchsiaResourceDialect,
13164            >::encode(
13165                (<fidl::encoding::Optional<
13166                    fidl::encoding::Endpoint<
13167                        fidl::endpoints::ClientEnd<NavigationEventListenerMarker>,
13168                    >,
13169                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13170                    &mut self.listener
13171                ),),
13172                encoder,
13173                offset,
13174                _depth,
13175            )
13176        }
13177    }
13178    unsafe impl<
13179            T0: fidl::encoding::Encode<
13180                fidl::encoding::Optional<
13181                    fidl::encoding::Endpoint<
13182                        fidl::endpoints::ClientEnd<NavigationEventListenerMarker>,
13183                    >,
13184                >,
13185                fidl::encoding::DefaultFuchsiaResourceDialect,
13186            >,
13187        >
13188        fidl::encoding::Encode<
13189            FrameSetNavigationEventListenerRequest,
13190            fidl::encoding::DefaultFuchsiaResourceDialect,
13191        > for (T0,)
13192    {
13193        #[inline]
13194        unsafe fn encode(
13195            self,
13196            encoder: &mut fidl::encoding::Encoder<
13197                '_,
13198                fidl::encoding::DefaultFuchsiaResourceDialect,
13199            >,
13200            offset: usize,
13201            depth: fidl::encoding::Depth,
13202        ) -> fidl::Result<()> {
13203            encoder.debug_check_bounds::<FrameSetNavigationEventListenerRequest>(offset);
13204            // Zero out padding regions. There's no need to apply masks
13205            // because the unmasked parts will be overwritten by fields.
13206            // Write the fields.
13207            self.0.encode(encoder, offset + 0, depth)?;
13208            Ok(())
13209        }
13210    }
13211
13212    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13213        for FrameSetNavigationEventListenerRequest
13214    {
13215        #[inline(always)]
13216        fn new_empty() -> Self {
13217            Self {
13218                listener: fidl::new_empty!(
13219                    fidl::encoding::Optional<
13220                        fidl::encoding::Endpoint<
13221                            fidl::endpoints::ClientEnd<NavigationEventListenerMarker>,
13222                        >,
13223                    >,
13224                    fidl::encoding::DefaultFuchsiaResourceDialect
13225                ),
13226            }
13227        }
13228
13229        #[inline]
13230        unsafe fn decode(
13231            &mut self,
13232            decoder: &mut fidl::encoding::Decoder<
13233                '_,
13234                fidl::encoding::DefaultFuchsiaResourceDialect,
13235            >,
13236            offset: usize,
13237            _depth: fidl::encoding::Depth,
13238        ) -> fidl::Result<()> {
13239            decoder.debug_check_bounds::<Self>(offset);
13240            // Verify that padding bytes are zero.
13241            fidl::decode!(
13242                fidl::encoding::Optional<
13243                    fidl::encoding::Endpoint<
13244                        fidl::endpoints::ClientEnd<NavigationEventListenerMarker>,
13245                    >,
13246                >,
13247                fidl::encoding::DefaultFuchsiaResourceDialect,
13248                &mut self.listener,
13249                decoder,
13250                offset + 0,
13251                _depth
13252            )?;
13253            Ok(())
13254        }
13255    }
13256
13257    impl fidl::encoding::ResourceTypeMarker for FrameSetNavigationPolicyProviderRequest {
13258        type Borrowed<'a> = &'a mut Self;
13259        fn take_or_borrow<'a>(
13260            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13261        ) -> Self::Borrowed<'a> {
13262            value
13263        }
13264    }
13265
13266    unsafe impl fidl::encoding::TypeMarker for FrameSetNavigationPolicyProviderRequest {
13267        type Owned = Self;
13268
13269        #[inline(always)]
13270        fn inline_align(_context: fidl::encoding::Context) -> usize {
13271            8
13272        }
13273
13274        #[inline(always)]
13275        fn inline_size(_context: fidl::encoding::Context) -> usize {
13276            24
13277        }
13278    }
13279
13280    unsafe impl
13281        fidl::encoding::Encode<
13282            FrameSetNavigationPolicyProviderRequest,
13283            fidl::encoding::DefaultFuchsiaResourceDialect,
13284        > for &mut FrameSetNavigationPolicyProviderRequest
13285    {
13286        #[inline]
13287        unsafe fn encode(
13288            self,
13289            encoder: &mut fidl::encoding::Encoder<
13290                '_,
13291                fidl::encoding::DefaultFuchsiaResourceDialect,
13292            >,
13293            offset: usize,
13294            _depth: fidl::encoding::Depth,
13295        ) -> fidl::Result<()> {
13296            encoder.debug_check_bounds::<FrameSetNavigationPolicyProviderRequest>(offset);
13297            // Delegate to tuple encoding.
13298            fidl::encoding::Encode::<
13299                FrameSetNavigationPolicyProviderRequest,
13300                fidl::encoding::DefaultFuchsiaResourceDialect,
13301            >::encode(
13302                (
13303                    <NavigationPolicyProviderParams as fidl::encoding::ValueTypeMarker>::borrow(
13304                        &self.params,
13305                    ),
13306                    <fidl::encoding::Endpoint<
13307                        fidl::endpoints::ClientEnd<NavigationPolicyProviderMarker>,
13308                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13309                        &mut self.provider
13310                    ),
13311                ),
13312                encoder,
13313                offset,
13314                _depth,
13315            )
13316        }
13317    }
13318    unsafe impl<
13319            T0: fidl::encoding::Encode<
13320                NavigationPolicyProviderParams,
13321                fidl::encoding::DefaultFuchsiaResourceDialect,
13322            >,
13323            T1: fidl::encoding::Encode<
13324                fidl::encoding::Endpoint<
13325                    fidl::endpoints::ClientEnd<NavigationPolicyProviderMarker>,
13326                >,
13327                fidl::encoding::DefaultFuchsiaResourceDialect,
13328            >,
13329        >
13330        fidl::encoding::Encode<
13331            FrameSetNavigationPolicyProviderRequest,
13332            fidl::encoding::DefaultFuchsiaResourceDialect,
13333        > for (T0, T1)
13334    {
13335        #[inline]
13336        unsafe fn encode(
13337            self,
13338            encoder: &mut fidl::encoding::Encoder<
13339                '_,
13340                fidl::encoding::DefaultFuchsiaResourceDialect,
13341            >,
13342            offset: usize,
13343            depth: fidl::encoding::Depth,
13344        ) -> fidl::Result<()> {
13345            encoder.debug_check_bounds::<FrameSetNavigationPolicyProviderRequest>(offset);
13346            // Zero out padding regions. There's no need to apply masks
13347            // because the unmasked parts will be overwritten by fields.
13348            unsafe {
13349                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
13350                (ptr as *mut u64).write_unaligned(0);
13351            }
13352            // Write the fields.
13353            self.0.encode(encoder, offset + 0, depth)?;
13354            self.1.encode(encoder, offset + 16, depth)?;
13355            Ok(())
13356        }
13357    }
13358
13359    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13360        for FrameSetNavigationPolicyProviderRequest
13361    {
13362        #[inline(always)]
13363        fn new_empty() -> Self {
13364            Self {
13365                params: fidl::new_empty!(
13366                    NavigationPolicyProviderParams,
13367                    fidl::encoding::DefaultFuchsiaResourceDialect
13368                ),
13369                provider: fidl::new_empty!(
13370                    fidl::encoding::Endpoint<
13371                        fidl::endpoints::ClientEnd<NavigationPolicyProviderMarker>,
13372                    >,
13373                    fidl::encoding::DefaultFuchsiaResourceDialect
13374                ),
13375            }
13376        }
13377
13378        #[inline]
13379        unsafe fn decode(
13380            &mut self,
13381            decoder: &mut fidl::encoding::Decoder<
13382                '_,
13383                fidl::encoding::DefaultFuchsiaResourceDialect,
13384            >,
13385            offset: usize,
13386            _depth: fidl::encoding::Depth,
13387        ) -> fidl::Result<()> {
13388            decoder.debug_check_bounds::<Self>(offset);
13389            // Verify that padding bytes are zero.
13390            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
13391            let padval = unsafe { (ptr as *const u64).read_unaligned() };
13392            let mask = 0xffffffff00000000u64;
13393            let maskedval = padval & mask;
13394            if maskedval != 0 {
13395                return Err(fidl::Error::NonZeroPadding {
13396                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
13397                });
13398            }
13399            fidl::decode!(
13400                NavigationPolicyProviderParams,
13401                fidl::encoding::DefaultFuchsiaResourceDialect,
13402                &mut self.params,
13403                decoder,
13404                offset + 0,
13405                _depth
13406            )?;
13407            fidl::decode!(
13408                fidl::encoding::Endpoint<
13409                    fidl::endpoints::ClientEnd<NavigationPolicyProviderMarker>,
13410                >,
13411                fidl::encoding::DefaultFuchsiaResourceDialect,
13412                &mut self.provider,
13413                decoder,
13414                offset + 16,
13415                _depth
13416            )?;
13417            Ok(())
13418        }
13419    }
13420
13421    impl fidl::encoding::ResourceTypeMarker for FrameSetPopupFrameCreationListenerRequest {
13422        type Borrowed<'a> = &'a mut Self;
13423        fn take_or_borrow<'a>(
13424            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13425        ) -> Self::Borrowed<'a> {
13426            value
13427        }
13428    }
13429
13430    unsafe impl fidl::encoding::TypeMarker for FrameSetPopupFrameCreationListenerRequest {
13431        type Owned = Self;
13432
13433        #[inline(always)]
13434        fn inline_align(_context: fidl::encoding::Context) -> usize {
13435            4
13436        }
13437
13438        #[inline(always)]
13439        fn inline_size(_context: fidl::encoding::Context) -> usize {
13440            4
13441        }
13442    }
13443
13444    unsafe impl
13445        fidl::encoding::Encode<
13446            FrameSetPopupFrameCreationListenerRequest,
13447            fidl::encoding::DefaultFuchsiaResourceDialect,
13448        > for &mut FrameSetPopupFrameCreationListenerRequest
13449    {
13450        #[inline]
13451        unsafe fn encode(
13452            self,
13453            encoder: &mut fidl::encoding::Encoder<
13454                '_,
13455                fidl::encoding::DefaultFuchsiaResourceDialect,
13456            >,
13457            offset: usize,
13458            _depth: fidl::encoding::Depth,
13459        ) -> fidl::Result<()> {
13460            encoder.debug_check_bounds::<FrameSetPopupFrameCreationListenerRequest>(offset);
13461            // Delegate to tuple encoding.
13462            fidl::encoding::Encode::<
13463                FrameSetPopupFrameCreationListenerRequest,
13464                fidl::encoding::DefaultFuchsiaResourceDialect,
13465            >::encode(
13466                (<fidl::encoding::Optional<
13467                    fidl::encoding::Endpoint<
13468                        fidl::endpoints::ClientEnd<PopupFrameCreationListenerMarker>,
13469                    >,
13470                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13471                    &mut self.listener
13472                ),),
13473                encoder,
13474                offset,
13475                _depth,
13476            )
13477        }
13478    }
13479    unsafe impl<
13480            T0: fidl::encoding::Encode<
13481                fidl::encoding::Optional<
13482                    fidl::encoding::Endpoint<
13483                        fidl::endpoints::ClientEnd<PopupFrameCreationListenerMarker>,
13484                    >,
13485                >,
13486                fidl::encoding::DefaultFuchsiaResourceDialect,
13487            >,
13488        >
13489        fidl::encoding::Encode<
13490            FrameSetPopupFrameCreationListenerRequest,
13491            fidl::encoding::DefaultFuchsiaResourceDialect,
13492        > for (T0,)
13493    {
13494        #[inline]
13495        unsafe fn encode(
13496            self,
13497            encoder: &mut fidl::encoding::Encoder<
13498                '_,
13499                fidl::encoding::DefaultFuchsiaResourceDialect,
13500            >,
13501            offset: usize,
13502            depth: fidl::encoding::Depth,
13503        ) -> fidl::Result<()> {
13504            encoder.debug_check_bounds::<FrameSetPopupFrameCreationListenerRequest>(offset);
13505            // Zero out padding regions. There's no need to apply masks
13506            // because the unmasked parts will be overwritten by fields.
13507            // Write the fields.
13508            self.0.encode(encoder, offset + 0, depth)?;
13509            Ok(())
13510        }
13511    }
13512
13513    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13514        for FrameSetPopupFrameCreationListenerRequest
13515    {
13516        #[inline(always)]
13517        fn new_empty() -> Self {
13518            Self {
13519                listener: fidl::new_empty!(
13520                    fidl::encoding::Optional<
13521                        fidl::encoding::Endpoint<
13522                            fidl::endpoints::ClientEnd<PopupFrameCreationListenerMarker>,
13523                        >,
13524                    >,
13525                    fidl::encoding::DefaultFuchsiaResourceDialect
13526                ),
13527            }
13528        }
13529
13530        #[inline]
13531        unsafe fn decode(
13532            &mut self,
13533            decoder: &mut fidl::encoding::Decoder<
13534                '_,
13535                fidl::encoding::DefaultFuchsiaResourceDialect,
13536            >,
13537            offset: usize,
13538            _depth: fidl::encoding::Depth,
13539        ) -> fidl::Result<()> {
13540            decoder.debug_check_bounds::<Self>(offset);
13541            // Verify that padding bytes are zero.
13542            fidl::decode!(
13543                fidl::encoding::Optional<
13544                    fidl::encoding::Endpoint<
13545                        fidl::endpoints::ClientEnd<PopupFrameCreationListenerMarker>,
13546                    >,
13547                >,
13548                fidl::encoding::DefaultFuchsiaResourceDialect,
13549                &mut self.listener,
13550                decoder,
13551                offset + 0,
13552                _depth
13553            )?;
13554            Ok(())
13555        }
13556    }
13557
13558    impl fidl::encoding::ResourceTypeMarker for FrameExecuteJavaScriptResponse {
13559        type Borrowed<'a> = &'a mut Self;
13560        fn take_or_borrow<'a>(
13561            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13562        ) -> Self::Borrowed<'a> {
13563            value
13564        }
13565    }
13566
13567    unsafe impl fidl::encoding::TypeMarker for FrameExecuteJavaScriptResponse {
13568        type Owned = Self;
13569
13570        #[inline(always)]
13571        fn inline_align(_context: fidl::encoding::Context) -> usize {
13572            8
13573        }
13574
13575        #[inline(always)]
13576        fn inline_size(_context: fidl::encoding::Context) -> usize {
13577            16
13578        }
13579    }
13580
13581    unsafe impl
13582        fidl::encoding::Encode<
13583            FrameExecuteJavaScriptResponse,
13584            fidl::encoding::DefaultFuchsiaResourceDialect,
13585        > for &mut FrameExecuteJavaScriptResponse
13586    {
13587        #[inline]
13588        unsafe fn encode(
13589            self,
13590            encoder: &mut fidl::encoding::Encoder<
13591                '_,
13592                fidl::encoding::DefaultFuchsiaResourceDialect,
13593            >,
13594            offset: usize,
13595            _depth: fidl::encoding::Depth,
13596        ) -> fidl::Result<()> {
13597            encoder.debug_check_bounds::<FrameExecuteJavaScriptResponse>(offset);
13598            // Delegate to tuple encoding.
13599            fidl::encoding::Encode::<
13600                FrameExecuteJavaScriptResponse,
13601                fidl::encoding::DefaultFuchsiaResourceDialect,
13602            >::encode(
13603                (<fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13604                    &mut self.result,
13605                ),),
13606                encoder,
13607                offset,
13608                _depth,
13609            )
13610        }
13611    }
13612    unsafe impl<
13613            T0: fidl::encoding::Encode<
13614                fidl_fuchsia_mem::Buffer,
13615                fidl::encoding::DefaultFuchsiaResourceDialect,
13616            >,
13617        >
13618        fidl::encoding::Encode<
13619            FrameExecuteJavaScriptResponse,
13620            fidl::encoding::DefaultFuchsiaResourceDialect,
13621        > for (T0,)
13622    {
13623        #[inline]
13624        unsafe fn encode(
13625            self,
13626            encoder: &mut fidl::encoding::Encoder<
13627                '_,
13628                fidl::encoding::DefaultFuchsiaResourceDialect,
13629            >,
13630            offset: usize,
13631            depth: fidl::encoding::Depth,
13632        ) -> fidl::Result<()> {
13633            encoder.debug_check_bounds::<FrameExecuteJavaScriptResponse>(offset);
13634            // Zero out padding regions. There's no need to apply masks
13635            // because the unmasked parts will be overwritten by fields.
13636            // Write the fields.
13637            self.0.encode(encoder, offset + 0, depth)?;
13638            Ok(())
13639        }
13640    }
13641
13642    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13643        for FrameExecuteJavaScriptResponse
13644    {
13645        #[inline(always)]
13646        fn new_empty() -> Self {
13647            Self {
13648                result: fidl::new_empty!(
13649                    fidl_fuchsia_mem::Buffer,
13650                    fidl::encoding::DefaultFuchsiaResourceDialect
13651                ),
13652            }
13653        }
13654
13655        #[inline]
13656        unsafe fn decode(
13657            &mut self,
13658            decoder: &mut fidl::encoding::Decoder<
13659                '_,
13660                fidl::encoding::DefaultFuchsiaResourceDialect,
13661            >,
13662            offset: usize,
13663            _depth: fidl::encoding::Depth,
13664        ) -> fidl::Result<()> {
13665            decoder.debug_check_bounds::<Self>(offset);
13666            // Verify that padding bytes are zero.
13667            fidl::decode!(
13668                fidl_fuchsia_mem::Buffer,
13669                fidl::encoding::DefaultFuchsiaResourceDialect,
13670                &mut self.result,
13671                decoder,
13672                offset + 0,
13673                _depth
13674            )?;
13675            Ok(())
13676        }
13677    }
13678
13679    impl fidl::encoding::ResourceTypeMarker for MessagePortPostMessageRequest {
13680        type Borrowed<'a> = &'a mut Self;
13681        fn take_or_borrow<'a>(
13682            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13683        ) -> Self::Borrowed<'a> {
13684            value
13685        }
13686    }
13687
13688    unsafe impl fidl::encoding::TypeMarker for MessagePortPostMessageRequest {
13689        type Owned = Self;
13690
13691        #[inline(always)]
13692        fn inline_align(_context: fidl::encoding::Context) -> usize {
13693            8
13694        }
13695
13696        #[inline(always)]
13697        fn inline_size(_context: fidl::encoding::Context) -> usize {
13698            16
13699        }
13700    }
13701
13702    unsafe impl
13703        fidl::encoding::Encode<
13704            MessagePortPostMessageRequest,
13705            fidl::encoding::DefaultFuchsiaResourceDialect,
13706        > for &mut MessagePortPostMessageRequest
13707    {
13708        #[inline]
13709        unsafe fn encode(
13710            self,
13711            encoder: &mut fidl::encoding::Encoder<
13712                '_,
13713                fidl::encoding::DefaultFuchsiaResourceDialect,
13714            >,
13715            offset: usize,
13716            _depth: fidl::encoding::Depth,
13717        ) -> fidl::Result<()> {
13718            encoder.debug_check_bounds::<MessagePortPostMessageRequest>(offset);
13719            // Delegate to tuple encoding.
13720            fidl::encoding::Encode::<
13721                MessagePortPostMessageRequest,
13722                fidl::encoding::DefaultFuchsiaResourceDialect,
13723            >::encode(
13724                (<WebMessage as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13725                    &mut self.message,
13726                ),),
13727                encoder,
13728                offset,
13729                _depth,
13730            )
13731        }
13732    }
13733    unsafe impl<T0: fidl::encoding::Encode<WebMessage, fidl::encoding::DefaultFuchsiaResourceDialect>>
13734        fidl::encoding::Encode<
13735            MessagePortPostMessageRequest,
13736            fidl::encoding::DefaultFuchsiaResourceDialect,
13737        > for (T0,)
13738    {
13739        #[inline]
13740        unsafe fn encode(
13741            self,
13742            encoder: &mut fidl::encoding::Encoder<
13743                '_,
13744                fidl::encoding::DefaultFuchsiaResourceDialect,
13745            >,
13746            offset: usize,
13747            depth: fidl::encoding::Depth,
13748        ) -> fidl::Result<()> {
13749            encoder.debug_check_bounds::<MessagePortPostMessageRequest>(offset);
13750            // Zero out padding regions. There's no need to apply masks
13751            // because the unmasked parts will be overwritten by fields.
13752            // Write the fields.
13753            self.0.encode(encoder, offset + 0, depth)?;
13754            Ok(())
13755        }
13756    }
13757
13758    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13759        for MessagePortPostMessageRequest
13760    {
13761        #[inline(always)]
13762        fn new_empty() -> Self {
13763            Self {
13764                message: fidl::new_empty!(
13765                    WebMessage,
13766                    fidl::encoding::DefaultFuchsiaResourceDialect
13767                ),
13768            }
13769        }
13770
13771        #[inline]
13772        unsafe fn decode(
13773            &mut self,
13774            decoder: &mut fidl::encoding::Decoder<
13775                '_,
13776                fidl::encoding::DefaultFuchsiaResourceDialect,
13777            >,
13778            offset: usize,
13779            _depth: fidl::encoding::Depth,
13780        ) -> fidl::Result<()> {
13781            decoder.debug_check_bounds::<Self>(offset);
13782            // Verify that padding bytes are zero.
13783            fidl::decode!(
13784                WebMessage,
13785                fidl::encoding::DefaultFuchsiaResourceDialect,
13786                &mut self.message,
13787                decoder,
13788                offset + 0,
13789                _depth
13790            )?;
13791            Ok(())
13792        }
13793    }
13794
13795    impl fidl::encoding::ResourceTypeMarker for MessagePortReceiveMessageResponse {
13796        type Borrowed<'a> = &'a mut Self;
13797        fn take_or_borrow<'a>(
13798            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13799        ) -> Self::Borrowed<'a> {
13800            value
13801        }
13802    }
13803
13804    unsafe impl fidl::encoding::TypeMarker for MessagePortReceiveMessageResponse {
13805        type Owned = Self;
13806
13807        #[inline(always)]
13808        fn inline_align(_context: fidl::encoding::Context) -> usize {
13809            8
13810        }
13811
13812        #[inline(always)]
13813        fn inline_size(_context: fidl::encoding::Context) -> usize {
13814            16
13815        }
13816    }
13817
13818    unsafe impl
13819        fidl::encoding::Encode<
13820            MessagePortReceiveMessageResponse,
13821            fidl::encoding::DefaultFuchsiaResourceDialect,
13822        > for &mut MessagePortReceiveMessageResponse
13823    {
13824        #[inline]
13825        unsafe fn encode(
13826            self,
13827            encoder: &mut fidl::encoding::Encoder<
13828                '_,
13829                fidl::encoding::DefaultFuchsiaResourceDialect,
13830            >,
13831            offset: usize,
13832            _depth: fidl::encoding::Depth,
13833        ) -> fidl::Result<()> {
13834            encoder.debug_check_bounds::<MessagePortReceiveMessageResponse>(offset);
13835            // Delegate to tuple encoding.
13836            fidl::encoding::Encode::<
13837                MessagePortReceiveMessageResponse,
13838                fidl::encoding::DefaultFuchsiaResourceDialect,
13839            >::encode(
13840                (<WebMessage as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13841                    &mut self.message,
13842                ),),
13843                encoder,
13844                offset,
13845                _depth,
13846            )
13847        }
13848    }
13849    unsafe impl<T0: fidl::encoding::Encode<WebMessage, fidl::encoding::DefaultFuchsiaResourceDialect>>
13850        fidl::encoding::Encode<
13851            MessagePortReceiveMessageResponse,
13852            fidl::encoding::DefaultFuchsiaResourceDialect,
13853        > for (T0,)
13854    {
13855        #[inline]
13856        unsafe fn encode(
13857            self,
13858            encoder: &mut fidl::encoding::Encoder<
13859                '_,
13860                fidl::encoding::DefaultFuchsiaResourceDialect,
13861            >,
13862            offset: usize,
13863            depth: fidl::encoding::Depth,
13864        ) -> fidl::Result<()> {
13865            encoder.debug_check_bounds::<MessagePortReceiveMessageResponse>(offset);
13866            // Zero out padding regions. There's no need to apply masks
13867            // because the unmasked parts will be overwritten by fields.
13868            // Write the fields.
13869            self.0.encode(encoder, offset + 0, depth)?;
13870            Ok(())
13871        }
13872    }
13873
13874    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13875        for MessagePortReceiveMessageResponse
13876    {
13877        #[inline(always)]
13878        fn new_empty() -> Self {
13879            Self {
13880                message: fidl::new_empty!(
13881                    WebMessage,
13882                    fidl::encoding::DefaultFuchsiaResourceDialect
13883                ),
13884            }
13885        }
13886
13887        #[inline]
13888        unsafe fn decode(
13889            &mut self,
13890            decoder: &mut fidl::encoding::Decoder<
13891                '_,
13892                fidl::encoding::DefaultFuchsiaResourceDialect,
13893            >,
13894            offset: usize,
13895            _depth: fidl::encoding::Depth,
13896        ) -> fidl::Result<()> {
13897            decoder.debug_check_bounds::<Self>(offset);
13898            // Verify that padding bytes are zero.
13899            fidl::decode!(
13900                WebMessage,
13901                fidl::encoding::DefaultFuchsiaResourceDialect,
13902                &mut self.message,
13903                decoder,
13904                offset + 0,
13905                _depth
13906            )?;
13907            Ok(())
13908        }
13909    }
13910
13911    impl fidl::encoding::ResourceTypeMarker for NavigationControllerLoadUrlRequest {
13912        type Borrowed<'a> = &'a mut Self;
13913        fn take_or_borrow<'a>(
13914            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13915        ) -> Self::Borrowed<'a> {
13916            value
13917        }
13918    }
13919
13920    unsafe impl fidl::encoding::TypeMarker for NavigationControllerLoadUrlRequest {
13921        type Owned = Self;
13922
13923        #[inline(always)]
13924        fn inline_align(_context: fidl::encoding::Context) -> usize {
13925            8
13926        }
13927
13928        #[inline(always)]
13929        fn inline_size(_context: fidl::encoding::Context) -> usize {
13930            32
13931        }
13932    }
13933
13934    unsafe impl
13935        fidl::encoding::Encode<
13936            NavigationControllerLoadUrlRequest,
13937            fidl::encoding::DefaultFuchsiaResourceDialect,
13938        > for &mut NavigationControllerLoadUrlRequest
13939    {
13940        #[inline]
13941        unsafe fn encode(
13942            self,
13943            encoder: &mut fidl::encoding::Encoder<
13944                '_,
13945                fidl::encoding::DefaultFuchsiaResourceDialect,
13946            >,
13947            offset: usize,
13948            _depth: fidl::encoding::Depth,
13949        ) -> fidl::Result<()> {
13950            encoder.debug_check_bounds::<NavigationControllerLoadUrlRequest>(offset);
13951            // Delegate to tuple encoding.
13952            fidl::encoding::Encode::<NavigationControllerLoadUrlRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
13953                (
13954                    <fidl::encoding::BoundedString<65536> as fidl::encoding::ValueTypeMarker>::borrow(&self.url),
13955                    <LoadUrlParams as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.params),
13956                ),
13957                encoder, offset, _depth
13958            )
13959        }
13960    }
13961    unsafe impl<
13962            T0: fidl::encoding::Encode<
13963                fidl::encoding::BoundedString<65536>,
13964                fidl::encoding::DefaultFuchsiaResourceDialect,
13965            >,
13966            T1: fidl::encoding::Encode<LoadUrlParams, fidl::encoding::DefaultFuchsiaResourceDialect>,
13967        >
13968        fidl::encoding::Encode<
13969            NavigationControllerLoadUrlRequest,
13970            fidl::encoding::DefaultFuchsiaResourceDialect,
13971        > for (T0, T1)
13972    {
13973        #[inline]
13974        unsafe fn encode(
13975            self,
13976            encoder: &mut fidl::encoding::Encoder<
13977                '_,
13978                fidl::encoding::DefaultFuchsiaResourceDialect,
13979            >,
13980            offset: usize,
13981            depth: fidl::encoding::Depth,
13982        ) -> fidl::Result<()> {
13983            encoder.debug_check_bounds::<NavigationControllerLoadUrlRequest>(offset);
13984            // Zero out padding regions. There's no need to apply masks
13985            // because the unmasked parts will be overwritten by fields.
13986            // Write the fields.
13987            self.0.encode(encoder, offset + 0, depth)?;
13988            self.1.encode(encoder, offset + 16, depth)?;
13989            Ok(())
13990        }
13991    }
13992
13993    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13994        for NavigationControllerLoadUrlRequest
13995    {
13996        #[inline(always)]
13997        fn new_empty() -> Self {
13998            Self {
13999                url: fidl::new_empty!(
14000                    fidl::encoding::BoundedString<65536>,
14001                    fidl::encoding::DefaultFuchsiaResourceDialect
14002                ),
14003                params: fidl::new_empty!(
14004                    LoadUrlParams,
14005                    fidl::encoding::DefaultFuchsiaResourceDialect
14006                ),
14007            }
14008        }
14009
14010        #[inline]
14011        unsafe fn decode(
14012            &mut self,
14013            decoder: &mut fidl::encoding::Decoder<
14014                '_,
14015                fidl::encoding::DefaultFuchsiaResourceDialect,
14016            >,
14017            offset: usize,
14018            _depth: fidl::encoding::Depth,
14019        ) -> fidl::Result<()> {
14020            decoder.debug_check_bounds::<Self>(offset);
14021            // Verify that padding bytes are zero.
14022            fidl::decode!(
14023                fidl::encoding::BoundedString<65536>,
14024                fidl::encoding::DefaultFuchsiaResourceDialect,
14025                &mut self.url,
14026                decoder,
14027                offset + 0,
14028                _depth
14029            )?;
14030            fidl::decode!(
14031                LoadUrlParams,
14032                fidl::encoding::DefaultFuchsiaResourceDialect,
14033                &mut self.params,
14034                decoder,
14035                offset + 16,
14036                _depth
14037            )?;
14038            Ok(())
14039        }
14040    }
14041
14042    impl fidl::encoding::ResourceTypeMarker for NavigationEventListenerOnNavigationStateChangedRequest {
14043        type Borrowed<'a> = &'a mut Self;
14044        fn take_or_borrow<'a>(
14045            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14046        ) -> Self::Borrowed<'a> {
14047            value
14048        }
14049    }
14050
14051    unsafe impl fidl::encoding::TypeMarker for NavigationEventListenerOnNavigationStateChangedRequest {
14052        type Owned = Self;
14053
14054        #[inline(always)]
14055        fn inline_align(_context: fidl::encoding::Context) -> usize {
14056            8
14057        }
14058
14059        #[inline(always)]
14060        fn inline_size(_context: fidl::encoding::Context) -> usize {
14061            16
14062        }
14063    }
14064
14065    unsafe impl
14066        fidl::encoding::Encode<
14067            NavigationEventListenerOnNavigationStateChangedRequest,
14068            fidl::encoding::DefaultFuchsiaResourceDialect,
14069        > for &mut NavigationEventListenerOnNavigationStateChangedRequest
14070    {
14071        #[inline]
14072        unsafe fn encode(
14073            self,
14074            encoder: &mut fidl::encoding::Encoder<
14075                '_,
14076                fidl::encoding::DefaultFuchsiaResourceDialect,
14077            >,
14078            offset: usize,
14079            _depth: fidl::encoding::Depth,
14080        ) -> fidl::Result<()> {
14081            encoder.debug_check_bounds::<NavigationEventListenerOnNavigationStateChangedRequest>(
14082                offset,
14083            );
14084            // Delegate to tuple encoding.
14085            fidl::encoding::Encode::<
14086                NavigationEventListenerOnNavigationStateChangedRequest,
14087                fidl::encoding::DefaultFuchsiaResourceDialect,
14088            >::encode(
14089                (<NavigationState as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
14090                    &mut self.change,
14091                ),),
14092                encoder,
14093                offset,
14094                _depth,
14095            )
14096        }
14097    }
14098    unsafe impl<
14099            T0: fidl::encoding::Encode<NavigationState, fidl::encoding::DefaultFuchsiaResourceDialect>,
14100        >
14101        fidl::encoding::Encode<
14102            NavigationEventListenerOnNavigationStateChangedRequest,
14103            fidl::encoding::DefaultFuchsiaResourceDialect,
14104        > for (T0,)
14105    {
14106        #[inline]
14107        unsafe fn encode(
14108            self,
14109            encoder: &mut fidl::encoding::Encoder<
14110                '_,
14111                fidl::encoding::DefaultFuchsiaResourceDialect,
14112            >,
14113            offset: usize,
14114            depth: fidl::encoding::Depth,
14115        ) -> fidl::Result<()> {
14116            encoder.debug_check_bounds::<NavigationEventListenerOnNavigationStateChangedRequest>(
14117                offset,
14118            );
14119            // Zero out padding regions. There's no need to apply masks
14120            // because the unmasked parts will be overwritten by fields.
14121            // Write the fields.
14122            self.0.encode(encoder, offset + 0, depth)?;
14123            Ok(())
14124        }
14125    }
14126
14127    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14128        for NavigationEventListenerOnNavigationStateChangedRequest
14129    {
14130        #[inline(always)]
14131        fn new_empty() -> Self {
14132            Self {
14133                change: fidl::new_empty!(
14134                    NavigationState,
14135                    fidl::encoding::DefaultFuchsiaResourceDialect
14136                ),
14137            }
14138        }
14139
14140        #[inline]
14141        unsafe fn decode(
14142            &mut self,
14143            decoder: &mut fidl::encoding::Decoder<
14144                '_,
14145                fidl::encoding::DefaultFuchsiaResourceDialect,
14146            >,
14147            offset: usize,
14148            _depth: fidl::encoding::Depth,
14149        ) -> fidl::Result<()> {
14150            decoder.debug_check_bounds::<Self>(offset);
14151            // Verify that padding bytes are zero.
14152            fidl::decode!(
14153                NavigationState,
14154                fidl::encoding::DefaultFuchsiaResourceDialect,
14155                &mut self.change,
14156                decoder,
14157                offset + 0,
14158                _depth
14159            )?;
14160            Ok(())
14161        }
14162    }
14163
14164    impl fidl::encoding::ResourceTypeMarker
14165        for NavigationPolicyProviderEvaluateRequestedNavigationResponse
14166    {
14167        type Borrowed<'a> = &'a mut Self;
14168        fn take_or_borrow<'a>(
14169            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14170        ) -> Self::Borrowed<'a> {
14171            value
14172        }
14173    }
14174
14175    unsafe impl fidl::encoding::TypeMarker
14176        for NavigationPolicyProviderEvaluateRequestedNavigationResponse
14177    {
14178        type Owned = Self;
14179
14180        #[inline(always)]
14181        fn inline_align(_context: fidl::encoding::Context) -> usize {
14182            8
14183        }
14184
14185        #[inline(always)]
14186        fn inline_size(_context: fidl::encoding::Context) -> usize {
14187            16
14188        }
14189    }
14190
14191    unsafe impl
14192        fidl::encoding::Encode<
14193            NavigationPolicyProviderEvaluateRequestedNavigationResponse,
14194            fidl::encoding::DefaultFuchsiaResourceDialect,
14195        > for &mut NavigationPolicyProviderEvaluateRequestedNavigationResponse
14196    {
14197        #[inline]
14198        unsafe fn encode(
14199            self,
14200            encoder: &mut fidl::encoding::Encoder<
14201                '_,
14202                fidl::encoding::DefaultFuchsiaResourceDialect,
14203            >,
14204            offset: usize,
14205            _depth: fidl::encoding::Depth,
14206        ) -> fidl::Result<()> {
14207            encoder
14208                .debug_check_bounds::<NavigationPolicyProviderEvaluateRequestedNavigationResponse>(
14209                    offset,
14210                );
14211            // Delegate to tuple encoding.
14212            fidl::encoding::Encode::<
14213                NavigationPolicyProviderEvaluateRequestedNavigationResponse,
14214                fidl::encoding::DefaultFuchsiaResourceDialect,
14215            >::encode(
14216                (<NavigationDecision as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
14217                    &mut self.decision,
14218                ),),
14219                encoder,
14220                offset,
14221                _depth,
14222            )
14223        }
14224    }
14225    unsafe impl<
14226            T0: fidl::encoding::Encode<
14227                NavigationDecision,
14228                fidl::encoding::DefaultFuchsiaResourceDialect,
14229            >,
14230        >
14231        fidl::encoding::Encode<
14232            NavigationPolicyProviderEvaluateRequestedNavigationResponse,
14233            fidl::encoding::DefaultFuchsiaResourceDialect,
14234        > for (T0,)
14235    {
14236        #[inline]
14237        unsafe fn encode(
14238            self,
14239            encoder: &mut fidl::encoding::Encoder<
14240                '_,
14241                fidl::encoding::DefaultFuchsiaResourceDialect,
14242            >,
14243            offset: usize,
14244            depth: fidl::encoding::Depth,
14245        ) -> fidl::Result<()> {
14246            encoder
14247                .debug_check_bounds::<NavigationPolicyProviderEvaluateRequestedNavigationResponse>(
14248                    offset,
14249                );
14250            // Zero out padding regions. There's no need to apply masks
14251            // because the unmasked parts will be overwritten by fields.
14252            // Write the fields.
14253            self.0.encode(encoder, offset + 0, depth)?;
14254            Ok(())
14255        }
14256    }
14257
14258    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14259        for NavigationPolicyProviderEvaluateRequestedNavigationResponse
14260    {
14261        #[inline(always)]
14262        fn new_empty() -> Self {
14263            Self {
14264                decision: fidl::new_empty!(
14265                    NavigationDecision,
14266                    fidl::encoding::DefaultFuchsiaResourceDialect
14267                ),
14268            }
14269        }
14270
14271        #[inline]
14272        unsafe fn decode(
14273            &mut self,
14274            decoder: &mut fidl::encoding::Decoder<
14275                '_,
14276                fidl::encoding::DefaultFuchsiaResourceDialect,
14277            >,
14278            offset: usize,
14279            _depth: fidl::encoding::Depth,
14280        ) -> fidl::Result<()> {
14281            decoder.debug_check_bounds::<Self>(offset);
14282            // Verify that padding bytes are zero.
14283            fidl::decode!(
14284                NavigationDecision,
14285                fidl::encoding::DefaultFuchsiaResourceDialect,
14286                &mut self.decision,
14287                decoder,
14288                offset + 0,
14289                _depth
14290            )?;
14291            Ok(())
14292        }
14293    }
14294
14295    impl fidl::encoding::ResourceTypeMarker for PopupFrameCreationListenerOnPopupFrameCreatedRequest {
14296        type Borrowed<'a> = &'a mut Self;
14297        fn take_or_borrow<'a>(
14298            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14299        ) -> Self::Borrowed<'a> {
14300            value
14301        }
14302    }
14303
14304    unsafe impl fidl::encoding::TypeMarker for PopupFrameCreationListenerOnPopupFrameCreatedRequest {
14305        type Owned = Self;
14306
14307        #[inline(always)]
14308        fn inline_align(_context: fidl::encoding::Context) -> usize {
14309            8
14310        }
14311
14312        #[inline(always)]
14313        fn inline_size(_context: fidl::encoding::Context) -> usize {
14314            24
14315        }
14316    }
14317
14318    unsafe impl
14319        fidl::encoding::Encode<
14320            PopupFrameCreationListenerOnPopupFrameCreatedRequest,
14321            fidl::encoding::DefaultFuchsiaResourceDialect,
14322        > for &mut PopupFrameCreationListenerOnPopupFrameCreatedRequest
14323    {
14324        #[inline]
14325        unsafe fn encode(
14326            self,
14327            encoder: &mut fidl::encoding::Encoder<
14328                '_,
14329                fidl::encoding::DefaultFuchsiaResourceDialect,
14330            >,
14331            offset: usize,
14332            _depth: fidl::encoding::Depth,
14333        ) -> fidl::Result<()> {
14334            encoder
14335                .debug_check_bounds::<PopupFrameCreationListenerOnPopupFrameCreatedRequest>(offset);
14336            // Delegate to tuple encoding.
14337            fidl::encoding::Encode::<PopupFrameCreationListenerOnPopupFrameCreatedRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
14338                (
14339                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<FrameMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.frame),
14340                    <PopupFrameCreationInfo as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.info),
14341                ),
14342                encoder, offset, _depth
14343            )
14344        }
14345    }
14346    unsafe impl<
14347            T0: fidl::encoding::Encode<
14348                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<FrameMarker>>,
14349                fidl::encoding::DefaultFuchsiaResourceDialect,
14350            >,
14351            T1: fidl::encoding::Encode<
14352                PopupFrameCreationInfo,
14353                fidl::encoding::DefaultFuchsiaResourceDialect,
14354            >,
14355        >
14356        fidl::encoding::Encode<
14357            PopupFrameCreationListenerOnPopupFrameCreatedRequest,
14358            fidl::encoding::DefaultFuchsiaResourceDialect,
14359        > for (T0, T1)
14360    {
14361        #[inline]
14362        unsafe fn encode(
14363            self,
14364            encoder: &mut fidl::encoding::Encoder<
14365                '_,
14366                fidl::encoding::DefaultFuchsiaResourceDialect,
14367            >,
14368            offset: usize,
14369            depth: fidl::encoding::Depth,
14370        ) -> fidl::Result<()> {
14371            encoder
14372                .debug_check_bounds::<PopupFrameCreationListenerOnPopupFrameCreatedRequest>(offset);
14373            // Zero out padding regions. There's no need to apply masks
14374            // because the unmasked parts will be overwritten by fields.
14375            unsafe {
14376                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
14377                (ptr as *mut u64).write_unaligned(0);
14378            }
14379            // Write the fields.
14380            self.0.encode(encoder, offset + 0, depth)?;
14381            self.1.encode(encoder, offset + 8, depth)?;
14382            Ok(())
14383        }
14384    }
14385
14386    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14387        for PopupFrameCreationListenerOnPopupFrameCreatedRequest
14388    {
14389        #[inline(always)]
14390        fn new_empty() -> Self {
14391            Self {
14392                frame: fidl::new_empty!(
14393                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<FrameMarker>>,
14394                    fidl::encoding::DefaultFuchsiaResourceDialect
14395                ),
14396                info: fidl::new_empty!(
14397                    PopupFrameCreationInfo,
14398                    fidl::encoding::DefaultFuchsiaResourceDialect
14399                ),
14400            }
14401        }
14402
14403        #[inline]
14404        unsafe fn decode(
14405            &mut self,
14406            decoder: &mut fidl::encoding::Decoder<
14407                '_,
14408                fidl::encoding::DefaultFuchsiaResourceDialect,
14409            >,
14410            offset: usize,
14411            _depth: fidl::encoding::Depth,
14412        ) -> fidl::Result<()> {
14413            decoder.debug_check_bounds::<Self>(offset);
14414            // Verify that padding bytes are zero.
14415            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
14416            let padval = unsafe { (ptr as *const u64).read_unaligned() };
14417            let mask = 0xffffffff00000000u64;
14418            let maskedval = padval & mask;
14419            if maskedval != 0 {
14420                return Err(fidl::Error::NonZeroPadding {
14421                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
14422                });
14423            }
14424            fidl::decode!(
14425                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<FrameMarker>>,
14426                fidl::encoding::DefaultFuchsiaResourceDialect,
14427                &mut self.frame,
14428                decoder,
14429                offset + 0,
14430                _depth
14431            )?;
14432            fidl::decode!(
14433                PopupFrameCreationInfo,
14434                fidl::encoding::DefaultFuchsiaResourceDialect,
14435                &mut self.info,
14436                decoder,
14437                offset + 8,
14438                _depth
14439            )?;
14440            Ok(())
14441        }
14442    }
14443
14444    impl ContentDirectoryProvider {
14445        #[inline(always)]
14446        fn max_ordinal_present(&self) -> u64 {
14447            if let Some(_) = self.directory {
14448                return 2;
14449            }
14450            if let Some(_) = self.name {
14451                return 1;
14452            }
14453            0
14454        }
14455    }
14456
14457    impl fidl::encoding::ResourceTypeMarker for ContentDirectoryProvider {
14458        type Borrowed<'a> = &'a mut Self;
14459        fn take_or_borrow<'a>(
14460            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14461        ) -> Self::Borrowed<'a> {
14462            value
14463        }
14464    }
14465
14466    unsafe impl fidl::encoding::TypeMarker for ContentDirectoryProvider {
14467        type Owned = Self;
14468
14469        #[inline(always)]
14470        fn inline_align(_context: fidl::encoding::Context) -> usize {
14471            8
14472        }
14473
14474        #[inline(always)]
14475        fn inline_size(_context: fidl::encoding::Context) -> usize {
14476            16
14477        }
14478    }
14479
14480    unsafe impl
14481        fidl::encoding::Encode<
14482            ContentDirectoryProvider,
14483            fidl::encoding::DefaultFuchsiaResourceDialect,
14484        > for &mut ContentDirectoryProvider
14485    {
14486        unsafe fn encode(
14487            self,
14488            encoder: &mut fidl::encoding::Encoder<
14489                '_,
14490                fidl::encoding::DefaultFuchsiaResourceDialect,
14491            >,
14492            offset: usize,
14493            mut depth: fidl::encoding::Depth,
14494        ) -> fidl::Result<()> {
14495            encoder.debug_check_bounds::<ContentDirectoryProvider>(offset);
14496            // Vector header
14497            let max_ordinal: u64 = self.max_ordinal_present();
14498            encoder.write_num(max_ordinal, offset);
14499            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
14500            // Calling encoder.out_of_line_offset(0) is not allowed.
14501            if max_ordinal == 0 {
14502                return Ok(());
14503            }
14504            depth.increment()?;
14505            let envelope_size = 8;
14506            let bytes_len = max_ordinal as usize * envelope_size;
14507            #[allow(unused_variables)]
14508            let offset = encoder.out_of_line_offset(bytes_len);
14509            let mut _prev_end_offset: usize = 0;
14510            if 1 > max_ordinal {
14511                return Ok(());
14512            }
14513
14514            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14515            // are envelope_size bytes.
14516            let cur_offset: usize = (1 - 1) * envelope_size;
14517
14518            // Zero reserved fields.
14519            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14520
14521            // Safety:
14522            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14523            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14524            //   envelope_size bytes, there is always sufficient room.
14525            fidl::encoding::encode_in_envelope_optional::<
14526                fidl::encoding::BoundedString<255>,
14527                fidl::encoding::DefaultFuchsiaResourceDialect,
14528            >(
14529                self.name.as_ref().map(
14530                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow,
14531                ),
14532                encoder,
14533                offset + cur_offset,
14534                depth,
14535            )?;
14536
14537            _prev_end_offset = cur_offset + envelope_size;
14538            if 2 > max_ordinal {
14539                return Ok(());
14540            }
14541
14542            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14543            // are envelope_size bytes.
14544            let cur_offset: usize = (2 - 1) * envelope_size;
14545
14546            // Zero reserved fields.
14547            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14548
14549            // Safety:
14550            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14551            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14552            //   envelope_size bytes, there is always sufficient room.
14553            fidl::encoding::encode_in_envelope_optional::<
14554                fidl::encoding::Endpoint<
14555                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
14556                >,
14557                fidl::encoding::DefaultFuchsiaResourceDialect,
14558            >(
14559                self.directory.as_mut().map(
14560                    <fidl::encoding::Endpoint<
14561                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
14562                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
14563                ),
14564                encoder,
14565                offset + cur_offset,
14566                depth,
14567            )?;
14568
14569            _prev_end_offset = cur_offset + envelope_size;
14570
14571            Ok(())
14572        }
14573    }
14574
14575    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14576        for ContentDirectoryProvider
14577    {
14578        #[inline(always)]
14579        fn new_empty() -> Self {
14580            Self::default()
14581        }
14582
14583        unsafe fn decode(
14584            &mut self,
14585            decoder: &mut fidl::encoding::Decoder<
14586                '_,
14587                fidl::encoding::DefaultFuchsiaResourceDialect,
14588            >,
14589            offset: usize,
14590            mut depth: fidl::encoding::Depth,
14591        ) -> fidl::Result<()> {
14592            decoder.debug_check_bounds::<Self>(offset);
14593            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
14594                None => return Err(fidl::Error::NotNullable),
14595                Some(len) => len,
14596            };
14597            // Calling decoder.out_of_line_offset(0) is not allowed.
14598            if len == 0 {
14599                return Ok(());
14600            };
14601            depth.increment()?;
14602            let envelope_size = 8;
14603            let bytes_len = len * envelope_size;
14604            let offset = decoder.out_of_line_offset(bytes_len)?;
14605            // Decode the envelope for each type.
14606            let mut _next_ordinal_to_read = 0;
14607            let mut next_offset = offset;
14608            let end_offset = offset + bytes_len;
14609            _next_ordinal_to_read += 1;
14610            if next_offset >= end_offset {
14611                return Ok(());
14612            }
14613
14614            // Decode unknown envelopes for gaps in ordinals.
14615            while _next_ordinal_to_read < 1 {
14616                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14617                _next_ordinal_to_read += 1;
14618                next_offset += envelope_size;
14619            }
14620
14621            let next_out_of_line = decoder.next_out_of_line();
14622            let handles_before = decoder.remaining_handles();
14623            if let Some((inlined, num_bytes, num_handles)) =
14624                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14625            {
14626                let member_inline_size =
14627                    <fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
14628                        decoder.context,
14629                    );
14630                if inlined != (member_inline_size <= 4) {
14631                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14632                }
14633                let inner_offset;
14634                let mut inner_depth = depth.clone();
14635                if inlined {
14636                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14637                    inner_offset = next_offset;
14638                } else {
14639                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14640                    inner_depth.increment()?;
14641                }
14642                let val_ref = self.name.get_or_insert_with(|| {
14643                    fidl::new_empty!(
14644                        fidl::encoding::BoundedString<255>,
14645                        fidl::encoding::DefaultFuchsiaResourceDialect
14646                    )
14647                });
14648                fidl::decode!(
14649                    fidl::encoding::BoundedString<255>,
14650                    fidl::encoding::DefaultFuchsiaResourceDialect,
14651                    val_ref,
14652                    decoder,
14653                    inner_offset,
14654                    inner_depth
14655                )?;
14656                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14657                {
14658                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14659                }
14660                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14661                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14662                }
14663            }
14664
14665            next_offset += envelope_size;
14666            _next_ordinal_to_read += 1;
14667            if next_offset >= end_offset {
14668                return Ok(());
14669            }
14670
14671            // Decode unknown envelopes for gaps in ordinals.
14672            while _next_ordinal_to_read < 2 {
14673                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14674                _next_ordinal_to_read += 1;
14675                next_offset += envelope_size;
14676            }
14677
14678            let next_out_of_line = decoder.next_out_of_line();
14679            let handles_before = decoder.remaining_handles();
14680            if let Some((inlined, num_bytes, num_handles)) =
14681                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14682            {
14683                let member_inline_size = <fidl::encoding::Endpoint<
14684                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
14685                > as fidl::encoding::TypeMarker>::inline_size(
14686                    decoder.context
14687                );
14688                if inlined != (member_inline_size <= 4) {
14689                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14690                }
14691                let inner_offset;
14692                let mut inner_depth = depth.clone();
14693                if inlined {
14694                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14695                    inner_offset = next_offset;
14696                } else {
14697                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14698                    inner_depth.increment()?;
14699                }
14700                let val_ref = self.directory.get_or_insert_with(|| {
14701                    fidl::new_empty!(
14702                        fidl::encoding::Endpoint<
14703                            fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
14704                        >,
14705                        fidl::encoding::DefaultFuchsiaResourceDialect
14706                    )
14707                });
14708                fidl::decode!(
14709                    fidl::encoding::Endpoint<
14710                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
14711                    >,
14712                    fidl::encoding::DefaultFuchsiaResourceDialect,
14713                    val_ref,
14714                    decoder,
14715                    inner_offset,
14716                    inner_depth
14717                )?;
14718                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14719                {
14720                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14721                }
14722                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14723                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14724                }
14725            }
14726
14727            next_offset += envelope_size;
14728
14729            // Decode the remaining unknown envelopes.
14730            while next_offset < end_offset {
14731                _next_ordinal_to_read += 1;
14732                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14733                next_offset += envelope_size;
14734            }
14735
14736            Ok(())
14737        }
14738    }
14739
14740    impl Cookie {
14741        #[inline(always)]
14742        fn max_ordinal_present(&self) -> u64 {
14743            if let Some(_) = self.value {
14744                return 2;
14745            }
14746            if let Some(_) = self.id {
14747                return 1;
14748            }
14749            0
14750        }
14751    }
14752
14753    impl fidl::encoding::ResourceTypeMarker for Cookie {
14754        type Borrowed<'a> = &'a mut Self;
14755        fn take_or_borrow<'a>(
14756            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14757        ) -> Self::Borrowed<'a> {
14758            value
14759        }
14760    }
14761
14762    unsafe impl fidl::encoding::TypeMarker for Cookie {
14763        type Owned = Self;
14764
14765        #[inline(always)]
14766        fn inline_align(_context: fidl::encoding::Context) -> usize {
14767            8
14768        }
14769
14770        #[inline(always)]
14771        fn inline_size(_context: fidl::encoding::Context) -> usize {
14772            16
14773        }
14774    }
14775
14776    unsafe impl fidl::encoding::Encode<Cookie, fidl::encoding::DefaultFuchsiaResourceDialect>
14777        for &mut Cookie
14778    {
14779        unsafe fn encode(
14780            self,
14781            encoder: &mut fidl::encoding::Encoder<
14782                '_,
14783                fidl::encoding::DefaultFuchsiaResourceDialect,
14784            >,
14785            offset: usize,
14786            mut depth: fidl::encoding::Depth,
14787        ) -> fidl::Result<()> {
14788            encoder.debug_check_bounds::<Cookie>(offset);
14789            // Vector header
14790            let max_ordinal: u64 = self.max_ordinal_present();
14791            encoder.write_num(max_ordinal, offset);
14792            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
14793            // Calling encoder.out_of_line_offset(0) is not allowed.
14794            if max_ordinal == 0 {
14795                return Ok(());
14796            }
14797            depth.increment()?;
14798            let envelope_size = 8;
14799            let bytes_len = max_ordinal as usize * envelope_size;
14800            #[allow(unused_variables)]
14801            let offset = encoder.out_of_line_offset(bytes_len);
14802            let mut _prev_end_offset: usize = 0;
14803            if 1 > max_ordinal {
14804                return Ok(());
14805            }
14806
14807            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14808            // are envelope_size bytes.
14809            let cur_offset: usize = (1 - 1) * envelope_size;
14810
14811            // Zero reserved fields.
14812            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14813
14814            // Safety:
14815            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14816            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14817            //   envelope_size bytes, there is always sufficient room.
14818            fidl::encoding::encode_in_envelope_optional::<
14819                CookieId,
14820                fidl::encoding::DefaultFuchsiaResourceDialect,
14821            >(
14822                self.id.as_ref().map(<CookieId as fidl::encoding::ValueTypeMarker>::borrow),
14823                encoder,
14824                offset + cur_offset,
14825                depth,
14826            )?;
14827
14828            _prev_end_offset = cur_offset + envelope_size;
14829            if 2 > max_ordinal {
14830                return Ok(());
14831            }
14832
14833            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14834            // are envelope_size bytes.
14835            let cur_offset: usize = (2 - 1) * envelope_size;
14836
14837            // Zero reserved fields.
14838            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14839
14840            // Safety:
14841            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14842            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14843            //   envelope_size bytes, there is always sufficient room.
14844            fidl::encoding::encode_in_envelope_optional::<
14845                fidl::encoding::UnboundedString,
14846                fidl::encoding::DefaultFuchsiaResourceDialect,
14847            >(
14848                self.value.as_ref().map(
14849                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
14850                ),
14851                encoder,
14852                offset + cur_offset,
14853                depth,
14854            )?;
14855
14856            _prev_end_offset = cur_offset + envelope_size;
14857
14858            Ok(())
14859        }
14860    }
14861
14862    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Cookie {
14863        #[inline(always)]
14864        fn new_empty() -> Self {
14865            Self::default()
14866        }
14867
14868        unsafe fn decode(
14869            &mut self,
14870            decoder: &mut fidl::encoding::Decoder<
14871                '_,
14872                fidl::encoding::DefaultFuchsiaResourceDialect,
14873            >,
14874            offset: usize,
14875            mut depth: fidl::encoding::Depth,
14876        ) -> fidl::Result<()> {
14877            decoder.debug_check_bounds::<Self>(offset);
14878            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
14879                None => return Err(fidl::Error::NotNullable),
14880                Some(len) => len,
14881            };
14882            // Calling decoder.out_of_line_offset(0) is not allowed.
14883            if len == 0 {
14884                return Ok(());
14885            };
14886            depth.increment()?;
14887            let envelope_size = 8;
14888            let bytes_len = len * envelope_size;
14889            let offset = decoder.out_of_line_offset(bytes_len)?;
14890            // Decode the envelope for each type.
14891            let mut _next_ordinal_to_read = 0;
14892            let mut next_offset = offset;
14893            let end_offset = offset + bytes_len;
14894            _next_ordinal_to_read += 1;
14895            if next_offset >= end_offset {
14896                return Ok(());
14897            }
14898
14899            // Decode unknown envelopes for gaps in ordinals.
14900            while _next_ordinal_to_read < 1 {
14901                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14902                _next_ordinal_to_read += 1;
14903                next_offset += envelope_size;
14904            }
14905
14906            let next_out_of_line = decoder.next_out_of_line();
14907            let handles_before = decoder.remaining_handles();
14908            if let Some((inlined, num_bytes, num_handles)) =
14909                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14910            {
14911                let member_inline_size =
14912                    <CookieId as fidl::encoding::TypeMarker>::inline_size(decoder.context);
14913                if inlined != (member_inline_size <= 4) {
14914                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14915                }
14916                let inner_offset;
14917                let mut inner_depth = depth.clone();
14918                if inlined {
14919                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14920                    inner_offset = next_offset;
14921                } else {
14922                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14923                    inner_depth.increment()?;
14924                }
14925                let val_ref = self.id.get_or_insert_with(|| {
14926                    fidl::new_empty!(CookieId, fidl::encoding::DefaultFuchsiaResourceDialect)
14927                });
14928                fidl::decode!(
14929                    CookieId,
14930                    fidl::encoding::DefaultFuchsiaResourceDialect,
14931                    val_ref,
14932                    decoder,
14933                    inner_offset,
14934                    inner_depth
14935                )?;
14936                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14937                {
14938                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14939                }
14940                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14941                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14942                }
14943            }
14944
14945            next_offset += envelope_size;
14946            _next_ordinal_to_read += 1;
14947            if next_offset >= end_offset {
14948                return Ok(());
14949            }
14950
14951            // Decode unknown envelopes for gaps in ordinals.
14952            while _next_ordinal_to_read < 2 {
14953                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14954                _next_ordinal_to_read += 1;
14955                next_offset += envelope_size;
14956            }
14957
14958            let next_out_of_line = decoder.next_out_of_line();
14959            let handles_before = decoder.remaining_handles();
14960            if let Some((inlined, num_bytes, num_handles)) =
14961                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14962            {
14963                let member_inline_size =
14964                    <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
14965                        decoder.context,
14966                    );
14967                if inlined != (member_inline_size <= 4) {
14968                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14969                }
14970                let inner_offset;
14971                let mut inner_depth = depth.clone();
14972                if inlined {
14973                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14974                    inner_offset = next_offset;
14975                } else {
14976                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14977                    inner_depth.increment()?;
14978                }
14979                let val_ref = self.value.get_or_insert_with(|| {
14980                    fidl::new_empty!(
14981                        fidl::encoding::UnboundedString,
14982                        fidl::encoding::DefaultFuchsiaResourceDialect
14983                    )
14984                });
14985                fidl::decode!(
14986                    fidl::encoding::UnboundedString,
14987                    fidl::encoding::DefaultFuchsiaResourceDialect,
14988                    val_ref,
14989                    decoder,
14990                    inner_offset,
14991                    inner_depth
14992                )?;
14993                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14994                {
14995                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14996                }
14997                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14998                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14999                }
15000            }
15001
15002            next_offset += envelope_size;
15003
15004            // Decode the remaining unknown envelopes.
15005            while next_offset < end_offset {
15006                _next_ordinal_to_read += 1;
15007                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15008                next_offset += envelope_size;
15009            }
15010
15011            Ok(())
15012        }
15013    }
15014
15015    impl CreateContextParams {
15016        #[inline(always)]
15017        fn max_ordinal_present(&self) -> u64 {
15018            if let Some(_) = self.data_quota_bytes {
15019                return 13;
15020            }
15021            if let Some(_) = self.cdm_data_quota_bytes {
15022                return 12;
15023            }
15024            if let Some(_) = self.cdm_data_directory {
15025                return 11;
15026            }
15027            if let Some(_) = self.cors_exempt_headers {
15028                return 10;
15029            }
15030            if let Some(_) = self.unsafely_treat_insecure_origins_as_secure {
15031                return 9;
15032            }
15033            if let Some(_) = self.playready_key_system {
15034                return 8;
15035            }
15036            if let Some(_) = self.features {
15037                return 7;
15038            }
15039            if let Some(_) = self.content_directories {
15040                return 6;
15041            }
15042            if let Some(_) = self.remote_debugging_port {
15043                return 5;
15044            }
15045            if let Some(_) = self.user_agent_version {
15046                return 4;
15047            }
15048            if let Some(_) = self.user_agent_product {
15049                return 3;
15050            }
15051            if let Some(_) = self.data_directory {
15052                return 2;
15053            }
15054            if let Some(_) = self.service_directory {
15055                return 1;
15056            }
15057            0
15058        }
15059    }
15060
15061    impl fidl::encoding::ResourceTypeMarker for CreateContextParams {
15062        type Borrowed<'a> = &'a mut Self;
15063        fn take_or_borrow<'a>(
15064            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
15065        ) -> Self::Borrowed<'a> {
15066            value
15067        }
15068    }
15069
15070    unsafe impl fidl::encoding::TypeMarker for CreateContextParams {
15071        type Owned = Self;
15072
15073        #[inline(always)]
15074        fn inline_align(_context: fidl::encoding::Context) -> usize {
15075            8
15076        }
15077
15078        #[inline(always)]
15079        fn inline_size(_context: fidl::encoding::Context) -> usize {
15080            16
15081        }
15082    }
15083
15084    unsafe impl
15085        fidl::encoding::Encode<CreateContextParams, fidl::encoding::DefaultFuchsiaResourceDialect>
15086        for &mut CreateContextParams
15087    {
15088        unsafe fn encode(
15089            self,
15090            encoder: &mut fidl::encoding::Encoder<
15091                '_,
15092                fidl::encoding::DefaultFuchsiaResourceDialect,
15093            >,
15094            offset: usize,
15095            mut depth: fidl::encoding::Depth,
15096        ) -> fidl::Result<()> {
15097            encoder.debug_check_bounds::<CreateContextParams>(offset);
15098            // Vector header
15099            let max_ordinal: u64 = self.max_ordinal_present();
15100            encoder.write_num(max_ordinal, offset);
15101            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
15102            // Calling encoder.out_of_line_offset(0) is not allowed.
15103            if max_ordinal == 0 {
15104                return Ok(());
15105            }
15106            depth.increment()?;
15107            let envelope_size = 8;
15108            let bytes_len = max_ordinal as usize * envelope_size;
15109            #[allow(unused_variables)]
15110            let offset = encoder.out_of_line_offset(bytes_len);
15111            let mut _prev_end_offset: usize = 0;
15112            if 1 > max_ordinal {
15113                return Ok(());
15114            }
15115
15116            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15117            // are envelope_size bytes.
15118            let cur_offset: usize = (1 - 1) * envelope_size;
15119
15120            // Zero reserved fields.
15121            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15122
15123            // Safety:
15124            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15125            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15126            //   envelope_size bytes, there is always sufficient room.
15127            fidl::encoding::encode_in_envelope_optional::<
15128                fidl::encoding::Endpoint<
15129                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15130                >,
15131                fidl::encoding::DefaultFuchsiaResourceDialect,
15132            >(
15133                self.service_directory.as_mut().map(
15134                    <fidl::encoding::Endpoint<
15135                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15136                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
15137                ),
15138                encoder,
15139                offset + cur_offset,
15140                depth,
15141            )?;
15142
15143            _prev_end_offset = cur_offset + envelope_size;
15144            if 2 > max_ordinal {
15145                return Ok(());
15146            }
15147
15148            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15149            // are envelope_size bytes.
15150            let cur_offset: usize = (2 - 1) * envelope_size;
15151
15152            // Zero reserved fields.
15153            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15154
15155            // Safety:
15156            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15157            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15158            //   envelope_size bytes, there is always sufficient room.
15159            fidl::encoding::encode_in_envelope_optional::<
15160                fidl::encoding::Endpoint<
15161                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15162                >,
15163                fidl::encoding::DefaultFuchsiaResourceDialect,
15164            >(
15165                self.data_directory.as_mut().map(
15166                    <fidl::encoding::Endpoint<
15167                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15168                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
15169                ),
15170                encoder,
15171                offset + cur_offset,
15172                depth,
15173            )?;
15174
15175            _prev_end_offset = cur_offset + envelope_size;
15176            if 3 > max_ordinal {
15177                return Ok(());
15178            }
15179
15180            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15181            // are envelope_size bytes.
15182            let cur_offset: usize = (3 - 1) * envelope_size;
15183
15184            // Zero reserved fields.
15185            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15186
15187            // Safety:
15188            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15189            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15190            //   envelope_size bytes, there is always sufficient room.
15191            fidl::encoding::encode_in_envelope_optional::<
15192                fidl::encoding::BoundedString<128>,
15193                fidl::encoding::DefaultFuchsiaResourceDialect,
15194            >(
15195                self.user_agent_product.as_ref().map(
15196                    <fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow,
15197                ),
15198                encoder,
15199                offset + cur_offset,
15200                depth,
15201            )?;
15202
15203            _prev_end_offset = cur_offset + envelope_size;
15204            if 4 > max_ordinal {
15205                return Ok(());
15206            }
15207
15208            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15209            // are envelope_size bytes.
15210            let cur_offset: usize = (4 - 1) * envelope_size;
15211
15212            // Zero reserved fields.
15213            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15214
15215            // Safety:
15216            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15217            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15218            //   envelope_size bytes, there is always sufficient room.
15219            fidl::encoding::encode_in_envelope_optional::<
15220                fidl::encoding::BoundedString<128>,
15221                fidl::encoding::DefaultFuchsiaResourceDialect,
15222            >(
15223                self.user_agent_version.as_ref().map(
15224                    <fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow,
15225                ),
15226                encoder,
15227                offset + cur_offset,
15228                depth,
15229            )?;
15230
15231            _prev_end_offset = cur_offset + envelope_size;
15232            if 5 > max_ordinal {
15233                return Ok(());
15234            }
15235
15236            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15237            // are envelope_size bytes.
15238            let cur_offset: usize = (5 - 1) * envelope_size;
15239
15240            // Zero reserved fields.
15241            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15242
15243            // Safety:
15244            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15245            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15246            //   envelope_size bytes, there is always sufficient room.
15247            fidl::encoding::encode_in_envelope_optional::<
15248                u16,
15249                fidl::encoding::DefaultFuchsiaResourceDialect,
15250            >(
15251                self.remote_debugging_port
15252                    .as_ref()
15253                    .map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
15254                encoder,
15255                offset + cur_offset,
15256                depth,
15257            )?;
15258
15259            _prev_end_offset = cur_offset + envelope_size;
15260            if 6 > max_ordinal {
15261                return Ok(());
15262            }
15263
15264            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15265            // are envelope_size bytes.
15266            let cur_offset: usize = (6 - 1) * envelope_size;
15267
15268            // Zero reserved fields.
15269            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15270
15271            // Safety:
15272            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15273            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15274            //   envelope_size bytes, there is always sufficient room.
15275            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<ContentDirectoryProvider, 100>, fidl::encoding::DefaultFuchsiaResourceDialect>(
15276            self.content_directories.as_mut().map(<fidl::encoding::Vector<ContentDirectoryProvider, 100> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
15277            encoder, offset + cur_offset, depth
15278        )?;
15279
15280            _prev_end_offset = cur_offset + envelope_size;
15281            if 7 > max_ordinal {
15282                return Ok(());
15283            }
15284
15285            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15286            // are envelope_size bytes.
15287            let cur_offset: usize = (7 - 1) * envelope_size;
15288
15289            // Zero reserved fields.
15290            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15291
15292            // Safety:
15293            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15294            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15295            //   envelope_size bytes, there is always sufficient room.
15296            fidl::encoding::encode_in_envelope_optional::<
15297                ContextFeatureFlags,
15298                fidl::encoding::DefaultFuchsiaResourceDialect,
15299            >(
15300                self.features
15301                    .as_ref()
15302                    .map(<ContextFeatureFlags as fidl::encoding::ValueTypeMarker>::borrow),
15303                encoder,
15304                offset + cur_offset,
15305                depth,
15306            )?;
15307
15308            _prev_end_offset = cur_offset + envelope_size;
15309            if 8 > max_ordinal {
15310                return Ok(());
15311            }
15312
15313            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15314            // are envelope_size bytes.
15315            let cur_offset: usize = (8 - 1) * envelope_size;
15316
15317            // Zero reserved fields.
15318            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15319
15320            // Safety:
15321            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15322            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15323            //   envelope_size bytes, there is always sufficient room.
15324            fidl::encoding::encode_in_envelope_optional::<
15325                fidl::encoding::BoundedString<128>,
15326                fidl::encoding::DefaultFuchsiaResourceDialect,
15327            >(
15328                self.playready_key_system.as_ref().map(
15329                    <fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow,
15330                ),
15331                encoder,
15332                offset + cur_offset,
15333                depth,
15334            )?;
15335
15336            _prev_end_offset = cur_offset + envelope_size;
15337            if 9 > max_ordinal {
15338                return Ok(());
15339            }
15340
15341            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15342            // are envelope_size bytes.
15343            let cur_offset: usize = (9 - 1) * envelope_size;
15344
15345            // Zero reserved fields.
15346            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15347
15348            // Safety:
15349            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15350            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15351            //   envelope_size bytes, there is always sufficient room.
15352            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl::encoding::BoundedString<513>, 100>, fidl::encoding::DefaultFuchsiaResourceDialect>(
15353            self.unsafely_treat_insecure_origins_as_secure.as_ref().map(<fidl::encoding::Vector<fidl::encoding::BoundedString<513>, 100> as fidl::encoding::ValueTypeMarker>::borrow),
15354            encoder, offset + cur_offset, depth
15355        )?;
15356
15357            _prev_end_offset = cur_offset + envelope_size;
15358            if 10 > max_ordinal {
15359                return Ok(());
15360            }
15361
15362            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15363            // are envelope_size bytes.
15364            let cur_offset: usize = (10 - 1) * envelope_size;
15365
15366            // Zero reserved fields.
15367            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15368
15369            // Safety:
15370            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15371            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15372            //   envelope_size bytes, there is always sufficient room.
15373            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedVector<u8>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
15374            self.cors_exempt_headers.as_ref().map(<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedVector<u8>> as fidl::encoding::ValueTypeMarker>::borrow),
15375            encoder, offset + cur_offset, depth
15376        )?;
15377
15378            _prev_end_offset = cur_offset + envelope_size;
15379            if 11 > max_ordinal {
15380                return Ok(());
15381            }
15382
15383            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15384            // are envelope_size bytes.
15385            let cur_offset: usize = (11 - 1) * envelope_size;
15386
15387            // Zero reserved fields.
15388            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15389
15390            // Safety:
15391            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15392            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15393            //   envelope_size bytes, there is always sufficient room.
15394            fidl::encoding::encode_in_envelope_optional::<
15395                fidl::encoding::Endpoint<
15396                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15397                >,
15398                fidl::encoding::DefaultFuchsiaResourceDialect,
15399            >(
15400                self.cdm_data_directory.as_mut().map(
15401                    <fidl::encoding::Endpoint<
15402                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15403                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
15404                ),
15405                encoder,
15406                offset + cur_offset,
15407                depth,
15408            )?;
15409
15410            _prev_end_offset = cur_offset + envelope_size;
15411            if 12 > max_ordinal {
15412                return Ok(());
15413            }
15414
15415            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15416            // are envelope_size bytes.
15417            let cur_offset: usize = (12 - 1) * envelope_size;
15418
15419            // Zero reserved fields.
15420            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15421
15422            // Safety:
15423            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15424            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15425            //   envelope_size bytes, there is always sufficient room.
15426            fidl::encoding::encode_in_envelope_optional::<
15427                u64,
15428                fidl::encoding::DefaultFuchsiaResourceDialect,
15429            >(
15430                self.cdm_data_quota_bytes
15431                    .as_ref()
15432                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
15433                encoder,
15434                offset + cur_offset,
15435                depth,
15436            )?;
15437
15438            _prev_end_offset = cur_offset + envelope_size;
15439            if 13 > max_ordinal {
15440                return Ok(());
15441            }
15442
15443            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15444            // are envelope_size bytes.
15445            let cur_offset: usize = (13 - 1) * envelope_size;
15446
15447            // Zero reserved fields.
15448            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15449
15450            // Safety:
15451            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15452            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15453            //   envelope_size bytes, there is always sufficient room.
15454            fidl::encoding::encode_in_envelope_optional::<
15455                u64,
15456                fidl::encoding::DefaultFuchsiaResourceDialect,
15457            >(
15458                self.data_quota_bytes
15459                    .as_ref()
15460                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
15461                encoder,
15462                offset + cur_offset,
15463                depth,
15464            )?;
15465
15466            _prev_end_offset = cur_offset + envelope_size;
15467
15468            Ok(())
15469        }
15470    }
15471
15472    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
15473        for CreateContextParams
15474    {
15475        #[inline(always)]
15476        fn new_empty() -> Self {
15477            Self::default()
15478        }
15479
15480        unsafe fn decode(
15481            &mut self,
15482            decoder: &mut fidl::encoding::Decoder<
15483                '_,
15484                fidl::encoding::DefaultFuchsiaResourceDialect,
15485            >,
15486            offset: usize,
15487            mut depth: fidl::encoding::Depth,
15488        ) -> fidl::Result<()> {
15489            decoder.debug_check_bounds::<Self>(offset);
15490            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
15491                None => return Err(fidl::Error::NotNullable),
15492                Some(len) => len,
15493            };
15494            // Calling decoder.out_of_line_offset(0) is not allowed.
15495            if len == 0 {
15496                return Ok(());
15497            };
15498            depth.increment()?;
15499            let envelope_size = 8;
15500            let bytes_len = len * envelope_size;
15501            let offset = decoder.out_of_line_offset(bytes_len)?;
15502            // Decode the envelope for each type.
15503            let mut _next_ordinal_to_read = 0;
15504            let mut next_offset = offset;
15505            let end_offset = offset + bytes_len;
15506            _next_ordinal_to_read += 1;
15507            if next_offset >= end_offset {
15508                return Ok(());
15509            }
15510
15511            // Decode unknown envelopes for gaps in ordinals.
15512            while _next_ordinal_to_read < 1 {
15513                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15514                _next_ordinal_to_read += 1;
15515                next_offset += envelope_size;
15516            }
15517
15518            let next_out_of_line = decoder.next_out_of_line();
15519            let handles_before = decoder.remaining_handles();
15520            if let Some((inlined, num_bytes, num_handles)) =
15521                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15522            {
15523                let member_inline_size = <fidl::encoding::Endpoint<
15524                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15525                > as fidl::encoding::TypeMarker>::inline_size(
15526                    decoder.context
15527                );
15528                if inlined != (member_inline_size <= 4) {
15529                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15530                }
15531                let inner_offset;
15532                let mut inner_depth = depth.clone();
15533                if inlined {
15534                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15535                    inner_offset = next_offset;
15536                } else {
15537                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15538                    inner_depth.increment()?;
15539                }
15540                let val_ref = self.service_directory.get_or_insert_with(|| {
15541                    fidl::new_empty!(
15542                        fidl::encoding::Endpoint<
15543                            fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15544                        >,
15545                        fidl::encoding::DefaultFuchsiaResourceDialect
15546                    )
15547                });
15548                fidl::decode!(
15549                    fidl::encoding::Endpoint<
15550                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15551                    >,
15552                    fidl::encoding::DefaultFuchsiaResourceDialect,
15553                    val_ref,
15554                    decoder,
15555                    inner_offset,
15556                    inner_depth
15557                )?;
15558                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15559                {
15560                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15561                }
15562                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15563                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15564                }
15565            }
15566
15567            next_offset += envelope_size;
15568            _next_ordinal_to_read += 1;
15569            if next_offset >= end_offset {
15570                return Ok(());
15571            }
15572
15573            // Decode unknown envelopes for gaps in ordinals.
15574            while _next_ordinal_to_read < 2 {
15575                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15576                _next_ordinal_to_read += 1;
15577                next_offset += envelope_size;
15578            }
15579
15580            let next_out_of_line = decoder.next_out_of_line();
15581            let handles_before = decoder.remaining_handles();
15582            if let Some((inlined, num_bytes, num_handles)) =
15583                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15584            {
15585                let member_inline_size = <fidl::encoding::Endpoint<
15586                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15587                > as fidl::encoding::TypeMarker>::inline_size(
15588                    decoder.context
15589                );
15590                if inlined != (member_inline_size <= 4) {
15591                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15592                }
15593                let inner_offset;
15594                let mut inner_depth = depth.clone();
15595                if inlined {
15596                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15597                    inner_offset = next_offset;
15598                } else {
15599                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15600                    inner_depth.increment()?;
15601                }
15602                let val_ref = self.data_directory.get_or_insert_with(|| {
15603                    fidl::new_empty!(
15604                        fidl::encoding::Endpoint<
15605                            fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15606                        >,
15607                        fidl::encoding::DefaultFuchsiaResourceDialect
15608                    )
15609                });
15610                fidl::decode!(
15611                    fidl::encoding::Endpoint<
15612                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15613                    >,
15614                    fidl::encoding::DefaultFuchsiaResourceDialect,
15615                    val_ref,
15616                    decoder,
15617                    inner_offset,
15618                    inner_depth
15619                )?;
15620                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15621                {
15622                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15623                }
15624                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15625                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15626                }
15627            }
15628
15629            next_offset += envelope_size;
15630            _next_ordinal_to_read += 1;
15631            if next_offset >= end_offset {
15632                return Ok(());
15633            }
15634
15635            // Decode unknown envelopes for gaps in ordinals.
15636            while _next_ordinal_to_read < 3 {
15637                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15638                _next_ordinal_to_read += 1;
15639                next_offset += envelope_size;
15640            }
15641
15642            let next_out_of_line = decoder.next_out_of_line();
15643            let handles_before = decoder.remaining_handles();
15644            if let Some((inlined, num_bytes, num_handles)) =
15645                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15646            {
15647                let member_inline_size =
15648                    <fidl::encoding::BoundedString<128> as fidl::encoding::TypeMarker>::inline_size(
15649                        decoder.context,
15650                    );
15651                if inlined != (member_inline_size <= 4) {
15652                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15653                }
15654                let inner_offset;
15655                let mut inner_depth = depth.clone();
15656                if inlined {
15657                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15658                    inner_offset = next_offset;
15659                } else {
15660                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15661                    inner_depth.increment()?;
15662                }
15663                let val_ref = self.user_agent_product.get_or_insert_with(|| {
15664                    fidl::new_empty!(
15665                        fidl::encoding::BoundedString<128>,
15666                        fidl::encoding::DefaultFuchsiaResourceDialect
15667                    )
15668                });
15669                fidl::decode!(
15670                    fidl::encoding::BoundedString<128>,
15671                    fidl::encoding::DefaultFuchsiaResourceDialect,
15672                    val_ref,
15673                    decoder,
15674                    inner_offset,
15675                    inner_depth
15676                )?;
15677                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15678                {
15679                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15680                }
15681                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15682                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15683                }
15684            }
15685
15686            next_offset += envelope_size;
15687            _next_ordinal_to_read += 1;
15688            if next_offset >= end_offset {
15689                return Ok(());
15690            }
15691
15692            // Decode unknown envelopes for gaps in ordinals.
15693            while _next_ordinal_to_read < 4 {
15694                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15695                _next_ordinal_to_read += 1;
15696                next_offset += envelope_size;
15697            }
15698
15699            let next_out_of_line = decoder.next_out_of_line();
15700            let handles_before = decoder.remaining_handles();
15701            if let Some((inlined, num_bytes, num_handles)) =
15702                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15703            {
15704                let member_inline_size =
15705                    <fidl::encoding::BoundedString<128> as fidl::encoding::TypeMarker>::inline_size(
15706                        decoder.context,
15707                    );
15708                if inlined != (member_inline_size <= 4) {
15709                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15710                }
15711                let inner_offset;
15712                let mut inner_depth = depth.clone();
15713                if inlined {
15714                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15715                    inner_offset = next_offset;
15716                } else {
15717                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15718                    inner_depth.increment()?;
15719                }
15720                let val_ref = self.user_agent_version.get_or_insert_with(|| {
15721                    fidl::new_empty!(
15722                        fidl::encoding::BoundedString<128>,
15723                        fidl::encoding::DefaultFuchsiaResourceDialect
15724                    )
15725                });
15726                fidl::decode!(
15727                    fidl::encoding::BoundedString<128>,
15728                    fidl::encoding::DefaultFuchsiaResourceDialect,
15729                    val_ref,
15730                    decoder,
15731                    inner_offset,
15732                    inner_depth
15733                )?;
15734                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15735                {
15736                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15737                }
15738                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15739                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15740                }
15741            }
15742
15743            next_offset += envelope_size;
15744            _next_ordinal_to_read += 1;
15745            if next_offset >= end_offset {
15746                return Ok(());
15747            }
15748
15749            // Decode unknown envelopes for gaps in ordinals.
15750            while _next_ordinal_to_read < 5 {
15751                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15752                _next_ordinal_to_read += 1;
15753                next_offset += envelope_size;
15754            }
15755
15756            let next_out_of_line = decoder.next_out_of_line();
15757            let handles_before = decoder.remaining_handles();
15758            if let Some((inlined, num_bytes, num_handles)) =
15759                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15760            {
15761                let member_inline_size =
15762                    <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
15763                if inlined != (member_inline_size <= 4) {
15764                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15765                }
15766                let inner_offset;
15767                let mut inner_depth = depth.clone();
15768                if inlined {
15769                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15770                    inner_offset = next_offset;
15771                } else {
15772                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15773                    inner_depth.increment()?;
15774                }
15775                let val_ref = self.remote_debugging_port.get_or_insert_with(|| {
15776                    fidl::new_empty!(u16, fidl::encoding::DefaultFuchsiaResourceDialect)
15777                });
15778                fidl::decode!(
15779                    u16,
15780                    fidl::encoding::DefaultFuchsiaResourceDialect,
15781                    val_ref,
15782                    decoder,
15783                    inner_offset,
15784                    inner_depth
15785                )?;
15786                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15787                {
15788                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15789                }
15790                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15791                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15792                }
15793            }
15794
15795            next_offset += envelope_size;
15796            _next_ordinal_to_read += 1;
15797            if next_offset >= end_offset {
15798                return Ok(());
15799            }
15800
15801            // Decode unknown envelopes for gaps in ordinals.
15802            while _next_ordinal_to_read < 6 {
15803                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15804                _next_ordinal_to_read += 1;
15805                next_offset += envelope_size;
15806            }
15807
15808            let next_out_of_line = decoder.next_out_of_line();
15809            let handles_before = decoder.remaining_handles();
15810            if let Some((inlined, num_bytes, num_handles)) =
15811                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15812            {
15813                let member_inline_size = <fidl::encoding::Vector<ContentDirectoryProvider, 100> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
15814                if inlined != (member_inline_size <= 4) {
15815                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15816                }
15817                let inner_offset;
15818                let mut inner_depth = depth.clone();
15819                if inlined {
15820                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15821                    inner_offset = next_offset;
15822                } else {
15823                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15824                    inner_depth.increment()?;
15825                }
15826                let val_ref =
15827                self.content_directories.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<ContentDirectoryProvider, 100>, fidl::encoding::DefaultFuchsiaResourceDialect));
15828                fidl::decode!(fidl::encoding::Vector<ContentDirectoryProvider, 100>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
15829                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15830                {
15831                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15832                }
15833                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15834                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15835                }
15836            }
15837
15838            next_offset += envelope_size;
15839            _next_ordinal_to_read += 1;
15840            if next_offset >= end_offset {
15841                return Ok(());
15842            }
15843
15844            // Decode unknown envelopes for gaps in ordinals.
15845            while _next_ordinal_to_read < 7 {
15846                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15847                _next_ordinal_to_read += 1;
15848                next_offset += envelope_size;
15849            }
15850
15851            let next_out_of_line = decoder.next_out_of_line();
15852            let handles_before = decoder.remaining_handles();
15853            if let Some((inlined, num_bytes, num_handles)) =
15854                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15855            {
15856                let member_inline_size =
15857                    <ContextFeatureFlags as fidl::encoding::TypeMarker>::inline_size(
15858                        decoder.context,
15859                    );
15860                if inlined != (member_inline_size <= 4) {
15861                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15862                }
15863                let inner_offset;
15864                let mut inner_depth = depth.clone();
15865                if inlined {
15866                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15867                    inner_offset = next_offset;
15868                } else {
15869                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15870                    inner_depth.increment()?;
15871                }
15872                let val_ref = self.features.get_or_insert_with(|| {
15873                    fidl::new_empty!(
15874                        ContextFeatureFlags,
15875                        fidl::encoding::DefaultFuchsiaResourceDialect
15876                    )
15877                });
15878                fidl::decode!(
15879                    ContextFeatureFlags,
15880                    fidl::encoding::DefaultFuchsiaResourceDialect,
15881                    val_ref,
15882                    decoder,
15883                    inner_offset,
15884                    inner_depth
15885                )?;
15886                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15887                {
15888                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15889                }
15890                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15891                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15892                }
15893            }
15894
15895            next_offset += envelope_size;
15896            _next_ordinal_to_read += 1;
15897            if next_offset >= end_offset {
15898                return Ok(());
15899            }
15900
15901            // Decode unknown envelopes for gaps in ordinals.
15902            while _next_ordinal_to_read < 8 {
15903                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15904                _next_ordinal_to_read += 1;
15905                next_offset += envelope_size;
15906            }
15907
15908            let next_out_of_line = decoder.next_out_of_line();
15909            let handles_before = decoder.remaining_handles();
15910            if let Some((inlined, num_bytes, num_handles)) =
15911                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15912            {
15913                let member_inline_size =
15914                    <fidl::encoding::BoundedString<128> as fidl::encoding::TypeMarker>::inline_size(
15915                        decoder.context,
15916                    );
15917                if inlined != (member_inline_size <= 4) {
15918                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15919                }
15920                let inner_offset;
15921                let mut inner_depth = depth.clone();
15922                if inlined {
15923                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15924                    inner_offset = next_offset;
15925                } else {
15926                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15927                    inner_depth.increment()?;
15928                }
15929                let val_ref = self.playready_key_system.get_or_insert_with(|| {
15930                    fidl::new_empty!(
15931                        fidl::encoding::BoundedString<128>,
15932                        fidl::encoding::DefaultFuchsiaResourceDialect
15933                    )
15934                });
15935                fidl::decode!(
15936                    fidl::encoding::BoundedString<128>,
15937                    fidl::encoding::DefaultFuchsiaResourceDialect,
15938                    val_ref,
15939                    decoder,
15940                    inner_offset,
15941                    inner_depth
15942                )?;
15943                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15944                {
15945                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15946                }
15947                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15948                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15949                }
15950            }
15951
15952            next_offset += envelope_size;
15953            _next_ordinal_to_read += 1;
15954            if next_offset >= end_offset {
15955                return Ok(());
15956            }
15957
15958            // Decode unknown envelopes for gaps in ordinals.
15959            while _next_ordinal_to_read < 9 {
15960                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15961                _next_ordinal_to_read += 1;
15962                next_offset += envelope_size;
15963            }
15964
15965            let next_out_of_line = decoder.next_out_of_line();
15966            let handles_before = decoder.remaining_handles();
15967            if let Some((inlined, num_bytes, num_handles)) =
15968                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15969            {
15970                let member_inline_size = <fidl::encoding::Vector<
15971                    fidl::encoding::BoundedString<513>,
15972                    100,
15973                > as fidl::encoding::TypeMarker>::inline_size(
15974                    decoder.context
15975                );
15976                if inlined != (member_inline_size <= 4) {
15977                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15978                }
15979                let inner_offset;
15980                let mut inner_depth = depth.clone();
15981                if inlined {
15982                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15983                    inner_offset = next_offset;
15984                } else {
15985                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15986                    inner_depth.increment()?;
15987                }
15988                let val_ref =
15989                    self.unsafely_treat_insecure_origins_as_secure.get_or_insert_with(|| {
15990                        fidl::new_empty!(
15991                            fidl::encoding::Vector<fidl::encoding::BoundedString<513>, 100>,
15992                            fidl::encoding::DefaultFuchsiaResourceDialect
15993                        )
15994                    });
15995                fidl::decode!(
15996                    fidl::encoding::Vector<fidl::encoding::BoundedString<513>, 100>,
15997                    fidl::encoding::DefaultFuchsiaResourceDialect,
15998                    val_ref,
15999                    decoder,
16000                    inner_offset,
16001                    inner_depth
16002                )?;
16003                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16004                {
16005                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16006                }
16007                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16008                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16009                }
16010            }
16011
16012            next_offset += envelope_size;
16013            _next_ordinal_to_read += 1;
16014            if next_offset >= end_offset {
16015                return Ok(());
16016            }
16017
16018            // Decode unknown envelopes for gaps in ordinals.
16019            while _next_ordinal_to_read < 10 {
16020                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16021                _next_ordinal_to_read += 1;
16022                next_offset += envelope_size;
16023            }
16024
16025            let next_out_of_line = decoder.next_out_of_line();
16026            let handles_before = decoder.remaining_handles();
16027            if let Some((inlined, num_bytes, num_handles)) =
16028                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16029            {
16030                let member_inline_size = <fidl::encoding::UnboundedVector<
16031                    fidl::encoding::UnboundedVector<u8>,
16032                > as fidl::encoding::TypeMarker>::inline_size(
16033                    decoder.context
16034                );
16035                if inlined != (member_inline_size <= 4) {
16036                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16037                }
16038                let inner_offset;
16039                let mut inner_depth = depth.clone();
16040                if inlined {
16041                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16042                    inner_offset = next_offset;
16043                } else {
16044                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16045                    inner_depth.increment()?;
16046                }
16047                let val_ref = self.cors_exempt_headers.get_or_insert_with(|| {
16048                    fidl::new_empty!(
16049                        fidl::encoding::UnboundedVector<fidl::encoding::UnboundedVector<u8>>,
16050                        fidl::encoding::DefaultFuchsiaResourceDialect
16051                    )
16052                });
16053                fidl::decode!(
16054                    fidl::encoding::UnboundedVector<fidl::encoding::UnboundedVector<u8>>,
16055                    fidl::encoding::DefaultFuchsiaResourceDialect,
16056                    val_ref,
16057                    decoder,
16058                    inner_offset,
16059                    inner_depth
16060                )?;
16061                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16062                {
16063                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16064                }
16065                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16066                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16067                }
16068            }
16069
16070            next_offset += envelope_size;
16071            _next_ordinal_to_read += 1;
16072            if next_offset >= end_offset {
16073                return Ok(());
16074            }
16075
16076            // Decode unknown envelopes for gaps in ordinals.
16077            while _next_ordinal_to_read < 11 {
16078                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16079                _next_ordinal_to_read += 1;
16080                next_offset += envelope_size;
16081            }
16082
16083            let next_out_of_line = decoder.next_out_of_line();
16084            let handles_before = decoder.remaining_handles();
16085            if let Some((inlined, num_bytes, num_handles)) =
16086                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16087            {
16088                let member_inline_size = <fidl::encoding::Endpoint<
16089                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
16090                > as fidl::encoding::TypeMarker>::inline_size(
16091                    decoder.context
16092                );
16093                if inlined != (member_inline_size <= 4) {
16094                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16095                }
16096                let inner_offset;
16097                let mut inner_depth = depth.clone();
16098                if inlined {
16099                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16100                    inner_offset = next_offset;
16101                } else {
16102                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16103                    inner_depth.increment()?;
16104                }
16105                let val_ref = self.cdm_data_directory.get_or_insert_with(|| {
16106                    fidl::new_empty!(
16107                        fidl::encoding::Endpoint<
16108                            fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
16109                        >,
16110                        fidl::encoding::DefaultFuchsiaResourceDialect
16111                    )
16112                });
16113                fidl::decode!(
16114                    fidl::encoding::Endpoint<
16115                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
16116                    >,
16117                    fidl::encoding::DefaultFuchsiaResourceDialect,
16118                    val_ref,
16119                    decoder,
16120                    inner_offset,
16121                    inner_depth
16122                )?;
16123                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16124                {
16125                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16126                }
16127                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16128                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16129                }
16130            }
16131
16132            next_offset += envelope_size;
16133            _next_ordinal_to_read += 1;
16134            if next_offset >= end_offset {
16135                return Ok(());
16136            }
16137
16138            // Decode unknown envelopes for gaps in ordinals.
16139            while _next_ordinal_to_read < 12 {
16140                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16141                _next_ordinal_to_read += 1;
16142                next_offset += envelope_size;
16143            }
16144
16145            let next_out_of_line = decoder.next_out_of_line();
16146            let handles_before = decoder.remaining_handles();
16147            if let Some((inlined, num_bytes, num_handles)) =
16148                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16149            {
16150                let member_inline_size =
16151                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16152                if inlined != (member_inline_size <= 4) {
16153                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16154                }
16155                let inner_offset;
16156                let mut inner_depth = depth.clone();
16157                if inlined {
16158                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16159                    inner_offset = next_offset;
16160                } else {
16161                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16162                    inner_depth.increment()?;
16163                }
16164                let val_ref = self.cdm_data_quota_bytes.get_or_insert_with(|| {
16165                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
16166                });
16167                fidl::decode!(
16168                    u64,
16169                    fidl::encoding::DefaultFuchsiaResourceDialect,
16170                    val_ref,
16171                    decoder,
16172                    inner_offset,
16173                    inner_depth
16174                )?;
16175                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16176                {
16177                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16178                }
16179                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16180                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16181                }
16182            }
16183
16184            next_offset += envelope_size;
16185            _next_ordinal_to_read += 1;
16186            if next_offset >= end_offset {
16187                return Ok(());
16188            }
16189
16190            // Decode unknown envelopes for gaps in ordinals.
16191            while _next_ordinal_to_read < 13 {
16192                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16193                _next_ordinal_to_read += 1;
16194                next_offset += envelope_size;
16195            }
16196
16197            let next_out_of_line = decoder.next_out_of_line();
16198            let handles_before = decoder.remaining_handles();
16199            if let Some((inlined, num_bytes, num_handles)) =
16200                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16201            {
16202                let member_inline_size =
16203                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16204                if inlined != (member_inline_size <= 4) {
16205                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16206                }
16207                let inner_offset;
16208                let mut inner_depth = depth.clone();
16209                if inlined {
16210                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16211                    inner_offset = next_offset;
16212                } else {
16213                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16214                    inner_depth.increment()?;
16215                }
16216                let val_ref = self.data_quota_bytes.get_or_insert_with(|| {
16217                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
16218                });
16219                fidl::decode!(
16220                    u64,
16221                    fidl::encoding::DefaultFuchsiaResourceDialect,
16222                    val_ref,
16223                    decoder,
16224                    inner_offset,
16225                    inner_depth
16226                )?;
16227                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16228                {
16229                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16230                }
16231                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16232                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16233                }
16234            }
16235
16236            next_offset += envelope_size;
16237
16238            // Decode the remaining unknown envelopes.
16239            while next_offset < end_offset {
16240                _next_ordinal_to_read += 1;
16241                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16242                next_offset += envelope_size;
16243            }
16244
16245            Ok(())
16246        }
16247    }
16248
16249    impl CreateFrameParams {
16250        #[inline(always)]
16251        fn max_ordinal_present(&self) -> u64 {
16252            if let Some(_) = self.explicit_sites_filter_error_page {
16253                return 4;
16254            }
16255            if let Some(_) = self.debug_name {
16256                return 2;
16257            }
16258            if let Some(_) = self.enable_remote_debugging {
16259                return 1;
16260            }
16261            0
16262        }
16263    }
16264
16265    impl fidl::encoding::ResourceTypeMarker for CreateFrameParams {
16266        type Borrowed<'a> = &'a mut Self;
16267        fn take_or_borrow<'a>(
16268            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
16269        ) -> Self::Borrowed<'a> {
16270            value
16271        }
16272    }
16273
16274    unsafe impl fidl::encoding::TypeMarker for CreateFrameParams {
16275        type Owned = Self;
16276
16277        #[inline(always)]
16278        fn inline_align(_context: fidl::encoding::Context) -> usize {
16279            8
16280        }
16281
16282        #[inline(always)]
16283        fn inline_size(_context: fidl::encoding::Context) -> usize {
16284            16
16285        }
16286    }
16287
16288    unsafe impl
16289        fidl::encoding::Encode<CreateFrameParams, fidl::encoding::DefaultFuchsiaResourceDialect>
16290        for &mut CreateFrameParams
16291    {
16292        unsafe fn encode(
16293            self,
16294            encoder: &mut fidl::encoding::Encoder<
16295                '_,
16296                fidl::encoding::DefaultFuchsiaResourceDialect,
16297            >,
16298            offset: usize,
16299            mut depth: fidl::encoding::Depth,
16300        ) -> fidl::Result<()> {
16301            encoder.debug_check_bounds::<CreateFrameParams>(offset);
16302            // Vector header
16303            let max_ordinal: u64 = self.max_ordinal_present();
16304            encoder.write_num(max_ordinal, offset);
16305            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
16306            // Calling encoder.out_of_line_offset(0) is not allowed.
16307            if max_ordinal == 0 {
16308                return Ok(());
16309            }
16310            depth.increment()?;
16311            let envelope_size = 8;
16312            let bytes_len = max_ordinal as usize * envelope_size;
16313            #[allow(unused_variables)]
16314            let offset = encoder.out_of_line_offset(bytes_len);
16315            let mut _prev_end_offset: usize = 0;
16316            if 1 > max_ordinal {
16317                return Ok(());
16318            }
16319
16320            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16321            // are envelope_size bytes.
16322            let cur_offset: usize = (1 - 1) * envelope_size;
16323
16324            // Zero reserved fields.
16325            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16326
16327            // Safety:
16328            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16329            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16330            //   envelope_size bytes, there is always sufficient room.
16331            fidl::encoding::encode_in_envelope_optional::<
16332                bool,
16333                fidl::encoding::DefaultFuchsiaResourceDialect,
16334            >(
16335                self.enable_remote_debugging
16336                    .as_ref()
16337                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
16338                encoder,
16339                offset + cur_offset,
16340                depth,
16341            )?;
16342
16343            _prev_end_offset = cur_offset + envelope_size;
16344            if 2 > max_ordinal {
16345                return Ok(());
16346            }
16347
16348            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16349            // are envelope_size bytes.
16350            let cur_offset: usize = (2 - 1) * envelope_size;
16351
16352            // Zero reserved fields.
16353            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16354
16355            // Safety:
16356            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16357            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16358            //   envelope_size bytes, there is always sufficient room.
16359            fidl::encoding::encode_in_envelope_optional::<
16360                fidl::encoding::UnboundedString,
16361                fidl::encoding::DefaultFuchsiaResourceDialect,
16362            >(
16363                self.debug_name.as_ref().map(
16364                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
16365                ),
16366                encoder,
16367                offset + cur_offset,
16368                depth,
16369            )?;
16370
16371            _prev_end_offset = cur_offset + envelope_size;
16372            if 4 > max_ordinal {
16373                return Ok(());
16374            }
16375
16376            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16377            // are envelope_size bytes.
16378            let cur_offset: usize = (4 - 1) * envelope_size;
16379
16380            // Zero reserved fields.
16381            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16382
16383            // Safety:
16384            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16385            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16386            //   envelope_size bytes, there is always sufficient room.
16387            fidl::encoding::encode_in_envelope_optional::<
16388                fidl_fuchsia_mem::Data,
16389                fidl::encoding::DefaultFuchsiaResourceDialect,
16390            >(
16391                self.explicit_sites_filter_error_page.as_mut().map(
16392                    <fidl_fuchsia_mem::Data as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
16393                ),
16394                encoder,
16395                offset + cur_offset,
16396                depth,
16397            )?;
16398
16399            _prev_end_offset = cur_offset + envelope_size;
16400
16401            Ok(())
16402        }
16403    }
16404
16405    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
16406        for CreateFrameParams
16407    {
16408        #[inline(always)]
16409        fn new_empty() -> Self {
16410            Self::default()
16411        }
16412
16413        unsafe fn decode(
16414            &mut self,
16415            decoder: &mut fidl::encoding::Decoder<
16416                '_,
16417                fidl::encoding::DefaultFuchsiaResourceDialect,
16418            >,
16419            offset: usize,
16420            mut depth: fidl::encoding::Depth,
16421        ) -> fidl::Result<()> {
16422            decoder.debug_check_bounds::<Self>(offset);
16423            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
16424                None => return Err(fidl::Error::NotNullable),
16425                Some(len) => len,
16426            };
16427            // Calling decoder.out_of_line_offset(0) is not allowed.
16428            if len == 0 {
16429                return Ok(());
16430            };
16431            depth.increment()?;
16432            let envelope_size = 8;
16433            let bytes_len = len * envelope_size;
16434            let offset = decoder.out_of_line_offset(bytes_len)?;
16435            // Decode the envelope for each type.
16436            let mut _next_ordinal_to_read = 0;
16437            let mut next_offset = offset;
16438            let end_offset = offset + bytes_len;
16439            _next_ordinal_to_read += 1;
16440            if next_offset >= end_offset {
16441                return Ok(());
16442            }
16443
16444            // Decode unknown envelopes for gaps in ordinals.
16445            while _next_ordinal_to_read < 1 {
16446                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16447                _next_ordinal_to_read += 1;
16448                next_offset += envelope_size;
16449            }
16450
16451            let next_out_of_line = decoder.next_out_of_line();
16452            let handles_before = decoder.remaining_handles();
16453            if let Some((inlined, num_bytes, num_handles)) =
16454                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16455            {
16456                let member_inline_size =
16457                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16458                if inlined != (member_inline_size <= 4) {
16459                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16460                }
16461                let inner_offset;
16462                let mut inner_depth = depth.clone();
16463                if inlined {
16464                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16465                    inner_offset = next_offset;
16466                } else {
16467                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16468                    inner_depth.increment()?;
16469                }
16470                let val_ref = self.enable_remote_debugging.get_or_insert_with(|| {
16471                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
16472                });
16473                fidl::decode!(
16474                    bool,
16475                    fidl::encoding::DefaultFuchsiaResourceDialect,
16476                    val_ref,
16477                    decoder,
16478                    inner_offset,
16479                    inner_depth
16480                )?;
16481                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16482                {
16483                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16484                }
16485                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16486                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16487                }
16488            }
16489
16490            next_offset += envelope_size;
16491            _next_ordinal_to_read += 1;
16492            if next_offset >= end_offset {
16493                return Ok(());
16494            }
16495
16496            // Decode unknown envelopes for gaps in ordinals.
16497            while _next_ordinal_to_read < 2 {
16498                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16499                _next_ordinal_to_read += 1;
16500                next_offset += envelope_size;
16501            }
16502
16503            let next_out_of_line = decoder.next_out_of_line();
16504            let handles_before = decoder.remaining_handles();
16505            if let Some((inlined, num_bytes, num_handles)) =
16506                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16507            {
16508                let member_inline_size =
16509                    <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
16510                        decoder.context,
16511                    );
16512                if inlined != (member_inline_size <= 4) {
16513                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16514                }
16515                let inner_offset;
16516                let mut inner_depth = depth.clone();
16517                if inlined {
16518                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16519                    inner_offset = next_offset;
16520                } else {
16521                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16522                    inner_depth.increment()?;
16523                }
16524                let val_ref = self.debug_name.get_or_insert_with(|| {
16525                    fidl::new_empty!(
16526                        fidl::encoding::UnboundedString,
16527                        fidl::encoding::DefaultFuchsiaResourceDialect
16528                    )
16529                });
16530                fidl::decode!(
16531                    fidl::encoding::UnboundedString,
16532                    fidl::encoding::DefaultFuchsiaResourceDialect,
16533                    val_ref,
16534                    decoder,
16535                    inner_offset,
16536                    inner_depth
16537                )?;
16538                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16539                {
16540                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16541                }
16542                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16543                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16544                }
16545            }
16546
16547            next_offset += envelope_size;
16548            _next_ordinal_to_read += 1;
16549            if next_offset >= end_offset {
16550                return Ok(());
16551            }
16552
16553            // Decode unknown envelopes for gaps in ordinals.
16554            while _next_ordinal_to_read < 4 {
16555                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16556                _next_ordinal_to_read += 1;
16557                next_offset += envelope_size;
16558            }
16559
16560            let next_out_of_line = decoder.next_out_of_line();
16561            let handles_before = decoder.remaining_handles();
16562            if let Some((inlined, num_bytes, num_handles)) =
16563                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16564            {
16565                let member_inline_size =
16566                    <fidl_fuchsia_mem::Data as fidl::encoding::TypeMarker>::inline_size(
16567                        decoder.context,
16568                    );
16569                if inlined != (member_inline_size <= 4) {
16570                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16571                }
16572                let inner_offset;
16573                let mut inner_depth = depth.clone();
16574                if inlined {
16575                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16576                    inner_offset = next_offset;
16577                } else {
16578                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16579                    inner_depth.increment()?;
16580                }
16581                let val_ref = self.explicit_sites_filter_error_page.get_or_insert_with(|| {
16582                    fidl::new_empty!(
16583                        fidl_fuchsia_mem::Data,
16584                        fidl::encoding::DefaultFuchsiaResourceDialect
16585                    )
16586                });
16587                fidl::decode!(
16588                    fidl_fuchsia_mem::Data,
16589                    fidl::encoding::DefaultFuchsiaResourceDialect,
16590                    val_ref,
16591                    decoder,
16592                    inner_offset,
16593                    inner_depth
16594                )?;
16595                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16596                {
16597                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16598                }
16599                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16600                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16601                }
16602            }
16603
16604            next_offset += envelope_size;
16605
16606            // Decode the remaining unknown envelopes.
16607            while next_offset < end_offset {
16608                _next_ordinal_to_read += 1;
16609                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16610                next_offset += envelope_size;
16611            }
16612
16613            Ok(())
16614        }
16615    }
16616
16617    impl CreateView2Args {
16618        #[inline(always)]
16619        fn max_ordinal_present(&self) -> u64 {
16620            if let Some(_) = self.view_creation_token {
16621                return 1;
16622            }
16623            0
16624        }
16625    }
16626
16627    impl fidl::encoding::ResourceTypeMarker for CreateView2Args {
16628        type Borrowed<'a> = &'a mut Self;
16629        fn take_or_borrow<'a>(
16630            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
16631        ) -> Self::Borrowed<'a> {
16632            value
16633        }
16634    }
16635
16636    unsafe impl fidl::encoding::TypeMarker for CreateView2Args {
16637        type Owned = Self;
16638
16639        #[inline(always)]
16640        fn inline_align(_context: fidl::encoding::Context) -> usize {
16641            8
16642        }
16643
16644        #[inline(always)]
16645        fn inline_size(_context: fidl::encoding::Context) -> usize {
16646            16
16647        }
16648    }
16649
16650    unsafe impl
16651        fidl::encoding::Encode<CreateView2Args, fidl::encoding::DefaultFuchsiaResourceDialect>
16652        for &mut CreateView2Args
16653    {
16654        unsafe fn encode(
16655            self,
16656            encoder: &mut fidl::encoding::Encoder<
16657                '_,
16658                fidl::encoding::DefaultFuchsiaResourceDialect,
16659            >,
16660            offset: usize,
16661            mut depth: fidl::encoding::Depth,
16662        ) -> fidl::Result<()> {
16663            encoder.debug_check_bounds::<CreateView2Args>(offset);
16664            // Vector header
16665            let max_ordinal: u64 = self.max_ordinal_present();
16666            encoder.write_num(max_ordinal, offset);
16667            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
16668            // Calling encoder.out_of_line_offset(0) is not allowed.
16669            if max_ordinal == 0 {
16670                return Ok(());
16671            }
16672            depth.increment()?;
16673            let envelope_size = 8;
16674            let bytes_len = max_ordinal as usize * envelope_size;
16675            #[allow(unused_variables)]
16676            let offset = encoder.out_of_line_offset(bytes_len);
16677            let mut _prev_end_offset: usize = 0;
16678            if 1 > max_ordinal {
16679                return Ok(());
16680            }
16681
16682            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16683            // are envelope_size bytes.
16684            let cur_offset: usize = (1 - 1) * envelope_size;
16685
16686            // Zero reserved fields.
16687            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16688
16689            // Safety:
16690            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16691            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16692            //   envelope_size bytes, there is always sufficient room.
16693            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_ui_views::ViewCreationToken, fidl::encoding::DefaultFuchsiaResourceDialect>(
16694            self.view_creation_token.as_mut().map(<fidl_fuchsia_ui_views::ViewCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
16695            encoder, offset + cur_offset, depth
16696        )?;
16697
16698            _prev_end_offset = cur_offset + envelope_size;
16699
16700            Ok(())
16701        }
16702    }
16703
16704    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
16705        for CreateView2Args
16706    {
16707        #[inline(always)]
16708        fn new_empty() -> Self {
16709            Self::default()
16710        }
16711
16712        unsafe fn decode(
16713            &mut self,
16714            decoder: &mut fidl::encoding::Decoder<
16715                '_,
16716                fidl::encoding::DefaultFuchsiaResourceDialect,
16717            >,
16718            offset: usize,
16719            mut depth: fidl::encoding::Depth,
16720        ) -> fidl::Result<()> {
16721            decoder.debug_check_bounds::<Self>(offset);
16722            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
16723                None => return Err(fidl::Error::NotNullable),
16724                Some(len) => len,
16725            };
16726            // Calling decoder.out_of_line_offset(0) is not allowed.
16727            if len == 0 {
16728                return Ok(());
16729            };
16730            depth.increment()?;
16731            let envelope_size = 8;
16732            let bytes_len = len * envelope_size;
16733            let offset = decoder.out_of_line_offset(bytes_len)?;
16734            // Decode the envelope for each type.
16735            let mut _next_ordinal_to_read = 0;
16736            let mut next_offset = offset;
16737            let end_offset = offset + bytes_len;
16738            _next_ordinal_to_read += 1;
16739            if next_offset >= end_offset {
16740                return Ok(());
16741            }
16742
16743            // Decode unknown envelopes for gaps in ordinals.
16744            while _next_ordinal_to_read < 1 {
16745                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16746                _next_ordinal_to_read += 1;
16747                next_offset += envelope_size;
16748            }
16749
16750            let next_out_of_line = decoder.next_out_of_line();
16751            let handles_before = decoder.remaining_handles();
16752            if let Some((inlined, num_bytes, num_handles)) =
16753                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16754            {
16755                let member_inline_size = <fidl_fuchsia_ui_views::ViewCreationToken as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16756                if inlined != (member_inline_size <= 4) {
16757                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16758                }
16759                let inner_offset;
16760                let mut inner_depth = depth.clone();
16761                if inlined {
16762                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16763                    inner_offset = next_offset;
16764                } else {
16765                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16766                    inner_depth.increment()?;
16767                }
16768                let val_ref = self.view_creation_token.get_or_insert_with(|| {
16769                    fidl::new_empty!(
16770                        fidl_fuchsia_ui_views::ViewCreationToken,
16771                        fidl::encoding::DefaultFuchsiaResourceDialect
16772                    )
16773                });
16774                fidl::decode!(
16775                    fidl_fuchsia_ui_views::ViewCreationToken,
16776                    fidl::encoding::DefaultFuchsiaResourceDialect,
16777                    val_ref,
16778                    decoder,
16779                    inner_offset,
16780                    inner_depth
16781                )?;
16782                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16783                {
16784                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16785                }
16786                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16787                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16788                }
16789            }
16790
16791            next_offset += envelope_size;
16792
16793            // Decode the remaining unknown envelopes.
16794            while next_offset < end_offset {
16795                _next_ordinal_to_read += 1;
16796                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16797                next_offset += envelope_size;
16798            }
16799
16800            Ok(())
16801        }
16802    }
16803
16804    impl Favicon {
16805        #[inline(always)]
16806        fn max_ordinal_present(&self) -> u64 {
16807            if let Some(_) = self.height {
16808                return 3;
16809            }
16810            if let Some(_) = self.width {
16811                return 2;
16812            }
16813            if let Some(_) = self.data {
16814                return 1;
16815            }
16816            0
16817        }
16818    }
16819
16820    impl fidl::encoding::ResourceTypeMarker for Favicon {
16821        type Borrowed<'a> = &'a mut Self;
16822        fn take_or_borrow<'a>(
16823            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
16824        ) -> Self::Borrowed<'a> {
16825            value
16826        }
16827    }
16828
16829    unsafe impl fidl::encoding::TypeMarker for Favicon {
16830        type Owned = Self;
16831
16832        #[inline(always)]
16833        fn inline_align(_context: fidl::encoding::Context) -> usize {
16834            8
16835        }
16836
16837        #[inline(always)]
16838        fn inline_size(_context: fidl::encoding::Context) -> usize {
16839            16
16840        }
16841    }
16842
16843    unsafe impl fidl::encoding::Encode<Favicon, fidl::encoding::DefaultFuchsiaResourceDialect>
16844        for &mut Favicon
16845    {
16846        unsafe fn encode(
16847            self,
16848            encoder: &mut fidl::encoding::Encoder<
16849                '_,
16850                fidl::encoding::DefaultFuchsiaResourceDialect,
16851            >,
16852            offset: usize,
16853            mut depth: fidl::encoding::Depth,
16854        ) -> fidl::Result<()> {
16855            encoder.debug_check_bounds::<Favicon>(offset);
16856            // Vector header
16857            let max_ordinal: u64 = self.max_ordinal_present();
16858            encoder.write_num(max_ordinal, offset);
16859            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
16860            // Calling encoder.out_of_line_offset(0) is not allowed.
16861            if max_ordinal == 0 {
16862                return Ok(());
16863            }
16864            depth.increment()?;
16865            let envelope_size = 8;
16866            let bytes_len = max_ordinal as usize * envelope_size;
16867            #[allow(unused_variables)]
16868            let offset = encoder.out_of_line_offset(bytes_len);
16869            let mut _prev_end_offset: usize = 0;
16870            if 1 > max_ordinal {
16871                return Ok(());
16872            }
16873
16874            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16875            // are envelope_size bytes.
16876            let cur_offset: usize = (1 - 1) * envelope_size;
16877
16878            // Zero reserved fields.
16879            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16880
16881            // Safety:
16882            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16883            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16884            //   envelope_size bytes, there is always sufficient room.
16885            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_mem::Buffer, fidl::encoding::DefaultFuchsiaResourceDialect>(
16886            self.data.as_mut().map(<fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
16887            encoder, offset + cur_offset, depth
16888        )?;
16889
16890            _prev_end_offset = cur_offset + envelope_size;
16891            if 2 > max_ordinal {
16892                return Ok(());
16893            }
16894
16895            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16896            // are envelope_size bytes.
16897            let cur_offset: usize = (2 - 1) * envelope_size;
16898
16899            // Zero reserved fields.
16900            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16901
16902            // Safety:
16903            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16904            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16905            //   envelope_size bytes, there is always sufficient room.
16906            fidl::encoding::encode_in_envelope_optional::<
16907                u32,
16908                fidl::encoding::DefaultFuchsiaResourceDialect,
16909            >(
16910                self.width.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
16911                encoder,
16912                offset + cur_offset,
16913                depth,
16914            )?;
16915
16916            _prev_end_offset = cur_offset + envelope_size;
16917            if 3 > max_ordinal {
16918                return Ok(());
16919            }
16920
16921            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16922            // are envelope_size bytes.
16923            let cur_offset: usize = (3 - 1) * envelope_size;
16924
16925            // Zero reserved fields.
16926            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16927
16928            // Safety:
16929            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16930            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16931            //   envelope_size bytes, there is always sufficient room.
16932            fidl::encoding::encode_in_envelope_optional::<
16933                u32,
16934                fidl::encoding::DefaultFuchsiaResourceDialect,
16935            >(
16936                self.height.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
16937                encoder,
16938                offset + cur_offset,
16939                depth,
16940            )?;
16941
16942            _prev_end_offset = cur_offset + envelope_size;
16943
16944            Ok(())
16945        }
16946    }
16947
16948    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Favicon {
16949        #[inline(always)]
16950        fn new_empty() -> Self {
16951            Self::default()
16952        }
16953
16954        unsafe fn decode(
16955            &mut self,
16956            decoder: &mut fidl::encoding::Decoder<
16957                '_,
16958                fidl::encoding::DefaultFuchsiaResourceDialect,
16959            >,
16960            offset: usize,
16961            mut depth: fidl::encoding::Depth,
16962        ) -> fidl::Result<()> {
16963            decoder.debug_check_bounds::<Self>(offset);
16964            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
16965                None => return Err(fidl::Error::NotNullable),
16966                Some(len) => len,
16967            };
16968            // Calling decoder.out_of_line_offset(0) is not allowed.
16969            if len == 0 {
16970                return Ok(());
16971            };
16972            depth.increment()?;
16973            let envelope_size = 8;
16974            let bytes_len = len * envelope_size;
16975            let offset = decoder.out_of_line_offset(bytes_len)?;
16976            // Decode the envelope for each type.
16977            let mut _next_ordinal_to_read = 0;
16978            let mut next_offset = offset;
16979            let end_offset = offset + bytes_len;
16980            _next_ordinal_to_read += 1;
16981            if next_offset >= end_offset {
16982                return Ok(());
16983            }
16984
16985            // Decode unknown envelopes for gaps in ordinals.
16986            while _next_ordinal_to_read < 1 {
16987                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16988                _next_ordinal_to_read += 1;
16989                next_offset += envelope_size;
16990            }
16991
16992            let next_out_of_line = decoder.next_out_of_line();
16993            let handles_before = decoder.remaining_handles();
16994            if let Some((inlined, num_bytes, num_handles)) =
16995                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16996            {
16997                let member_inline_size =
16998                    <fidl_fuchsia_mem::Buffer as fidl::encoding::TypeMarker>::inline_size(
16999                        decoder.context,
17000                    );
17001                if inlined != (member_inline_size <= 4) {
17002                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17003                }
17004                let inner_offset;
17005                let mut inner_depth = depth.clone();
17006                if inlined {
17007                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17008                    inner_offset = next_offset;
17009                } else {
17010                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17011                    inner_depth.increment()?;
17012                }
17013                let val_ref = self.data.get_or_insert_with(|| {
17014                    fidl::new_empty!(
17015                        fidl_fuchsia_mem::Buffer,
17016                        fidl::encoding::DefaultFuchsiaResourceDialect
17017                    )
17018                });
17019                fidl::decode!(
17020                    fidl_fuchsia_mem::Buffer,
17021                    fidl::encoding::DefaultFuchsiaResourceDialect,
17022                    val_ref,
17023                    decoder,
17024                    inner_offset,
17025                    inner_depth
17026                )?;
17027                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17028                {
17029                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17030                }
17031                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17032                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17033                }
17034            }
17035
17036            next_offset += envelope_size;
17037            _next_ordinal_to_read += 1;
17038            if next_offset >= end_offset {
17039                return Ok(());
17040            }
17041
17042            // Decode unknown envelopes for gaps in ordinals.
17043            while _next_ordinal_to_read < 2 {
17044                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17045                _next_ordinal_to_read += 1;
17046                next_offset += envelope_size;
17047            }
17048
17049            let next_out_of_line = decoder.next_out_of_line();
17050            let handles_before = decoder.remaining_handles();
17051            if let Some((inlined, num_bytes, num_handles)) =
17052                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17053            {
17054                let member_inline_size =
17055                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
17056                if inlined != (member_inline_size <= 4) {
17057                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17058                }
17059                let inner_offset;
17060                let mut inner_depth = depth.clone();
17061                if inlined {
17062                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17063                    inner_offset = next_offset;
17064                } else {
17065                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17066                    inner_depth.increment()?;
17067                }
17068                let val_ref = self.width.get_or_insert_with(|| {
17069                    fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
17070                });
17071                fidl::decode!(
17072                    u32,
17073                    fidl::encoding::DefaultFuchsiaResourceDialect,
17074                    val_ref,
17075                    decoder,
17076                    inner_offset,
17077                    inner_depth
17078                )?;
17079                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17080                {
17081                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17082                }
17083                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17084                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17085                }
17086            }
17087
17088            next_offset += envelope_size;
17089            _next_ordinal_to_read += 1;
17090            if next_offset >= end_offset {
17091                return Ok(());
17092            }
17093
17094            // Decode unknown envelopes for gaps in ordinals.
17095            while _next_ordinal_to_read < 3 {
17096                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17097                _next_ordinal_to_read += 1;
17098                next_offset += envelope_size;
17099            }
17100
17101            let next_out_of_line = decoder.next_out_of_line();
17102            let handles_before = decoder.remaining_handles();
17103            if let Some((inlined, num_bytes, num_handles)) =
17104                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17105            {
17106                let member_inline_size =
17107                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
17108                if inlined != (member_inline_size <= 4) {
17109                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17110                }
17111                let inner_offset;
17112                let mut inner_depth = depth.clone();
17113                if inlined {
17114                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17115                    inner_offset = next_offset;
17116                } else {
17117                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17118                    inner_depth.increment()?;
17119                }
17120                let val_ref = self.height.get_or_insert_with(|| {
17121                    fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
17122                });
17123                fidl::decode!(
17124                    u32,
17125                    fidl::encoding::DefaultFuchsiaResourceDialect,
17126                    val_ref,
17127                    decoder,
17128                    inner_offset,
17129                    inner_depth
17130                )?;
17131                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17132                {
17133                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17134                }
17135                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17136                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17137                }
17138            }
17139
17140            next_offset += envelope_size;
17141
17142            // Decode the remaining unknown envelopes.
17143            while next_offset < end_offset {
17144                _next_ordinal_to_read += 1;
17145                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17146                next_offset += envelope_size;
17147            }
17148
17149            Ok(())
17150        }
17151    }
17152
17153    impl LoadUrlParams {
17154        #[inline(always)]
17155        fn max_ordinal_present(&self) -> u64 {
17156            if let Some(_) = self.headers {
17157                return 4;
17158            }
17159            if let Some(_) = self.was_user_activated {
17160                return 3;
17161            }
17162            if let Some(_) = self.referrer_url {
17163                return 2;
17164            }
17165            if let Some(_) = self.type_ {
17166                return 1;
17167            }
17168            0
17169        }
17170    }
17171
17172    impl fidl::encoding::ResourceTypeMarker for LoadUrlParams {
17173        type Borrowed<'a> = &'a mut Self;
17174        fn take_or_borrow<'a>(
17175            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
17176        ) -> Self::Borrowed<'a> {
17177            value
17178        }
17179    }
17180
17181    unsafe impl fidl::encoding::TypeMarker for LoadUrlParams {
17182        type Owned = Self;
17183
17184        #[inline(always)]
17185        fn inline_align(_context: fidl::encoding::Context) -> usize {
17186            8
17187        }
17188
17189        #[inline(always)]
17190        fn inline_size(_context: fidl::encoding::Context) -> usize {
17191            16
17192        }
17193    }
17194
17195    unsafe impl fidl::encoding::Encode<LoadUrlParams, fidl::encoding::DefaultFuchsiaResourceDialect>
17196        for &mut LoadUrlParams
17197    {
17198        unsafe fn encode(
17199            self,
17200            encoder: &mut fidl::encoding::Encoder<
17201                '_,
17202                fidl::encoding::DefaultFuchsiaResourceDialect,
17203            >,
17204            offset: usize,
17205            mut depth: fidl::encoding::Depth,
17206        ) -> fidl::Result<()> {
17207            encoder.debug_check_bounds::<LoadUrlParams>(offset);
17208            // Vector header
17209            let max_ordinal: u64 = self.max_ordinal_present();
17210            encoder.write_num(max_ordinal, offset);
17211            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
17212            // Calling encoder.out_of_line_offset(0) is not allowed.
17213            if max_ordinal == 0 {
17214                return Ok(());
17215            }
17216            depth.increment()?;
17217            let envelope_size = 8;
17218            let bytes_len = max_ordinal as usize * envelope_size;
17219            #[allow(unused_variables)]
17220            let offset = encoder.out_of_line_offset(bytes_len);
17221            let mut _prev_end_offset: usize = 0;
17222            if 1 > max_ordinal {
17223                return Ok(());
17224            }
17225
17226            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17227            // are envelope_size bytes.
17228            let cur_offset: usize = (1 - 1) * envelope_size;
17229
17230            // Zero reserved fields.
17231            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17232
17233            // Safety:
17234            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17235            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17236            //   envelope_size bytes, there is always sufficient room.
17237            fidl::encoding::encode_in_envelope_optional::<
17238                LoadUrlReason,
17239                fidl::encoding::DefaultFuchsiaResourceDialect,
17240            >(
17241                self.type_.as_ref().map(<LoadUrlReason as fidl::encoding::ValueTypeMarker>::borrow),
17242                encoder,
17243                offset + cur_offset,
17244                depth,
17245            )?;
17246
17247            _prev_end_offset = cur_offset + envelope_size;
17248            if 2 > max_ordinal {
17249                return Ok(());
17250            }
17251
17252            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17253            // are envelope_size bytes.
17254            let cur_offset: usize = (2 - 1) * envelope_size;
17255
17256            // Zero reserved fields.
17257            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17258
17259            // Safety:
17260            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17261            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17262            //   envelope_size bytes, there is always sufficient room.
17263            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<65536>, fidl::encoding::DefaultFuchsiaResourceDialect>(
17264            self.referrer_url.as_ref().map(<fidl::encoding::BoundedString<65536> as fidl::encoding::ValueTypeMarker>::borrow),
17265            encoder, offset + cur_offset, depth
17266        )?;
17267
17268            _prev_end_offset = cur_offset + envelope_size;
17269            if 3 > max_ordinal {
17270                return Ok(());
17271            }
17272
17273            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17274            // are envelope_size bytes.
17275            let cur_offset: usize = (3 - 1) * envelope_size;
17276
17277            // Zero reserved fields.
17278            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17279
17280            // Safety:
17281            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17282            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17283            //   envelope_size bytes, there is always sufficient room.
17284            fidl::encoding::encode_in_envelope_optional::<
17285                bool,
17286                fidl::encoding::DefaultFuchsiaResourceDialect,
17287            >(
17288                self.was_user_activated
17289                    .as_ref()
17290                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
17291                encoder,
17292                offset + cur_offset,
17293                depth,
17294            )?;
17295
17296            _prev_end_offset = cur_offset + envelope_size;
17297            if 4 > max_ordinal {
17298                return Ok(());
17299            }
17300
17301            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17302            // are envelope_size bytes.
17303            let cur_offset: usize = (4 - 1) * envelope_size;
17304
17305            // Zero reserved fields.
17306            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17307
17308            // Safety:
17309            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17310            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17311            //   envelope_size bytes, there is always sufficient room.
17312            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl_fuchsia_net_http::Header>, fidl::encoding::DefaultFuchsiaResourceDialect>(
17313            self.headers.as_ref().map(<fidl::encoding::UnboundedVector<fidl_fuchsia_net_http::Header> as fidl::encoding::ValueTypeMarker>::borrow),
17314            encoder, offset + cur_offset, depth
17315        )?;
17316
17317            _prev_end_offset = cur_offset + envelope_size;
17318
17319            Ok(())
17320        }
17321    }
17322
17323    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for LoadUrlParams {
17324        #[inline(always)]
17325        fn new_empty() -> Self {
17326            Self::default()
17327        }
17328
17329        unsafe fn decode(
17330            &mut self,
17331            decoder: &mut fidl::encoding::Decoder<
17332                '_,
17333                fidl::encoding::DefaultFuchsiaResourceDialect,
17334            >,
17335            offset: usize,
17336            mut depth: fidl::encoding::Depth,
17337        ) -> fidl::Result<()> {
17338            decoder.debug_check_bounds::<Self>(offset);
17339            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
17340                None => return Err(fidl::Error::NotNullable),
17341                Some(len) => len,
17342            };
17343            // Calling decoder.out_of_line_offset(0) is not allowed.
17344            if len == 0 {
17345                return Ok(());
17346            };
17347            depth.increment()?;
17348            let envelope_size = 8;
17349            let bytes_len = len * envelope_size;
17350            let offset = decoder.out_of_line_offset(bytes_len)?;
17351            // Decode the envelope for each type.
17352            let mut _next_ordinal_to_read = 0;
17353            let mut next_offset = offset;
17354            let end_offset = offset + bytes_len;
17355            _next_ordinal_to_read += 1;
17356            if next_offset >= end_offset {
17357                return Ok(());
17358            }
17359
17360            // Decode unknown envelopes for gaps in ordinals.
17361            while _next_ordinal_to_read < 1 {
17362                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17363                _next_ordinal_to_read += 1;
17364                next_offset += envelope_size;
17365            }
17366
17367            let next_out_of_line = decoder.next_out_of_line();
17368            let handles_before = decoder.remaining_handles();
17369            if let Some((inlined, num_bytes, num_handles)) =
17370                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17371            {
17372                let member_inline_size =
17373                    <LoadUrlReason as fidl::encoding::TypeMarker>::inline_size(decoder.context);
17374                if inlined != (member_inline_size <= 4) {
17375                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17376                }
17377                let inner_offset;
17378                let mut inner_depth = depth.clone();
17379                if inlined {
17380                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17381                    inner_offset = next_offset;
17382                } else {
17383                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17384                    inner_depth.increment()?;
17385                }
17386                let val_ref = self.type_.get_or_insert_with(|| {
17387                    fidl::new_empty!(LoadUrlReason, fidl::encoding::DefaultFuchsiaResourceDialect)
17388                });
17389                fidl::decode!(
17390                    LoadUrlReason,
17391                    fidl::encoding::DefaultFuchsiaResourceDialect,
17392                    val_ref,
17393                    decoder,
17394                    inner_offset,
17395                    inner_depth
17396                )?;
17397                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17398                {
17399                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17400                }
17401                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17402                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17403                }
17404            }
17405
17406            next_offset += envelope_size;
17407            _next_ordinal_to_read += 1;
17408            if next_offset >= end_offset {
17409                return Ok(());
17410            }
17411
17412            // Decode unknown envelopes for gaps in ordinals.
17413            while _next_ordinal_to_read < 2 {
17414                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17415                _next_ordinal_to_read += 1;
17416                next_offset += envelope_size;
17417            }
17418
17419            let next_out_of_line = decoder.next_out_of_line();
17420            let handles_before = decoder.remaining_handles();
17421            if let Some((inlined, num_bytes, num_handles)) =
17422                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17423            {
17424                let member_inline_size = <fidl::encoding::BoundedString<65536> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
17425                if inlined != (member_inline_size <= 4) {
17426                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17427                }
17428                let inner_offset;
17429                let mut inner_depth = depth.clone();
17430                if inlined {
17431                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17432                    inner_offset = next_offset;
17433                } else {
17434                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17435                    inner_depth.increment()?;
17436                }
17437                let val_ref = self.referrer_url.get_or_insert_with(|| {
17438                    fidl::new_empty!(
17439                        fidl::encoding::BoundedString<65536>,
17440                        fidl::encoding::DefaultFuchsiaResourceDialect
17441                    )
17442                });
17443                fidl::decode!(
17444                    fidl::encoding::BoundedString<65536>,
17445                    fidl::encoding::DefaultFuchsiaResourceDialect,
17446                    val_ref,
17447                    decoder,
17448                    inner_offset,
17449                    inner_depth
17450                )?;
17451                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17452                {
17453                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17454                }
17455                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17456                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17457                }
17458            }
17459
17460            next_offset += envelope_size;
17461            _next_ordinal_to_read += 1;
17462            if next_offset >= end_offset {
17463                return Ok(());
17464            }
17465
17466            // Decode unknown envelopes for gaps in ordinals.
17467            while _next_ordinal_to_read < 3 {
17468                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17469                _next_ordinal_to_read += 1;
17470                next_offset += envelope_size;
17471            }
17472
17473            let next_out_of_line = decoder.next_out_of_line();
17474            let handles_before = decoder.remaining_handles();
17475            if let Some((inlined, num_bytes, num_handles)) =
17476                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17477            {
17478                let member_inline_size =
17479                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
17480                if inlined != (member_inline_size <= 4) {
17481                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17482                }
17483                let inner_offset;
17484                let mut inner_depth = depth.clone();
17485                if inlined {
17486                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17487                    inner_offset = next_offset;
17488                } else {
17489                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17490                    inner_depth.increment()?;
17491                }
17492                let val_ref = self.was_user_activated.get_or_insert_with(|| {
17493                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
17494                });
17495                fidl::decode!(
17496                    bool,
17497                    fidl::encoding::DefaultFuchsiaResourceDialect,
17498                    val_ref,
17499                    decoder,
17500                    inner_offset,
17501                    inner_depth
17502                )?;
17503                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17504                {
17505                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17506                }
17507                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17508                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17509                }
17510            }
17511
17512            next_offset += envelope_size;
17513            _next_ordinal_to_read += 1;
17514            if next_offset >= end_offset {
17515                return Ok(());
17516            }
17517
17518            // Decode unknown envelopes for gaps in ordinals.
17519            while _next_ordinal_to_read < 4 {
17520                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17521                _next_ordinal_to_read += 1;
17522                next_offset += envelope_size;
17523            }
17524
17525            let next_out_of_line = decoder.next_out_of_line();
17526            let handles_before = decoder.remaining_handles();
17527            if let Some((inlined, num_bytes, num_handles)) =
17528                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17529            {
17530                let member_inline_size = <fidl::encoding::UnboundedVector<
17531                    fidl_fuchsia_net_http::Header,
17532                > as fidl::encoding::TypeMarker>::inline_size(
17533                    decoder.context
17534                );
17535                if inlined != (member_inline_size <= 4) {
17536                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17537                }
17538                let inner_offset;
17539                let mut inner_depth = depth.clone();
17540                if inlined {
17541                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17542                    inner_offset = next_offset;
17543                } else {
17544                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17545                    inner_depth.increment()?;
17546                }
17547                let val_ref = self.headers.get_or_insert_with(|| {
17548                    fidl::new_empty!(
17549                        fidl::encoding::UnboundedVector<fidl_fuchsia_net_http::Header>,
17550                        fidl::encoding::DefaultFuchsiaResourceDialect
17551                    )
17552                });
17553                fidl::decode!(
17554                    fidl::encoding::UnboundedVector<fidl_fuchsia_net_http::Header>,
17555                    fidl::encoding::DefaultFuchsiaResourceDialect,
17556                    val_ref,
17557                    decoder,
17558                    inner_offset,
17559                    inner_depth
17560                )?;
17561                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17562                {
17563                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17564                }
17565                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17566                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17567                }
17568            }
17569
17570            next_offset += envelope_size;
17571
17572            // Decode the remaining unknown envelopes.
17573            while next_offset < end_offset {
17574                _next_ordinal_to_read += 1;
17575                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17576                next_offset += envelope_size;
17577            }
17578
17579            Ok(())
17580        }
17581    }
17582
17583    impl NavigationState {
17584        #[inline(always)]
17585        fn max_ordinal_present(&self) -> u64 {
17586            if let Some(_) = self.error_detail {
17587                return 8;
17588            }
17589            if let Some(_) = self.favicon {
17590                return 7;
17591            }
17592            if let Some(_) = self.is_main_document_loaded {
17593                return 6;
17594            }
17595            if let Some(_) = self.can_go_back {
17596                return 5;
17597            }
17598            if let Some(_) = self.can_go_forward {
17599                return 4;
17600            }
17601            if let Some(_) = self.page_type {
17602                return 3;
17603            }
17604            if let Some(_) = self.title {
17605                return 2;
17606            }
17607            if let Some(_) = self.url {
17608                return 1;
17609            }
17610            0
17611        }
17612    }
17613
17614    impl fidl::encoding::ResourceTypeMarker for NavigationState {
17615        type Borrowed<'a> = &'a mut Self;
17616        fn take_or_borrow<'a>(
17617            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
17618        ) -> Self::Borrowed<'a> {
17619            value
17620        }
17621    }
17622
17623    unsafe impl fidl::encoding::TypeMarker for NavigationState {
17624        type Owned = Self;
17625
17626        #[inline(always)]
17627        fn inline_align(_context: fidl::encoding::Context) -> usize {
17628            8
17629        }
17630
17631        #[inline(always)]
17632        fn inline_size(_context: fidl::encoding::Context) -> usize {
17633            16
17634        }
17635    }
17636
17637    unsafe impl
17638        fidl::encoding::Encode<NavigationState, fidl::encoding::DefaultFuchsiaResourceDialect>
17639        for &mut NavigationState
17640    {
17641        unsafe fn encode(
17642            self,
17643            encoder: &mut fidl::encoding::Encoder<
17644                '_,
17645                fidl::encoding::DefaultFuchsiaResourceDialect,
17646            >,
17647            offset: usize,
17648            mut depth: fidl::encoding::Depth,
17649        ) -> fidl::Result<()> {
17650            encoder.debug_check_bounds::<NavigationState>(offset);
17651            // Vector header
17652            let max_ordinal: u64 = self.max_ordinal_present();
17653            encoder.write_num(max_ordinal, offset);
17654            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
17655            // Calling encoder.out_of_line_offset(0) is not allowed.
17656            if max_ordinal == 0 {
17657                return Ok(());
17658            }
17659            depth.increment()?;
17660            let envelope_size = 8;
17661            let bytes_len = max_ordinal as usize * envelope_size;
17662            #[allow(unused_variables)]
17663            let offset = encoder.out_of_line_offset(bytes_len);
17664            let mut _prev_end_offset: usize = 0;
17665            if 1 > max_ordinal {
17666                return Ok(());
17667            }
17668
17669            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17670            // are envelope_size bytes.
17671            let cur_offset: usize = (1 - 1) * envelope_size;
17672
17673            // Zero reserved fields.
17674            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17675
17676            // Safety:
17677            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17678            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17679            //   envelope_size bytes, there is always sufficient room.
17680            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<65536>, fidl::encoding::DefaultFuchsiaResourceDialect>(
17681            self.url.as_ref().map(<fidl::encoding::BoundedString<65536> as fidl::encoding::ValueTypeMarker>::borrow),
17682            encoder, offset + cur_offset, depth
17683        )?;
17684
17685            _prev_end_offset = cur_offset + envelope_size;
17686            if 2 > max_ordinal {
17687                return Ok(());
17688            }
17689
17690            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17691            // are envelope_size bytes.
17692            let cur_offset: usize = (2 - 1) * envelope_size;
17693
17694            // Zero reserved fields.
17695            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17696
17697            // Safety:
17698            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17699            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17700            //   envelope_size bytes, there is always sufficient room.
17701            fidl::encoding::encode_in_envelope_optional::<
17702                fidl::encoding::UnboundedString,
17703                fidl::encoding::DefaultFuchsiaResourceDialect,
17704            >(
17705                self.title.as_ref().map(
17706                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
17707                ),
17708                encoder,
17709                offset + cur_offset,
17710                depth,
17711            )?;
17712
17713            _prev_end_offset = cur_offset + envelope_size;
17714            if 3 > max_ordinal {
17715                return Ok(());
17716            }
17717
17718            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17719            // are envelope_size bytes.
17720            let cur_offset: usize = (3 - 1) * envelope_size;
17721
17722            // Zero reserved fields.
17723            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17724
17725            // Safety:
17726            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17727            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17728            //   envelope_size bytes, there is always sufficient room.
17729            fidl::encoding::encode_in_envelope_optional::<
17730                PageType,
17731                fidl::encoding::DefaultFuchsiaResourceDialect,
17732            >(
17733                self.page_type.as_ref().map(<PageType as fidl::encoding::ValueTypeMarker>::borrow),
17734                encoder,
17735                offset + cur_offset,
17736                depth,
17737            )?;
17738
17739            _prev_end_offset = cur_offset + envelope_size;
17740            if 4 > max_ordinal {
17741                return Ok(());
17742            }
17743
17744            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17745            // are envelope_size bytes.
17746            let cur_offset: usize = (4 - 1) * envelope_size;
17747
17748            // Zero reserved fields.
17749            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17750
17751            // Safety:
17752            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17753            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17754            //   envelope_size bytes, there is always sufficient room.
17755            fidl::encoding::encode_in_envelope_optional::<
17756                bool,
17757                fidl::encoding::DefaultFuchsiaResourceDialect,
17758            >(
17759                self.can_go_forward.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
17760                encoder,
17761                offset + cur_offset,
17762                depth,
17763            )?;
17764
17765            _prev_end_offset = cur_offset + envelope_size;
17766            if 5 > max_ordinal {
17767                return Ok(());
17768            }
17769
17770            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17771            // are envelope_size bytes.
17772            let cur_offset: usize = (5 - 1) * envelope_size;
17773
17774            // Zero reserved fields.
17775            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17776
17777            // Safety:
17778            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17779            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17780            //   envelope_size bytes, there is always sufficient room.
17781            fidl::encoding::encode_in_envelope_optional::<
17782                bool,
17783                fidl::encoding::DefaultFuchsiaResourceDialect,
17784            >(
17785                self.can_go_back.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
17786                encoder,
17787                offset + cur_offset,
17788                depth,
17789            )?;
17790
17791            _prev_end_offset = cur_offset + envelope_size;
17792            if 6 > max_ordinal {
17793                return Ok(());
17794            }
17795
17796            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17797            // are envelope_size bytes.
17798            let cur_offset: usize = (6 - 1) * envelope_size;
17799
17800            // Zero reserved fields.
17801            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17802
17803            // Safety:
17804            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17805            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17806            //   envelope_size bytes, there is always sufficient room.
17807            fidl::encoding::encode_in_envelope_optional::<
17808                bool,
17809                fidl::encoding::DefaultFuchsiaResourceDialect,
17810            >(
17811                self.is_main_document_loaded
17812                    .as_ref()
17813                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
17814                encoder,
17815                offset + cur_offset,
17816                depth,
17817            )?;
17818
17819            _prev_end_offset = cur_offset + envelope_size;
17820            if 7 > max_ordinal {
17821                return Ok(());
17822            }
17823
17824            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17825            // are envelope_size bytes.
17826            let cur_offset: usize = (7 - 1) * envelope_size;
17827
17828            // Zero reserved fields.
17829            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17830
17831            // Safety:
17832            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17833            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17834            //   envelope_size bytes, there is always sufficient room.
17835            fidl::encoding::encode_in_envelope_optional::<
17836                Favicon,
17837                fidl::encoding::DefaultFuchsiaResourceDialect,
17838            >(
17839                self.favicon
17840                    .as_mut()
17841                    .map(<Favicon as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
17842                encoder,
17843                offset + cur_offset,
17844                depth,
17845            )?;
17846
17847            _prev_end_offset = cur_offset + envelope_size;
17848            if 8 > max_ordinal {
17849                return Ok(());
17850            }
17851
17852            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17853            // are envelope_size bytes.
17854            let cur_offset: usize = (8 - 1) * envelope_size;
17855
17856            // Zero reserved fields.
17857            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17858
17859            // Safety:
17860            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17861            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17862            //   envelope_size bytes, there is always sufficient room.
17863            fidl::encoding::encode_in_envelope_optional::<
17864                ErrorDetail,
17865                fidl::encoding::DefaultFuchsiaResourceDialect,
17866            >(
17867                self.error_detail
17868                    .as_ref()
17869                    .map(<ErrorDetail as fidl::encoding::ValueTypeMarker>::borrow),
17870                encoder,
17871                offset + cur_offset,
17872                depth,
17873            )?;
17874
17875            _prev_end_offset = cur_offset + envelope_size;
17876
17877            Ok(())
17878        }
17879    }
17880
17881    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
17882        for NavigationState
17883    {
17884        #[inline(always)]
17885        fn new_empty() -> Self {
17886            Self::default()
17887        }
17888
17889        unsafe fn decode(
17890            &mut self,
17891            decoder: &mut fidl::encoding::Decoder<
17892                '_,
17893                fidl::encoding::DefaultFuchsiaResourceDialect,
17894            >,
17895            offset: usize,
17896            mut depth: fidl::encoding::Depth,
17897        ) -> fidl::Result<()> {
17898            decoder.debug_check_bounds::<Self>(offset);
17899            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
17900                None => return Err(fidl::Error::NotNullable),
17901                Some(len) => len,
17902            };
17903            // Calling decoder.out_of_line_offset(0) is not allowed.
17904            if len == 0 {
17905                return Ok(());
17906            };
17907            depth.increment()?;
17908            let envelope_size = 8;
17909            let bytes_len = len * envelope_size;
17910            let offset = decoder.out_of_line_offset(bytes_len)?;
17911            // Decode the envelope for each type.
17912            let mut _next_ordinal_to_read = 0;
17913            let mut next_offset = offset;
17914            let end_offset = offset + bytes_len;
17915            _next_ordinal_to_read += 1;
17916            if next_offset >= end_offset {
17917                return Ok(());
17918            }
17919
17920            // Decode unknown envelopes for gaps in ordinals.
17921            while _next_ordinal_to_read < 1 {
17922                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17923                _next_ordinal_to_read += 1;
17924                next_offset += envelope_size;
17925            }
17926
17927            let next_out_of_line = decoder.next_out_of_line();
17928            let handles_before = decoder.remaining_handles();
17929            if let Some((inlined, num_bytes, num_handles)) =
17930                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17931            {
17932                let member_inline_size = <fidl::encoding::BoundedString<65536> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
17933                if inlined != (member_inline_size <= 4) {
17934                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17935                }
17936                let inner_offset;
17937                let mut inner_depth = depth.clone();
17938                if inlined {
17939                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17940                    inner_offset = next_offset;
17941                } else {
17942                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17943                    inner_depth.increment()?;
17944                }
17945                let val_ref = self.url.get_or_insert_with(|| {
17946                    fidl::new_empty!(
17947                        fidl::encoding::BoundedString<65536>,
17948                        fidl::encoding::DefaultFuchsiaResourceDialect
17949                    )
17950                });
17951                fidl::decode!(
17952                    fidl::encoding::BoundedString<65536>,
17953                    fidl::encoding::DefaultFuchsiaResourceDialect,
17954                    val_ref,
17955                    decoder,
17956                    inner_offset,
17957                    inner_depth
17958                )?;
17959                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17960                {
17961                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17962                }
17963                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17964                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17965                }
17966            }
17967
17968            next_offset += envelope_size;
17969            _next_ordinal_to_read += 1;
17970            if next_offset >= end_offset {
17971                return Ok(());
17972            }
17973
17974            // Decode unknown envelopes for gaps in ordinals.
17975            while _next_ordinal_to_read < 2 {
17976                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17977                _next_ordinal_to_read += 1;
17978                next_offset += envelope_size;
17979            }
17980
17981            let next_out_of_line = decoder.next_out_of_line();
17982            let handles_before = decoder.remaining_handles();
17983            if let Some((inlined, num_bytes, num_handles)) =
17984                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17985            {
17986                let member_inline_size =
17987                    <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
17988                        decoder.context,
17989                    );
17990                if inlined != (member_inline_size <= 4) {
17991                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17992                }
17993                let inner_offset;
17994                let mut inner_depth = depth.clone();
17995                if inlined {
17996                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17997                    inner_offset = next_offset;
17998                } else {
17999                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18000                    inner_depth.increment()?;
18001                }
18002                let val_ref = self.title.get_or_insert_with(|| {
18003                    fidl::new_empty!(
18004                        fidl::encoding::UnboundedString,
18005                        fidl::encoding::DefaultFuchsiaResourceDialect
18006                    )
18007                });
18008                fidl::decode!(
18009                    fidl::encoding::UnboundedString,
18010                    fidl::encoding::DefaultFuchsiaResourceDialect,
18011                    val_ref,
18012                    decoder,
18013                    inner_offset,
18014                    inner_depth
18015                )?;
18016                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18017                {
18018                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18019                }
18020                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18021                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18022                }
18023            }
18024
18025            next_offset += envelope_size;
18026            _next_ordinal_to_read += 1;
18027            if next_offset >= end_offset {
18028                return Ok(());
18029            }
18030
18031            // Decode unknown envelopes for gaps in ordinals.
18032            while _next_ordinal_to_read < 3 {
18033                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18034                _next_ordinal_to_read += 1;
18035                next_offset += envelope_size;
18036            }
18037
18038            let next_out_of_line = decoder.next_out_of_line();
18039            let handles_before = decoder.remaining_handles();
18040            if let Some((inlined, num_bytes, num_handles)) =
18041                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18042            {
18043                let member_inline_size =
18044                    <PageType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18045                if inlined != (member_inline_size <= 4) {
18046                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18047                }
18048                let inner_offset;
18049                let mut inner_depth = depth.clone();
18050                if inlined {
18051                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18052                    inner_offset = next_offset;
18053                } else {
18054                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18055                    inner_depth.increment()?;
18056                }
18057                let val_ref = self.page_type.get_or_insert_with(|| {
18058                    fidl::new_empty!(PageType, fidl::encoding::DefaultFuchsiaResourceDialect)
18059                });
18060                fidl::decode!(
18061                    PageType,
18062                    fidl::encoding::DefaultFuchsiaResourceDialect,
18063                    val_ref,
18064                    decoder,
18065                    inner_offset,
18066                    inner_depth
18067                )?;
18068                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18069                {
18070                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18071                }
18072                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18073                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18074                }
18075            }
18076
18077            next_offset += envelope_size;
18078            _next_ordinal_to_read += 1;
18079            if next_offset >= end_offset {
18080                return Ok(());
18081            }
18082
18083            // Decode unknown envelopes for gaps in ordinals.
18084            while _next_ordinal_to_read < 4 {
18085                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18086                _next_ordinal_to_read += 1;
18087                next_offset += envelope_size;
18088            }
18089
18090            let next_out_of_line = decoder.next_out_of_line();
18091            let handles_before = decoder.remaining_handles();
18092            if let Some((inlined, num_bytes, num_handles)) =
18093                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18094            {
18095                let member_inline_size =
18096                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18097                if inlined != (member_inline_size <= 4) {
18098                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18099                }
18100                let inner_offset;
18101                let mut inner_depth = depth.clone();
18102                if inlined {
18103                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18104                    inner_offset = next_offset;
18105                } else {
18106                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18107                    inner_depth.increment()?;
18108                }
18109                let val_ref = self.can_go_forward.get_or_insert_with(|| {
18110                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
18111                });
18112                fidl::decode!(
18113                    bool,
18114                    fidl::encoding::DefaultFuchsiaResourceDialect,
18115                    val_ref,
18116                    decoder,
18117                    inner_offset,
18118                    inner_depth
18119                )?;
18120                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18121                {
18122                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18123                }
18124                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18125                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18126                }
18127            }
18128
18129            next_offset += envelope_size;
18130            _next_ordinal_to_read += 1;
18131            if next_offset >= end_offset {
18132                return Ok(());
18133            }
18134
18135            // Decode unknown envelopes for gaps in ordinals.
18136            while _next_ordinal_to_read < 5 {
18137                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18138                _next_ordinal_to_read += 1;
18139                next_offset += envelope_size;
18140            }
18141
18142            let next_out_of_line = decoder.next_out_of_line();
18143            let handles_before = decoder.remaining_handles();
18144            if let Some((inlined, num_bytes, num_handles)) =
18145                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18146            {
18147                let member_inline_size =
18148                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18149                if inlined != (member_inline_size <= 4) {
18150                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18151                }
18152                let inner_offset;
18153                let mut inner_depth = depth.clone();
18154                if inlined {
18155                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18156                    inner_offset = next_offset;
18157                } else {
18158                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18159                    inner_depth.increment()?;
18160                }
18161                let val_ref = self.can_go_back.get_or_insert_with(|| {
18162                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
18163                });
18164                fidl::decode!(
18165                    bool,
18166                    fidl::encoding::DefaultFuchsiaResourceDialect,
18167                    val_ref,
18168                    decoder,
18169                    inner_offset,
18170                    inner_depth
18171                )?;
18172                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18173                {
18174                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18175                }
18176                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18177                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18178                }
18179            }
18180
18181            next_offset += envelope_size;
18182            _next_ordinal_to_read += 1;
18183            if next_offset >= end_offset {
18184                return Ok(());
18185            }
18186
18187            // Decode unknown envelopes for gaps in ordinals.
18188            while _next_ordinal_to_read < 6 {
18189                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18190                _next_ordinal_to_read += 1;
18191                next_offset += envelope_size;
18192            }
18193
18194            let next_out_of_line = decoder.next_out_of_line();
18195            let handles_before = decoder.remaining_handles();
18196            if let Some((inlined, num_bytes, num_handles)) =
18197                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18198            {
18199                let member_inline_size =
18200                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18201                if inlined != (member_inline_size <= 4) {
18202                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18203                }
18204                let inner_offset;
18205                let mut inner_depth = depth.clone();
18206                if inlined {
18207                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18208                    inner_offset = next_offset;
18209                } else {
18210                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18211                    inner_depth.increment()?;
18212                }
18213                let val_ref = self.is_main_document_loaded.get_or_insert_with(|| {
18214                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
18215                });
18216                fidl::decode!(
18217                    bool,
18218                    fidl::encoding::DefaultFuchsiaResourceDialect,
18219                    val_ref,
18220                    decoder,
18221                    inner_offset,
18222                    inner_depth
18223                )?;
18224                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18225                {
18226                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18227                }
18228                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18229                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18230                }
18231            }
18232
18233            next_offset += envelope_size;
18234            _next_ordinal_to_read += 1;
18235            if next_offset >= end_offset {
18236                return Ok(());
18237            }
18238
18239            // Decode unknown envelopes for gaps in ordinals.
18240            while _next_ordinal_to_read < 7 {
18241                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18242                _next_ordinal_to_read += 1;
18243                next_offset += envelope_size;
18244            }
18245
18246            let next_out_of_line = decoder.next_out_of_line();
18247            let handles_before = decoder.remaining_handles();
18248            if let Some((inlined, num_bytes, num_handles)) =
18249                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18250            {
18251                let member_inline_size =
18252                    <Favicon as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18253                if inlined != (member_inline_size <= 4) {
18254                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18255                }
18256                let inner_offset;
18257                let mut inner_depth = depth.clone();
18258                if inlined {
18259                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18260                    inner_offset = next_offset;
18261                } else {
18262                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18263                    inner_depth.increment()?;
18264                }
18265                let val_ref = self.favicon.get_or_insert_with(|| {
18266                    fidl::new_empty!(Favicon, fidl::encoding::DefaultFuchsiaResourceDialect)
18267                });
18268                fidl::decode!(
18269                    Favicon,
18270                    fidl::encoding::DefaultFuchsiaResourceDialect,
18271                    val_ref,
18272                    decoder,
18273                    inner_offset,
18274                    inner_depth
18275                )?;
18276                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18277                {
18278                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18279                }
18280                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18281                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18282                }
18283            }
18284
18285            next_offset += envelope_size;
18286            _next_ordinal_to_read += 1;
18287            if next_offset >= end_offset {
18288                return Ok(());
18289            }
18290
18291            // Decode unknown envelopes for gaps in ordinals.
18292            while _next_ordinal_to_read < 8 {
18293                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18294                _next_ordinal_to_read += 1;
18295                next_offset += envelope_size;
18296            }
18297
18298            let next_out_of_line = decoder.next_out_of_line();
18299            let handles_before = decoder.remaining_handles();
18300            if let Some((inlined, num_bytes, num_handles)) =
18301                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18302            {
18303                let member_inline_size =
18304                    <ErrorDetail as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18305                if inlined != (member_inline_size <= 4) {
18306                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18307                }
18308                let inner_offset;
18309                let mut inner_depth = depth.clone();
18310                if inlined {
18311                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18312                    inner_offset = next_offset;
18313                } else {
18314                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18315                    inner_depth.increment()?;
18316                }
18317                let val_ref = self.error_detail.get_or_insert_with(|| {
18318                    fidl::new_empty!(ErrorDetail, fidl::encoding::DefaultFuchsiaResourceDialect)
18319                });
18320                fidl::decode!(
18321                    ErrorDetail,
18322                    fidl::encoding::DefaultFuchsiaResourceDialect,
18323                    val_ref,
18324                    decoder,
18325                    inner_offset,
18326                    inner_depth
18327                )?;
18328                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18329                {
18330                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18331                }
18332                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18333                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18334                }
18335            }
18336
18337            next_offset += envelope_size;
18338
18339            // Decode the remaining unknown envelopes.
18340            while next_offset < end_offset {
18341                _next_ordinal_to_read += 1;
18342                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18343                next_offset += envelope_size;
18344            }
18345
18346            Ok(())
18347        }
18348    }
18349
18350    impl PopupFrameCreationInfo {
18351        #[inline(always)]
18352        fn max_ordinal_present(&self) -> u64 {
18353            if let Some(_) = self.initiated_by_user {
18354                return 2;
18355            }
18356            if let Some(_) = self.initial_url {
18357                return 1;
18358            }
18359            0
18360        }
18361    }
18362
18363    impl fidl::encoding::ResourceTypeMarker for PopupFrameCreationInfo {
18364        type Borrowed<'a> = &'a mut Self;
18365        fn take_or_borrow<'a>(
18366            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
18367        ) -> Self::Borrowed<'a> {
18368            value
18369        }
18370    }
18371
18372    unsafe impl fidl::encoding::TypeMarker for PopupFrameCreationInfo {
18373        type Owned = Self;
18374
18375        #[inline(always)]
18376        fn inline_align(_context: fidl::encoding::Context) -> usize {
18377            8
18378        }
18379
18380        #[inline(always)]
18381        fn inline_size(_context: fidl::encoding::Context) -> usize {
18382            16
18383        }
18384    }
18385
18386    unsafe impl
18387        fidl::encoding::Encode<
18388            PopupFrameCreationInfo,
18389            fidl::encoding::DefaultFuchsiaResourceDialect,
18390        > for &mut PopupFrameCreationInfo
18391    {
18392        unsafe fn encode(
18393            self,
18394            encoder: &mut fidl::encoding::Encoder<
18395                '_,
18396                fidl::encoding::DefaultFuchsiaResourceDialect,
18397            >,
18398            offset: usize,
18399            mut depth: fidl::encoding::Depth,
18400        ) -> fidl::Result<()> {
18401            encoder.debug_check_bounds::<PopupFrameCreationInfo>(offset);
18402            // Vector header
18403            let max_ordinal: u64 = self.max_ordinal_present();
18404            encoder.write_num(max_ordinal, offset);
18405            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
18406            // Calling encoder.out_of_line_offset(0) is not allowed.
18407            if max_ordinal == 0 {
18408                return Ok(());
18409            }
18410            depth.increment()?;
18411            let envelope_size = 8;
18412            let bytes_len = max_ordinal as usize * envelope_size;
18413            #[allow(unused_variables)]
18414            let offset = encoder.out_of_line_offset(bytes_len);
18415            let mut _prev_end_offset: usize = 0;
18416            if 1 > max_ordinal {
18417                return Ok(());
18418            }
18419
18420            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
18421            // are envelope_size bytes.
18422            let cur_offset: usize = (1 - 1) * envelope_size;
18423
18424            // Zero reserved fields.
18425            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
18426
18427            // Safety:
18428            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
18429            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
18430            //   envelope_size bytes, there is always sufficient room.
18431            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<65536>, fidl::encoding::DefaultFuchsiaResourceDialect>(
18432            self.initial_url.as_ref().map(<fidl::encoding::BoundedString<65536> as fidl::encoding::ValueTypeMarker>::borrow),
18433            encoder, offset + cur_offset, depth
18434        )?;
18435
18436            _prev_end_offset = cur_offset + envelope_size;
18437            if 2 > max_ordinal {
18438                return Ok(());
18439            }
18440
18441            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
18442            // are envelope_size bytes.
18443            let cur_offset: usize = (2 - 1) * envelope_size;
18444
18445            // Zero reserved fields.
18446            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
18447
18448            // Safety:
18449            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
18450            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
18451            //   envelope_size bytes, there is always sufficient room.
18452            fidl::encoding::encode_in_envelope_optional::<
18453                bool,
18454                fidl::encoding::DefaultFuchsiaResourceDialect,
18455            >(
18456                self.initiated_by_user
18457                    .as_ref()
18458                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
18459                encoder,
18460                offset + cur_offset,
18461                depth,
18462            )?;
18463
18464            _prev_end_offset = cur_offset + envelope_size;
18465
18466            Ok(())
18467        }
18468    }
18469
18470    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
18471        for PopupFrameCreationInfo
18472    {
18473        #[inline(always)]
18474        fn new_empty() -> Self {
18475            Self::default()
18476        }
18477
18478        unsafe fn decode(
18479            &mut self,
18480            decoder: &mut fidl::encoding::Decoder<
18481                '_,
18482                fidl::encoding::DefaultFuchsiaResourceDialect,
18483            >,
18484            offset: usize,
18485            mut depth: fidl::encoding::Depth,
18486        ) -> fidl::Result<()> {
18487            decoder.debug_check_bounds::<Self>(offset);
18488            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
18489                None => return Err(fidl::Error::NotNullable),
18490                Some(len) => len,
18491            };
18492            // Calling decoder.out_of_line_offset(0) is not allowed.
18493            if len == 0 {
18494                return Ok(());
18495            };
18496            depth.increment()?;
18497            let envelope_size = 8;
18498            let bytes_len = len * envelope_size;
18499            let offset = decoder.out_of_line_offset(bytes_len)?;
18500            // Decode the envelope for each type.
18501            let mut _next_ordinal_to_read = 0;
18502            let mut next_offset = offset;
18503            let end_offset = offset + bytes_len;
18504            _next_ordinal_to_read += 1;
18505            if next_offset >= end_offset {
18506                return Ok(());
18507            }
18508
18509            // Decode unknown envelopes for gaps in ordinals.
18510            while _next_ordinal_to_read < 1 {
18511                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18512                _next_ordinal_to_read += 1;
18513                next_offset += envelope_size;
18514            }
18515
18516            let next_out_of_line = decoder.next_out_of_line();
18517            let handles_before = decoder.remaining_handles();
18518            if let Some((inlined, num_bytes, num_handles)) =
18519                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18520            {
18521                let member_inline_size = <fidl::encoding::BoundedString<65536> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18522                if inlined != (member_inline_size <= 4) {
18523                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18524                }
18525                let inner_offset;
18526                let mut inner_depth = depth.clone();
18527                if inlined {
18528                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18529                    inner_offset = next_offset;
18530                } else {
18531                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18532                    inner_depth.increment()?;
18533                }
18534                let val_ref = self.initial_url.get_or_insert_with(|| {
18535                    fidl::new_empty!(
18536                        fidl::encoding::BoundedString<65536>,
18537                        fidl::encoding::DefaultFuchsiaResourceDialect
18538                    )
18539                });
18540                fidl::decode!(
18541                    fidl::encoding::BoundedString<65536>,
18542                    fidl::encoding::DefaultFuchsiaResourceDialect,
18543                    val_ref,
18544                    decoder,
18545                    inner_offset,
18546                    inner_depth
18547                )?;
18548                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18549                {
18550                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18551                }
18552                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18553                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18554                }
18555            }
18556
18557            next_offset += envelope_size;
18558            _next_ordinal_to_read += 1;
18559            if next_offset >= end_offset {
18560                return Ok(());
18561            }
18562
18563            // Decode unknown envelopes for gaps in ordinals.
18564            while _next_ordinal_to_read < 2 {
18565                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18566                _next_ordinal_to_read += 1;
18567                next_offset += envelope_size;
18568            }
18569
18570            let next_out_of_line = decoder.next_out_of_line();
18571            let handles_before = decoder.remaining_handles();
18572            if let Some((inlined, num_bytes, num_handles)) =
18573                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18574            {
18575                let member_inline_size =
18576                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18577                if inlined != (member_inline_size <= 4) {
18578                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18579                }
18580                let inner_offset;
18581                let mut inner_depth = depth.clone();
18582                if inlined {
18583                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18584                    inner_offset = next_offset;
18585                } else {
18586                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18587                    inner_depth.increment()?;
18588                }
18589                let val_ref = self.initiated_by_user.get_or_insert_with(|| {
18590                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
18591                });
18592                fidl::decode!(
18593                    bool,
18594                    fidl::encoding::DefaultFuchsiaResourceDialect,
18595                    val_ref,
18596                    decoder,
18597                    inner_offset,
18598                    inner_depth
18599                )?;
18600                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18601                {
18602                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18603                }
18604                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18605                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18606                }
18607            }
18608
18609            next_offset += envelope_size;
18610
18611            // Decode the remaining unknown envelopes.
18612            while next_offset < end_offset {
18613                _next_ordinal_to_read += 1;
18614                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18615                next_offset += envelope_size;
18616            }
18617
18618            Ok(())
18619        }
18620    }
18621
18622    impl WebMessage {
18623        #[inline(always)]
18624        fn max_ordinal_present(&self) -> u64 {
18625            if let Some(_) = self.outgoing_transfer {
18626                return 3;
18627            }
18628            if let Some(_) = self.incoming_transfer {
18629                return 2;
18630            }
18631            if let Some(_) = self.data {
18632                return 1;
18633            }
18634            0
18635        }
18636    }
18637
18638    impl fidl::encoding::ResourceTypeMarker for WebMessage {
18639        type Borrowed<'a> = &'a mut Self;
18640        fn take_or_borrow<'a>(
18641            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
18642        ) -> Self::Borrowed<'a> {
18643            value
18644        }
18645    }
18646
18647    unsafe impl fidl::encoding::TypeMarker for WebMessage {
18648        type Owned = Self;
18649
18650        #[inline(always)]
18651        fn inline_align(_context: fidl::encoding::Context) -> usize {
18652            8
18653        }
18654
18655        #[inline(always)]
18656        fn inline_size(_context: fidl::encoding::Context) -> usize {
18657            16
18658        }
18659    }
18660
18661    unsafe impl fidl::encoding::Encode<WebMessage, fidl::encoding::DefaultFuchsiaResourceDialect>
18662        for &mut WebMessage
18663    {
18664        unsafe fn encode(
18665            self,
18666            encoder: &mut fidl::encoding::Encoder<
18667                '_,
18668                fidl::encoding::DefaultFuchsiaResourceDialect,
18669            >,
18670            offset: usize,
18671            mut depth: fidl::encoding::Depth,
18672        ) -> fidl::Result<()> {
18673            encoder.debug_check_bounds::<WebMessage>(offset);
18674            // Vector header
18675            let max_ordinal: u64 = self.max_ordinal_present();
18676            encoder.write_num(max_ordinal, offset);
18677            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
18678            // Calling encoder.out_of_line_offset(0) is not allowed.
18679            if max_ordinal == 0 {
18680                return Ok(());
18681            }
18682            depth.increment()?;
18683            let envelope_size = 8;
18684            let bytes_len = max_ordinal as usize * envelope_size;
18685            #[allow(unused_variables)]
18686            let offset = encoder.out_of_line_offset(bytes_len);
18687            let mut _prev_end_offset: usize = 0;
18688            if 1 > max_ordinal {
18689                return Ok(());
18690            }
18691
18692            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
18693            // are envelope_size bytes.
18694            let cur_offset: usize = (1 - 1) * envelope_size;
18695
18696            // Zero reserved fields.
18697            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
18698
18699            // Safety:
18700            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
18701            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
18702            //   envelope_size bytes, there is always sufficient room.
18703            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_mem::Buffer, fidl::encoding::DefaultFuchsiaResourceDialect>(
18704            self.data.as_mut().map(<fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
18705            encoder, offset + cur_offset, depth
18706        )?;
18707
18708            _prev_end_offset = cur_offset + envelope_size;
18709            if 2 > max_ordinal {
18710                return Ok(());
18711            }
18712
18713            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
18714            // are envelope_size bytes.
18715            let cur_offset: usize = (2 - 1) * envelope_size;
18716
18717            // Zero reserved fields.
18718            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
18719
18720            // Safety:
18721            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
18722            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
18723            //   envelope_size bytes, there is always sufficient room.
18724            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<IncomingTransferable>, fidl::encoding::DefaultFuchsiaResourceDialect>(
18725            self.incoming_transfer.as_mut().map(<fidl::encoding::UnboundedVector<IncomingTransferable> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
18726            encoder, offset + cur_offset, depth
18727        )?;
18728
18729            _prev_end_offset = cur_offset + envelope_size;
18730            if 3 > max_ordinal {
18731                return Ok(());
18732            }
18733
18734            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
18735            // are envelope_size bytes.
18736            let cur_offset: usize = (3 - 1) * envelope_size;
18737
18738            // Zero reserved fields.
18739            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
18740
18741            // Safety:
18742            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
18743            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
18744            //   envelope_size bytes, there is always sufficient room.
18745            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<OutgoingTransferable>, fidl::encoding::DefaultFuchsiaResourceDialect>(
18746            self.outgoing_transfer.as_mut().map(<fidl::encoding::UnboundedVector<OutgoingTransferable> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
18747            encoder, offset + cur_offset, depth
18748        )?;
18749
18750            _prev_end_offset = cur_offset + envelope_size;
18751
18752            Ok(())
18753        }
18754    }
18755
18756    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for WebMessage {
18757        #[inline(always)]
18758        fn new_empty() -> Self {
18759            Self::default()
18760        }
18761
18762        unsafe fn decode(
18763            &mut self,
18764            decoder: &mut fidl::encoding::Decoder<
18765                '_,
18766                fidl::encoding::DefaultFuchsiaResourceDialect,
18767            >,
18768            offset: usize,
18769            mut depth: fidl::encoding::Depth,
18770        ) -> fidl::Result<()> {
18771            decoder.debug_check_bounds::<Self>(offset);
18772            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
18773                None => return Err(fidl::Error::NotNullable),
18774                Some(len) => len,
18775            };
18776            // Calling decoder.out_of_line_offset(0) is not allowed.
18777            if len == 0 {
18778                return Ok(());
18779            };
18780            depth.increment()?;
18781            let envelope_size = 8;
18782            let bytes_len = len * envelope_size;
18783            let offset = decoder.out_of_line_offset(bytes_len)?;
18784            // Decode the envelope for each type.
18785            let mut _next_ordinal_to_read = 0;
18786            let mut next_offset = offset;
18787            let end_offset = offset + bytes_len;
18788            _next_ordinal_to_read += 1;
18789            if next_offset >= end_offset {
18790                return Ok(());
18791            }
18792
18793            // Decode unknown envelopes for gaps in ordinals.
18794            while _next_ordinal_to_read < 1 {
18795                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18796                _next_ordinal_to_read += 1;
18797                next_offset += envelope_size;
18798            }
18799
18800            let next_out_of_line = decoder.next_out_of_line();
18801            let handles_before = decoder.remaining_handles();
18802            if let Some((inlined, num_bytes, num_handles)) =
18803                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18804            {
18805                let member_inline_size =
18806                    <fidl_fuchsia_mem::Buffer as fidl::encoding::TypeMarker>::inline_size(
18807                        decoder.context,
18808                    );
18809                if inlined != (member_inline_size <= 4) {
18810                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18811                }
18812                let inner_offset;
18813                let mut inner_depth = depth.clone();
18814                if inlined {
18815                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18816                    inner_offset = next_offset;
18817                } else {
18818                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18819                    inner_depth.increment()?;
18820                }
18821                let val_ref = self.data.get_or_insert_with(|| {
18822                    fidl::new_empty!(
18823                        fidl_fuchsia_mem::Buffer,
18824                        fidl::encoding::DefaultFuchsiaResourceDialect
18825                    )
18826                });
18827                fidl::decode!(
18828                    fidl_fuchsia_mem::Buffer,
18829                    fidl::encoding::DefaultFuchsiaResourceDialect,
18830                    val_ref,
18831                    decoder,
18832                    inner_offset,
18833                    inner_depth
18834                )?;
18835                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18836                {
18837                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18838                }
18839                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18840                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18841                }
18842            }
18843
18844            next_offset += envelope_size;
18845            _next_ordinal_to_read += 1;
18846            if next_offset >= end_offset {
18847                return Ok(());
18848            }
18849
18850            // Decode unknown envelopes for gaps in ordinals.
18851            while _next_ordinal_to_read < 2 {
18852                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18853                _next_ordinal_to_read += 1;
18854                next_offset += envelope_size;
18855            }
18856
18857            let next_out_of_line = decoder.next_out_of_line();
18858            let handles_before = decoder.remaining_handles();
18859            if let Some((inlined, num_bytes, num_handles)) =
18860                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18861            {
18862                let member_inline_size = <fidl::encoding::UnboundedVector<IncomingTransferable> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18863                if inlined != (member_inline_size <= 4) {
18864                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18865                }
18866                let inner_offset;
18867                let mut inner_depth = depth.clone();
18868                if inlined {
18869                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18870                    inner_offset = next_offset;
18871                } else {
18872                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18873                    inner_depth.increment()?;
18874                }
18875                let val_ref = self.incoming_transfer.get_or_insert_with(|| {
18876                    fidl::new_empty!(
18877                        fidl::encoding::UnboundedVector<IncomingTransferable>,
18878                        fidl::encoding::DefaultFuchsiaResourceDialect
18879                    )
18880                });
18881                fidl::decode!(
18882                    fidl::encoding::UnboundedVector<IncomingTransferable>,
18883                    fidl::encoding::DefaultFuchsiaResourceDialect,
18884                    val_ref,
18885                    decoder,
18886                    inner_offset,
18887                    inner_depth
18888                )?;
18889                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18890                {
18891                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18892                }
18893                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18894                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18895                }
18896            }
18897
18898            next_offset += envelope_size;
18899            _next_ordinal_to_read += 1;
18900            if next_offset >= end_offset {
18901                return Ok(());
18902            }
18903
18904            // Decode unknown envelopes for gaps in ordinals.
18905            while _next_ordinal_to_read < 3 {
18906                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18907                _next_ordinal_to_read += 1;
18908                next_offset += envelope_size;
18909            }
18910
18911            let next_out_of_line = decoder.next_out_of_line();
18912            let handles_before = decoder.remaining_handles();
18913            if let Some((inlined, num_bytes, num_handles)) =
18914                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18915            {
18916                let member_inline_size = <fidl::encoding::UnboundedVector<OutgoingTransferable> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18917                if inlined != (member_inline_size <= 4) {
18918                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18919                }
18920                let inner_offset;
18921                let mut inner_depth = depth.clone();
18922                if inlined {
18923                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18924                    inner_offset = next_offset;
18925                } else {
18926                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18927                    inner_depth.increment()?;
18928                }
18929                let val_ref = self.outgoing_transfer.get_or_insert_with(|| {
18930                    fidl::new_empty!(
18931                        fidl::encoding::UnboundedVector<OutgoingTransferable>,
18932                        fidl::encoding::DefaultFuchsiaResourceDialect
18933                    )
18934                });
18935                fidl::decode!(
18936                    fidl::encoding::UnboundedVector<OutgoingTransferable>,
18937                    fidl::encoding::DefaultFuchsiaResourceDialect,
18938                    val_ref,
18939                    decoder,
18940                    inner_offset,
18941                    inner_depth
18942                )?;
18943                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18944                {
18945                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18946                }
18947                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18948                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18949                }
18950            }
18951
18952            next_offset += envelope_size;
18953
18954            // Decode the remaining unknown envelopes.
18955            while next_offset < end_offset {
18956                _next_ordinal_to_read += 1;
18957                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18958                next_offset += envelope_size;
18959            }
18960
18961            Ok(())
18962        }
18963    }
18964
18965    impl fidl::encoding::ResourceTypeMarker for IncomingTransferable {
18966        type Borrowed<'a> = &'a mut Self;
18967        fn take_or_borrow<'a>(
18968            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
18969        ) -> Self::Borrowed<'a> {
18970            value
18971        }
18972    }
18973
18974    unsafe impl fidl::encoding::TypeMarker for IncomingTransferable {
18975        type Owned = Self;
18976
18977        #[inline(always)]
18978        fn inline_align(_context: fidl::encoding::Context) -> usize {
18979            8
18980        }
18981
18982        #[inline(always)]
18983        fn inline_size(_context: fidl::encoding::Context) -> usize {
18984            16
18985        }
18986    }
18987
18988    unsafe impl
18989        fidl::encoding::Encode<IncomingTransferable, fidl::encoding::DefaultFuchsiaResourceDialect>
18990        for &mut IncomingTransferable
18991    {
18992        #[inline]
18993        unsafe fn encode(
18994            self,
18995            encoder: &mut fidl::encoding::Encoder<
18996                '_,
18997                fidl::encoding::DefaultFuchsiaResourceDialect,
18998            >,
18999            offset: usize,
19000            _depth: fidl::encoding::Depth,
19001        ) -> fidl::Result<()> {
19002            encoder.debug_check_bounds::<IncomingTransferable>(offset);
19003            encoder.write_num::<u64>(self.ordinal(), offset);
19004            match self {
19005            IncomingTransferable::MessagePort(ref mut val) => {
19006                fidl::encoding::encode_in_envelope::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<MessagePortMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
19007                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<MessagePortMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
19008                    encoder, offset + 8, _depth
19009                )
19010            }
19011            IncomingTransferable::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
19012        }
19013        }
19014    }
19015
19016    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
19017        for IncomingTransferable
19018    {
19019        #[inline(always)]
19020        fn new_empty() -> Self {
19021            Self::__SourceBreaking { unknown_ordinal: 0 }
19022        }
19023
19024        #[inline]
19025        unsafe fn decode(
19026            &mut self,
19027            decoder: &mut fidl::encoding::Decoder<
19028                '_,
19029                fidl::encoding::DefaultFuchsiaResourceDialect,
19030            >,
19031            offset: usize,
19032            mut depth: fidl::encoding::Depth,
19033        ) -> fidl::Result<()> {
19034            decoder.debug_check_bounds::<Self>(offset);
19035            #[allow(unused_variables)]
19036            let next_out_of_line = decoder.next_out_of_line();
19037            let handles_before = decoder.remaining_handles();
19038            let (ordinal, inlined, num_bytes, num_handles) =
19039                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
19040
19041            let member_inline_size = match ordinal {
19042            1 => <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<MessagePortMarker>> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
19043            0 => return Err(fidl::Error::UnknownUnionTag),
19044            _ => num_bytes as usize,
19045        };
19046
19047            if inlined != (member_inline_size <= 4) {
19048                return Err(fidl::Error::InvalidInlineBitInEnvelope);
19049            }
19050            let _inner_offset;
19051            if inlined {
19052                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
19053                _inner_offset = offset + 8;
19054            } else {
19055                depth.increment()?;
19056                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
19057            }
19058            match ordinal {
19059                1 => {
19060                    #[allow(irrefutable_let_patterns)]
19061                    if let IncomingTransferable::MessagePort(_) = self {
19062                        // Do nothing, read the value into the object
19063                    } else {
19064                        // Initialize `self` to the right variant
19065                        *self = IncomingTransferable::MessagePort(fidl::new_empty!(
19066                            fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<MessagePortMarker>>,
19067                            fidl::encoding::DefaultFuchsiaResourceDialect
19068                        ));
19069                    }
19070                    #[allow(irrefutable_let_patterns)]
19071                    if let IncomingTransferable::MessagePort(ref mut val) = self {
19072                        fidl::decode!(
19073                            fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<MessagePortMarker>>,
19074                            fidl::encoding::DefaultFuchsiaResourceDialect,
19075                            val,
19076                            decoder,
19077                            _inner_offset,
19078                            depth
19079                        )?;
19080                    } else {
19081                        unreachable!()
19082                    }
19083                }
19084                #[allow(deprecated)]
19085                ordinal => {
19086                    for _ in 0..num_handles {
19087                        decoder.drop_next_handle()?;
19088                    }
19089                    *self = IncomingTransferable::__SourceBreaking { unknown_ordinal: ordinal };
19090                }
19091            }
19092            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
19093                return Err(fidl::Error::InvalidNumBytesInEnvelope);
19094            }
19095            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
19096                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
19097            }
19098            Ok(())
19099        }
19100    }
19101
19102    impl fidl::encoding::ResourceTypeMarker for NavigationDecision {
19103        type Borrowed<'a> = &'a mut Self;
19104        fn take_or_borrow<'a>(
19105            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
19106        ) -> Self::Borrowed<'a> {
19107            value
19108        }
19109    }
19110
19111    unsafe impl fidl::encoding::TypeMarker for NavigationDecision {
19112        type Owned = Self;
19113
19114        #[inline(always)]
19115        fn inline_align(_context: fidl::encoding::Context) -> usize {
19116            8
19117        }
19118
19119        #[inline(always)]
19120        fn inline_size(_context: fidl::encoding::Context) -> usize {
19121            16
19122        }
19123    }
19124
19125    unsafe impl
19126        fidl::encoding::Encode<NavigationDecision, fidl::encoding::DefaultFuchsiaResourceDialect>
19127        for &mut NavigationDecision
19128    {
19129        #[inline]
19130        unsafe fn encode(
19131            self,
19132            encoder: &mut fidl::encoding::Encoder<
19133                '_,
19134                fidl::encoding::DefaultFuchsiaResourceDialect,
19135            >,
19136            offset: usize,
19137            _depth: fidl::encoding::Depth,
19138        ) -> fidl::Result<()> {
19139            encoder.debug_check_bounds::<NavigationDecision>(offset);
19140            encoder.write_num::<u64>(self.ordinal(), offset);
19141            match self {
19142                NavigationDecision::Proceed(ref val) => fidl::encoding::encode_in_envelope::<
19143                    NoArgumentsAction,
19144                    fidl::encoding::DefaultFuchsiaResourceDialect,
19145                >(
19146                    <NoArgumentsAction as fidl::encoding::ValueTypeMarker>::borrow(val),
19147                    encoder,
19148                    offset + 8,
19149                    _depth,
19150                ),
19151                NavigationDecision::Abort(ref val) => fidl::encoding::encode_in_envelope::<
19152                    NoArgumentsAction,
19153                    fidl::encoding::DefaultFuchsiaResourceDialect,
19154                >(
19155                    <NoArgumentsAction as fidl::encoding::ValueTypeMarker>::borrow(val),
19156                    encoder,
19157                    offset + 8,
19158                    _depth,
19159                ),
19160            }
19161        }
19162    }
19163
19164    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
19165        for NavigationDecision
19166    {
19167        #[inline(always)]
19168        fn new_empty() -> Self {
19169            Self::Proceed(fidl::new_empty!(
19170                NoArgumentsAction,
19171                fidl::encoding::DefaultFuchsiaResourceDialect
19172            ))
19173        }
19174
19175        #[inline]
19176        unsafe fn decode(
19177            &mut self,
19178            decoder: &mut fidl::encoding::Decoder<
19179                '_,
19180                fidl::encoding::DefaultFuchsiaResourceDialect,
19181            >,
19182            offset: usize,
19183            mut depth: fidl::encoding::Depth,
19184        ) -> fidl::Result<()> {
19185            decoder.debug_check_bounds::<Self>(offset);
19186            #[allow(unused_variables)]
19187            let next_out_of_line = decoder.next_out_of_line();
19188            let handles_before = decoder.remaining_handles();
19189            let (ordinal, inlined, num_bytes, num_handles) =
19190                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
19191
19192            let member_inline_size = match ordinal {
19193                1 => {
19194                    <NoArgumentsAction as fidl::encoding::TypeMarker>::inline_size(decoder.context)
19195                }
19196                2 => {
19197                    <NoArgumentsAction as fidl::encoding::TypeMarker>::inline_size(decoder.context)
19198                }
19199                _ => return Err(fidl::Error::UnknownUnionTag),
19200            };
19201
19202            if inlined != (member_inline_size <= 4) {
19203                return Err(fidl::Error::InvalidInlineBitInEnvelope);
19204            }
19205            let _inner_offset;
19206            if inlined {
19207                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
19208                _inner_offset = offset + 8;
19209            } else {
19210                depth.increment()?;
19211                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
19212            }
19213            match ordinal {
19214                1 => {
19215                    #[allow(irrefutable_let_patterns)]
19216                    if let NavigationDecision::Proceed(_) = self {
19217                        // Do nothing, read the value into the object
19218                    } else {
19219                        // Initialize `self` to the right variant
19220                        *self = NavigationDecision::Proceed(fidl::new_empty!(
19221                            NoArgumentsAction,
19222                            fidl::encoding::DefaultFuchsiaResourceDialect
19223                        ));
19224                    }
19225                    #[allow(irrefutable_let_patterns)]
19226                    if let NavigationDecision::Proceed(ref mut val) = self {
19227                        fidl::decode!(
19228                            NoArgumentsAction,
19229                            fidl::encoding::DefaultFuchsiaResourceDialect,
19230                            val,
19231                            decoder,
19232                            _inner_offset,
19233                            depth
19234                        )?;
19235                    } else {
19236                        unreachable!()
19237                    }
19238                }
19239                2 => {
19240                    #[allow(irrefutable_let_patterns)]
19241                    if let NavigationDecision::Abort(_) = self {
19242                        // Do nothing, read the value into the object
19243                    } else {
19244                        // Initialize `self` to the right variant
19245                        *self = NavigationDecision::Abort(fidl::new_empty!(
19246                            NoArgumentsAction,
19247                            fidl::encoding::DefaultFuchsiaResourceDialect
19248                        ));
19249                    }
19250                    #[allow(irrefutable_let_patterns)]
19251                    if let NavigationDecision::Abort(ref mut val) = self {
19252                        fidl::decode!(
19253                            NoArgumentsAction,
19254                            fidl::encoding::DefaultFuchsiaResourceDialect,
19255                            val,
19256                            decoder,
19257                            _inner_offset,
19258                            depth
19259                        )?;
19260                    } else {
19261                        unreachable!()
19262                    }
19263                }
19264                ordinal => panic!("unexpected ordinal {:?}", ordinal),
19265            }
19266            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
19267                return Err(fidl::Error::InvalidNumBytesInEnvelope);
19268            }
19269            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
19270                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
19271            }
19272            Ok(())
19273        }
19274    }
19275
19276    impl fidl::encoding::ResourceTypeMarker for OutgoingTransferable {
19277        type Borrowed<'a> = &'a mut Self;
19278        fn take_or_borrow<'a>(
19279            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
19280        ) -> Self::Borrowed<'a> {
19281            value
19282        }
19283    }
19284
19285    unsafe impl fidl::encoding::TypeMarker for OutgoingTransferable {
19286        type Owned = Self;
19287
19288        #[inline(always)]
19289        fn inline_align(_context: fidl::encoding::Context) -> usize {
19290            8
19291        }
19292
19293        #[inline(always)]
19294        fn inline_size(_context: fidl::encoding::Context) -> usize {
19295            16
19296        }
19297    }
19298
19299    unsafe impl
19300        fidl::encoding::Encode<OutgoingTransferable, fidl::encoding::DefaultFuchsiaResourceDialect>
19301        for &mut OutgoingTransferable
19302    {
19303        #[inline]
19304        unsafe fn encode(
19305            self,
19306            encoder: &mut fidl::encoding::Encoder<
19307                '_,
19308                fidl::encoding::DefaultFuchsiaResourceDialect,
19309            >,
19310            offset: usize,
19311            _depth: fidl::encoding::Depth,
19312        ) -> fidl::Result<()> {
19313            encoder.debug_check_bounds::<OutgoingTransferable>(offset);
19314            encoder.write_num::<u64>(self.ordinal(), offset);
19315            match self {
19316            OutgoingTransferable::MessagePort(ref mut val) => {
19317                fidl::encoding::encode_in_envelope::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MessagePortMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
19318                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MessagePortMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
19319                    encoder, offset + 8, _depth
19320                )
19321            }
19322            OutgoingTransferable::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
19323        }
19324        }
19325    }
19326
19327    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
19328        for OutgoingTransferable
19329    {
19330        #[inline(always)]
19331        fn new_empty() -> Self {
19332            Self::__SourceBreaking { unknown_ordinal: 0 }
19333        }
19334
19335        #[inline]
19336        unsafe fn decode(
19337            &mut self,
19338            decoder: &mut fidl::encoding::Decoder<
19339                '_,
19340                fidl::encoding::DefaultFuchsiaResourceDialect,
19341            >,
19342            offset: usize,
19343            mut depth: fidl::encoding::Depth,
19344        ) -> fidl::Result<()> {
19345            decoder.debug_check_bounds::<Self>(offset);
19346            #[allow(unused_variables)]
19347            let next_out_of_line = decoder.next_out_of_line();
19348            let handles_before = decoder.remaining_handles();
19349            let (ordinal, inlined, num_bytes, num_handles) =
19350                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
19351
19352            let member_inline_size = match ordinal {
19353            1 => <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MessagePortMarker>> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
19354            0 => return Err(fidl::Error::UnknownUnionTag),
19355            _ => num_bytes as usize,
19356        };
19357
19358            if inlined != (member_inline_size <= 4) {
19359                return Err(fidl::Error::InvalidInlineBitInEnvelope);
19360            }
19361            let _inner_offset;
19362            if inlined {
19363                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
19364                _inner_offset = offset + 8;
19365            } else {
19366                depth.increment()?;
19367                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
19368            }
19369            match ordinal {
19370                1 => {
19371                    #[allow(irrefutable_let_patterns)]
19372                    if let OutgoingTransferable::MessagePort(_) = self {
19373                        // Do nothing, read the value into the object
19374                    } else {
19375                        // Initialize `self` to the right variant
19376                        *self = OutgoingTransferable::MessagePort(fidl::new_empty!(
19377                            fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MessagePortMarker>>,
19378                            fidl::encoding::DefaultFuchsiaResourceDialect
19379                        ));
19380                    }
19381                    #[allow(irrefutable_let_patterns)]
19382                    if let OutgoingTransferable::MessagePort(ref mut val) = self {
19383                        fidl::decode!(
19384                            fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MessagePortMarker>>,
19385                            fidl::encoding::DefaultFuchsiaResourceDialect,
19386                            val,
19387                            decoder,
19388                            _inner_offset,
19389                            depth
19390                        )?;
19391                    } else {
19392                        unreachable!()
19393                    }
19394                }
19395                #[allow(deprecated)]
19396                ordinal => {
19397                    for _ in 0..num_handles {
19398                        decoder.drop_next_handle()?;
19399                    }
19400                    *self = OutgoingTransferable::__SourceBreaking { unknown_ordinal: ordinal };
19401                }
19402            }
19403            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
19404                return Err(fidl::Error::InvalidNumBytesInEnvelope);
19405            }
19406            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
19407                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
19408            }
19409            Ok(())
19410        }
19411    }
19412}