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#[derive(Debug, Clone)]
897pub struct ContextProxy {
898    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
899}
900
901impl fidl::endpoints::Proxy for ContextProxy {
902    type Protocol = ContextMarker;
903
904    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
905        Self::new(inner)
906    }
907
908    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
909        self.client.into_channel().map_err(|client| Self { client })
910    }
911
912    fn as_channel(&self) -> &::fidl::AsyncChannel {
913        self.client.as_channel()
914    }
915}
916
917impl ContextProxy {
918    /// Create a new Proxy for fuchsia.web/Context.
919    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
920        let protocol_name = <ContextMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
921        Self { client: fidl::client::Client::new(channel, protocol_name) }
922    }
923
924    /// Get a Stream of events from the remote end of the protocol.
925    ///
926    /// # Panics
927    ///
928    /// Panics if the event stream was already taken.
929    pub fn take_event_stream(&self) -> ContextEventStream {
930        ContextEventStream { event_receiver: self.client.take_event_receiver() }
931    }
932
933    /// Creates a new [`Frame`] under this [`Context`]. Destruction of a [`Context`] triggers the
934    /// destruction of all of its associated [`Frame`]. [`Frame`] can be transferred to another
935    /// component but cannot be shared across multiple components.
936    ///
937    /// - `frame`: An interface request that will be bound to the created [`Frame`].
938    pub fn r#create_frame(
939        &self,
940        mut frame: fidl::endpoints::ServerEnd<FrameMarker>,
941    ) -> Result<(), fidl::Error> {
942        ContextProxyInterface::r#create_frame(self, frame)
943    }
944
945    /// Similar to [`Context.CreateFrame`], with extra parameters.
946    ///
947    /// - `params`: The configuration used to create the [`Frame`].
948    ///   This method will fail with `ZX_ERR_INVALID_ARGS` if the table is not clonable.
949    /// - `frame`: An interface request that will be bound to the created [`Frame`].
950    pub fn r#create_frame_with_params(
951        &self,
952        mut params: CreateFrameParams,
953        mut frame: fidl::endpoints::ServerEnd<FrameMarker>,
954    ) -> Result<(), fidl::Error> {
955        ContextProxyInterface::r#create_frame_with_params(self, params, frame)
956    }
957
958    /// Used to observe cookies for sites hosted under this Context.
959    pub fn r#get_cookie_manager(
960        &self,
961        mut manager: fidl::endpoints::ServerEnd<CookieManagerMarker>,
962    ) -> Result<(), fidl::Error> {
963        ContextProxyInterface::r#get_cookie_manager(self, manager)
964    }
965
966    /// Waits until debugging is available on one or more Frames, and returns the DevTools port
967    /// number. Multiple calls may be queued to received the port number.
968    ///
969    /// If an error occurred, the [`ContextError`] will be set to this value:
970    /// - `REMOTE_DEBUGGING_PORT_NOT_OPENED`: `remote_debugging_port` was not set in
971    ///   [`CreateContextParams`] or the remote debugging service failed to start.
972    pub fn r#get_remote_debugging_port(
973        &self,
974    ) -> fidl::client::QueryResponseFut<
975        ContextGetRemoteDebuggingPortResult,
976        fidl::encoding::DefaultFuchsiaResourceDialect,
977    > {
978        ContextProxyInterface::r#get_remote_debugging_port(self)
979    }
980}
981
982impl ContextProxyInterface for ContextProxy {
983    fn r#create_frame(
984        &self,
985        mut frame: fidl::endpoints::ServerEnd<FrameMarker>,
986    ) -> Result<(), fidl::Error> {
987        self.client.send::<ContextCreateFrameRequest>(
988            (frame,),
989            0x5440a38db7cd7d8f,
990            fidl::encoding::DynamicFlags::empty(),
991        )
992    }
993
994    fn r#create_frame_with_params(
995        &self,
996        mut params: CreateFrameParams,
997        mut frame: fidl::endpoints::ServerEnd<FrameMarker>,
998    ) -> Result<(), fidl::Error> {
999        self.client.send::<ContextCreateFrameWithParamsRequest>(
1000            (&mut params, frame),
1001            0x2c968a330787be96,
1002            fidl::encoding::DynamicFlags::empty(),
1003        )
1004    }
1005
1006    fn r#get_cookie_manager(
1007        &self,
1008        mut manager: fidl::endpoints::ServerEnd<CookieManagerMarker>,
1009    ) -> Result<(), fidl::Error> {
1010        self.client.send::<ContextGetCookieManagerRequest>(
1011            (manager,),
1012            0x7396cda568e3fca,
1013            fidl::encoding::DynamicFlags::empty(),
1014        )
1015    }
1016
1017    type GetRemoteDebuggingPortResponseFut = fidl::client::QueryResponseFut<
1018        ContextGetRemoteDebuggingPortResult,
1019        fidl::encoding::DefaultFuchsiaResourceDialect,
1020    >;
1021    fn r#get_remote_debugging_port(&self) -> Self::GetRemoteDebuggingPortResponseFut {
1022        fn _decode(
1023            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1024        ) -> Result<ContextGetRemoteDebuggingPortResult, fidl::Error> {
1025            let _response = fidl::client::decode_transaction_body::<
1026                fidl::encoding::ResultType<ContextGetRemoteDebuggingPortResponse, ContextError>,
1027                fidl::encoding::DefaultFuchsiaResourceDialect,
1028                0x4ac6a26fe972f29,
1029            >(_buf?)?;
1030            Ok(_response.map(|x| x.port))
1031        }
1032        self.client.send_query_and_decode::<
1033            fidl::encoding::EmptyPayload,
1034            ContextGetRemoteDebuggingPortResult,
1035        >(
1036            (),
1037            0x4ac6a26fe972f29,
1038            fidl::encoding::DynamicFlags::empty(),
1039            _decode,
1040        )
1041    }
1042}
1043
1044pub struct ContextEventStream {
1045    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1046}
1047
1048impl std::marker::Unpin for ContextEventStream {}
1049
1050impl futures::stream::FusedStream for ContextEventStream {
1051    fn is_terminated(&self) -> bool {
1052        self.event_receiver.is_terminated()
1053    }
1054}
1055
1056impl futures::Stream for ContextEventStream {
1057    type Item = Result<ContextEvent, fidl::Error>;
1058
1059    fn poll_next(
1060        mut self: std::pin::Pin<&mut Self>,
1061        cx: &mut std::task::Context<'_>,
1062    ) -> std::task::Poll<Option<Self::Item>> {
1063        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1064            &mut self.event_receiver,
1065            cx
1066        )?) {
1067            Some(buf) => std::task::Poll::Ready(Some(ContextEvent::decode(buf))),
1068            None => std::task::Poll::Ready(None),
1069        }
1070    }
1071}
1072
1073#[derive(Debug)]
1074pub enum ContextEvent {}
1075
1076impl ContextEvent {
1077    /// Decodes a message buffer as a [`ContextEvent`].
1078    fn decode(
1079        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1080    ) -> Result<ContextEvent, fidl::Error> {
1081        let (bytes, _handles) = buf.split_mut();
1082        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1083        debug_assert_eq!(tx_header.tx_id, 0);
1084        match tx_header.ordinal {
1085            _ => Err(fidl::Error::UnknownOrdinal {
1086                ordinal: tx_header.ordinal,
1087                protocol_name: <ContextMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1088            }),
1089        }
1090    }
1091}
1092
1093/// A Stream of incoming requests for fuchsia.web/Context.
1094pub struct ContextRequestStream {
1095    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1096    is_terminated: bool,
1097}
1098
1099impl std::marker::Unpin for ContextRequestStream {}
1100
1101impl futures::stream::FusedStream for ContextRequestStream {
1102    fn is_terminated(&self) -> bool {
1103        self.is_terminated
1104    }
1105}
1106
1107impl fidl::endpoints::RequestStream for ContextRequestStream {
1108    type Protocol = ContextMarker;
1109    type ControlHandle = ContextControlHandle;
1110
1111    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1112        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1113    }
1114
1115    fn control_handle(&self) -> Self::ControlHandle {
1116        ContextControlHandle { inner: self.inner.clone() }
1117    }
1118
1119    fn into_inner(
1120        self,
1121    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1122    {
1123        (self.inner, self.is_terminated)
1124    }
1125
1126    fn from_inner(
1127        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1128        is_terminated: bool,
1129    ) -> Self {
1130        Self { inner, is_terminated }
1131    }
1132}
1133
1134impl futures::Stream for ContextRequestStream {
1135    type Item = Result<ContextRequest, fidl::Error>;
1136
1137    fn poll_next(
1138        mut self: std::pin::Pin<&mut Self>,
1139        cx: &mut std::task::Context<'_>,
1140    ) -> std::task::Poll<Option<Self::Item>> {
1141        let this = &mut *self;
1142        if this.inner.check_shutdown(cx) {
1143            this.is_terminated = true;
1144            return std::task::Poll::Ready(None);
1145        }
1146        if this.is_terminated {
1147            panic!("polled ContextRequestStream after completion");
1148        }
1149        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1150            |bytes, handles| {
1151                match this.inner.channel().read_etc(cx, bytes, handles) {
1152                    std::task::Poll::Ready(Ok(())) => {}
1153                    std::task::Poll::Pending => return std::task::Poll::Pending,
1154                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1155                        this.is_terminated = true;
1156                        return std::task::Poll::Ready(None);
1157                    }
1158                    std::task::Poll::Ready(Err(e)) => {
1159                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1160                            e.into(),
1161                        ))))
1162                    }
1163                }
1164
1165                // A message has been received from the channel
1166                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1167
1168                std::task::Poll::Ready(Some(match header.ordinal {
1169                    0x5440a38db7cd7d8f => {
1170                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1171                        let mut req = fidl::new_empty!(
1172                            ContextCreateFrameRequest,
1173                            fidl::encoding::DefaultFuchsiaResourceDialect
1174                        );
1175                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ContextCreateFrameRequest>(&header, _body_bytes, handles, &mut req)?;
1176                        let control_handle = ContextControlHandle { inner: this.inner.clone() };
1177                        Ok(ContextRequest::CreateFrame { frame: req.frame, control_handle })
1178                    }
1179                    0x2c968a330787be96 => {
1180                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1181                        let mut req = fidl::new_empty!(
1182                            ContextCreateFrameWithParamsRequest,
1183                            fidl::encoding::DefaultFuchsiaResourceDialect
1184                        );
1185                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ContextCreateFrameWithParamsRequest>(&header, _body_bytes, handles, &mut req)?;
1186                        let control_handle = ContextControlHandle { inner: this.inner.clone() };
1187                        Ok(ContextRequest::CreateFrameWithParams {
1188                            params: req.params,
1189                            frame: req.frame,
1190
1191                            control_handle,
1192                        })
1193                    }
1194                    0x7396cda568e3fca => {
1195                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1196                        let mut req = fidl::new_empty!(
1197                            ContextGetCookieManagerRequest,
1198                            fidl::encoding::DefaultFuchsiaResourceDialect
1199                        );
1200                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ContextGetCookieManagerRequest>(&header, _body_bytes, handles, &mut req)?;
1201                        let control_handle = ContextControlHandle { inner: this.inner.clone() };
1202                        Ok(ContextRequest::GetCookieManager {
1203                            manager: req.manager,
1204
1205                            control_handle,
1206                        })
1207                    }
1208                    0x4ac6a26fe972f29 => {
1209                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1210                        let mut req = fidl::new_empty!(
1211                            fidl::encoding::EmptyPayload,
1212                            fidl::encoding::DefaultFuchsiaResourceDialect
1213                        );
1214                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1215                        let control_handle = ContextControlHandle { inner: this.inner.clone() };
1216                        Ok(ContextRequest::GetRemoteDebuggingPort {
1217                            responder: ContextGetRemoteDebuggingPortResponder {
1218                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1219                                tx_id: header.tx_id,
1220                            },
1221                        })
1222                    }
1223                    _ => Err(fidl::Error::UnknownOrdinal {
1224                        ordinal: header.ordinal,
1225                        protocol_name:
1226                            <ContextMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1227                    }),
1228                }))
1229            },
1230        )
1231    }
1232}
1233
1234/// Manages browsing state (e.g. LocalStorage, cookies, etc) associated with a set of [`Frame`].
1235#[derive(Debug)]
1236pub enum ContextRequest {
1237    /// Creates a new [`Frame`] under this [`Context`]. Destruction of a [`Context`] triggers the
1238    /// destruction of all of its associated [`Frame`]. [`Frame`] can be transferred to another
1239    /// component but cannot be shared across multiple components.
1240    ///
1241    /// - `frame`: An interface request that will be bound to the created [`Frame`].
1242    CreateFrame {
1243        frame: fidl::endpoints::ServerEnd<FrameMarker>,
1244        control_handle: ContextControlHandle,
1245    },
1246    /// Similar to [`Context.CreateFrame`], with extra parameters.
1247    ///
1248    /// - `params`: The configuration used to create the [`Frame`].
1249    ///   This method will fail with `ZX_ERR_INVALID_ARGS` if the table is not clonable.
1250    /// - `frame`: An interface request that will be bound to the created [`Frame`].
1251    CreateFrameWithParams {
1252        params: CreateFrameParams,
1253        frame: fidl::endpoints::ServerEnd<FrameMarker>,
1254        control_handle: ContextControlHandle,
1255    },
1256    /// Used to observe cookies for sites hosted under this Context.
1257    GetCookieManager {
1258        manager: fidl::endpoints::ServerEnd<CookieManagerMarker>,
1259        control_handle: ContextControlHandle,
1260    },
1261    /// Waits until debugging is available on one or more Frames, and returns the DevTools port
1262    /// number. Multiple calls may be queued to received the port number.
1263    ///
1264    /// If an error occurred, the [`ContextError`] will be set to this value:
1265    /// - `REMOTE_DEBUGGING_PORT_NOT_OPENED`: `remote_debugging_port` was not set in
1266    ///   [`CreateContextParams`] or the remote debugging service failed to start.
1267    GetRemoteDebuggingPort { responder: ContextGetRemoteDebuggingPortResponder },
1268}
1269
1270impl ContextRequest {
1271    #[allow(irrefutable_let_patterns)]
1272    pub fn into_create_frame(
1273        self,
1274    ) -> Option<(fidl::endpoints::ServerEnd<FrameMarker>, ContextControlHandle)> {
1275        if let ContextRequest::CreateFrame { frame, control_handle } = self {
1276            Some((frame, control_handle))
1277        } else {
1278            None
1279        }
1280    }
1281
1282    #[allow(irrefutable_let_patterns)]
1283    pub fn into_create_frame_with_params(
1284        self,
1285    ) -> Option<(CreateFrameParams, fidl::endpoints::ServerEnd<FrameMarker>, ContextControlHandle)>
1286    {
1287        if let ContextRequest::CreateFrameWithParams { params, frame, control_handle } = self {
1288            Some((params, frame, control_handle))
1289        } else {
1290            None
1291        }
1292    }
1293
1294    #[allow(irrefutable_let_patterns)]
1295    pub fn into_get_cookie_manager(
1296        self,
1297    ) -> Option<(fidl::endpoints::ServerEnd<CookieManagerMarker>, ContextControlHandle)> {
1298        if let ContextRequest::GetCookieManager { manager, control_handle } = self {
1299            Some((manager, control_handle))
1300        } else {
1301            None
1302        }
1303    }
1304
1305    #[allow(irrefutable_let_patterns)]
1306    pub fn into_get_remote_debugging_port(
1307        self,
1308    ) -> Option<(ContextGetRemoteDebuggingPortResponder)> {
1309        if let ContextRequest::GetRemoteDebuggingPort { responder } = self {
1310            Some((responder))
1311        } else {
1312            None
1313        }
1314    }
1315
1316    /// Name of the method defined in FIDL
1317    pub fn method_name(&self) -> &'static str {
1318        match *self {
1319            ContextRequest::CreateFrame { .. } => "create_frame",
1320            ContextRequest::CreateFrameWithParams { .. } => "create_frame_with_params",
1321            ContextRequest::GetCookieManager { .. } => "get_cookie_manager",
1322            ContextRequest::GetRemoteDebuggingPort { .. } => "get_remote_debugging_port",
1323        }
1324    }
1325}
1326
1327#[derive(Debug, Clone)]
1328pub struct ContextControlHandle {
1329    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1330}
1331
1332impl fidl::endpoints::ControlHandle for ContextControlHandle {
1333    fn shutdown(&self) {
1334        self.inner.shutdown()
1335    }
1336    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1337        self.inner.shutdown_with_epitaph(status)
1338    }
1339
1340    fn is_closed(&self) -> bool {
1341        self.inner.channel().is_closed()
1342    }
1343    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1344        self.inner.channel().on_closed()
1345    }
1346
1347    #[cfg(target_os = "fuchsia")]
1348    fn signal_peer(
1349        &self,
1350        clear_mask: zx::Signals,
1351        set_mask: zx::Signals,
1352    ) -> Result<(), zx_status::Status> {
1353        use fidl::Peered;
1354        self.inner.channel().signal_peer(clear_mask, set_mask)
1355    }
1356}
1357
1358impl ContextControlHandle {}
1359
1360#[must_use = "FIDL methods require a response to be sent"]
1361#[derive(Debug)]
1362pub struct ContextGetRemoteDebuggingPortResponder {
1363    control_handle: std::mem::ManuallyDrop<ContextControlHandle>,
1364    tx_id: u32,
1365}
1366
1367/// Set the the channel to be shutdown (see [`ContextControlHandle::shutdown`])
1368/// if the responder is dropped without sending a response, so that the client
1369/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1370impl std::ops::Drop for ContextGetRemoteDebuggingPortResponder {
1371    fn drop(&mut self) {
1372        self.control_handle.shutdown();
1373        // Safety: drops once, never accessed again
1374        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1375    }
1376}
1377
1378impl fidl::endpoints::Responder for ContextGetRemoteDebuggingPortResponder {
1379    type ControlHandle = ContextControlHandle;
1380
1381    fn control_handle(&self) -> &ContextControlHandle {
1382        &self.control_handle
1383    }
1384
1385    fn drop_without_shutdown(mut self) {
1386        // Safety: drops once, never accessed again due to mem::forget
1387        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1388        // Prevent Drop from running (which would shut down the channel)
1389        std::mem::forget(self);
1390    }
1391}
1392
1393impl ContextGetRemoteDebuggingPortResponder {
1394    /// Sends a response to the FIDL transaction.
1395    ///
1396    /// Sets the channel to shutdown if an error occurs.
1397    pub fn send(self, mut result: Result<u16, ContextError>) -> Result<(), fidl::Error> {
1398        let _result = self.send_raw(result);
1399        if _result.is_err() {
1400            self.control_handle.shutdown();
1401        }
1402        self.drop_without_shutdown();
1403        _result
1404    }
1405
1406    /// Similar to "send" but does not shutdown the channel if an error occurs.
1407    pub fn send_no_shutdown_on_err(
1408        self,
1409        mut result: Result<u16, ContextError>,
1410    ) -> Result<(), fidl::Error> {
1411        let _result = self.send_raw(result);
1412        self.drop_without_shutdown();
1413        _result
1414    }
1415
1416    fn send_raw(&self, mut result: Result<u16, ContextError>) -> Result<(), fidl::Error> {
1417        self.control_handle.inner.send::<fidl::encoding::ResultType<
1418            ContextGetRemoteDebuggingPortResponse,
1419            ContextError,
1420        >>(
1421            result.map(|port| (port,)),
1422            self.tx_id,
1423            0x4ac6a26fe972f29,
1424            fidl::encoding::DynamicFlags::empty(),
1425        )
1426    }
1427}
1428
1429#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1430pub struct ContextProviderMarker;
1431
1432impl fidl::endpoints::ProtocolMarker for ContextProviderMarker {
1433    type Proxy = ContextProviderProxy;
1434    type RequestStream = ContextProviderRequestStream;
1435    #[cfg(target_os = "fuchsia")]
1436    type SynchronousProxy = ContextProviderSynchronousProxy;
1437
1438    const DEBUG_NAME: &'static str = "fuchsia.web.ContextProvider";
1439}
1440impl fidl::endpoints::DiscoverableProtocolMarker for ContextProviderMarker {}
1441
1442pub trait ContextProviderProxyInterface: Send + Sync {
1443    fn r#create(
1444        &self,
1445        params: CreateContextParams,
1446        context: fidl::endpoints::ServerEnd<ContextMarker>,
1447    ) -> Result<(), fidl::Error>;
1448}
1449#[derive(Debug)]
1450#[cfg(target_os = "fuchsia")]
1451pub struct ContextProviderSynchronousProxy {
1452    client: fidl::client::sync::Client,
1453}
1454
1455#[cfg(target_os = "fuchsia")]
1456impl fidl::endpoints::SynchronousProxy for ContextProviderSynchronousProxy {
1457    type Proxy = ContextProviderProxy;
1458    type Protocol = ContextProviderMarker;
1459
1460    fn from_channel(inner: fidl::Channel) -> Self {
1461        Self::new(inner)
1462    }
1463
1464    fn into_channel(self) -> fidl::Channel {
1465        self.client.into_channel()
1466    }
1467
1468    fn as_channel(&self) -> &fidl::Channel {
1469        self.client.as_channel()
1470    }
1471}
1472
1473#[cfg(target_os = "fuchsia")]
1474impl ContextProviderSynchronousProxy {
1475    pub fn new(channel: fidl::Channel) -> Self {
1476        let protocol_name = <ContextProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1477        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1478    }
1479
1480    pub fn into_channel(self) -> fidl::Channel {
1481        self.client.into_channel()
1482    }
1483
1484    /// Waits until an event arrives and returns it. It is safe for other
1485    /// threads to make concurrent requests while waiting for an event.
1486    pub fn wait_for_event(
1487        &self,
1488        deadline: zx::MonotonicInstant,
1489    ) -> Result<ContextProviderEvent, fidl::Error> {
1490        ContextProviderEvent::decode(self.client.wait_for_event(deadline)?)
1491    }
1492
1493    /// Creates a new browser [`Context`] whose state is wholly independent and isolated from other
1494    /// [`Context`](`Contexts`).
1495    ///
1496    /// - `params`: The configuration used to create the [`Context`].
1497    /// - `context`: An interface request which will receive a bound [`Context`]
1498    ///   service.
1499    pub fn r#create(
1500        &self,
1501        mut params: CreateContextParams,
1502        mut context: fidl::endpoints::ServerEnd<ContextMarker>,
1503    ) -> Result<(), fidl::Error> {
1504        self.client.send::<ContextProviderCreateRequest>(
1505            (&mut params, context),
1506            0x6ee6fa35978eb98d,
1507            fidl::encoding::DynamicFlags::empty(),
1508        )
1509    }
1510}
1511
1512#[cfg(target_os = "fuchsia")]
1513impl From<ContextProviderSynchronousProxy> for zx::Handle {
1514    fn from(value: ContextProviderSynchronousProxy) -> Self {
1515        value.into_channel().into()
1516    }
1517}
1518
1519#[cfg(target_os = "fuchsia")]
1520impl From<fidl::Channel> for ContextProviderSynchronousProxy {
1521    fn from(value: fidl::Channel) -> Self {
1522        Self::new(value)
1523    }
1524}
1525
1526#[derive(Debug, Clone)]
1527pub struct ContextProviderProxy {
1528    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1529}
1530
1531impl fidl::endpoints::Proxy for ContextProviderProxy {
1532    type Protocol = ContextProviderMarker;
1533
1534    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1535        Self::new(inner)
1536    }
1537
1538    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1539        self.client.into_channel().map_err(|client| Self { client })
1540    }
1541
1542    fn as_channel(&self) -> &::fidl::AsyncChannel {
1543        self.client.as_channel()
1544    }
1545}
1546
1547impl ContextProviderProxy {
1548    /// Create a new Proxy for fuchsia.web/ContextProvider.
1549    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1550        let protocol_name = <ContextProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1551        Self { client: fidl::client::Client::new(channel, protocol_name) }
1552    }
1553
1554    /// Get a Stream of events from the remote end of the protocol.
1555    ///
1556    /// # Panics
1557    ///
1558    /// Panics if the event stream was already taken.
1559    pub fn take_event_stream(&self) -> ContextProviderEventStream {
1560        ContextProviderEventStream { event_receiver: self.client.take_event_receiver() }
1561    }
1562
1563    /// Creates a new browser [`Context`] whose state is wholly independent and isolated from other
1564    /// [`Context`](`Contexts`).
1565    ///
1566    /// - `params`: The configuration used to create the [`Context`].
1567    /// - `context`: An interface request which will receive a bound [`Context`]
1568    ///   service.
1569    pub fn r#create(
1570        &self,
1571        mut params: CreateContextParams,
1572        mut context: fidl::endpoints::ServerEnd<ContextMarker>,
1573    ) -> Result<(), fidl::Error> {
1574        ContextProviderProxyInterface::r#create(self, params, context)
1575    }
1576}
1577
1578impl ContextProviderProxyInterface for ContextProviderProxy {
1579    fn r#create(
1580        &self,
1581        mut params: CreateContextParams,
1582        mut context: fidl::endpoints::ServerEnd<ContextMarker>,
1583    ) -> Result<(), fidl::Error> {
1584        self.client.send::<ContextProviderCreateRequest>(
1585            (&mut params, context),
1586            0x6ee6fa35978eb98d,
1587            fidl::encoding::DynamicFlags::empty(),
1588        )
1589    }
1590}
1591
1592pub struct ContextProviderEventStream {
1593    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1594}
1595
1596impl std::marker::Unpin for ContextProviderEventStream {}
1597
1598impl futures::stream::FusedStream for ContextProviderEventStream {
1599    fn is_terminated(&self) -> bool {
1600        self.event_receiver.is_terminated()
1601    }
1602}
1603
1604impl futures::Stream for ContextProviderEventStream {
1605    type Item = Result<ContextProviderEvent, fidl::Error>;
1606
1607    fn poll_next(
1608        mut self: std::pin::Pin<&mut Self>,
1609        cx: &mut std::task::Context<'_>,
1610    ) -> std::task::Poll<Option<Self::Item>> {
1611        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1612            &mut self.event_receiver,
1613            cx
1614        )?) {
1615            Some(buf) => std::task::Poll::Ready(Some(ContextProviderEvent::decode(buf))),
1616            None => std::task::Poll::Ready(None),
1617        }
1618    }
1619}
1620
1621#[derive(Debug)]
1622pub enum ContextProviderEvent {}
1623
1624impl ContextProviderEvent {
1625    /// Decodes a message buffer as a [`ContextProviderEvent`].
1626    fn decode(
1627        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1628    ) -> Result<ContextProviderEvent, fidl::Error> {
1629        let (bytes, _handles) = buf.split_mut();
1630        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1631        debug_assert_eq!(tx_header.tx_id, 0);
1632        match tx_header.ordinal {
1633            _ => Err(fidl::Error::UnknownOrdinal {
1634                ordinal: tx_header.ordinal,
1635                protocol_name:
1636                    <ContextProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1637            }),
1638        }
1639    }
1640}
1641
1642/// A Stream of incoming requests for fuchsia.web/ContextProvider.
1643pub struct ContextProviderRequestStream {
1644    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1645    is_terminated: bool,
1646}
1647
1648impl std::marker::Unpin for ContextProviderRequestStream {}
1649
1650impl futures::stream::FusedStream for ContextProviderRequestStream {
1651    fn is_terminated(&self) -> bool {
1652        self.is_terminated
1653    }
1654}
1655
1656impl fidl::endpoints::RequestStream for ContextProviderRequestStream {
1657    type Protocol = ContextProviderMarker;
1658    type ControlHandle = ContextProviderControlHandle;
1659
1660    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1661        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1662    }
1663
1664    fn control_handle(&self) -> Self::ControlHandle {
1665        ContextProviderControlHandle { inner: self.inner.clone() }
1666    }
1667
1668    fn into_inner(
1669        self,
1670    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1671    {
1672        (self.inner, self.is_terminated)
1673    }
1674
1675    fn from_inner(
1676        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1677        is_terminated: bool,
1678    ) -> Self {
1679        Self { inner, is_terminated }
1680    }
1681}
1682
1683impl futures::Stream for ContextProviderRequestStream {
1684    type Item = Result<ContextProviderRequest, fidl::Error>;
1685
1686    fn poll_next(
1687        mut self: std::pin::Pin<&mut Self>,
1688        cx: &mut std::task::Context<'_>,
1689    ) -> std::task::Poll<Option<Self::Item>> {
1690        let this = &mut *self;
1691        if this.inner.check_shutdown(cx) {
1692            this.is_terminated = true;
1693            return std::task::Poll::Ready(None);
1694        }
1695        if this.is_terminated {
1696            panic!("polled ContextProviderRequestStream after completion");
1697        }
1698        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1699            |bytes, handles| {
1700                match this.inner.channel().read_etc(cx, bytes, handles) {
1701                    std::task::Poll::Ready(Ok(())) => {}
1702                    std::task::Poll::Pending => return std::task::Poll::Pending,
1703                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1704                        this.is_terminated = true;
1705                        return std::task::Poll::Ready(None);
1706                    }
1707                    std::task::Poll::Ready(Err(e)) => {
1708                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1709                            e.into(),
1710                        ))))
1711                    }
1712                }
1713
1714                // A message has been received from the channel
1715                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1716
1717                std::task::Poll::Ready(Some(match header.ordinal {
1718                    0x6ee6fa35978eb98d => {
1719                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1720                        let mut req = fidl::new_empty!(
1721                            ContextProviderCreateRequest,
1722                            fidl::encoding::DefaultFuchsiaResourceDialect
1723                        );
1724                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ContextProviderCreateRequest>(&header, _body_bytes, handles, &mut req)?;
1725                        let control_handle =
1726                            ContextProviderControlHandle { inner: this.inner.clone() };
1727                        Ok(ContextProviderRequest::Create {
1728                            params: req.params,
1729                            context: req.context,
1730
1731                            control_handle,
1732                        })
1733                    }
1734                    _ => Err(fidl::Error::UnknownOrdinal {
1735                        ordinal: header.ordinal,
1736                        protocol_name:
1737                            <ContextProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1738                    }),
1739                }))
1740            },
1741        )
1742    }
1743}
1744
1745/// The top-level service interface which allows for the creation of Context resources.
1746#[derive(Debug)]
1747pub enum ContextProviderRequest {
1748    /// Creates a new browser [`Context`] whose state is wholly independent and isolated from other
1749    /// [`Context`](`Contexts`).
1750    ///
1751    /// - `params`: The configuration used to create the [`Context`].
1752    /// - `context`: An interface request which will receive a bound [`Context`]
1753    ///   service.
1754    Create {
1755        params: CreateContextParams,
1756        context: fidl::endpoints::ServerEnd<ContextMarker>,
1757        control_handle: ContextProviderControlHandle,
1758    },
1759}
1760
1761impl ContextProviderRequest {
1762    #[allow(irrefutable_let_patterns)]
1763    pub fn into_create(
1764        self,
1765    ) -> Option<(
1766        CreateContextParams,
1767        fidl::endpoints::ServerEnd<ContextMarker>,
1768        ContextProviderControlHandle,
1769    )> {
1770        if let ContextProviderRequest::Create { params, context, control_handle } = self {
1771            Some((params, context, control_handle))
1772        } else {
1773            None
1774        }
1775    }
1776
1777    /// Name of the method defined in FIDL
1778    pub fn method_name(&self) -> &'static str {
1779        match *self {
1780            ContextProviderRequest::Create { .. } => "create",
1781        }
1782    }
1783}
1784
1785#[derive(Debug, Clone)]
1786pub struct ContextProviderControlHandle {
1787    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1788}
1789
1790impl fidl::endpoints::ControlHandle for ContextProviderControlHandle {
1791    fn shutdown(&self) {
1792        self.inner.shutdown()
1793    }
1794    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1795        self.inner.shutdown_with_epitaph(status)
1796    }
1797
1798    fn is_closed(&self) -> bool {
1799        self.inner.channel().is_closed()
1800    }
1801    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1802        self.inner.channel().on_closed()
1803    }
1804
1805    #[cfg(target_os = "fuchsia")]
1806    fn signal_peer(
1807        &self,
1808        clear_mask: zx::Signals,
1809        set_mask: zx::Signals,
1810    ) -> Result<(), zx_status::Status> {
1811        use fidl::Peered;
1812        self.inner.channel().signal_peer(clear_mask, set_mask)
1813    }
1814}
1815
1816impl ContextProviderControlHandle {}
1817
1818#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1819pub struct CookieManagerMarker;
1820
1821impl fidl::endpoints::ProtocolMarker for CookieManagerMarker {
1822    type Proxy = CookieManagerProxy;
1823    type RequestStream = CookieManagerRequestStream;
1824    #[cfg(target_os = "fuchsia")]
1825    type SynchronousProxy = CookieManagerSynchronousProxy;
1826
1827    const DEBUG_NAME: &'static str = "(anonymous) CookieManager";
1828}
1829
1830pub trait CookieManagerProxyInterface: Send + Sync {
1831    fn r#observe_cookie_changes(
1832        &self,
1833        url: Option<&str>,
1834        name: Option<&str>,
1835        changes: fidl::endpoints::ServerEnd<CookiesIteratorMarker>,
1836    ) -> Result<(), fidl::Error>;
1837    fn r#get_cookie_list(
1838        &self,
1839        url: Option<&str>,
1840        name: Option<&str>,
1841        cookies: fidl::endpoints::ServerEnd<CookiesIteratorMarker>,
1842    ) -> Result<(), fidl::Error>;
1843}
1844#[derive(Debug)]
1845#[cfg(target_os = "fuchsia")]
1846pub struct CookieManagerSynchronousProxy {
1847    client: fidl::client::sync::Client,
1848}
1849
1850#[cfg(target_os = "fuchsia")]
1851impl fidl::endpoints::SynchronousProxy for CookieManagerSynchronousProxy {
1852    type Proxy = CookieManagerProxy;
1853    type Protocol = CookieManagerMarker;
1854
1855    fn from_channel(inner: fidl::Channel) -> Self {
1856        Self::new(inner)
1857    }
1858
1859    fn into_channel(self) -> fidl::Channel {
1860        self.client.into_channel()
1861    }
1862
1863    fn as_channel(&self) -> &fidl::Channel {
1864        self.client.as_channel()
1865    }
1866}
1867
1868#[cfg(target_os = "fuchsia")]
1869impl CookieManagerSynchronousProxy {
1870    pub fn new(channel: fidl::Channel) -> Self {
1871        let protocol_name = <CookieManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1872        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1873    }
1874
1875    pub fn into_channel(self) -> fidl::Channel {
1876        self.client.into_channel()
1877    }
1878
1879    /// Waits until an event arrives and returns it. It is safe for other
1880    /// threads to make concurrent requests while waiting for an event.
1881    pub fn wait_for_event(
1882        &self,
1883        deadline: zx::MonotonicInstant,
1884    ) -> Result<CookieManagerEvent, fidl::Error> {
1885        CookieManagerEvent::decode(self.client.wait_for_event(deadline)?)
1886    }
1887
1888    /// Observe changes to all cookies named `name` that would be sent in a request to `url`.
1889    ///
1890    /// If neither `url` nor `name` are set then all cookies are observed. If only `url` is set
1891    /// then all cookies for that URL are observed. If both are set then only cookies matching both
1892    /// fields are observed.
1893    ///
1894    /// `changes` iterates over a stream of cookie changes. Additions or updates are expressed as
1895    /// complete cookies, while deletions are expressed as cookies with no `value` set.
1896    pub fn r#observe_cookie_changes(
1897        &self,
1898        mut url: Option<&str>,
1899        mut name: Option<&str>,
1900        mut changes: fidl::endpoints::ServerEnd<CookiesIteratorMarker>,
1901    ) -> Result<(), fidl::Error> {
1902        self.client.send::<CookieManagerObserveCookieChangesRequest>(
1903            (url, name, changes),
1904            0x49d8259726088b2,
1905            fidl::encoding::DynamicFlags::empty(),
1906        )
1907    }
1908
1909    /// Returns a list of Cookies, optionally limited to those matching `url`, and optionally
1910    /// `name`. `cookies` iterates over the matching cookies, including their `value`s.
1911    pub fn r#get_cookie_list(
1912        &self,
1913        mut url: Option<&str>,
1914        mut name: Option<&str>,
1915        mut cookies: fidl::endpoints::ServerEnd<CookiesIteratorMarker>,
1916    ) -> Result<(), fidl::Error> {
1917        self.client.send::<CookieManagerGetCookieListRequest>(
1918            (url, name, cookies),
1919            0x391d79f54044f334,
1920            fidl::encoding::DynamicFlags::empty(),
1921        )
1922    }
1923}
1924
1925#[cfg(target_os = "fuchsia")]
1926impl From<CookieManagerSynchronousProxy> for zx::Handle {
1927    fn from(value: CookieManagerSynchronousProxy) -> Self {
1928        value.into_channel().into()
1929    }
1930}
1931
1932#[cfg(target_os = "fuchsia")]
1933impl From<fidl::Channel> for CookieManagerSynchronousProxy {
1934    fn from(value: fidl::Channel) -> Self {
1935        Self::new(value)
1936    }
1937}
1938
1939#[derive(Debug, Clone)]
1940pub struct CookieManagerProxy {
1941    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1942}
1943
1944impl fidl::endpoints::Proxy for CookieManagerProxy {
1945    type Protocol = CookieManagerMarker;
1946
1947    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1948        Self::new(inner)
1949    }
1950
1951    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1952        self.client.into_channel().map_err(|client| Self { client })
1953    }
1954
1955    fn as_channel(&self) -> &::fidl::AsyncChannel {
1956        self.client.as_channel()
1957    }
1958}
1959
1960impl CookieManagerProxy {
1961    /// Create a new Proxy for fuchsia.web/CookieManager.
1962    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1963        let protocol_name = <CookieManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1964        Self { client: fidl::client::Client::new(channel, protocol_name) }
1965    }
1966
1967    /// Get a Stream of events from the remote end of the protocol.
1968    ///
1969    /// # Panics
1970    ///
1971    /// Panics if the event stream was already taken.
1972    pub fn take_event_stream(&self) -> CookieManagerEventStream {
1973        CookieManagerEventStream { event_receiver: self.client.take_event_receiver() }
1974    }
1975
1976    /// Observe changes to all cookies named `name` that would be sent in a request to `url`.
1977    ///
1978    /// If neither `url` nor `name` are set then all cookies are observed. If only `url` is set
1979    /// then all cookies for that URL are observed. If both are set then only cookies matching both
1980    /// fields are observed.
1981    ///
1982    /// `changes` iterates over a stream of cookie changes. Additions or updates are expressed as
1983    /// complete cookies, while deletions are expressed as cookies with no `value` set.
1984    pub fn r#observe_cookie_changes(
1985        &self,
1986        mut url: Option<&str>,
1987        mut name: Option<&str>,
1988        mut changes: fidl::endpoints::ServerEnd<CookiesIteratorMarker>,
1989    ) -> Result<(), fidl::Error> {
1990        CookieManagerProxyInterface::r#observe_cookie_changes(self, url, name, changes)
1991    }
1992
1993    /// Returns a list of Cookies, optionally limited to those matching `url`, and optionally
1994    /// `name`. `cookies` iterates over the matching cookies, including their `value`s.
1995    pub fn r#get_cookie_list(
1996        &self,
1997        mut url: Option<&str>,
1998        mut name: Option<&str>,
1999        mut cookies: fidl::endpoints::ServerEnd<CookiesIteratorMarker>,
2000    ) -> Result<(), fidl::Error> {
2001        CookieManagerProxyInterface::r#get_cookie_list(self, url, name, cookies)
2002    }
2003}
2004
2005impl CookieManagerProxyInterface for CookieManagerProxy {
2006    fn r#observe_cookie_changes(
2007        &self,
2008        mut url: Option<&str>,
2009        mut name: Option<&str>,
2010        mut changes: fidl::endpoints::ServerEnd<CookiesIteratorMarker>,
2011    ) -> Result<(), fidl::Error> {
2012        self.client.send::<CookieManagerObserveCookieChangesRequest>(
2013            (url, name, changes),
2014            0x49d8259726088b2,
2015            fidl::encoding::DynamicFlags::empty(),
2016        )
2017    }
2018
2019    fn r#get_cookie_list(
2020        &self,
2021        mut url: Option<&str>,
2022        mut name: Option<&str>,
2023        mut cookies: fidl::endpoints::ServerEnd<CookiesIteratorMarker>,
2024    ) -> Result<(), fidl::Error> {
2025        self.client.send::<CookieManagerGetCookieListRequest>(
2026            (url, name, cookies),
2027            0x391d79f54044f334,
2028            fidl::encoding::DynamicFlags::empty(),
2029        )
2030    }
2031}
2032
2033pub struct CookieManagerEventStream {
2034    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2035}
2036
2037impl std::marker::Unpin for CookieManagerEventStream {}
2038
2039impl futures::stream::FusedStream for CookieManagerEventStream {
2040    fn is_terminated(&self) -> bool {
2041        self.event_receiver.is_terminated()
2042    }
2043}
2044
2045impl futures::Stream for CookieManagerEventStream {
2046    type Item = Result<CookieManagerEvent, fidl::Error>;
2047
2048    fn poll_next(
2049        mut self: std::pin::Pin<&mut Self>,
2050        cx: &mut std::task::Context<'_>,
2051    ) -> std::task::Poll<Option<Self::Item>> {
2052        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2053            &mut self.event_receiver,
2054            cx
2055        )?) {
2056            Some(buf) => std::task::Poll::Ready(Some(CookieManagerEvent::decode(buf))),
2057            None => std::task::Poll::Ready(None),
2058        }
2059    }
2060}
2061
2062#[derive(Debug)]
2063pub enum CookieManagerEvent {}
2064
2065impl CookieManagerEvent {
2066    /// Decodes a message buffer as a [`CookieManagerEvent`].
2067    fn decode(
2068        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2069    ) -> Result<CookieManagerEvent, fidl::Error> {
2070        let (bytes, _handles) = buf.split_mut();
2071        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2072        debug_assert_eq!(tx_header.tx_id, 0);
2073        match tx_header.ordinal {
2074            _ => Err(fidl::Error::UnknownOrdinal {
2075                ordinal: tx_header.ordinal,
2076                protocol_name: <CookieManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2077            }),
2078        }
2079    }
2080}
2081
2082/// A Stream of incoming requests for fuchsia.web/CookieManager.
2083pub struct CookieManagerRequestStream {
2084    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2085    is_terminated: bool,
2086}
2087
2088impl std::marker::Unpin for CookieManagerRequestStream {}
2089
2090impl futures::stream::FusedStream for CookieManagerRequestStream {
2091    fn is_terminated(&self) -> bool {
2092        self.is_terminated
2093    }
2094}
2095
2096impl fidl::endpoints::RequestStream for CookieManagerRequestStream {
2097    type Protocol = CookieManagerMarker;
2098    type ControlHandle = CookieManagerControlHandle;
2099
2100    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2101        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2102    }
2103
2104    fn control_handle(&self) -> Self::ControlHandle {
2105        CookieManagerControlHandle { inner: self.inner.clone() }
2106    }
2107
2108    fn into_inner(
2109        self,
2110    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2111    {
2112        (self.inner, self.is_terminated)
2113    }
2114
2115    fn from_inner(
2116        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2117        is_terminated: bool,
2118    ) -> Self {
2119        Self { inner, is_terminated }
2120    }
2121}
2122
2123impl futures::Stream for CookieManagerRequestStream {
2124    type Item = Result<CookieManagerRequest, fidl::Error>;
2125
2126    fn poll_next(
2127        mut self: std::pin::Pin<&mut Self>,
2128        cx: &mut std::task::Context<'_>,
2129    ) -> std::task::Poll<Option<Self::Item>> {
2130        let this = &mut *self;
2131        if this.inner.check_shutdown(cx) {
2132            this.is_terminated = true;
2133            return std::task::Poll::Ready(None);
2134        }
2135        if this.is_terminated {
2136            panic!("polled CookieManagerRequestStream after completion");
2137        }
2138        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2139            |bytes, handles| {
2140                match this.inner.channel().read_etc(cx, bytes, handles) {
2141                    std::task::Poll::Ready(Ok(())) => {}
2142                    std::task::Poll::Pending => return std::task::Poll::Pending,
2143                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2144                        this.is_terminated = true;
2145                        return std::task::Poll::Ready(None);
2146                    }
2147                    std::task::Poll::Ready(Err(e)) => {
2148                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2149                            e.into(),
2150                        ))))
2151                    }
2152                }
2153
2154                // A message has been received from the channel
2155                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2156
2157                std::task::Poll::Ready(Some(match header.ordinal {
2158                    0x49d8259726088b2 => {
2159                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2160                        let mut req = fidl::new_empty!(
2161                            CookieManagerObserveCookieChangesRequest,
2162                            fidl::encoding::DefaultFuchsiaResourceDialect
2163                        );
2164                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CookieManagerObserveCookieChangesRequest>(&header, _body_bytes, handles, &mut req)?;
2165                        let control_handle =
2166                            CookieManagerControlHandle { inner: this.inner.clone() };
2167                        Ok(CookieManagerRequest::ObserveCookieChanges {
2168                            url: req.url,
2169                            name: req.name,
2170                            changes: req.changes,
2171
2172                            control_handle,
2173                        })
2174                    }
2175                    0x391d79f54044f334 => {
2176                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2177                        let mut req = fidl::new_empty!(
2178                            CookieManagerGetCookieListRequest,
2179                            fidl::encoding::DefaultFuchsiaResourceDialect
2180                        );
2181                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CookieManagerGetCookieListRequest>(&header, _body_bytes, handles, &mut req)?;
2182                        let control_handle =
2183                            CookieManagerControlHandle { inner: this.inner.clone() };
2184                        Ok(CookieManagerRequest::GetCookieList {
2185                            url: req.url,
2186                            name: req.name,
2187                            cookies: req.cookies,
2188
2189                            control_handle,
2190                        })
2191                    }
2192                    _ => Err(fidl::Error::UnknownOrdinal {
2193                        ordinal: header.ordinal,
2194                        protocol_name:
2195                            <CookieManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2196                    }),
2197                }))
2198            },
2199        )
2200    }
2201}
2202
2203/// Provides methods for monitoring and accessing browser cookie state.
2204#[derive(Debug)]
2205pub enum CookieManagerRequest {
2206    /// Observe changes to all cookies named `name` that would be sent in a request to `url`.
2207    ///
2208    /// If neither `url` nor `name` are set then all cookies are observed. If only `url` is set
2209    /// then all cookies for that URL are observed. If both are set then only cookies matching both
2210    /// fields are observed.
2211    ///
2212    /// `changes` iterates over a stream of cookie changes. Additions or updates are expressed as
2213    /// complete cookies, while deletions are expressed as cookies with no `value` set.
2214    ObserveCookieChanges {
2215        url: Option<String>,
2216        name: Option<String>,
2217        changes: fidl::endpoints::ServerEnd<CookiesIteratorMarker>,
2218        control_handle: CookieManagerControlHandle,
2219    },
2220    /// Returns a list of Cookies, optionally limited to those matching `url`, and optionally
2221    /// `name`. `cookies` iterates over the matching cookies, including their `value`s.
2222    GetCookieList {
2223        url: Option<String>,
2224        name: Option<String>,
2225        cookies: fidl::endpoints::ServerEnd<CookiesIteratorMarker>,
2226        control_handle: CookieManagerControlHandle,
2227    },
2228}
2229
2230impl CookieManagerRequest {
2231    #[allow(irrefutable_let_patterns)]
2232    pub fn into_observe_cookie_changes(
2233        self,
2234    ) -> Option<(
2235        Option<String>,
2236        Option<String>,
2237        fidl::endpoints::ServerEnd<CookiesIteratorMarker>,
2238        CookieManagerControlHandle,
2239    )> {
2240        if let CookieManagerRequest::ObserveCookieChanges { url, name, changes, control_handle } =
2241            self
2242        {
2243            Some((url, name, changes, control_handle))
2244        } else {
2245            None
2246        }
2247    }
2248
2249    #[allow(irrefutable_let_patterns)]
2250    pub fn into_get_cookie_list(
2251        self,
2252    ) -> Option<(
2253        Option<String>,
2254        Option<String>,
2255        fidl::endpoints::ServerEnd<CookiesIteratorMarker>,
2256        CookieManagerControlHandle,
2257    )> {
2258        if let CookieManagerRequest::GetCookieList { url, name, cookies, control_handle } = self {
2259            Some((url, name, cookies, control_handle))
2260        } else {
2261            None
2262        }
2263    }
2264
2265    /// Name of the method defined in FIDL
2266    pub fn method_name(&self) -> &'static str {
2267        match *self {
2268            CookieManagerRequest::ObserveCookieChanges { .. } => "observe_cookie_changes",
2269            CookieManagerRequest::GetCookieList { .. } => "get_cookie_list",
2270        }
2271    }
2272}
2273
2274#[derive(Debug, Clone)]
2275pub struct CookieManagerControlHandle {
2276    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2277}
2278
2279impl fidl::endpoints::ControlHandle for CookieManagerControlHandle {
2280    fn shutdown(&self) {
2281        self.inner.shutdown()
2282    }
2283    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2284        self.inner.shutdown_with_epitaph(status)
2285    }
2286
2287    fn is_closed(&self) -> bool {
2288        self.inner.channel().is_closed()
2289    }
2290    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2291        self.inner.channel().on_closed()
2292    }
2293
2294    #[cfg(target_os = "fuchsia")]
2295    fn signal_peer(
2296        &self,
2297        clear_mask: zx::Signals,
2298        set_mask: zx::Signals,
2299    ) -> Result<(), zx_status::Status> {
2300        use fidl::Peered;
2301        self.inner.channel().signal_peer(clear_mask, set_mask)
2302    }
2303}
2304
2305impl CookieManagerControlHandle {}
2306
2307#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2308pub struct CookiesIteratorMarker;
2309
2310impl fidl::endpoints::ProtocolMarker for CookiesIteratorMarker {
2311    type Proxy = CookiesIteratorProxy;
2312    type RequestStream = CookiesIteratorRequestStream;
2313    #[cfg(target_os = "fuchsia")]
2314    type SynchronousProxy = CookiesIteratorSynchronousProxy;
2315
2316    const DEBUG_NAME: &'static str = "(anonymous) CookiesIterator";
2317}
2318
2319pub trait CookiesIteratorProxyInterface: Send + Sync {
2320    type GetNextResponseFut: std::future::Future<Output = Result<Vec<Cookie>, fidl::Error>> + Send;
2321    fn r#get_next(&self) -> Self::GetNextResponseFut;
2322}
2323#[derive(Debug)]
2324#[cfg(target_os = "fuchsia")]
2325pub struct CookiesIteratorSynchronousProxy {
2326    client: fidl::client::sync::Client,
2327}
2328
2329#[cfg(target_os = "fuchsia")]
2330impl fidl::endpoints::SynchronousProxy for CookiesIteratorSynchronousProxy {
2331    type Proxy = CookiesIteratorProxy;
2332    type Protocol = CookiesIteratorMarker;
2333
2334    fn from_channel(inner: fidl::Channel) -> Self {
2335        Self::new(inner)
2336    }
2337
2338    fn into_channel(self) -> fidl::Channel {
2339        self.client.into_channel()
2340    }
2341
2342    fn as_channel(&self) -> &fidl::Channel {
2343        self.client.as_channel()
2344    }
2345}
2346
2347#[cfg(target_os = "fuchsia")]
2348impl CookiesIteratorSynchronousProxy {
2349    pub fn new(channel: fidl::Channel) -> Self {
2350        let protocol_name = <CookiesIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2351        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2352    }
2353
2354    pub fn into_channel(self) -> fidl::Channel {
2355        self.client.into_channel()
2356    }
2357
2358    /// Waits until an event arrives and returns it. It is safe for other
2359    /// threads to make concurrent requests while waiting for an event.
2360    pub fn wait_for_event(
2361        &self,
2362        deadline: zx::MonotonicInstant,
2363    ) -> Result<CookiesIteratorEvent, fidl::Error> {
2364        CookiesIteratorEvent::decode(self.client.wait_for_event(deadline)?)
2365    }
2366
2367    /// Fetches the next batch of cookies, or of changes to cookies.
2368    /// RFC6265 does not specify an upper-bound on the number of cookies which
2369    /// may be stored.
2370    pub fn r#get_next(
2371        &self,
2372        ___deadline: zx::MonotonicInstant,
2373    ) -> Result<Vec<Cookie>, fidl::Error> {
2374        let _response = self
2375            .client
2376            .send_query::<fidl::encoding::EmptyPayload, CookiesIteratorGetNextResponse>(
2377                (),
2378                0x61b55ebf67ec457d,
2379                fidl::encoding::DynamicFlags::empty(),
2380                ___deadline,
2381            )?;
2382        Ok(_response.changed_cookies)
2383    }
2384}
2385
2386#[cfg(target_os = "fuchsia")]
2387impl From<CookiesIteratorSynchronousProxy> for zx::Handle {
2388    fn from(value: CookiesIteratorSynchronousProxy) -> Self {
2389        value.into_channel().into()
2390    }
2391}
2392
2393#[cfg(target_os = "fuchsia")]
2394impl From<fidl::Channel> for CookiesIteratorSynchronousProxy {
2395    fn from(value: fidl::Channel) -> Self {
2396        Self::new(value)
2397    }
2398}
2399
2400#[derive(Debug, Clone)]
2401pub struct CookiesIteratorProxy {
2402    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2403}
2404
2405impl fidl::endpoints::Proxy for CookiesIteratorProxy {
2406    type Protocol = CookiesIteratorMarker;
2407
2408    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2409        Self::new(inner)
2410    }
2411
2412    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2413        self.client.into_channel().map_err(|client| Self { client })
2414    }
2415
2416    fn as_channel(&self) -> &::fidl::AsyncChannel {
2417        self.client.as_channel()
2418    }
2419}
2420
2421impl CookiesIteratorProxy {
2422    /// Create a new Proxy for fuchsia.web/CookiesIterator.
2423    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2424        let protocol_name = <CookiesIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2425        Self { client: fidl::client::Client::new(channel, protocol_name) }
2426    }
2427
2428    /// Get a Stream of events from the remote end of the protocol.
2429    ///
2430    /// # Panics
2431    ///
2432    /// Panics if the event stream was already taken.
2433    pub fn take_event_stream(&self) -> CookiesIteratorEventStream {
2434        CookiesIteratorEventStream { event_receiver: self.client.take_event_receiver() }
2435    }
2436
2437    /// Fetches the next batch of cookies, or of changes to cookies.
2438    /// RFC6265 does not specify an upper-bound on the number of cookies which
2439    /// may be stored.
2440    pub fn r#get_next(
2441        &self,
2442    ) -> fidl::client::QueryResponseFut<Vec<Cookie>, fidl::encoding::DefaultFuchsiaResourceDialect>
2443    {
2444        CookiesIteratorProxyInterface::r#get_next(self)
2445    }
2446}
2447
2448impl CookiesIteratorProxyInterface for CookiesIteratorProxy {
2449    type GetNextResponseFut =
2450        fidl::client::QueryResponseFut<Vec<Cookie>, fidl::encoding::DefaultFuchsiaResourceDialect>;
2451    fn r#get_next(&self) -> Self::GetNextResponseFut {
2452        fn _decode(
2453            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2454        ) -> Result<Vec<Cookie>, fidl::Error> {
2455            let _response = fidl::client::decode_transaction_body::<
2456                CookiesIteratorGetNextResponse,
2457                fidl::encoding::DefaultFuchsiaResourceDialect,
2458                0x61b55ebf67ec457d,
2459            >(_buf?)?;
2460            Ok(_response.changed_cookies)
2461        }
2462        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<Cookie>>(
2463            (),
2464            0x61b55ebf67ec457d,
2465            fidl::encoding::DynamicFlags::empty(),
2466            _decode,
2467        )
2468    }
2469}
2470
2471pub struct CookiesIteratorEventStream {
2472    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2473}
2474
2475impl std::marker::Unpin for CookiesIteratorEventStream {}
2476
2477impl futures::stream::FusedStream for CookiesIteratorEventStream {
2478    fn is_terminated(&self) -> bool {
2479        self.event_receiver.is_terminated()
2480    }
2481}
2482
2483impl futures::Stream for CookiesIteratorEventStream {
2484    type Item = Result<CookiesIteratorEvent, fidl::Error>;
2485
2486    fn poll_next(
2487        mut self: std::pin::Pin<&mut Self>,
2488        cx: &mut std::task::Context<'_>,
2489    ) -> std::task::Poll<Option<Self::Item>> {
2490        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2491            &mut self.event_receiver,
2492            cx
2493        )?) {
2494            Some(buf) => std::task::Poll::Ready(Some(CookiesIteratorEvent::decode(buf))),
2495            None => std::task::Poll::Ready(None),
2496        }
2497    }
2498}
2499
2500#[derive(Debug)]
2501pub enum CookiesIteratorEvent {}
2502
2503impl CookiesIteratorEvent {
2504    /// Decodes a message buffer as a [`CookiesIteratorEvent`].
2505    fn decode(
2506        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2507    ) -> Result<CookiesIteratorEvent, fidl::Error> {
2508        let (bytes, _handles) = buf.split_mut();
2509        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2510        debug_assert_eq!(tx_header.tx_id, 0);
2511        match tx_header.ordinal {
2512            _ => Err(fidl::Error::UnknownOrdinal {
2513                ordinal: tx_header.ordinal,
2514                protocol_name:
2515                    <CookiesIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2516            }),
2517        }
2518    }
2519}
2520
2521/// A Stream of incoming requests for fuchsia.web/CookiesIterator.
2522pub struct CookiesIteratorRequestStream {
2523    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2524    is_terminated: bool,
2525}
2526
2527impl std::marker::Unpin for CookiesIteratorRequestStream {}
2528
2529impl futures::stream::FusedStream for CookiesIteratorRequestStream {
2530    fn is_terminated(&self) -> bool {
2531        self.is_terminated
2532    }
2533}
2534
2535impl fidl::endpoints::RequestStream for CookiesIteratorRequestStream {
2536    type Protocol = CookiesIteratorMarker;
2537    type ControlHandle = CookiesIteratorControlHandle;
2538
2539    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2540        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2541    }
2542
2543    fn control_handle(&self) -> Self::ControlHandle {
2544        CookiesIteratorControlHandle { inner: self.inner.clone() }
2545    }
2546
2547    fn into_inner(
2548        self,
2549    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2550    {
2551        (self.inner, self.is_terminated)
2552    }
2553
2554    fn from_inner(
2555        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2556        is_terminated: bool,
2557    ) -> Self {
2558        Self { inner, is_terminated }
2559    }
2560}
2561
2562impl futures::Stream for CookiesIteratorRequestStream {
2563    type Item = Result<CookiesIteratorRequest, fidl::Error>;
2564
2565    fn poll_next(
2566        mut self: std::pin::Pin<&mut Self>,
2567        cx: &mut std::task::Context<'_>,
2568    ) -> std::task::Poll<Option<Self::Item>> {
2569        let this = &mut *self;
2570        if this.inner.check_shutdown(cx) {
2571            this.is_terminated = true;
2572            return std::task::Poll::Ready(None);
2573        }
2574        if this.is_terminated {
2575            panic!("polled CookiesIteratorRequestStream after completion");
2576        }
2577        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2578            |bytes, handles| {
2579                match this.inner.channel().read_etc(cx, bytes, handles) {
2580                    std::task::Poll::Ready(Ok(())) => {}
2581                    std::task::Poll::Pending => return std::task::Poll::Pending,
2582                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2583                        this.is_terminated = true;
2584                        return std::task::Poll::Ready(None);
2585                    }
2586                    std::task::Poll::Ready(Err(e)) => {
2587                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2588                            e.into(),
2589                        ))))
2590                    }
2591                }
2592
2593                // A message has been received from the channel
2594                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2595
2596                std::task::Poll::Ready(Some(match header.ordinal {
2597                    0x61b55ebf67ec457d => {
2598                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2599                        let mut req = fidl::new_empty!(
2600                            fidl::encoding::EmptyPayload,
2601                            fidl::encoding::DefaultFuchsiaResourceDialect
2602                        );
2603                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2604                        let control_handle =
2605                            CookiesIteratorControlHandle { inner: this.inner.clone() };
2606                        Ok(CookiesIteratorRequest::GetNext {
2607                            responder: CookiesIteratorGetNextResponder {
2608                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2609                                tx_id: header.tx_id,
2610                            },
2611                        })
2612                    }
2613                    _ => Err(fidl::Error::UnknownOrdinal {
2614                        ordinal: header.ordinal,
2615                        protocol_name:
2616                            <CookiesIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2617                    }),
2618                }))
2619            },
2620        )
2621    }
2622}
2623
2624/// Used to iterator over a set of cookies, or a stream of changes to cookies.
2625#[derive(Debug)]
2626pub enum CookiesIteratorRequest {
2627    /// Fetches the next batch of cookies, or of changes to cookies.
2628    /// RFC6265 does not specify an upper-bound on the number of cookies which
2629    /// may be stored.
2630    GetNext { responder: CookiesIteratorGetNextResponder },
2631}
2632
2633impl CookiesIteratorRequest {
2634    #[allow(irrefutable_let_patterns)]
2635    pub fn into_get_next(self) -> Option<(CookiesIteratorGetNextResponder)> {
2636        if let CookiesIteratorRequest::GetNext { responder } = self {
2637            Some((responder))
2638        } else {
2639            None
2640        }
2641    }
2642
2643    /// Name of the method defined in FIDL
2644    pub fn method_name(&self) -> &'static str {
2645        match *self {
2646            CookiesIteratorRequest::GetNext { .. } => "get_next",
2647        }
2648    }
2649}
2650
2651#[derive(Debug, Clone)]
2652pub struct CookiesIteratorControlHandle {
2653    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2654}
2655
2656impl fidl::endpoints::ControlHandle for CookiesIteratorControlHandle {
2657    fn shutdown(&self) {
2658        self.inner.shutdown()
2659    }
2660    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2661        self.inner.shutdown_with_epitaph(status)
2662    }
2663
2664    fn is_closed(&self) -> bool {
2665        self.inner.channel().is_closed()
2666    }
2667    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2668        self.inner.channel().on_closed()
2669    }
2670
2671    #[cfg(target_os = "fuchsia")]
2672    fn signal_peer(
2673        &self,
2674        clear_mask: zx::Signals,
2675        set_mask: zx::Signals,
2676    ) -> Result<(), zx_status::Status> {
2677        use fidl::Peered;
2678        self.inner.channel().signal_peer(clear_mask, set_mask)
2679    }
2680}
2681
2682impl CookiesIteratorControlHandle {}
2683
2684#[must_use = "FIDL methods require a response to be sent"]
2685#[derive(Debug)]
2686pub struct CookiesIteratorGetNextResponder {
2687    control_handle: std::mem::ManuallyDrop<CookiesIteratorControlHandle>,
2688    tx_id: u32,
2689}
2690
2691/// Set the the channel to be shutdown (see [`CookiesIteratorControlHandle::shutdown`])
2692/// if the responder is dropped without sending a response, so that the client
2693/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2694impl std::ops::Drop for CookiesIteratorGetNextResponder {
2695    fn drop(&mut self) {
2696        self.control_handle.shutdown();
2697        // Safety: drops once, never accessed again
2698        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2699    }
2700}
2701
2702impl fidl::endpoints::Responder for CookiesIteratorGetNextResponder {
2703    type ControlHandle = CookiesIteratorControlHandle;
2704
2705    fn control_handle(&self) -> &CookiesIteratorControlHandle {
2706        &self.control_handle
2707    }
2708
2709    fn drop_without_shutdown(mut self) {
2710        // Safety: drops once, never accessed again due to mem::forget
2711        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2712        // Prevent Drop from running (which would shut down the channel)
2713        std::mem::forget(self);
2714    }
2715}
2716
2717impl CookiesIteratorGetNextResponder {
2718    /// Sends a response to the FIDL transaction.
2719    ///
2720    /// Sets the channel to shutdown if an error occurs.
2721    pub fn send(self, mut changed_cookies: Vec<Cookie>) -> Result<(), fidl::Error> {
2722        let _result = self.send_raw(changed_cookies);
2723        if _result.is_err() {
2724            self.control_handle.shutdown();
2725        }
2726        self.drop_without_shutdown();
2727        _result
2728    }
2729
2730    /// Similar to "send" but does not shutdown the channel if an error occurs.
2731    pub fn send_no_shutdown_on_err(
2732        self,
2733        mut changed_cookies: Vec<Cookie>,
2734    ) -> Result<(), fidl::Error> {
2735        let _result = self.send_raw(changed_cookies);
2736        self.drop_without_shutdown();
2737        _result
2738    }
2739
2740    fn send_raw(&self, mut changed_cookies: Vec<Cookie>) -> Result<(), fidl::Error> {
2741        self.control_handle.inner.send::<CookiesIteratorGetNextResponse>(
2742            (changed_cookies.as_mut(),),
2743            self.tx_id,
2744            0x61b55ebf67ec457d,
2745            fidl::encoding::DynamicFlags::empty(),
2746        )
2747    }
2748}
2749
2750#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2751pub struct DebugMarker;
2752
2753impl fidl::endpoints::ProtocolMarker for DebugMarker {
2754    type Proxy = DebugProxy;
2755    type RequestStream = DebugRequestStream;
2756    #[cfg(target_os = "fuchsia")]
2757    type SynchronousProxy = DebugSynchronousProxy;
2758
2759    const DEBUG_NAME: &'static str = "fuchsia.web.Debug";
2760}
2761impl fidl::endpoints::DiscoverableProtocolMarker for DebugMarker {}
2762
2763pub trait DebugProxyInterface: Send + Sync {
2764    type EnableDevToolsResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
2765    fn r#enable_dev_tools(
2766        &self,
2767        listener: fidl::endpoints::ClientEnd<DevToolsListenerMarker>,
2768    ) -> Self::EnableDevToolsResponseFut;
2769}
2770#[derive(Debug)]
2771#[cfg(target_os = "fuchsia")]
2772pub struct DebugSynchronousProxy {
2773    client: fidl::client::sync::Client,
2774}
2775
2776#[cfg(target_os = "fuchsia")]
2777impl fidl::endpoints::SynchronousProxy for DebugSynchronousProxy {
2778    type Proxy = DebugProxy;
2779    type Protocol = DebugMarker;
2780
2781    fn from_channel(inner: fidl::Channel) -> Self {
2782        Self::new(inner)
2783    }
2784
2785    fn into_channel(self) -> fidl::Channel {
2786        self.client.into_channel()
2787    }
2788
2789    fn as_channel(&self) -> &fidl::Channel {
2790        self.client.as_channel()
2791    }
2792}
2793
2794#[cfg(target_os = "fuchsia")]
2795impl DebugSynchronousProxy {
2796    pub fn new(channel: fidl::Channel) -> Self {
2797        let protocol_name = <DebugMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2798        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2799    }
2800
2801    pub fn into_channel(self) -> fidl::Channel {
2802        self.client.into_channel()
2803    }
2804
2805    /// Waits until an event arrives and returns it. It is safe for other
2806    /// threads to make concurrent requests while waiting for an event.
2807    pub fn wait_for_event(
2808        &self,
2809        deadline: zx::MonotonicInstant,
2810    ) -> Result<DebugEvent, fidl::Error> {
2811        DebugEvent::decode(self.client.wait_for_event(deadline)?)
2812    }
2813
2814    /// Enables the DevTools service on every subsequent [`Context`] creation and delivers
2815    /// subsequent DevTools events to the supplied `listener`. The callback indicates when the
2816    /// WebEngine is in a debuggable state. Events will be sent to every `listener` registered with
2817    /// this method.
2818    ///
2819    /// Because DevTools debugging is exposed using TCP as its transport, only
2820    /// [`Context`]s created with access to network capabilities will report
2821    /// themselves as available for debugging.
2822    pub fn r#enable_dev_tools(
2823        &self,
2824        mut listener: fidl::endpoints::ClientEnd<DevToolsListenerMarker>,
2825        ___deadline: zx::MonotonicInstant,
2826    ) -> Result<(), fidl::Error> {
2827        let _response =
2828            self.client.send_query::<DebugEnableDevToolsRequest, fidl::encoding::EmptyPayload>(
2829                (listener,),
2830                0x44b5e1f4e4c548e4,
2831                fidl::encoding::DynamicFlags::empty(),
2832                ___deadline,
2833            )?;
2834        Ok(_response)
2835    }
2836}
2837
2838#[cfg(target_os = "fuchsia")]
2839impl From<DebugSynchronousProxy> for zx::Handle {
2840    fn from(value: DebugSynchronousProxy) -> Self {
2841        value.into_channel().into()
2842    }
2843}
2844
2845#[cfg(target_os = "fuchsia")]
2846impl From<fidl::Channel> for DebugSynchronousProxy {
2847    fn from(value: fidl::Channel) -> Self {
2848        Self::new(value)
2849    }
2850}
2851
2852#[derive(Debug, Clone)]
2853pub struct DebugProxy {
2854    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2855}
2856
2857impl fidl::endpoints::Proxy for DebugProxy {
2858    type Protocol = DebugMarker;
2859
2860    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2861        Self::new(inner)
2862    }
2863
2864    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2865        self.client.into_channel().map_err(|client| Self { client })
2866    }
2867
2868    fn as_channel(&self) -> &::fidl::AsyncChannel {
2869        self.client.as_channel()
2870    }
2871}
2872
2873impl DebugProxy {
2874    /// Create a new Proxy for fuchsia.web/Debug.
2875    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2876        let protocol_name = <DebugMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2877        Self { client: fidl::client::Client::new(channel, protocol_name) }
2878    }
2879
2880    /// Get a Stream of events from the remote end of the protocol.
2881    ///
2882    /// # Panics
2883    ///
2884    /// Panics if the event stream was already taken.
2885    pub fn take_event_stream(&self) -> DebugEventStream {
2886        DebugEventStream { event_receiver: self.client.take_event_receiver() }
2887    }
2888
2889    /// Enables the DevTools service on every subsequent [`Context`] creation and delivers
2890    /// subsequent DevTools events to the supplied `listener`. The callback indicates when the
2891    /// WebEngine is in a debuggable state. Events will be sent to every `listener` registered with
2892    /// this method.
2893    ///
2894    /// Because DevTools debugging is exposed using TCP as its transport, only
2895    /// [`Context`]s created with access to network capabilities will report
2896    /// themselves as available for debugging.
2897    pub fn r#enable_dev_tools(
2898        &self,
2899        mut listener: fidl::endpoints::ClientEnd<DevToolsListenerMarker>,
2900    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
2901        DebugProxyInterface::r#enable_dev_tools(self, listener)
2902    }
2903}
2904
2905impl DebugProxyInterface for DebugProxy {
2906    type EnableDevToolsResponseFut =
2907        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
2908    fn r#enable_dev_tools(
2909        &self,
2910        mut listener: fidl::endpoints::ClientEnd<DevToolsListenerMarker>,
2911    ) -> Self::EnableDevToolsResponseFut {
2912        fn _decode(
2913            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2914        ) -> Result<(), fidl::Error> {
2915            let _response = fidl::client::decode_transaction_body::<
2916                fidl::encoding::EmptyPayload,
2917                fidl::encoding::DefaultFuchsiaResourceDialect,
2918                0x44b5e1f4e4c548e4,
2919            >(_buf?)?;
2920            Ok(_response)
2921        }
2922        self.client.send_query_and_decode::<DebugEnableDevToolsRequest, ()>(
2923            (listener,),
2924            0x44b5e1f4e4c548e4,
2925            fidl::encoding::DynamicFlags::empty(),
2926            _decode,
2927        )
2928    }
2929}
2930
2931pub struct DebugEventStream {
2932    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2933}
2934
2935impl std::marker::Unpin for DebugEventStream {}
2936
2937impl futures::stream::FusedStream for DebugEventStream {
2938    fn is_terminated(&self) -> bool {
2939        self.event_receiver.is_terminated()
2940    }
2941}
2942
2943impl futures::Stream for DebugEventStream {
2944    type Item = Result<DebugEvent, fidl::Error>;
2945
2946    fn poll_next(
2947        mut self: std::pin::Pin<&mut Self>,
2948        cx: &mut std::task::Context<'_>,
2949    ) -> std::task::Poll<Option<Self::Item>> {
2950        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2951            &mut self.event_receiver,
2952            cx
2953        )?) {
2954            Some(buf) => std::task::Poll::Ready(Some(DebugEvent::decode(buf))),
2955            None => std::task::Poll::Ready(None),
2956        }
2957    }
2958}
2959
2960#[derive(Debug)]
2961pub enum DebugEvent {}
2962
2963impl DebugEvent {
2964    /// Decodes a message buffer as a [`DebugEvent`].
2965    fn decode(
2966        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2967    ) -> Result<DebugEvent, fidl::Error> {
2968        let (bytes, _handles) = buf.split_mut();
2969        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2970        debug_assert_eq!(tx_header.tx_id, 0);
2971        match tx_header.ordinal {
2972            _ => Err(fidl::Error::UnknownOrdinal {
2973                ordinal: tx_header.ordinal,
2974                protocol_name: <DebugMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2975            }),
2976        }
2977    }
2978}
2979
2980/// A Stream of incoming requests for fuchsia.web/Debug.
2981pub struct DebugRequestStream {
2982    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2983    is_terminated: bool,
2984}
2985
2986impl std::marker::Unpin for DebugRequestStream {}
2987
2988impl futures::stream::FusedStream for DebugRequestStream {
2989    fn is_terminated(&self) -> bool {
2990        self.is_terminated
2991    }
2992}
2993
2994impl fidl::endpoints::RequestStream for DebugRequestStream {
2995    type Protocol = DebugMarker;
2996    type ControlHandle = DebugControlHandle;
2997
2998    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2999        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3000    }
3001
3002    fn control_handle(&self) -> Self::ControlHandle {
3003        DebugControlHandle { inner: self.inner.clone() }
3004    }
3005
3006    fn into_inner(
3007        self,
3008    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3009    {
3010        (self.inner, self.is_terminated)
3011    }
3012
3013    fn from_inner(
3014        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3015        is_terminated: bool,
3016    ) -> Self {
3017        Self { inner, is_terminated }
3018    }
3019}
3020
3021impl futures::Stream for DebugRequestStream {
3022    type Item = Result<DebugRequest, fidl::Error>;
3023
3024    fn poll_next(
3025        mut self: std::pin::Pin<&mut Self>,
3026        cx: &mut std::task::Context<'_>,
3027    ) -> std::task::Poll<Option<Self::Item>> {
3028        let this = &mut *self;
3029        if this.inner.check_shutdown(cx) {
3030            this.is_terminated = true;
3031            return std::task::Poll::Ready(None);
3032        }
3033        if this.is_terminated {
3034            panic!("polled DebugRequestStream after completion");
3035        }
3036        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3037            |bytes, handles| {
3038                match this.inner.channel().read_etc(cx, bytes, handles) {
3039                    std::task::Poll::Ready(Ok(())) => {}
3040                    std::task::Poll::Pending => return std::task::Poll::Pending,
3041                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3042                        this.is_terminated = true;
3043                        return std::task::Poll::Ready(None);
3044                    }
3045                    std::task::Poll::Ready(Err(e)) => {
3046                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3047                            e.into(),
3048                        ))))
3049                    }
3050                }
3051
3052                // A message has been received from the channel
3053                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3054
3055                std::task::Poll::Ready(Some(match header.ordinal {
3056                    0x44b5e1f4e4c548e4 => {
3057                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3058                        let mut req = fidl::new_empty!(
3059                            DebugEnableDevToolsRequest,
3060                            fidl::encoding::DefaultFuchsiaResourceDialect
3061                        );
3062                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DebugEnableDevToolsRequest>(&header, _body_bytes, handles, &mut req)?;
3063                        let control_handle = DebugControlHandle { inner: this.inner.clone() };
3064                        Ok(DebugRequest::EnableDevTools {
3065                            listener: req.listener,
3066
3067                            responder: DebugEnableDevToolsResponder {
3068                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3069                                tx_id: header.tx_id,
3070                            },
3071                        })
3072                    }
3073                    _ => Err(fidl::Error::UnknownOrdinal {
3074                        ordinal: header.ordinal,
3075                        protocol_name: <DebugMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3076                    }),
3077                }))
3078            },
3079        )
3080    }
3081}
3082
3083/// The debug service which allows to enable the DevTools service on Contexts.
3084#[derive(Debug)]
3085pub enum DebugRequest {
3086    /// Enables the DevTools service on every subsequent [`Context`] creation and delivers
3087    /// subsequent DevTools events to the supplied `listener`. The callback indicates when the
3088    /// WebEngine is in a debuggable state. Events will be sent to every `listener` registered with
3089    /// this method.
3090    ///
3091    /// Because DevTools debugging is exposed using TCP as its transport, only
3092    /// [`Context`]s created with access to network capabilities will report
3093    /// themselves as available for debugging.
3094    EnableDevTools {
3095        listener: fidl::endpoints::ClientEnd<DevToolsListenerMarker>,
3096        responder: DebugEnableDevToolsResponder,
3097    },
3098}
3099
3100impl DebugRequest {
3101    #[allow(irrefutable_let_patterns)]
3102    pub fn into_enable_dev_tools(
3103        self,
3104    ) -> Option<(fidl::endpoints::ClientEnd<DevToolsListenerMarker>, DebugEnableDevToolsResponder)>
3105    {
3106        if let DebugRequest::EnableDevTools { listener, responder } = self {
3107            Some((listener, responder))
3108        } else {
3109            None
3110        }
3111    }
3112
3113    /// Name of the method defined in FIDL
3114    pub fn method_name(&self) -> &'static str {
3115        match *self {
3116            DebugRequest::EnableDevTools { .. } => "enable_dev_tools",
3117        }
3118    }
3119}
3120
3121#[derive(Debug, Clone)]
3122pub struct DebugControlHandle {
3123    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3124}
3125
3126impl fidl::endpoints::ControlHandle for DebugControlHandle {
3127    fn shutdown(&self) {
3128        self.inner.shutdown()
3129    }
3130    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3131        self.inner.shutdown_with_epitaph(status)
3132    }
3133
3134    fn is_closed(&self) -> bool {
3135        self.inner.channel().is_closed()
3136    }
3137    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3138        self.inner.channel().on_closed()
3139    }
3140
3141    #[cfg(target_os = "fuchsia")]
3142    fn signal_peer(
3143        &self,
3144        clear_mask: zx::Signals,
3145        set_mask: zx::Signals,
3146    ) -> Result<(), zx_status::Status> {
3147        use fidl::Peered;
3148        self.inner.channel().signal_peer(clear_mask, set_mask)
3149    }
3150}
3151
3152impl DebugControlHandle {}
3153
3154#[must_use = "FIDL methods require a response to be sent"]
3155#[derive(Debug)]
3156pub struct DebugEnableDevToolsResponder {
3157    control_handle: std::mem::ManuallyDrop<DebugControlHandle>,
3158    tx_id: u32,
3159}
3160
3161/// Set the the channel to be shutdown (see [`DebugControlHandle::shutdown`])
3162/// if the responder is dropped without sending a response, so that the client
3163/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3164impl std::ops::Drop for DebugEnableDevToolsResponder {
3165    fn drop(&mut self) {
3166        self.control_handle.shutdown();
3167        // Safety: drops once, never accessed again
3168        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3169    }
3170}
3171
3172impl fidl::endpoints::Responder for DebugEnableDevToolsResponder {
3173    type ControlHandle = DebugControlHandle;
3174
3175    fn control_handle(&self) -> &DebugControlHandle {
3176        &self.control_handle
3177    }
3178
3179    fn drop_without_shutdown(mut self) {
3180        // Safety: drops once, never accessed again due to mem::forget
3181        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3182        // Prevent Drop from running (which would shut down the channel)
3183        std::mem::forget(self);
3184    }
3185}
3186
3187impl DebugEnableDevToolsResponder {
3188    /// Sends a response to the FIDL transaction.
3189    ///
3190    /// Sets the channel to shutdown if an error occurs.
3191    pub fn send(self) -> Result<(), fidl::Error> {
3192        let _result = self.send_raw();
3193        if _result.is_err() {
3194            self.control_handle.shutdown();
3195        }
3196        self.drop_without_shutdown();
3197        _result
3198    }
3199
3200    /// Similar to "send" but does not shutdown the channel if an error occurs.
3201    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
3202        let _result = self.send_raw();
3203        self.drop_without_shutdown();
3204        _result
3205    }
3206
3207    fn send_raw(&self) -> Result<(), fidl::Error> {
3208        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
3209            (),
3210            self.tx_id,
3211            0x44b5e1f4e4c548e4,
3212            fidl::encoding::DynamicFlags::empty(),
3213        )
3214    }
3215}
3216
3217#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3218pub struct DevToolsListenerMarker;
3219
3220impl fidl::endpoints::ProtocolMarker for DevToolsListenerMarker {
3221    type Proxy = DevToolsListenerProxy;
3222    type RequestStream = DevToolsListenerRequestStream;
3223    #[cfg(target_os = "fuchsia")]
3224    type SynchronousProxy = DevToolsListenerSynchronousProxy;
3225
3226    const DEBUG_NAME: &'static str = "(anonymous) DevToolsListener";
3227}
3228
3229pub trait DevToolsListenerProxyInterface: Send + Sync {
3230    fn r#on_context_dev_tools_available(
3231        &self,
3232        listener: fidl::endpoints::ServerEnd<DevToolsPerContextListenerMarker>,
3233    ) -> Result<(), fidl::Error>;
3234}
3235#[derive(Debug)]
3236#[cfg(target_os = "fuchsia")]
3237pub struct DevToolsListenerSynchronousProxy {
3238    client: fidl::client::sync::Client,
3239}
3240
3241#[cfg(target_os = "fuchsia")]
3242impl fidl::endpoints::SynchronousProxy for DevToolsListenerSynchronousProxy {
3243    type Proxy = DevToolsListenerProxy;
3244    type Protocol = DevToolsListenerMarker;
3245
3246    fn from_channel(inner: fidl::Channel) -> Self {
3247        Self::new(inner)
3248    }
3249
3250    fn into_channel(self) -> fidl::Channel {
3251        self.client.into_channel()
3252    }
3253
3254    fn as_channel(&self) -> &fidl::Channel {
3255        self.client.as_channel()
3256    }
3257}
3258
3259#[cfg(target_os = "fuchsia")]
3260impl DevToolsListenerSynchronousProxy {
3261    pub fn new(channel: fidl::Channel) -> Self {
3262        let protocol_name = <DevToolsListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3263        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3264    }
3265
3266    pub fn into_channel(self) -> fidl::Channel {
3267        self.client.into_channel()
3268    }
3269
3270    /// Waits until an event arrives and returns it. It is safe for other
3271    /// threads to make concurrent requests while waiting for an event.
3272    pub fn wait_for_event(
3273        &self,
3274        deadline: zx::MonotonicInstant,
3275    ) -> Result<DevToolsListenerEvent, fidl::Error> {
3276        DevToolsListenerEvent::decode(self.client.wait_for_event(deadline)?)
3277    }
3278
3279    /// Called when the DevTools service is available on a new [`Context`].
3280    ///
3281    /// - `listener`: Channel over which DevTools events for the new [`Context`] will
3282    ///   be delivered. This channel will disconnect when the [`Context`] is destroyed.
3283    pub fn r#on_context_dev_tools_available(
3284        &self,
3285        mut listener: fidl::endpoints::ServerEnd<DevToolsPerContextListenerMarker>,
3286    ) -> Result<(), fidl::Error> {
3287        self.client.send::<DevToolsListenerOnContextDevToolsAvailableRequest>(
3288            (listener,),
3289            0x4b259fb4d7e49e87,
3290            fidl::encoding::DynamicFlags::empty(),
3291        )
3292    }
3293}
3294
3295#[cfg(target_os = "fuchsia")]
3296impl From<DevToolsListenerSynchronousProxy> for zx::Handle {
3297    fn from(value: DevToolsListenerSynchronousProxy) -> Self {
3298        value.into_channel().into()
3299    }
3300}
3301
3302#[cfg(target_os = "fuchsia")]
3303impl From<fidl::Channel> for DevToolsListenerSynchronousProxy {
3304    fn from(value: fidl::Channel) -> Self {
3305        Self::new(value)
3306    }
3307}
3308
3309#[derive(Debug, Clone)]
3310pub struct DevToolsListenerProxy {
3311    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3312}
3313
3314impl fidl::endpoints::Proxy for DevToolsListenerProxy {
3315    type Protocol = DevToolsListenerMarker;
3316
3317    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3318        Self::new(inner)
3319    }
3320
3321    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3322        self.client.into_channel().map_err(|client| Self { client })
3323    }
3324
3325    fn as_channel(&self) -> &::fidl::AsyncChannel {
3326        self.client.as_channel()
3327    }
3328}
3329
3330impl DevToolsListenerProxy {
3331    /// Create a new Proxy for fuchsia.web/DevToolsListener.
3332    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3333        let protocol_name = <DevToolsListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3334        Self { client: fidl::client::Client::new(channel, protocol_name) }
3335    }
3336
3337    /// Get a Stream of events from the remote end of the protocol.
3338    ///
3339    /// # Panics
3340    ///
3341    /// Panics if the event stream was already taken.
3342    pub fn take_event_stream(&self) -> DevToolsListenerEventStream {
3343        DevToolsListenerEventStream { event_receiver: self.client.take_event_receiver() }
3344    }
3345
3346    /// Called when the DevTools service is available on a new [`Context`].
3347    ///
3348    /// - `listener`: Channel over which DevTools events for the new [`Context`] will
3349    ///   be delivered. This channel will disconnect when the [`Context`] is destroyed.
3350    pub fn r#on_context_dev_tools_available(
3351        &self,
3352        mut listener: fidl::endpoints::ServerEnd<DevToolsPerContextListenerMarker>,
3353    ) -> Result<(), fidl::Error> {
3354        DevToolsListenerProxyInterface::r#on_context_dev_tools_available(self, listener)
3355    }
3356}
3357
3358impl DevToolsListenerProxyInterface for DevToolsListenerProxy {
3359    fn r#on_context_dev_tools_available(
3360        &self,
3361        mut listener: fidl::endpoints::ServerEnd<DevToolsPerContextListenerMarker>,
3362    ) -> Result<(), fidl::Error> {
3363        self.client.send::<DevToolsListenerOnContextDevToolsAvailableRequest>(
3364            (listener,),
3365            0x4b259fb4d7e49e87,
3366            fidl::encoding::DynamicFlags::empty(),
3367        )
3368    }
3369}
3370
3371pub struct DevToolsListenerEventStream {
3372    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3373}
3374
3375impl std::marker::Unpin for DevToolsListenerEventStream {}
3376
3377impl futures::stream::FusedStream for DevToolsListenerEventStream {
3378    fn is_terminated(&self) -> bool {
3379        self.event_receiver.is_terminated()
3380    }
3381}
3382
3383impl futures::Stream for DevToolsListenerEventStream {
3384    type Item = Result<DevToolsListenerEvent, fidl::Error>;
3385
3386    fn poll_next(
3387        mut self: std::pin::Pin<&mut Self>,
3388        cx: &mut std::task::Context<'_>,
3389    ) -> std::task::Poll<Option<Self::Item>> {
3390        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3391            &mut self.event_receiver,
3392            cx
3393        )?) {
3394            Some(buf) => std::task::Poll::Ready(Some(DevToolsListenerEvent::decode(buf))),
3395            None => std::task::Poll::Ready(None),
3396        }
3397    }
3398}
3399
3400#[derive(Debug)]
3401pub enum DevToolsListenerEvent {}
3402
3403impl DevToolsListenerEvent {
3404    /// Decodes a message buffer as a [`DevToolsListenerEvent`].
3405    fn decode(
3406        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3407    ) -> Result<DevToolsListenerEvent, fidl::Error> {
3408        let (bytes, _handles) = buf.split_mut();
3409        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3410        debug_assert_eq!(tx_header.tx_id, 0);
3411        match tx_header.ordinal {
3412            _ => Err(fidl::Error::UnknownOrdinal {
3413                ordinal: tx_header.ordinal,
3414                protocol_name:
3415                    <DevToolsListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3416            }),
3417        }
3418    }
3419}
3420
3421/// A Stream of incoming requests for fuchsia.web/DevToolsListener.
3422pub struct DevToolsListenerRequestStream {
3423    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3424    is_terminated: bool,
3425}
3426
3427impl std::marker::Unpin for DevToolsListenerRequestStream {}
3428
3429impl futures::stream::FusedStream for DevToolsListenerRequestStream {
3430    fn is_terminated(&self) -> bool {
3431        self.is_terminated
3432    }
3433}
3434
3435impl fidl::endpoints::RequestStream for DevToolsListenerRequestStream {
3436    type Protocol = DevToolsListenerMarker;
3437    type ControlHandle = DevToolsListenerControlHandle;
3438
3439    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3440        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3441    }
3442
3443    fn control_handle(&self) -> Self::ControlHandle {
3444        DevToolsListenerControlHandle { inner: self.inner.clone() }
3445    }
3446
3447    fn into_inner(
3448        self,
3449    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3450    {
3451        (self.inner, self.is_terminated)
3452    }
3453
3454    fn from_inner(
3455        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3456        is_terminated: bool,
3457    ) -> Self {
3458        Self { inner, is_terminated }
3459    }
3460}
3461
3462impl futures::Stream for DevToolsListenerRequestStream {
3463    type Item = Result<DevToolsListenerRequest, fidl::Error>;
3464
3465    fn poll_next(
3466        mut self: std::pin::Pin<&mut Self>,
3467        cx: &mut std::task::Context<'_>,
3468    ) -> std::task::Poll<Option<Self::Item>> {
3469        let this = &mut *self;
3470        if this.inner.check_shutdown(cx) {
3471            this.is_terminated = true;
3472            return std::task::Poll::Ready(None);
3473        }
3474        if this.is_terminated {
3475            panic!("polled DevToolsListenerRequestStream after completion");
3476        }
3477        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3478            |bytes, handles| {
3479                match this.inner.channel().read_etc(cx, bytes, handles) {
3480                    std::task::Poll::Ready(Ok(())) => {}
3481                    std::task::Poll::Pending => return std::task::Poll::Pending,
3482                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3483                        this.is_terminated = true;
3484                        return std::task::Poll::Ready(None);
3485                    }
3486                    std::task::Poll::Ready(Err(e)) => {
3487                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3488                            e.into(),
3489                        ))))
3490                    }
3491                }
3492
3493                // A message has been received from the channel
3494                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3495
3496                std::task::Poll::Ready(Some(match header.ordinal {
3497                    0x4b259fb4d7e49e87 => {
3498                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3499                        let mut req = fidl::new_empty!(
3500                            DevToolsListenerOnContextDevToolsAvailableRequest,
3501                            fidl::encoding::DefaultFuchsiaResourceDialect
3502                        );
3503                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DevToolsListenerOnContextDevToolsAvailableRequest>(&header, _body_bytes, handles, &mut req)?;
3504                        let control_handle =
3505                            DevToolsListenerControlHandle { inner: this.inner.clone() };
3506                        Ok(DevToolsListenerRequest::OnContextDevToolsAvailable {
3507                            listener: req.listener,
3508
3509                            control_handle,
3510                        })
3511                    }
3512                    _ => Err(fidl::Error::UnknownOrdinal {
3513                        ordinal: header.ordinal,
3514                        protocol_name:
3515                            <DevToolsListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3516                    }),
3517                }))
3518            },
3519        )
3520    }
3521}
3522
3523/// Interface used to observe DevTools service availability events.
3524#[derive(Debug)]
3525pub enum DevToolsListenerRequest {
3526    /// Called when the DevTools service is available on a new [`Context`].
3527    ///
3528    /// - `listener`: Channel over which DevTools events for the new [`Context`] will
3529    ///   be delivered. This channel will disconnect when the [`Context`] is destroyed.
3530    OnContextDevToolsAvailable {
3531        listener: fidl::endpoints::ServerEnd<DevToolsPerContextListenerMarker>,
3532        control_handle: DevToolsListenerControlHandle,
3533    },
3534}
3535
3536impl DevToolsListenerRequest {
3537    #[allow(irrefutable_let_patterns)]
3538    pub fn into_on_context_dev_tools_available(
3539        self,
3540    ) -> Option<(
3541        fidl::endpoints::ServerEnd<DevToolsPerContextListenerMarker>,
3542        DevToolsListenerControlHandle,
3543    )> {
3544        if let DevToolsListenerRequest::OnContextDevToolsAvailable { listener, control_handle } =
3545            self
3546        {
3547            Some((listener, control_handle))
3548        } else {
3549            None
3550        }
3551    }
3552
3553    /// Name of the method defined in FIDL
3554    pub fn method_name(&self) -> &'static str {
3555        match *self {
3556            DevToolsListenerRequest::OnContextDevToolsAvailable { .. } => {
3557                "on_context_dev_tools_available"
3558            }
3559        }
3560    }
3561}
3562
3563#[derive(Debug, Clone)]
3564pub struct DevToolsListenerControlHandle {
3565    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3566}
3567
3568impl fidl::endpoints::ControlHandle for DevToolsListenerControlHandle {
3569    fn shutdown(&self) {
3570        self.inner.shutdown()
3571    }
3572    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3573        self.inner.shutdown_with_epitaph(status)
3574    }
3575
3576    fn is_closed(&self) -> bool {
3577        self.inner.channel().is_closed()
3578    }
3579    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3580        self.inner.channel().on_closed()
3581    }
3582
3583    #[cfg(target_os = "fuchsia")]
3584    fn signal_peer(
3585        &self,
3586        clear_mask: zx::Signals,
3587        set_mask: zx::Signals,
3588    ) -> Result<(), zx_status::Status> {
3589        use fidl::Peered;
3590        self.inner.channel().signal_peer(clear_mask, set_mask)
3591    }
3592}
3593
3594impl DevToolsListenerControlHandle {}
3595
3596#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3597pub struct DevToolsPerContextListenerMarker;
3598
3599impl fidl::endpoints::ProtocolMarker for DevToolsPerContextListenerMarker {
3600    type Proxy = DevToolsPerContextListenerProxy;
3601    type RequestStream = DevToolsPerContextListenerRequestStream;
3602    #[cfg(target_os = "fuchsia")]
3603    type SynchronousProxy = DevToolsPerContextListenerSynchronousProxy;
3604
3605    const DEBUG_NAME: &'static str = "(anonymous) DevToolsPerContextListener";
3606}
3607
3608pub trait DevToolsPerContextListenerProxyInterface: Send + Sync {
3609    fn r#on_http_port_open(&self, port: u16) -> Result<(), fidl::Error>;
3610}
3611#[derive(Debug)]
3612#[cfg(target_os = "fuchsia")]
3613pub struct DevToolsPerContextListenerSynchronousProxy {
3614    client: fidl::client::sync::Client,
3615}
3616
3617#[cfg(target_os = "fuchsia")]
3618impl fidl::endpoints::SynchronousProxy for DevToolsPerContextListenerSynchronousProxy {
3619    type Proxy = DevToolsPerContextListenerProxy;
3620    type Protocol = DevToolsPerContextListenerMarker;
3621
3622    fn from_channel(inner: fidl::Channel) -> Self {
3623        Self::new(inner)
3624    }
3625
3626    fn into_channel(self) -> fidl::Channel {
3627        self.client.into_channel()
3628    }
3629
3630    fn as_channel(&self) -> &fidl::Channel {
3631        self.client.as_channel()
3632    }
3633}
3634
3635#[cfg(target_os = "fuchsia")]
3636impl DevToolsPerContextListenerSynchronousProxy {
3637    pub fn new(channel: fidl::Channel) -> Self {
3638        let protocol_name =
3639            <DevToolsPerContextListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3640        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3641    }
3642
3643    pub fn into_channel(self) -> fidl::Channel {
3644        self.client.into_channel()
3645    }
3646
3647    /// Waits until an event arrives and returns it. It is safe for other
3648    /// threads to make concurrent requests while waiting for an event.
3649    pub fn wait_for_event(
3650        &self,
3651        deadline: zx::MonotonicInstant,
3652    ) -> Result<DevToolsPerContextListenerEvent, fidl::Error> {
3653        DevToolsPerContextListenerEvent::decode(self.client.wait_for_event(deadline)?)
3654    }
3655
3656    /// Called when the DevTools service starts accepting TCP connections on `port`. `port` will
3657    /// remain open until the [`Context`] is destroyed.
3658    ///
3659    /// - `port`: The port used by the service.
3660    pub fn r#on_http_port_open(&self, mut port: u16) -> Result<(), fidl::Error> {
3661        self.client.send::<DevToolsPerContextListenerOnHttpPortOpenRequest>(
3662            (port,),
3663            0x5e330939b035553b,
3664            fidl::encoding::DynamicFlags::empty(),
3665        )
3666    }
3667}
3668
3669#[cfg(target_os = "fuchsia")]
3670impl From<DevToolsPerContextListenerSynchronousProxy> for zx::Handle {
3671    fn from(value: DevToolsPerContextListenerSynchronousProxy) -> Self {
3672        value.into_channel().into()
3673    }
3674}
3675
3676#[cfg(target_os = "fuchsia")]
3677impl From<fidl::Channel> for DevToolsPerContextListenerSynchronousProxy {
3678    fn from(value: fidl::Channel) -> Self {
3679        Self::new(value)
3680    }
3681}
3682
3683#[derive(Debug, Clone)]
3684pub struct DevToolsPerContextListenerProxy {
3685    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3686}
3687
3688impl fidl::endpoints::Proxy for DevToolsPerContextListenerProxy {
3689    type Protocol = DevToolsPerContextListenerMarker;
3690
3691    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3692        Self::new(inner)
3693    }
3694
3695    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3696        self.client.into_channel().map_err(|client| Self { client })
3697    }
3698
3699    fn as_channel(&self) -> &::fidl::AsyncChannel {
3700        self.client.as_channel()
3701    }
3702}
3703
3704impl DevToolsPerContextListenerProxy {
3705    /// Create a new Proxy for fuchsia.web/DevToolsPerContextListener.
3706    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3707        let protocol_name =
3708            <DevToolsPerContextListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3709        Self { client: fidl::client::Client::new(channel, protocol_name) }
3710    }
3711
3712    /// Get a Stream of events from the remote end of the protocol.
3713    ///
3714    /// # Panics
3715    ///
3716    /// Panics if the event stream was already taken.
3717    pub fn take_event_stream(&self) -> DevToolsPerContextListenerEventStream {
3718        DevToolsPerContextListenerEventStream { event_receiver: self.client.take_event_receiver() }
3719    }
3720
3721    /// Called when the DevTools service starts accepting TCP connections on `port`. `port` will
3722    /// remain open until the [`Context`] is destroyed.
3723    ///
3724    /// - `port`: The port used by the service.
3725    pub fn r#on_http_port_open(&self, mut port: u16) -> Result<(), fidl::Error> {
3726        DevToolsPerContextListenerProxyInterface::r#on_http_port_open(self, port)
3727    }
3728}
3729
3730impl DevToolsPerContextListenerProxyInterface for DevToolsPerContextListenerProxy {
3731    fn r#on_http_port_open(&self, mut port: u16) -> Result<(), fidl::Error> {
3732        self.client.send::<DevToolsPerContextListenerOnHttpPortOpenRequest>(
3733            (port,),
3734            0x5e330939b035553b,
3735            fidl::encoding::DynamicFlags::empty(),
3736        )
3737    }
3738}
3739
3740pub struct DevToolsPerContextListenerEventStream {
3741    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3742}
3743
3744impl std::marker::Unpin for DevToolsPerContextListenerEventStream {}
3745
3746impl futures::stream::FusedStream for DevToolsPerContextListenerEventStream {
3747    fn is_terminated(&self) -> bool {
3748        self.event_receiver.is_terminated()
3749    }
3750}
3751
3752impl futures::Stream for DevToolsPerContextListenerEventStream {
3753    type Item = Result<DevToolsPerContextListenerEvent, fidl::Error>;
3754
3755    fn poll_next(
3756        mut self: std::pin::Pin<&mut Self>,
3757        cx: &mut std::task::Context<'_>,
3758    ) -> std::task::Poll<Option<Self::Item>> {
3759        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3760            &mut self.event_receiver,
3761            cx
3762        )?) {
3763            Some(buf) => std::task::Poll::Ready(Some(DevToolsPerContextListenerEvent::decode(buf))),
3764            None => std::task::Poll::Ready(None),
3765        }
3766    }
3767}
3768
3769#[derive(Debug)]
3770pub enum DevToolsPerContextListenerEvent {}
3771
3772impl DevToolsPerContextListenerEvent {
3773    /// Decodes a message buffer as a [`DevToolsPerContextListenerEvent`].
3774    fn decode(
3775        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3776    ) -> Result<DevToolsPerContextListenerEvent, fidl::Error> {
3777        let (bytes, _handles) = buf.split_mut();
3778        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3779        debug_assert_eq!(tx_header.tx_id, 0);
3780        match tx_header.ordinal {
3781            _ => Err(fidl::Error::UnknownOrdinal {
3782                ordinal: tx_header.ordinal,
3783                protocol_name: <DevToolsPerContextListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3784            })
3785        }
3786    }
3787}
3788
3789/// A Stream of incoming requests for fuchsia.web/DevToolsPerContextListener.
3790pub struct DevToolsPerContextListenerRequestStream {
3791    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3792    is_terminated: bool,
3793}
3794
3795impl std::marker::Unpin for DevToolsPerContextListenerRequestStream {}
3796
3797impl futures::stream::FusedStream for DevToolsPerContextListenerRequestStream {
3798    fn is_terminated(&self) -> bool {
3799        self.is_terminated
3800    }
3801}
3802
3803impl fidl::endpoints::RequestStream for DevToolsPerContextListenerRequestStream {
3804    type Protocol = DevToolsPerContextListenerMarker;
3805    type ControlHandle = DevToolsPerContextListenerControlHandle;
3806
3807    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3808        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3809    }
3810
3811    fn control_handle(&self) -> Self::ControlHandle {
3812        DevToolsPerContextListenerControlHandle { inner: self.inner.clone() }
3813    }
3814
3815    fn into_inner(
3816        self,
3817    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3818    {
3819        (self.inner, self.is_terminated)
3820    }
3821
3822    fn from_inner(
3823        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3824        is_terminated: bool,
3825    ) -> Self {
3826        Self { inner, is_terminated }
3827    }
3828}
3829
3830impl futures::Stream for DevToolsPerContextListenerRequestStream {
3831    type Item = Result<DevToolsPerContextListenerRequest, fidl::Error>;
3832
3833    fn poll_next(
3834        mut self: std::pin::Pin<&mut Self>,
3835        cx: &mut std::task::Context<'_>,
3836    ) -> std::task::Poll<Option<Self::Item>> {
3837        let this = &mut *self;
3838        if this.inner.check_shutdown(cx) {
3839            this.is_terminated = true;
3840            return std::task::Poll::Ready(None);
3841        }
3842        if this.is_terminated {
3843            panic!("polled DevToolsPerContextListenerRequestStream after completion");
3844        }
3845        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3846            |bytes, handles| {
3847                match this.inner.channel().read_etc(cx, bytes, handles) {
3848                    std::task::Poll::Ready(Ok(())) => {}
3849                    std::task::Poll::Pending => return std::task::Poll::Pending,
3850                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3851                        this.is_terminated = true;
3852                        return std::task::Poll::Ready(None);
3853                    }
3854                    std::task::Poll::Ready(Err(e)) => {
3855                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3856                            e.into(),
3857                        ))))
3858                    }
3859                }
3860
3861                // A message has been received from the channel
3862                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3863
3864                std::task::Poll::Ready(Some(match header.ordinal {
3865                0x5e330939b035553b => {
3866                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3867                    let mut req = fidl::new_empty!(DevToolsPerContextListenerOnHttpPortOpenRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
3868                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DevToolsPerContextListenerOnHttpPortOpenRequest>(&header, _body_bytes, handles, &mut req)?;
3869                    let control_handle = DevToolsPerContextListenerControlHandle {
3870                        inner: this.inner.clone(),
3871                    };
3872                    Ok(DevToolsPerContextListenerRequest::OnHttpPortOpen {port: req.port,
3873
3874                        control_handle,
3875                    })
3876                }
3877                _ => Err(fidl::Error::UnknownOrdinal {
3878                    ordinal: header.ordinal,
3879                    protocol_name: <DevToolsPerContextListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3880                }),
3881            }))
3882            },
3883        )
3884    }
3885}
3886
3887/// Interface supplied by the debugging component to observe the DevTools service opening event.
3888#[derive(Debug)]
3889pub enum DevToolsPerContextListenerRequest {
3890    /// Called when the DevTools service starts accepting TCP connections on `port`. `port` will
3891    /// remain open until the [`Context`] is destroyed.
3892    ///
3893    /// - `port`: The port used by the service.
3894    OnHttpPortOpen { port: u16, control_handle: DevToolsPerContextListenerControlHandle },
3895}
3896
3897impl DevToolsPerContextListenerRequest {
3898    #[allow(irrefutable_let_patterns)]
3899    pub fn into_on_http_port_open(self) -> Option<(u16, DevToolsPerContextListenerControlHandle)> {
3900        if let DevToolsPerContextListenerRequest::OnHttpPortOpen { port, control_handle } = self {
3901            Some((port, control_handle))
3902        } else {
3903            None
3904        }
3905    }
3906
3907    /// Name of the method defined in FIDL
3908    pub fn method_name(&self) -> &'static str {
3909        match *self {
3910            DevToolsPerContextListenerRequest::OnHttpPortOpen { .. } => "on_http_port_open",
3911        }
3912    }
3913}
3914
3915#[derive(Debug, Clone)]
3916pub struct DevToolsPerContextListenerControlHandle {
3917    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3918}
3919
3920impl fidl::endpoints::ControlHandle for DevToolsPerContextListenerControlHandle {
3921    fn shutdown(&self) {
3922        self.inner.shutdown()
3923    }
3924    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3925        self.inner.shutdown_with_epitaph(status)
3926    }
3927
3928    fn is_closed(&self) -> bool {
3929        self.inner.channel().is_closed()
3930    }
3931    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3932        self.inner.channel().on_closed()
3933    }
3934
3935    #[cfg(target_os = "fuchsia")]
3936    fn signal_peer(
3937        &self,
3938        clear_mask: zx::Signals,
3939        set_mask: zx::Signals,
3940    ) -> Result<(), zx_status::Status> {
3941        use fidl::Peered;
3942        self.inner.channel().signal_peer(clear_mask, set_mask)
3943    }
3944}
3945
3946impl DevToolsPerContextListenerControlHandle {}
3947
3948#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3949pub struct FrameMarker;
3950
3951impl fidl::endpoints::ProtocolMarker for FrameMarker {
3952    type Proxy = FrameProxy;
3953    type RequestStream = FrameRequestStream;
3954    #[cfg(target_os = "fuchsia")]
3955    type SynchronousProxy = FrameSynchronousProxy;
3956
3957    const DEBUG_NAME: &'static str = "(anonymous) Frame";
3958}
3959pub type FrameExecuteJavaScriptResult = Result<fidl_fuchsia_mem::Buffer, FrameError>;
3960pub type FrameExecuteJavaScriptNoResultResult = Result<(), FrameError>;
3961pub type FrameAddBeforeLoadJavaScriptResult = Result<(), FrameError>;
3962pub type FramePostMessageResult = Result<(), FrameError>;
3963
3964pub trait FrameProxyInterface: Send + Sync {
3965    fn r#create_view(
3966        &self,
3967        view_token: fidl_fuchsia_ui_views::ViewToken,
3968    ) -> Result<(), fidl::Error>;
3969    fn r#create_view_with_view_ref(
3970        &self,
3971        view_token: fidl_fuchsia_ui_views::ViewToken,
3972        view_ref_control: fidl_fuchsia_ui_views::ViewRefControl,
3973        view_ref: fidl_fuchsia_ui_views::ViewRef,
3974    ) -> Result<(), fidl::Error>;
3975    fn r#create_view2(&self, args: CreateView2Args) -> Result<(), fidl::Error>;
3976    fn r#enable_headless_rendering(&self) -> Result<(), fidl::Error>;
3977    fn r#disable_headless_rendering(&self) -> Result<(), fidl::Error>;
3978    fn r#get_media_player(
3979        &self,
3980        player: fidl::endpoints::ServerEnd<fidl_fuchsia_media_sessions2::PlayerMarker>,
3981    ) -> Result<(), fidl::Error>;
3982    fn r#get_navigation_controller(
3983        &self,
3984        controller: fidl::endpoints::ServerEnd<NavigationControllerMarker>,
3985    ) -> Result<(), fidl::Error>;
3986    type ExecuteJavaScriptResponseFut: std::future::Future<Output = Result<FrameExecuteJavaScriptResult, fidl::Error>>
3987        + Send;
3988    fn r#execute_java_script(
3989        &self,
3990        origins: &[String],
3991        script: fidl_fuchsia_mem::Buffer,
3992    ) -> Self::ExecuteJavaScriptResponseFut;
3993    type ExecuteJavaScriptNoResultResponseFut: std::future::Future<Output = Result<FrameExecuteJavaScriptNoResultResult, fidl::Error>>
3994        + Send;
3995    fn r#execute_java_script_no_result(
3996        &self,
3997        origins: &[String],
3998        script: fidl_fuchsia_mem::Buffer,
3999    ) -> Self::ExecuteJavaScriptNoResultResponseFut;
4000    type AddBeforeLoadJavaScriptResponseFut: std::future::Future<Output = Result<FrameAddBeforeLoadJavaScriptResult, fidl::Error>>
4001        + Send;
4002    fn r#add_before_load_java_script(
4003        &self,
4004        id: u64,
4005        origins: &[String],
4006        script: fidl_fuchsia_mem::Buffer,
4007    ) -> Self::AddBeforeLoadJavaScriptResponseFut;
4008    fn r#remove_before_load_java_script(&self, id: u64) -> Result<(), fidl::Error>;
4009    type PostMessageResponseFut: std::future::Future<Output = Result<FramePostMessageResult, fidl::Error>>
4010        + Send;
4011    fn r#post_message(
4012        &self,
4013        target_origin: &str,
4014        message: WebMessage,
4015    ) -> Self::PostMessageResponseFut;
4016    fn r#set_navigation_event_listener(
4017        &self,
4018        listener: Option<fidl::endpoints::ClientEnd<NavigationEventListenerMarker>>,
4019    ) -> Result<(), fidl::Error>;
4020    fn r#set_navigation_event_listener2(
4021        &self,
4022        listener: Option<fidl::endpoints::ClientEnd<NavigationEventListenerMarker>>,
4023        flags: NavigationEventListenerFlags,
4024    ) -> Result<(), fidl::Error>;
4025    fn r#set_java_script_log_level(&self, level: ConsoleLogLevel) -> Result<(), fidl::Error>;
4026    fn r#set_console_log_sink(
4027        &self,
4028        sink: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_logger::LogSinkMarker>>,
4029    ) -> Result<(), fidl::Error>;
4030    fn r#configure_input_types(
4031        &self,
4032        types: InputTypes,
4033        allow: AllowInputState,
4034    ) -> Result<(), fidl::Error>;
4035    fn r#set_popup_frame_creation_listener(
4036        &self,
4037        listener: Option<fidl::endpoints::ClientEnd<PopupFrameCreationListenerMarker>>,
4038    ) -> Result<(), fidl::Error>;
4039    type SetUrlRequestRewriteRulesResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
4040        + Send;
4041    fn r#set_url_request_rewrite_rules(
4042        &self,
4043        rules: &[UrlRequestRewriteRule],
4044    ) -> Self::SetUrlRequestRewriteRulesResponseFut;
4045    fn r#set_media_settings(&self, settings: &FrameMediaSettings) -> Result<(), fidl::Error>;
4046    fn r#force_content_dimensions(
4047        &self,
4048        web_dips: Option<&fidl_fuchsia_ui_gfx::Vec2>,
4049    ) -> Result<(), fidl::Error>;
4050    fn r#set_permission_state(
4051        &self,
4052        permission: &PermissionDescriptor,
4053        web_origin: &str,
4054        state: PermissionState,
4055    ) -> Result<(), fidl::Error>;
4056    fn r#set_block_media_loading(&self, blocked: bool) -> Result<(), fidl::Error>;
4057    type GetPrivateMemorySizeResponseFut: std::future::Future<Output = Result<u64, fidl::Error>>
4058        + Send;
4059    fn r#get_private_memory_size(&self) -> Self::GetPrivateMemorySizeResponseFut;
4060    fn r#set_navigation_policy_provider(
4061        &self,
4062        params: &NavigationPolicyProviderParams,
4063        provider: fidl::endpoints::ClientEnd<NavigationPolicyProviderMarker>,
4064    ) -> Result<(), fidl::Error>;
4065    fn r#set_content_area_settings(
4066        &self,
4067        settings: &ContentAreaSettings,
4068    ) -> Result<(), fidl::Error>;
4069    fn r#reset_content_area_settings(&self) -> Result<(), fidl::Error>;
4070    fn r#close(&self, payload: &FrameCloseRequest) -> Result<(), fidl::Error>;
4071}
4072#[derive(Debug)]
4073#[cfg(target_os = "fuchsia")]
4074pub struct FrameSynchronousProxy {
4075    client: fidl::client::sync::Client,
4076}
4077
4078#[cfg(target_os = "fuchsia")]
4079impl fidl::endpoints::SynchronousProxy for FrameSynchronousProxy {
4080    type Proxy = FrameProxy;
4081    type Protocol = FrameMarker;
4082
4083    fn from_channel(inner: fidl::Channel) -> Self {
4084        Self::new(inner)
4085    }
4086
4087    fn into_channel(self) -> fidl::Channel {
4088        self.client.into_channel()
4089    }
4090
4091    fn as_channel(&self) -> &fidl::Channel {
4092        self.client.as_channel()
4093    }
4094}
4095
4096#[cfg(target_os = "fuchsia")]
4097impl FrameSynchronousProxy {
4098    pub fn new(channel: fidl::Channel) -> Self {
4099        let protocol_name = <FrameMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4100        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4101    }
4102
4103    pub fn into_channel(self) -> fidl::Channel {
4104        self.client.into_channel()
4105    }
4106
4107    /// Waits until an event arrives and returns it. It is safe for other
4108    /// threads to make concurrent requests while waiting for an event.
4109    pub fn wait_for_event(
4110        &self,
4111        deadline: zx::MonotonicInstant,
4112    ) -> Result<FrameEvent, fidl::Error> {
4113        FrameEvent::decode(self.client.wait_for_event(deadline)?)
4114    }
4115
4116    /// Creates a new view using the specified `view_token`. Caller should pass the other end of
4117    /// the token to [`fuchsia.ui.gfx/ViewHolderArgs`] to attach the new view to a view tree.
4118    ///
4119    /// See the description of [`CreateContextParams.service_directory`] for additional services
4120    /// that must be present when using this method.
4121    pub fn r#create_view(
4122        &self,
4123        mut view_token: fidl_fuchsia_ui_views::ViewToken,
4124    ) -> Result<(), fidl::Error> {
4125        self.client.send::<FrameCreateViewRequest>(
4126            (&mut view_token,),
4127            0x6a27859439133264,
4128            fidl::encoding::DynamicFlags::empty(),
4129        )
4130    }
4131
4132    /// Creates a new view using the specified `view_token`. Caller should pass the other end of
4133    /// the token to [`fuchsia.ui.gfx/ViewHolderArgs`] to attach the new view to a view tree.
4134    /// `view_ref` can be cloned before passing it to this method, which will allow clients to
4135    /// track the view.
4136    ///
4137    /// `view_ref_control` must not have the `ZX_RIGHT_DUPLICATE` set, or view creation will fail
4138    /// and `view_token` will be closed.
4139    ///
4140    /// See the description of [`CreateContextParams.service_directory`] for additional services
4141    /// that must be present when using this method.
4142    pub fn r#create_view_with_view_ref(
4143        &self,
4144        mut view_token: fidl_fuchsia_ui_views::ViewToken,
4145        mut view_ref_control: fidl_fuchsia_ui_views::ViewRefControl,
4146        mut view_ref: fidl_fuchsia_ui_views::ViewRef,
4147    ) -> Result<(), fidl::Error> {
4148        self.client.send::<FrameCreateViewWithViewRefRequest>(
4149            (&mut view_token, &mut view_ref_control, &mut view_ref),
4150            0x1eb17ab2442326ac,
4151            fidl::encoding::DynamicFlags::empty(),
4152        )
4153    }
4154
4155    /// Creates a new Flatland view using the specified `view_creation_token` defined under `args`.
4156    /// Caller should pass the other end of the token to
4157    /// [`fuchsia.ui.composition/Flatland.CreateViewport`] to attach the new Flatland view to its
4158    /// graph.
4159    pub fn r#create_view2(&self, mut args: CreateView2Args) -> Result<(), fidl::Error> {
4160        self.client.send::<FrameCreateView2Request>(
4161            (&mut args,),
4162            0x1be7e9512962eb37,
4163            fidl::encoding::DynamicFlags::empty(),
4164        )
4165    }
4166
4167    /// Enables headless rendering of the Frame.
4168    ///
4169    /// This is used when content depends on layout and/or animation events firing normally.
4170    /// May only be used on a Context created with [`ContextFeatureFlags.HEADLESS`].
4171    pub fn r#enable_headless_rendering(&self) -> Result<(), fidl::Error> {
4172        self.client.send::<fidl::encoding::EmptyPayload>(
4173            (),
4174            0x72a81aaae7a80d2b,
4175            fidl::encoding::DynamicFlags::empty(),
4176        )
4177    }
4178
4179    /// Stops headless rendering of the Frame.
4180    ///
4181    /// May only be used on a Context created with [`ContextFeatureFlags.HEADLESS`].
4182    pub fn r#disable_headless_rendering(&self) -> Result<(), fidl::Error> {
4183        self.client.send::<fidl::encoding::EmptyPayload>(
4184            (),
4185            0x5ca38a3d1f7f543a,
4186            fidl::encoding::DynamicFlags::empty(),
4187        )
4188    }
4189
4190    /// Returns a [`fuchsia.media.sessions2/Player`] interface through which media (i.e.
4191    /// video/audio) playback in the frame may be observed, and/or controlled. Only one
4192    /// [`fuchsia.media.sessions2/Player`] may be active at a time, for each [`Frame`].
4193    pub fn r#get_media_player(
4194        &self,
4195        mut player: fidl::endpoints::ServerEnd<fidl_fuchsia_media_sessions2::PlayerMarker>,
4196    ) -> Result<(), fidl::Error> {
4197        self.client.send::<FrameGetMediaPlayerRequest>(
4198            (player,),
4199            0xaafb639fc0b9eb9,
4200            fidl::encoding::DynamicFlags::empty(),
4201        )
4202    }
4203
4204    /// Returns an interface through which the [`Frame`] may be navigated to a desired URL,
4205    /// reloaded, etc.
4206    ///
4207    /// - `controller`: An asynchronous interface request for the [`Frame`]'s
4208    ///   [`NavigationController`].
4209    pub fn r#get_navigation_controller(
4210        &self,
4211        mut controller: fidl::endpoints::ServerEnd<NavigationControllerMarker>,
4212    ) -> Result<(), fidl::Error> {
4213        self.client.send::<FrameGetNavigationControllerRequest>(
4214            (controller,),
4215            0x4521cfe95217a688,
4216            fidl::encoding::DynamicFlags::empty(),
4217        )
4218    }
4219
4220    /// Executes a UTF-8 encoded `script` in the [`Frame`] if the [`Frame`]'s URL has an origin
4221    /// which matches entries in `origins`.
4222    ///
4223    /// At least one `origins` entry must be specified. If a wildcard `"*"` is specified in
4224    /// `origins`, then the script will be evaluated unconditionally.
4225    ///
4226    /// Returns the result of executing `script`, as a JSON-encoded string.
4227    ///
4228    /// Note that scripts share the same execution context as the document,
4229    /// meaning that document may modify variables, classes, or objects set by
4230    /// the script in arbitrary or unpredictable ways.
4231    ///
4232    /// If an error occurred, the FrameError will be set to one of these values:
4233    /// - `BUFFER_NOT_UTF8`: `script` is not UTF-8 encoded.
4234    /// - `INVALID_ORIGIN`: The [`Frame`]'s current URL does not match any of the values in
4235    ///   `origins` or `origins` is an empty vector.
4236    pub fn r#execute_java_script(
4237        &self,
4238        mut origins: &[String],
4239        mut script: fidl_fuchsia_mem::Buffer,
4240        ___deadline: zx::MonotonicInstant,
4241    ) -> Result<FrameExecuteJavaScriptResult, fidl::Error> {
4242        let _response = self.client.send_query::<
4243            FrameExecuteJavaScriptRequest,
4244            fidl::encoding::ResultType<FrameExecuteJavaScriptResponse, FrameError>,
4245        >(
4246            (origins, &mut script,),
4247            0x79abdd4907000542,
4248            fidl::encoding::DynamicFlags::empty(),
4249            ___deadline,
4250        )?;
4251        Ok(_response.map(|x| x.result))
4252    }
4253
4254    /// Variant of [`Frame.ExecuteJavaScript`] which executes the supplied script without returning
4255    /// a result.
4256    pub fn r#execute_java_script_no_result(
4257        &self,
4258        mut origins: &[String],
4259        mut script: fidl_fuchsia_mem::Buffer,
4260        ___deadline: zx::MonotonicInstant,
4261    ) -> Result<FrameExecuteJavaScriptNoResultResult, fidl::Error> {
4262        let _response = self.client.send_query::<
4263            FrameExecuteJavaScriptNoResultRequest,
4264            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FrameError>,
4265        >(
4266            (origins, &mut script,),
4267            0x16b8491520cbcd63,
4268            fidl::encoding::DynamicFlags::empty(),
4269            ___deadline,
4270        )?;
4271        Ok(_response.map(|x| x))
4272    }
4273
4274    /// Executes a UTF-8 encoded `script` for every subsequent page load where the [`Frame`]'s URL
4275    /// has an origin reflected in `origins`. The script is executed early, prior to the execution
4276    /// of the document's scripts.
4277    ///
4278    /// Scripts are identified by a client-managed identifier `id`. Any script previously injected
4279    /// using the same `id` will be replaced.
4280    ///
4281    /// The order in which multiple bindings are executed is the same as the order in which the
4282    /// bindings were added. If a script is added which clobbers an existing script of the same
4283    /// `id`, the previous script's precedence in the injection order will be preserved.
4284    ///
4285    /// At least one `origins` entry must be specified. If a wildcard `"*"` is specified in
4286    /// `origins`, then the script will be evaluated unconditionally.
4287    ///
4288    /// If an error occurred, the [`FrameError`] will be set to one of these values:
4289    /// - `BUFFER_NOT_UTF8`: `script` is not UTF-8 encoded.
4290    /// - `INVALID_ORIGIN`: `origins` is an empty vector.
4291    pub fn r#add_before_load_java_script(
4292        &self,
4293        mut id: u64,
4294        mut origins: &[String],
4295        mut script: fidl_fuchsia_mem::Buffer,
4296        ___deadline: zx::MonotonicInstant,
4297    ) -> Result<FrameAddBeforeLoadJavaScriptResult, fidl::Error> {
4298        let _response = self.client.send_query::<
4299            FrameAddBeforeLoadJavaScriptRequest,
4300            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FrameError>,
4301        >(
4302            (id, origins, &mut script,),
4303            0x540ac0da59d823e,
4304            fidl::encoding::DynamicFlags::empty(),
4305            ___deadline,
4306        )?;
4307        Ok(_response.map(|x| x))
4308    }
4309
4310    /// Removes a previously added JavaScript snippet identified by `id`. This is a no-op if there
4311    /// is no JavaScript snippet identified by `id`.
4312    pub fn r#remove_before_load_java_script(&self, mut id: u64) -> Result<(), fidl::Error> {
4313        self.client.send::<FrameRemoveBeforeLoadJavaScriptRequest>(
4314            (id,),
4315            0x17d92b855b61d23a,
4316            fidl::encoding::DynamicFlags::empty(),
4317        )
4318    }
4319
4320    /// Posts a message to the frame's onMessage handler.
4321    ///
4322    /// `target_origin` restricts message delivery to the specified origin. If `target_origin` is
4323    /// `"*"`, then the message will be sent to the document regardless of its origin.
4324    /// See the
4325    /// [HTML spec](https://html.spec.whatwg.org/multipage/web-messaging.html#posting-messages)
4326    /// section 9.4.3 for more details on how the target origin policy is applied.
4327    ///
4328    /// If an error occurred, the [`FrameError`] will be set to one of these values:
4329    /// - `INTERNAL_ERROR`: The WebEngine failed to create a message pipe.
4330    /// - `BUFFER_NOT_UTF8`: The script in `message`'s `data` property is not UTF-8 encoded.
4331    /// - `INVALID_ORIGIN`: `origins` is an empty vector.
4332    /// - `NO_DATA_IN_MESSAGE`: The `data` property is missing in `message`.
4333    pub fn r#post_message(
4334        &self,
4335        mut target_origin: &str,
4336        mut message: WebMessage,
4337        ___deadline: zx::MonotonicInstant,
4338    ) -> Result<FramePostMessageResult, fidl::Error> {
4339        let _response = self.client.send_query::<
4340            FramePostMessageRequest,
4341            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FrameError>,
4342        >(
4343            (target_origin, &mut message,),
4344            0x751d686eb7caa341,
4345            fidl::encoding::DynamicFlags::empty(),
4346            ___deadline,
4347        )?;
4348        Ok(_response.map(|x| x))
4349    }
4350
4351    /// Sets the listener for handling page navigation events.
4352    ///
4353    /// - `listener`: The observer to use. Unregisters any existing listener if null.
4354    pub fn r#set_navigation_event_listener(
4355        &self,
4356        mut listener: Option<fidl::endpoints::ClientEnd<NavigationEventListenerMarker>>,
4357    ) -> Result<(), fidl::Error> {
4358        self.client.send::<FrameSetNavigationEventListenerRequest>(
4359            (listener,),
4360            0x965ba0fa20e0a56,
4361            fidl::encoding::DynamicFlags::empty(),
4362        )
4363    }
4364
4365    /// Sets the listener for handling page navigation events. The listener will receive the
4366    /// current navigation state immediately. After that, it's notified whenever the state changes.
4367    ///
4368    /// - `listener`: The observer to use. Unregisters any existing listener if null.
4369    /// - `flags`: Flags for optional features that should be enabled for the listener.
4370    pub fn r#set_navigation_event_listener2(
4371        &self,
4372        mut listener: Option<fidl::endpoints::ClientEnd<NavigationEventListenerMarker>>,
4373        mut flags: NavigationEventListenerFlags,
4374    ) -> Result<(), fidl::Error> {
4375        self.client.send::<FrameSetNavigationEventListener2Request>(
4376            (listener, flags),
4377            0x5f8b40607f1f578f,
4378            fidl::encoding::DynamicFlags::empty(),
4379        )
4380    }
4381
4382    /// If set to a value other than [`ConsoleLogLevel.NONE`], allows web content to log messages
4383    /// to the [`fuchsia.logger/LogSink`] configured for this [`Frame`], via the
4384    /// `console` object (e.g. using `debug()`, `log()`, `info()`, `warn()` and
4385    /// `error()`).
4386    /// The default value is [`ConsoleLogLevel.NONE`].
4387    ///
4388    /// As the system log may be persisted, it is recommended that [`ConsoleLogLevel.NONE`] be used
4389    /// in Incognito and other private browsing modes.
4390    ///
4391    /// Log lines are written to the [`fuchsia.logger/LogsSink`] configured
4392    /// for this [`fuchsia.web/Frame`], with severities mapped as follows:
4393    /// - `debug()`, `log()` and `info()` are logged at [`fuchsia.logger/LogLevelFilter.INFO`]
4394    ///   severity.
4395    /// - `warn()` is logged at [`fuchsia.logger/LogLevelFilter.WARN`] severity.
4396    /// - `error()` is logged at [`fuchsia.logger/LogLevelFilter.ERROR`] severity.
4397    pub fn r#set_java_script_log_level(
4398        &self,
4399        mut level: ConsoleLogLevel,
4400    ) -> Result<(), fidl::Error> {
4401        self.client.send::<FrameSetJavaScriptLogLevelRequest>(
4402            (level,),
4403            0x74824b11a71c4b5b,
4404            fidl::encoding::DynamicFlags::empty(),
4405        )
4406    }
4407
4408    /// Specifies where to emit `console` log output to. By default log output will be routed to a
4409    /// [`fuchsia.logger/LogSink`] obtained via the [`fuchsia.web/Context`]'s service directory.
4410    ///
4411    /// - `sink`: The [`fuchsia.logger/LogSink`] to use to emit logs. Passing a `null` handle
4412    ///   resets logging to use the default [`fuchsia.logger/LogSink`].
4413    pub fn r#set_console_log_sink(
4414        &self,
4415        mut sink: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_logger::LogSinkMarker>>,
4416    ) -> Result<(), fidl::Error> {
4417        self.client.send::<FrameSetConsoleLogSinkRequest>(
4418            (sink,),
4419            0x18f5cbc19fa4687b,
4420            fidl::encoding::DynamicFlags::empty(),
4421        )
4422    }
4423
4424    /// Enables or disables the processing of the specified `types` of user inputs.
4425    /// `allow` specifies whether to enable or disable the specified `types`.
4426    /// All input types are enabled by default.
4427    pub fn r#configure_input_types(
4428        &self,
4429        mut types: InputTypes,
4430        mut allow: AllowInputState,
4431    ) -> Result<(), fidl::Error> {
4432        self.client.send::<FrameConfigureInputTypesRequest>(
4433            (types, allow),
4434            0x38e08fe763c6bef6,
4435            fidl::encoding::DynamicFlags::empty(),
4436        )
4437    }
4438
4439    /// Sets the listener for handling popup frame opened by web content. If no listener is
4440    /// present, then any new popup frame will be blocked.
4441    ///
4442    /// - `listener`: The listener to use. Unregisters any existing listener if null.
4443    pub fn r#set_popup_frame_creation_listener(
4444        &self,
4445        mut listener: Option<fidl::endpoints::ClientEnd<PopupFrameCreationListenerMarker>>,
4446    ) -> Result<(), fidl::Error> {
4447        self.client.send::<FrameSetPopupFrameCreationListenerRequest>(
4448            (listener,),
4449            0x34ddec4e9f11e2aa,
4450            fidl::encoding::DynamicFlags::empty(),
4451        )
4452    }
4453
4454    /// Supplies a set of [`UrlRequestRewriteRule`] to apply on every subsequent URL request.
4455    /// - `rules` are cumulative and applied in order.
4456    /// - `rules` are only applied on the first URL request in a redirect chain.
4457    /// - `rules` will be validated before being applied. If `rules` are invalid, the [`Frame`]
4458    ///   will be closed with `ERR_INVALID_ARGS`.
4459    /// - [`Frame.SetUrlRequestRewriteRules`] must not be called again until its acknowledgement
4460    ///   callback has been processed. If this happens, the [`Frame`] will be closed with
4461    ///   `ERR_BAD_STATE`.
4462    pub fn r#set_url_request_rewrite_rules(
4463        &self,
4464        mut rules: &[UrlRequestRewriteRule],
4465        ___deadline: zx::MonotonicInstant,
4466    ) -> Result<(), fidl::Error> {
4467        let _response = self
4468            .client
4469            .send_query::<FrameSetUrlRequestRewriteRulesRequest, fidl::encoding::EmptyPayload>(
4470                (rules,),
4471                0x2e3f797350ab3281,
4472                fidl::encoding::DynamicFlags::empty(),
4473                ___deadline,
4474            )?;
4475        Ok(_response)
4476    }
4477
4478    /// Sets [`fuchsia.media/FrameMediaSettings`] for the frame. The specified parameters are
4479    /// applied to audio streams that started after this message is processed. Should be called
4480    /// before the Frame is navigated to content in order to ensure that the settings applied to
4481    /// all media streams. Due to request pipelining, this means doing so before calling
4482    /// [`Frame.GetNavigationController()`] and [`NavigationController.LoadUrl()`].
4483    pub fn r#set_media_settings(
4484        &self,
4485        mut settings: &FrameMediaSettings,
4486    ) -> Result<(), fidl::Error> {
4487        self.client.send::<FrameSetMediaSettingsRequest>(
4488            (settings,),
4489            0x7da879b6d284c143,
4490            fidl::encoding::DynamicFlags::empty(),
4491        )
4492    }
4493
4494    /// Overrides the dimensions reported to web content. The devicePixelRatio reported to
4495    /// web content will be adjusted in response to changes in the pixel size of the View,
4496    /// rather than changing the size reported to the content. Call with null `web_dips` to
4497    /// remove any prior forced content dimensions.
4498    pub fn r#force_content_dimensions(
4499        &self,
4500        mut web_dips: Option<&fidl_fuchsia_ui_gfx::Vec2>,
4501    ) -> Result<(), fidl::Error> {
4502        self.client.send::<FrameForceContentDimensionsRequest>(
4503            (web_dips,),
4504            0x8c7024c7149c901,
4505            fidl::encoding::DynamicFlags::empty(),
4506        )
4507    }
4508
4509    /// Sets the permission state for the specified `permission` and `web_origin`. By default, all
4510    /// permissions are denied.
4511    pub fn r#set_permission_state(
4512        &self,
4513        mut permission: &PermissionDescriptor,
4514        mut web_origin: &str,
4515        mut state: PermissionState,
4516    ) -> Result<(), fidl::Error> {
4517        self.client.send::<FrameSetPermissionStateRequest>(
4518            (permission, web_origin, state),
4519            0x19574e92a7033f4f,
4520            fidl::encoding::DynamicFlags::empty(),
4521        )
4522    }
4523
4524    /// Sets whether to block all HTMLMediaElements in the frame from fetching and loading media
4525    /// resources.
4526    ///
4527    /// May be used, for example, to prevent loading media in frames that are not visible.
4528    ///
4529    /// While media loading is blocked, elements with `autoplay` set to `true` will not start
4530    /// playback. The promises returned by calls to `play()` will remain unresolved until loading is
4531    /// unblocked by a call to this method.
4532    ///
4533    /// When media loading is unblocked, elements will begin fetching, resource, loading, and
4534    /// playing as appropriate.
4535    ///
4536    /// Any elements that have begun fetching or loading media resources for the current source
4537    /// before media loading was blocked will continue to fetch, load, and start playback as
4538    /// appropriate. This includes calls to `play()` even after media loading is blocked.
4539    pub fn r#set_block_media_loading(&self, mut blocked: bool) -> Result<(), fidl::Error> {
4540        self.client.send::<FrameSetBlockMediaLoadingRequest>(
4541            (blocked,),
4542            0x211071458fc9cf4f,
4543            fidl::encoding::DynamicFlags::empty(),
4544        )
4545    }
4546
4547    /// Returns the amount of private (non-shared) physical memory used by the Frame's main
4548    /// document. The returned size might not reflect the memory usage of embedded iframes.
4549    pub fn r#get_private_memory_size(
4550        &self,
4551        ___deadline: zx::MonotonicInstant,
4552    ) -> Result<u64, fidl::Error> {
4553        let _response = self
4554            .client
4555            .send_query::<fidl::encoding::EmptyPayload, FrameGetPrivateMemorySizeResponse>(
4556                (),
4557                0x6ad4d43da6c129b0,
4558                fidl::encoding::DynamicFlags::empty(),
4559                ___deadline,
4560            )?;
4561        Ok(_response.size_bytes)
4562    }
4563
4564    /// Sets the navigation policy provider for the [`Frame`]. When set, the [`Frame`] sends
4565    /// [`NavigationPolicyProvider.EvaluateRequestedNavigation`] when processing navigation
4566    /// requests. `params` defines when the message is sent. After sending the
4567    /// `EvaluateRequestedNavigation` message, the [`Frame`] blocks the corresponding navigation
4568    /// until it receives a response.
4569    ///
4570    /// Should be called before `GetNavigationController` to ensure that it is applied to all
4571    /// navigations including the first [`NavigationController.LoadURL`] request.
4572    pub fn r#set_navigation_policy_provider(
4573        &self,
4574        mut params: &NavigationPolicyProviderParams,
4575        mut provider: fidl::endpoints::ClientEnd<NavigationPolicyProviderMarker>,
4576    ) -> Result<(), fidl::Error> {
4577        self.client.send::<FrameSetNavigationPolicyProviderRequest>(
4578            (params, provider),
4579            0x602ce35195d66654,
4580            fidl::encoding::DynamicFlags::empty(),
4581        )
4582    }
4583
4584    /// Sets various settings for how web content should be run in the Frame. May be called at any
4585    /// time, including after the URL has loaded. Each call changes only the specified fields,
4586    /// overwriting any prior value.
4587    ///
4588    /// This method will fail with `ZX_ERR_NOT_SUPPORTED` if any value in [`ContentAreaSettings`]
4589    /// is not supported by the Frame.
4590    pub fn r#set_content_area_settings(
4591        &self,
4592        mut settings: &ContentAreaSettings,
4593    ) -> Result<(), fidl::Error> {
4594        self.client.send::<FrameSetContentAreaSettingsRequest>(
4595            (settings,),
4596            0x851f4de50c3c27e,
4597            fidl::encoding::DynamicFlags::empty(),
4598        )
4599    }
4600
4601    /// Reset the Frame's [`ContentAreaSettings`] to default values.
4602    pub fn r#reset_content_area_settings(&self) -> Result<(), fidl::Error> {
4603        self.client.send::<fidl::encoding::EmptyPayload>(
4604            (),
4605            0x6807e04f16f8ee5d,
4606            fidl::encoding::DynamicFlags::empty(),
4607        )
4608    }
4609
4610    /// Request graceful or immediate teardown of the Frame content and notification of completion
4611    /// via Frame epitaph.
4612    ///
4613    /// Graceful teardown allows unload and cleanup tasks in the implementation and web content
4614    /// (e.g., `unload` event handlers) to run for up to the specified period of time. Immediate
4615    /// teardown only runs the minimum cleanup tasks in the implementation and does not allow web
4616    /// content to run event handlers.
4617    ///
4618    /// * If `timeout` is zero, an immediate teardown is initiated. The channel will close with
4619    ///   `ZX_OK`. This is equivalent to the caller closing the Frame channel.
4620    ///
4621    /// * If `timeout` is non-zero, a graceful teardown is initiated. The channel will close with
4622    ///   `ZX_OK` if the Frame closes within the specified `timeout` and with `ZX_ERR_TIMED_OUT`
4623    ///   otherwise.
4624    ///
4625    /// * If `timeout` is not specified, a reasonable implementation-specific timeout is applied.
4626    ///
4627    /// Subsequent calls to `Close()` will override any previously specified `Close()` timeout.
4628    pub fn r#close(&self, mut payload: &FrameCloseRequest) -> Result<(), fidl::Error> {
4629        self.client.send::<FrameCloseRequest>(
4630            payload,
4631            0x442e84138e65351,
4632            fidl::encoding::DynamicFlags::empty(),
4633        )
4634    }
4635}
4636
4637#[cfg(target_os = "fuchsia")]
4638impl From<FrameSynchronousProxy> for zx::Handle {
4639    fn from(value: FrameSynchronousProxy) -> Self {
4640        value.into_channel().into()
4641    }
4642}
4643
4644#[cfg(target_os = "fuchsia")]
4645impl From<fidl::Channel> for FrameSynchronousProxy {
4646    fn from(value: fidl::Channel) -> Self {
4647        Self::new(value)
4648    }
4649}
4650
4651#[derive(Debug, Clone)]
4652pub struct FrameProxy {
4653    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4654}
4655
4656impl fidl::endpoints::Proxy for FrameProxy {
4657    type Protocol = FrameMarker;
4658
4659    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4660        Self::new(inner)
4661    }
4662
4663    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4664        self.client.into_channel().map_err(|client| Self { client })
4665    }
4666
4667    fn as_channel(&self) -> &::fidl::AsyncChannel {
4668        self.client.as_channel()
4669    }
4670}
4671
4672impl FrameProxy {
4673    /// Create a new Proxy for fuchsia.web/Frame.
4674    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4675        let protocol_name = <FrameMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4676        Self { client: fidl::client::Client::new(channel, protocol_name) }
4677    }
4678
4679    /// Get a Stream of events from the remote end of the protocol.
4680    ///
4681    /// # Panics
4682    ///
4683    /// Panics if the event stream was already taken.
4684    pub fn take_event_stream(&self) -> FrameEventStream {
4685        FrameEventStream { event_receiver: self.client.take_event_receiver() }
4686    }
4687
4688    /// Creates a new view using the specified `view_token`. Caller should pass the other end of
4689    /// the token to [`fuchsia.ui.gfx/ViewHolderArgs`] to attach the new view to a view tree.
4690    ///
4691    /// See the description of [`CreateContextParams.service_directory`] for additional services
4692    /// that must be present when using this method.
4693    pub fn r#create_view(
4694        &self,
4695        mut view_token: fidl_fuchsia_ui_views::ViewToken,
4696    ) -> Result<(), fidl::Error> {
4697        FrameProxyInterface::r#create_view(self, view_token)
4698    }
4699
4700    /// Creates a new view using the specified `view_token`. Caller should pass the other end of
4701    /// the token to [`fuchsia.ui.gfx/ViewHolderArgs`] to attach the new view to a view tree.
4702    /// `view_ref` can be cloned before passing it to this method, which will allow clients to
4703    /// track the view.
4704    ///
4705    /// `view_ref_control` must not have the `ZX_RIGHT_DUPLICATE` set, or view creation will fail
4706    /// and `view_token` will be closed.
4707    ///
4708    /// See the description of [`CreateContextParams.service_directory`] for additional services
4709    /// that must be present when using this method.
4710    pub fn r#create_view_with_view_ref(
4711        &self,
4712        mut view_token: fidl_fuchsia_ui_views::ViewToken,
4713        mut view_ref_control: fidl_fuchsia_ui_views::ViewRefControl,
4714        mut view_ref: fidl_fuchsia_ui_views::ViewRef,
4715    ) -> Result<(), fidl::Error> {
4716        FrameProxyInterface::r#create_view_with_view_ref(
4717            self,
4718            view_token,
4719            view_ref_control,
4720            view_ref,
4721        )
4722    }
4723
4724    /// Creates a new Flatland view using the specified `view_creation_token` defined under `args`.
4725    /// Caller should pass the other end of the token to
4726    /// [`fuchsia.ui.composition/Flatland.CreateViewport`] to attach the new Flatland view to its
4727    /// graph.
4728    pub fn r#create_view2(&self, mut args: CreateView2Args) -> Result<(), fidl::Error> {
4729        FrameProxyInterface::r#create_view2(self, args)
4730    }
4731
4732    /// Enables headless rendering of the Frame.
4733    ///
4734    /// This is used when content depends on layout and/or animation events firing normally.
4735    /// May only be used on a Context created with [`ContextFeatureFlags.HEADLESS`].
4736    pub fn r#enable_headless_rendering(&self) -> Result<(), fidl::Error> {
4737        FrameProxyInterface::r#enable_headless_rendering(self)
4738    }
4739
4740    /// Stops headless rendering of the Frame.
4741    ///
4742    /// May only be used on a Context created with [`ContextFeatureFlags.HEADLESS`].
4743    pub fn r#disable_headless_rendering(&self) -> Result<(), fidl::Error> {
4744        FrameProxyInterface::r#disable_headless_rendering(self)
4745    }
4746
4747    /// Returns a [`fuchsia.media.sessions2/Player`] interface through which media (i.e.
4748    /// video/audio) playback in the frame may be observed, and/or controlled. Only one
4749    /// [`fuchsia.media.sessions2/Player`] may be active at a time, for each [`Frame`].
4750    pub fn r#get_media_player(
4751        &self,
4752        mut player: fidl::endpoints::ServerEnd<fidl_fuchsia_media_sessions2::PlayerMarker>,
4753    ) -> Result<(), fidl::Error> {
4754        FrameProxyInterface::r#get_media_player(self, player)
4755    }
4756
4757    /// Returns an interface through which the [`Frame`] may be navigated to a desired URL,
4758    /// reloaded, etc.
4759    ///
4760    /// - `controller`: An asynchronous interface request for the [`Frame`]'s
4761    ///   [`NavigationController`].
4762    pub fn r#get_navigation_controller(
4763        &self,
4764        mut controller: fidl::endpoints::ServerEnd<NavigationControllerMarker>,
4765    ) -> Result<(), fidl::Error> {
4766        FrameProxyInterface::r#get_navigation_controller(self, controller)
4767    }
4768
4769    /// Executes a UTF-8 encoded `script` in the [`Frame`] if the [`Frame`]'s URL has an origin
4770    /// which matches entries in `origins`.
4771    ///
4772    /// At least one `origins` entry must be specified. If a wildcard `"*"` is specified in
4773    /// `origins`, then the script will be evaluated unconditionally.
4774    ///
4775    /// Returns the result of executing `script`, as a JSON-encoded string.
4776    ///
4777    /// Note that scripts share the same execution context as the document,
4778    /// meaning that document may modify variables, classes, or objects set by
4779    /// the script in arbitrary or unpredictable ways.
4780    ///
4781    /// If an error occurred, the FrameError will be set to one of these values:
4782    /// - `BUFFER_NOT_UTF8`: `script` is not UTF-8 encoded.
4783    /// - `INVALID_ORIGIN`: The [`Frame`]'s current URL does not match any of the values in
4784    ///   `origins` or `origins` is an empty vector.
4785    pub fn r#execute_java_script(
4786        &self,
4787        mut origins: &[String],
4788        mut script: fidl_fuchsia_mem::Buffer,
4789    ) -> fidl::client::QueryResponseFut<
4790        FrameExecuteJavaScriptResult,
4791        fidl::encoding::DefaultFuchsiaResourceDialect,
4792    > {
4793        FrameProxyInterface::r#execute_java_script(self, origins, script)
4794    }
4795
4796    /// Variant of [`Frame.ExecuteJavaScript`] which executes the supplied script without returning
4797    /// a result.
4798    pub fn r#execute_java_script_no_result(
4799        &self,
4800        mut origins: &[String],
4801        mut script: fidl_fuchsia_mem::Buffer,
4802    ) -> fidl::client::QueryResponseFut<
4803        FrameExecuteJavaScriptNoResultResult,
4804        fidl::encoding::DefaultFuchsiaResourceDialect,
4805    > {
4806        FrameProxyInterface::r#execute_java_script_no_result(self, origins, script)
4807    }
4808
4809    /// Executes a UTF-8 encoded `script` for every subsequent page load where the [`Frame`]'s URL
4810    /// has an origin reflected in `origins`. The script is executed early, prior to the execution
4811    /// of the document's scripts.
4812    ///
4813    /// Scripts are identified by a client-managed identifier `id`. Any script previously injected
4814    /// using the same `id` will be replaced.
4815    ///
4816    /// The order in which multiple bindings are executed is the same as the order in which the
4817    /// bindings were added. If a script is added which clobbers an existing script of the same
4818    /// `id`, the previous script's precedence in the injection order will be preserved.
4819    ///
4820    /// At least one `origins` entry must be specified. If a wildcard `"*"` is specified in
4821    /// `origins`, then the script will be evaluated unconditionally.
4822    ///
4823    /// If an error occurred, the [`FrameError`] will be set to one of these values:
4824    /// - `BUFFER_NOT_UTF8`: `script` is not UTF-8 encoded.
4825    /// - `INVALID_ORIGIN`: `origins` is an empty vector.
4826    pub fn r#add_before_load_java_script(
4827        &self,
4828        mut id: u64,
4829        mut origins: &[String],
4830        mut script: fidl_fuchsia_mem::Buffer,
4831    ) -> fidl::client::QueryResponseFut<
4832        FrameAddBeforeLoadJavaScriptResult,
4833        fidl::encoding::DefaultFuchsiaResourceDialect,
4834    > {
4835        FrameProxyInterface::r#add_before_load_java_script(self, id, origins, script)
4836    }
4837
4838    /// Removes a previously added JavaScript snippet identified by `id`. This is a no-op if there
4839    /// is no JavaScript snippet identified by `id`.
4840    pub fn r#remove_before_load_java_script(&self, mut id: u64) -> Result<(), fidl::Error> {
4841        FrameProxyInterface::r#remove_before_load_java_script(self, id)
4842    }
4843
4844    /// Posts a message to the frame's onMessage handler.
4845    ///
4846    /// `target_origin` restricts message delivery to the specified origin. If `target_origin` is
4847    /// `"*"`, then the message will be sent to the document regardless of its origin.
4848    /// See the
4849    /// [HTML spec](https://html.spec.whatwg.org/multipage/web-messaging.html#posting-messages)
4850    /// section 9.4.3 for more details on how the target origin policy is applied.
4851    ///
4852    /// If an error occurred, the [`FrameError`] will be set to one of these values:
4853    /// - `INTERNAL_ERROR`: The WebEngine failed to create a message pipe.
4854    /// - `BUFFER_NOT_UTF8`: The script in `message`'s `data` property is not UTF-8 encoded.
4855    /// - `INVALID_ORIGIN`: `origins` is an empty vector.
4856    /// - `NO_DATA_IN_MESSAGE`: The `data` property is missing in `message`.
4857    pub fn r#post_message(
4858        &self,
4859        mut target_origin: &str,
4860        mut message: WebMessage,
4861    ) -> fidl::client::QueryResponseFut<
4862        FramePostMessageResult,
4863        fidl::encoding::DefaultFuchsiaResourceDialect,
4864    > {
4865        FrameProxyInterface::r#post_message(self, target_origin, message)
4866    }
4867
4868    /// Sets the listener for handling page navigation events.
4869    ///
4870    /// - `listener`: The observer to use. Unregisters any existing listener if null.
4871    pub fn r#set_navigation_event_listener(
4872        &self,
4873        mut listener: Option<fidl::endpoints::ClientEnd<NavigationEventListenerMarker>>,
4874    ) -> Result<(), fidl::Error> {
4875        FrameProxyInterface::r#set_navigation_event_listener(self, listener)
4876    }
4877
4878    /// Sets the listener for handling page navigation events. The listener will receive the
4879    /// current navigation state immediately. After that, it's notified whenever the state changes.
4880    ///
4881    /// - `listener`: The observer to use. Unregisters any existing listener if null.
4882    /// - `flags`: Flags for optional features that should be enabled for the listener.
4883    pub fn r#set_navigation_event_listener2(
4884        &self,
4885        mut listener: Option<fidl::endpoints::ClientEnd<NavigationEventListenerMarker>>,
4886        mut flags: NavigationEventListenerFlags,
4887    ) -> Result<(), fidl::Error> {
4888        FrameProxyInterface::r#set_navigation_event_listener2(self, listener, flags)
4889    }
4890
4891    /// If set to a value other than [`ConsoleLogLevel.NONE`], allows web content to log messages
4892    /// to the [`fuchsia.logger/LogSink`] configured for this [`Frame`], via the
4893    /// `console` object (e.g. using `debug()`, `log()`, `info()`, `warn()` and
4894    /// `error()`).
4895    /// The default value is [`ConsoleLogLevel.NONE`].
4896    ///
4897    /// As the system log may be persisted, it is recommended that [`ConsoleLogLevel.NONE`] be used
4898    /// in Incognito and other private browsing modes.
4899    ///
4900    /// Log lines are written to the [`fuchsia.logger/LogsSink`] configured
4901    /// for this [`fuchsia.web/Frame`], with severities mapped as follows:
4902    /// - `debug()`, `log()` and `info()` are logged at [`fuchsia.logger/LogLevelFilter.INFO`]
4903    ///   severity.
4904    /// - `warn()` is logged at [`fuchsia.logger/LogLevelFilter.WARN`] severity.
4905    /// - `error()` is logged at [`fuchsia.logger/LogLevelFilter.ERROR`] severity.
4906    pub fn r#set_java_script_log_level(
4907        &self,
4908        mut level: ConsoleLogLevel,
4909    ) -> Result<(), fidl::Error> {
4910        FrameProxyInterface::r#set_java_script_log_level(self, level)
4911    }
4912
4913    /// Specifies where to emit `console` log output to. By default log output will be routed to a
4914    /// [`fuchsia.logger/LogSink`] obtained via the [`fuchsia.web/Context`]'s service directory.
4915    ///
4916    /// - `sink`: The [`fuchsia.logger/LogSink`] to use to emit logs. Passing a `null` handle
4917    ///   resets logging to use the default [`fuchsia.logger/LogSink`].
4918    pub fn r#set_console_log_sink(
4919        &self,
4920        mut sink: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_logger::LogSinkMarker>>,
4921    ) -> Result<(), fidl::Error> {
4922        FrameProxyInterface::r#set_console_log_sink(self, sink)
4923    }
4924
4925    /// Enables or disables the processing of the specified `types` of user inputs.
4926    /// `allow` specifies whether to enable or disable the specified `types`.
4927    /// All input types are enabled by default.
4928    pub fn r#configure_input_types(
4929        &self,
4930        mut types: InputTypes,
4931        mut allow: AllowInputState,
4932    ) -> Result<(), fidl::Error> {
4933        FrameProxyInterface::r#configure_input_types(self, types, allow)
4934    }
4935
4936    /// Sets the listener for handling popup frame opened by web content. If no listener is
4937    /// present, then any new popup frame will be blocked.
4938    ///
4939    /// - `listener`: The listener to use. Unregisters any existing listener if null.
4940    pub fn r#set_popup_frame_creation_listener(
4941        &self,
4942        mut listener: Option<fidl::endpoints::ClientEnd<PopupFrameCreationListenerMarker>>,
4943    ) -> Result<(), fidl::Error> {
4944        FrameProxyInterface::r#set_popup_frame_creation_listener(self, listener)
4945    }
4946
4947    /// Supplies a set of [`UrlRequestRewriteRule`] to apply on every subsequent URL request.
4948    /// - `rules` are cumulative and applied in order.
4949    /// - `rules` are only applied on the first URL request in a redirect chain.
4950    /// - `rules` will be validated before being applied. If `rules` are invalid, the [`Frame`]
4951    ///   will be closed with `ERR_INVALID_ARGS`.
4952    /// - [`Frame.SetUrlRequestRewriteRules`] must not be called again until its acknowledgement
4953    ///   callback has been processed. If this happens, the [`Frame`] will be closed with
4954    ///   `ERR_BAD_STATE`.
4955    pub fn r#set_url_request_rewrite_rules(
4956        &self,
4957        mut rules: &[UrlRequestRewriteRule],
4958    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
4959        FrameProxyInterface::r#set_url_request_rewrite_rules(self, rules)
4960    }
4961
4962    /// Sets [`fuchsia.media/FrameMediaSettings`] for the frame. The specified parameters are
4963    /// applied to audio streams that started after this message is processed. Should be called
4964    /// before the Frame is navigated to content in order to ensure that the settings applied to
4965    /// all media streams. Due to request pipelining, this means doing so before calling
4966    /// [`Frame.GetNavigationController()`] and [`NavigationController.LoadUrl()`].
4967    pub fn r#set_media_settings(
4968        &self,
4969        mut settings: &FrameMediaSettings,
4970    ) -> Result<(), fidl::Error> {
4971        FrameProxyInterface::r#set_media_settings(self, settings)
4972    }
4973
4974    /// Overrides the dimensions reported to web content. The devicePixelRatio reported to
4975    /// web content will be adjusted in response to changes in the pixel size of the View,
4976    /// rather than changing the size reported to the content. Call with null `web_dips` to
4977    /// remove any prior forced content dimensions.
4978    pub fn r#force_content_dimensions(
4979        &self,
4980        mut web_dips: Option<&fidl_fuchsia_ui_gfx::Vec2>,
4981    ) -> Result<(), fidl::Error> {
4982        FrameProxyInterface::r#force_content_dimensions(self, web_dips)
4983    }
4984
4985    /// Sets the permission state for the specified `permission` and `web_origin`. By default, all
4986    /// permissions are denied.
4987    pub fn r#set_permission_state(
4988        &self,
4989        mut permission: &PermissionDescriptor,
4990        mut web_origin: &str,
4991        mut state: PermissionState,
4992    ) -> Result<(), fidl::Error> {
4993        FrameProxyInterface::r#set_permission_state(self, permission, web_origin, state)
4994    }
4995
4996    /// Sets whether to block all HTMLMediaElements in the frame from fetching and loading media
4997    /// resources.
4998    ///
4999    /// May be used, for example, to prevent loading media in frames that are not visible.
5000    ///
5001    /// While media loading is blocked, elements with `autoplay` set to `true` will not start
5002    /// playback. The promises returned by calls to `play()` will remain unresolved until loading is
5003    /// unblocked by a call to this method.
5004    ///
5005    /// When media loading is unblocked, elements will begin fetching, resource, loading, and
5006    /// playing as appropriate.
5007    ///
5008    /// Any elements that have begun fetching or loading media resources for the current source
5009    /// before media loading was blocked will continue to fetch, load, and start playback as
5010    /// appropriate. This includes calls to `play()` even after media loading is blocked.
5011    pub fn r#set_block_media_loading(&self, mut blocked: bool) -> Result<(), fidl::Error> {
5012        FrameProxyInterface::r#set_block_media_loading(self, blocked)
5013    }
5014
5015    /// Returns the amount of private (non-shared) physical memory used by the Frame's main
5016    /// document. The returned size might not reflect the memory usage of embedded iframes.
5017    pub fn r#get_private_memory_size(
5018        &self,
5019    ) -> fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect> {
5020        FrameProxyInterface::r#get_private_memory_size(self)
5021    }
5022
5023    /// Sets the navigation policy provider for the [`Frame`]. When set, the [`Frame`] sends
5024    /// [`NavigationPolicyProvider.EvaluateRequestedNavigation`] when processing navigation
5025    /// requests. `params` defines when the message is sent. After sending the
5026    /// `EvaluateRequestedNavigation` message, the [`Frame`] blocks the corresponding navigation
5027    /// until it receives a response.
5028    ///
5029    /// Should be called before `GetNavigationController` to ensure that it is applied to all
5030    /// navigations including the first [`NavigationController.LoadURL`] request.
5031    pub fn r#set_navigation_policy_provider(
5032        &self,
5033        mut params: &NavigationPolicyProviderParams,
5034        mut provider: fidl::endpoints::ClientEnd<NavigationPolicyProviderMarker>,
5035    ) -> Result<(), fidl::Error> {
5036        FrameProxyInterface::r#set_navigation_policy_provider(self, params, provider)
5037    }
5038
5039    /// Sets various settings for how web content should be run in the Frame. May be called at any
5040    /// time, including after the URL has loaded. Each call changes only the specified fields,
5041    /// overwriting any prior value.
5042    ///
5043    /// This method will fail with `ZX_ERR_NOT_SUPPORTED` if any value in [`ContentAreaSettings`]
5044    /// is not supported by the Frame.
5045    pub fn r#set_content_area_settings(
5046        &self,
5047        mut settings: &ContentAreaSettings,
5048    ) -> Result<(), fidl::Error> {
5049        FrameProxyInterface::r#set_content_area_settings(self, settings)
5050    }
5051
5052    /// Reset the Frame's [`ContentAreaSettings`] to default values.
5053    pub fn r#reset_content_area_settings(&self) -> Result<(), fidl::Error> {
5054        FrameProxyInterface::r#reset_content_area_settings(self)
5055    }
5056
5057    /// Request graceful or immediate teardown of the Frame content and notification of completion
5058    /// via Frame epitaph.
5059    ///
5060    /// Graceful teardown allows unload and cleanup tasks in the implementation and web content
5061    /// (e.g., `unload` event handlers) to run for up to the specified period of time. Immediate
5062    /// teardown only runs the minimum cleanup tasks in the implementation and does not allow web
5063    /// content to run event handlers.
5064    ///
5065    /// * If `timeout` is zero, an immediate teardown is initiated. The channel will close with
5066    ///   `ZX_OK`. This is equivalent to the caller closing the Frame channel.
5067    ///
5068    /// * If `timeout` is non-zero, a graceful teardown is initiated. The channel will close with
5069    ///   `ZX_OK` if the Frame closes within the specified `timeout` and with `ZX_ERR_TIMED_OUT`
5070    ///   otherwise.
5071    ///
5072    /// * If `timeout` is not specified, a reasonable implementation-specific timeout is applied.
5073    ///
5074    /// Subsequent calls to `Close()` will override any previously specified `Close()` timeout.
5075    pub fn r#close(&self, mut payload: &FrameCloseRequest) -> Result<(), fidl::Error> {
5076        FrameProxyInterface::r#close(self, payload)
5077    }
5078}
5079
5080impl FrameProxyInterface for FrameProxy {
5081    fn r#create_view(
5082        &self,
5083        mut view_token: fidl_fuchsia_ui_views::ViewToken,
5084    ) -> Result<(), fidl::Error> {
5085        self.client.send::<FrameCreateViewRequest>(
5086            (&mut view_token,),
5087            0x6a27859439133264,
5088            fidl::encoding::DynamicFlags::empty(),
5089        )
5090    }
5091
5092    fn r#create_view_with_view_ref(
5093        &self,
5094        mut view_token: fidl_fuchsia_ui_views::ViewToken,
5095        mut view_ref_control: fidl_fuchsia_ui_views::ViewRefControl,
5096        mut view_ref: fidl_fuchsia_ui_views::ViewRef,
5097    ) -> Result<(), fidl::Error> {
5098        self.client.send::<FrameCreateViewWithViewRefRequest>(
5099            (&mut view_token, &mut view_ref_control, &mut view_ref),
5100            0x1eb17ab2442326ac,
5101            fidl::encoding::DynamicFlags::empty(),
5102        )
5103    }
5104
5105    fn r#create_view2(&self, mut args: CreateView2Args) -> Result<(), fidl::Error> {
5106        self.client.send::<FrameCreateView2Request>(
5107            (&mut args,),
5108            0x1be7e9512962eb37,
5109            fidl::encoding::DynamicFlags::empty(),
5110        )
5111    }
5112
5113    fn r#enable_headless_rendering(&self) -> Result<(), fidl::Error> {
5114        self.client.send::<fidl::encoding::EmptyPayload>(
5115            (),
5116            0x72a81aaae7a80d2b,
5117            fidl::encoding::DynamicFlags::empty(),
5118        )
5119    }
5120
5121    fn r#disable_headless_rendering(&self) -> Result<(), fidl::Error> {
5122        self.client.send::<fidl::encoding::EmptyPayload>(
5123            (),
5124            0x5ca38a3d1f7f543a,
5125            fidl::encoding::DynamicFlags::empty(),
5126        )
5127    }
5128
5129    fn r#get_media_player(
5130        &self,
5131        mut player: fidl::endpoints::ServerEnd<fidl_fuchsia_media_sessions2::PlayerMarker>,
5132    ) -> Result<(), fidl::Error> {
5133        self.client.send::<FrameGetMediaPlayerRequest>(
5134            (player,),
5135            0xaafb639fc0b9eb9,
5136            fidl::encoding::DynamicFlags::empty(),
5137        )
5138    }
5139
5140    fn r#get_navigation_controller(
5141        &self,
5142        mut controller: fidl::endpoints::ServerEnd<NavigationControllerMarker>,
5143    ) -> Result<(), fidl::Error> {
5144        self.client.send::<FrameGetNavigationControllerRequest>(
5145            (controller,),
5146            0x4521cfe95217a688,
5147            fidl::encoding::DynamicFlags::empty(),
5148        )
5149    }
5150
5151    type ExecuteJavaScriptResponseFut = fidl::client::QueryResponseFut<
5152        FrameExecuteJavaScriptResult,
5153        fidl::encoding::DefaultFuchsiaResourceDialect,
5154    >;
5155    fn r#execute_java_script(
5156        &self,
5157        mut origins: &[String],
5158        mut script: fidl_fuchsia_mem::Buffer,
5159    ) -> Self::ExecuteJavaScriptResponseFut {
5160        fn _decode(
5161            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5162        ) -> Result<FrameExecuteJavaScriptResult, fidl::Error> {
5163            let _response = fidl::client::decode_transaction_body::<
5164                fidl::encoding::ResultType<FrameExecuteJavaScriptResponse, FrameError>,
5165                fidl::encoding::DefaultFuchsiaResourceDialect,
5166                0x79abdd4907000542,
5167            >(_buf?)?;
5168            Ok(_response.map(|x| x.result))
5169        }
5170        self.client
5171            .send_query_and_decode::<FrameExecuteJavaScriptRequest, FrameExecuteJavaScriptResult>(
5172                (origins, &mut script),
5173                0x79abdd4907000542,
5174                fidl::encoding::DynamicFlags::empty(),
5175                _decode,
5176            )
5177    }
5178
5179    type ExecuteJavaScriptNoResultResponseFut = fidl::client::QueryResponseFut<
5180        FrameExecuteJavaScriptNoResultResult,
5181        fidl::encoding::DefaultFuchsiaResourceDialect,
5182    >;
5183    fn r#execute_java_script_no_result(
5184        &self,
5185        mut origins: &[String],
5186        mut script: fidl_fuchsia_mem::Buffer,
5187    ) -> Self::ExecuteJavaScriptNoResultResponseFut {
5188        fn _decode(
5189            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5190        ) -> Result<FrameExecuteJavaScriptNoResultResult, fidl::Error> {
5191            let _response = fidl::client::decode_transaction_body::<
5192                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FrameError>,
5193                fidl::encoding::DefaultFuchsiaResourceDialect,
5194                0x16b8491520cbcd63,
5195            >(_buf?)?;
5196            Ok(_response.map(|x| x))
5197        }
5198        self.client.send_query_and_decode::<
5199            FrameExecuteJavaScriptNoResultRequest,
5200            FrameExecuteJavaScriptNoResultResult,
5201        >(
5202            (origins, &mut script,),
5203            0x16b8491520cbcd63,
5204            fidl::encoding::DynamicFlags::empty(),
5205            _decode,
5206        )
5207    }
5208
5209    type AddBeforeLoadJavaScriptResponseFut = fidl::client::QueryResponseFut<
5210        FrameAddBeforeLoadJavaScriptResult,
5211        fidl::encoding::DefaultFuchsiaResourceDialect,
5212    >;
5213    fn r#add_before_load_java_script(
5214        &self,
5215        mut id: u64,
5216        mut origins: &[String],
5217        mut script: fidl_fuchsia_mem::Buffer,
5218    ) -> Self::AddBeforeLoadJavaScriptResponseFut {
5219        fn _decode(
5220            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5221        ) -> Result<FrameAddBeforeLoadJavaScriptResult, fidl::Error> {
5222            let _response = fidl::client::decode_transaction_body::<
5223                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FrameError>,
5224                fidl::encoding::DefaultFuchsiaResourceDialect,
5225                0x540ac0da59d823e,
5226            >(_buf?)?;
5227            Ok(_response.map(|x| x))
5228        }
5229        self.client.send_query_and_decode::<
5230            FrameAddBeforeLoadJavaScriptRequest,
5231            FrameAddBeforeLoadJavaScriptResult,
5232        >(
5233            (id, origins, &mut script,),
5234            0x540ac0da59d823e,
5235            fidl::encoding::DynamicFlags::empty(),
5236            _decode,
5237        )
5238    }
5239
5240    fn r#remove_before_load_java_script(&self, mut id: u64) -> Result<(), fidl::Error> {
5241        self.client.send::<FrameRemoveBeforeLoadJavaScriptRequest>(
5242            (id,),
5243            0x17d92b855b61d23a,
5244            fidl::encoding::DynamicFlags::empty(),
5245        )
5246    }
5247
5248    type PostMessageResponseFut = fidl::client::QueryResponseFut<
5249        FramePostMessageResult,
5250        fidl::encoding::DefaultFuchsiaResourceDialect,
5251    >;
5252    fn r#post_message(
5253        &self,
5254        mut target_origin: &str,
5255        mut message: WebMessage,
5256    ) -> Self::PostMessageResponseFut {
5257        fn _decode(
5258            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5259        ) -> Result<FramePostMessageResult, fidl::Error> {
5260            let _response = fidl::client::decode_transaction_body::<
5261                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FrameError>,
5262                fidl::encoding::DefaultFuchsiaResourceDialect,
5263                0x751d686eb7caa341,
5264            >(_buf?)?;
5265            Ok(_response.map(|x| x))
5266        }
5267        self.client.send_query_and_decode::<FramePostMessageRequest, FramePostMessageResult>(
5268            (target_origin, &mut message),
5269            0x751d686eb7caa341,
5270            fidl::encoding::DynamicFlags::empty(),
5271            _decode,
5272        )
5273    }
5274
5275    fn r#set_navigation_event_listener(
5276        &self,
5277        mut listener: Option<fidl::endpoints::ClientEnd<NavigationEventListenerMarker>>,
5278    ) -> Result<(), fidl::Error> {
5279        self.client.send::<FrameSetNavigationEventListenerRequest>(
5280            (listener,),
5281            0x965ba0fa20e0a56,
5282            fidl::encoding::DynamicFlags::empty(),
5283        )
5284    }
5285
5286    fn r#set_navigation_event_listener2(
5287        &self,
5288        mut listener: Option<fidl::endpoints::ClientEnd<NavigationEventListenerMarker>>,
5289        mut flags: NavigationEventListenerFlags,
5290    ) -> Result<(), fidl::Error> {
5291        self.client.send::<FrameSetNavigationEventListener2Request>(
5292            (listener, flags),
5293            0x5f8b40607f1f578f,
5294            fidl::encoding::DynamicFlags::empty(),
5295        )
5296    }
5297
5298    fn r#set_java_script_log_level(&self, mut level: ConsoleLogLevel) -> Result<(), fidl::Error> {
5299        self.client.send::<FrameSetJavaScriptLogLevelRequest>(
5300            (level,),
5301            0x74824b11a71c4b5b,
5302            fidl::encoding::DynamicFlags::empty(),
5303        )
5304    }
5305
5306    fn r#set_console_log_sink(
5307        &self,
5308        mut sink: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_logger::LogSinkMarker>>,
5309    ) -> Result<(), fidl::Error> {
5310        self.client.send::<FrameSetConsoleLogSinkRequest>(
5311            (sink,),
5312            0x18f5cbc19fa4687b,
5313            fidl::encoding::DynamicFlags::empty(),
5314        )
5315    }
5316
5317    fn r#configure_input_types(
5318        &self,
5319        mut types: InputTypes,
5320        mut allow: AllowInputState,
5321    ) -> Result<(), fidl::Error> {
5322        self.client.send::<FrameConfigureInputTypesRequest>(
5323            (types, allow),
5324            0x38e08fe763c6bef6,
5325            fidl::encoding::DynamicFlags::empty(),
5326        )
5327    }
5328
5329    fn r#set_popup_frame_creation_listener(
5330        &self,
5331        mut listener: Option<fidl::endpoints::ClientEnd<PopupFrameCreationListenerMarker>>,
5332    ) -> Result<(), fidl::Error> {
5333        self.client.send::<FrameSetPopupFrameCreationListenerRequest>(
5334            (listener,),
5335            0x34ddec4e9f11e2aa,
5336            fidl::encoding::DynamicFlags::empty(),
5337        )
5338    }
5339
5340    type SetUrlRequestRewriteRulesResponseFut =
5341        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
5342    fn r#set_url_request_rewrite_rules(
5343        &self,
5344        mut rules: &[UrlRequestRewriteRule],
5345    ) -> Self::SetUrlRequestRewriteRulesResponseFut {
5346        fn _decode(
5347            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5348        ) -> Result<(), fidl::Error> {
5349            let _response = fidl::client::decode_transaction_body::<
5350                fidl::encoding::EmptyPayload,
5351                fidl::encoding::DefaultFuchsiaResourceDialect,
5352                0x2e3f797350ab3281,
5353            >(_buf?)?;
5354            Ok(_response)
5355        }
5356        self.client.send_query_and_decode::<FrameSetUrlRequestRewriteRulesRequest, ()>(
5357            (rules,),
5358            0x2e3f797350ab3281,
5359            fidl::encoding::DynamicFlags::empty(),
5360            _decode,
5361        )
5362    }
5363
5364    fn r#set_media_settings(&self, mut settings: &FrameMediaSettings) -> Result<(), fidl::Error> {
5365        self.client.send::<FrameSetMediaSettingsRequest>(
5366            (settings,),
5367            0x7da879b6d284c143,
5368            fidl::encoding::DynamicFlags::empty(),
5369        )
5370    }
5371
5372    fn r#force_content_dimensions(
5373        &self,
5374        mut web_dips: Option<&fidl_fuchsia_ui_gfx::Vec2>,
5375    ) -> Result<(), fidl::Error> {
5376        self.client.send::<FrameForceContentDimensionsRequest>(
5377            (web_dips,),
5378            0x8c7024c7149c901,
5379            fidl::encoding::DynamicFlags::empty(),
5380        )
5381    }
5382
5383    fn r#set_permission_state(
5384        &self,
5385        mut permission: &PermissionDescriptor,
5386        mut web_origin: &str,
5387        mut state: PermissionState,
5388    ) -> Result<(), fidl::Error> {
5389        self.client.send::<FrameSetPermissionStateRequest>(
5390            (permission, web_origin, state),
5391            0x19574e92a7033f4f,
5392            fidl::encoding::DynamicFlags::empty(),
5393        )
5394    }
5395
5396    fn r#set_block_media_loading(&self, mut blocked: bool) -> Result<(), fidl::Error> {
5397        self.client.send::<FrameSetBlockMediaLoadingRequest>(
5398            (blocked,),
5399            0x211071458fc9cf4f,
5400            fidl::encoding::DynamicFlags::empty(),
5401        )
5402    }
5403
5404    type GetPrivateMemorySizeResponseFut =
5405        fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect>;
5406    fn r#get_private_memory_size(&self) -> Self::GetPrivateMemorySizeResponseFut {
5407        fn _decode(
5408            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5409        ) -> Result<u64, fidl::Error> {
5410            let _response = fidl::client::decode_transaction_body::<
5411                FrameGetPrivateMemorySizeResponse,
5412                fidl::encoding::DefaultFuchsiaResourceDialect,
5413                0x6ad4d43da6c129b0,
5414            >(_buf?)?;
5415            Ok(_response.size_bytes)
5416        }
5417        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u64>(
5418            (),
5419            0x6ad4d43da6c129b0,
5420            fidl::encoding::DynamicFlags::empty(),
5421            _decode,
5422        )
5423    }
5424
5425    fn r#set_navigation_policy_provider(
5426        &self,
5427        mut params: &NavigationPolicyProviderParams,
5428        mut provider: fidl::endpoints::ClientEnd<NavigationPolicyProviderMarker>,
5429    ) -> Result<(), fidl::Error> {
5430        self.client.send::<FrameSetNavigationPolicyProviderRequest>(
5431            (params, provider),
5432            0x602ce35195d66654,
5433            fidl::encoding::DynamicFlags::empty(),
5434        )
5435    }
5436
5437    fn r#set_content_area_settings(
5438        &self,
5439        mut settings: &ContentAreaSettings,
5440    ) -> Result<(), fidl::Error> {
5441        self.client.send::<FrameSetContentAreaSettingsRequest>(
5442            (settings,),
5443            0x851f4de50c3c27e,
5444            fidl::encoding::DynamicFlags::empty(),
5445        )
5446    }
5447
5448    fn r#reset_content_area_settings(&self) -> Result<(), fidl::Error> {
5449        self.client.send::<fidl::encoding::EmptyPayload>(
5450            (),
5451            0x6807e04f16f8ee5d,
5452            fidl::encoding::DynamicFlags::empty(),
5453        )
5454    }
5455
5456    fn r#close(&self, mut payload: &FrameCloseRequest) -> Result<(), fidl::Error> {
5457        self.client.send::<FrameCloseRequest>(
5458            payload,
5459            0x442e84138e65351,
5460            fidl::encoding::DynamicFlags::empty(),
5461        )
5462    }
5463}
5464
5465pub struct FrameEventStream {
5466    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5467}
5468
5469impl std::marker::Unpin for FrameEventStream {}
5470
5471impl futures::stream::FusedStream for FrameEventStream {
5472    fn is_terminated(&self) -> bool {
5473        self.event_receiver.is_terminated()
5474    }
5475}
5476
5477impl futures::Stream for FrameEventStream {
5478    type Item = Result<FrameEvent, fidl::Error>;
5479
5480    fn poll_next(
5481        mut self: std::pin::Pin<&mut Self>,
5482        cx: &mut std::task::Context<'_>,
5483    ) -> std::task::Poll<Option<Self::Item>> {
5484        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5485            &mut self.event_receiver,
5486            cx
5487        )?) {
5488            Some(buf) => std::task::Poll::Ready(Some(FrameEvent::decode(buf))),
5489            None => std::task::Poll::Ready(None),
5490        }
5491    }
5492}
5493
5494#[derive(Debug)]
5495pub enum FrameEvent {}
5496
5497impl FrameEvent {
5498    /// Decodes a message buffer as a [`FrameEvent`].
5499    fn decode(
5500        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5501    ) -> Result<FrameEvent, fidl::Error> {
5502        let (bytes, _handles) = buf.split_mut();
5503        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5504        debug_assert_eq!(tx_header.tx_id, 0);
5505        match tx_header.ordinal {
5506            _ => Err(fidl::Error::UnknownOrdinal {
5507                ordinal: tx_header.ordinal,
5508                protocol_name: <FrameMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5509            }),
5510        }
5511    }
5512}
5513
5514/// A Stream of incoming requests for fuchsia.web/Frame.
5515pub struct FrameRequestStream {
5516    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5517    is_terminated: bool,
5518}
5519
5520impl std::marker::Unpin for FrameRequestStream {}
5521
5522impl futures::stream::FusedStream for FrameRequestStream {
5523    fn is_terminated(&self) -> bool {
5524        self.is_terminated
5525    }
5526}
5527
5528impl fidl::endpoints::RequestStream for FrameRequestStream {
5529    type Protocol = FrameMarker;
5530    type ControlHandle = FrameControlHandle;
5531
5532    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5533        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5534    }
5535
5536    fn control_handle(&self) -> Self::ControlHandle {
5537        FrameControlHandle { inner: self.inner.clone() }
5538    }
5539
5540    fn into_inner(
5541        self,
5542    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5543    {
5544        (self.inner, self.is_terminated)
5545    }
5546
5547    fn from_inner(
5548        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5549        is_terminated: bool,
5550    ) -> Self {
5551        Self { inner, is_terminated }
5552    }
5553}
5554
5555impl futures::Stream for FrameRequestStream {
5556    type Item = Result<FrameRequest, fidl::Error>;
5557
5558    fn poll_next(
5559        mut self: std::pin::Pin<&mut Self>,
5560        cx: &mut std::task::Context<'_>,
5561    ) -> std::task::Poll<Option<Self::Item>> {
5562        let this = &mut *self;
5563        if this.inner.check_shutdown(cx) {
5564            this.is_terminated = true;
5565            return std::task::Poll::Ready(None);
5566        }
5567        if this.is_terminated {
5568            panic!("polled FrameRequestStream after completion");
5569        }
5570        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5571            |bytes, handles| {
5572                match this.inner.channel().read_etc(cx, bytes, handles) {
5573                    std::task::Poll::Ready(Ok(())) => {}
5574                    std::task::Poll::Pending => return std::task::Poll::Pending,
5575                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5576                        this.is_terminated = true;
5577                        return std::task::Poll::Ready(None);
5578                    }
5579                    std::task::Poll::Ready(Err(e)) => {
5580                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5581                            e.into(),
5582                        ))))
5583                    }
5584                }
5585
5586                // A message has been received from the channel
5587                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5588
5589                std::task::Poll::Ready(Some(match header.ordinal {
5590                    0x6a27859439133264 => {
5591                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5592                        let mut req = fidl::new_empty!(
5593                            FrameCreateViewRequest,
5594                            fidl::encoding::DefaultFuchsiaResourceDialect
5595                        );
5596                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameCreateViewRequest>(&header, _body_bytes, handles, &mut req)?;
5597                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5598                        Ok(FrameRequest::CreateView { view_token: req.view_token, control_handle })
5599                    }
5600                    0x1eb17ab2442326ac => {
5601                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5602                        let mut req = fidl::new_empty!(
5603                            FrameCreateViewWithViewRefRequest,
5604                            fidl::encoding::DefaultFuchsiaResourceDialect
5605                        );
5606                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameCreateViewWithViewRefRequest>(&header, _body_bytes, handles, &mut req)?;
5607                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5608                        Ok(FrameRequest::CreateViewWithViewRef {
5609                            view_token: req.view_token,
5610                            view_ref_control: req.view_ref_control,
5611                            view_ref: req.view_ref,
5612
5613                            control_handle,
5614                        })
5615                    }
5616                    0x1be7e9512962eb37 => {
5617                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5618                        let mut req = fidl::new_empty!(
5619                            FrameCreateView2Request,
5620                            fidl::encoding::DefaultFuchsiaResourceDialect
5621                        );
5622                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameCreateView2Request>(&header, _body_bytes, handles, &mut req)?;
5623                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5624                        Ok(FrameRequest::CreateView2 { args: req.args, control_handle })
5625                    }
5626                    0x72a81aaae7a80d2b => {
5627                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5628                        let mut req = fidl::new_empty!(
5629                            fidl::encoding::EmptyPayload,
5630                            fidl::encoding::DefaultFuchsiaResourceDialect
5631                        );
5632                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5633                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5634                        Ok(FrameRequest::EnableHeadlessRendering { control_handle })
5635                    }
5636                    0x5ca38a3d1f7f543a => {
5637                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5638                        let mut req = fidl::new_empty!(
5639                            fidl::encoding::EmptyPayload,
5640                            fidl::encoding::DefaultFuchsiaResourceDialect
5641                        );
5642                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5643                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5644                        Ok(FrameRequest::DisableHeadlessRendering { control_handle })
5645                    }
5646                    0xaafb639fc0b9eb9 => {
5647                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5648                        let mut req = fidl::new_empty!(
5649                            FrameGetMediaPlayerRequest,
5650                            fidl::encoding::DefaultFuchsiaResourceDialect
5651                        );
5652                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameGetMediaPlayerRequest>(&header, _body_bytes, handles, &mut req)?;
5653                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5654                        Ok(FrameRequest::GetMediaPlayer { player: req.player, control_handle })
5655                    }
5656                    0x4521cfe95217a688 => {
5657                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5658                        let mut req = fidl::new_empty!(
5659                            FrameGetNavigationControllerRequest,
5660                            fidl::encoding::DefaultFuchsiaResourceDialect
5661                        );
5662                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameGetNavigationControllerRequest>(&header, _body_bytes, handles, &mut req)?;
5663                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5664                        Ok(FrameRequest::GetNavigationController {
5665                            controller: req.controller,
5666
5667                            control_handle,
5668                        })
5669                    }
5670                    0x79abdd4907000542 => {
5671                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5672                        let mut req = fidl::new_empty!(
5673                            FrameExecuteJavaScriptRequest,
5674                            fidl::encoding::DefaultFuchsiaResourceDialect
5675                        );
5676                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameExecuteJavaScriptRequest>(&header, _body_bytes, handles, &mut req)?;
5677                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5678                        Ok(FrameRequest::ExecuteJavaScript {
5679                            origins: req.origins,
5680                            script: req.script,
5681
5682                            responder: FrameExecuteJavaScriptResponder {
5683                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5684                                tx_id: header.tx_id,
5685                            },
5686                        })
5687                    }
5688                    0x16b8491520cbcd63 => {
5689                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5690                        let mut req = fidl::new_empty!(
5691                            FrameExecuteJavaScriptNoResultRequest,
5692                            fidl::encoding::DefaultFuchsiaResourceDialect
5693                        );
5694                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameExecuteJavaScriptNoResultRequest>(&header, _body_bytes, handles, &mut req)?;
5695                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5696                        Ok(FrameRequest::ExecuteJavaScriptNoResult {
5697                            origins: req.origins,
5698                            script: req.script,
5699
5700                            responder: FrameExecuteJavaScriptNoResultResponder {
5701                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5702                                tx_id: header.tx_id,
5703                            },
5704                        })
5705                    }
5706                    0x540ac0da59d823e => {
5707                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5708                        let mut req = fidl::new_empty!(
5709                            FrameAddBeforeLoadJavaScriptRequest,
5710                            fidl::encoding::DefaultFuchsiaResourceDialect
5711                        );
5712                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameAddBeforeLoadJavaScriptRequest>(&header, _body_bytes, handles, &mut req)?;
5713                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5714                        Ok(FrameRequest::AddBeforeLoadJavaScript {
5715                            id: req.id,
5716                            origins: req.origins,
5717                            script: req.script,
5718
5719                            responder: FrameAddBeforeLoadJavaScriptResponder {
5720                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5721                                tx_id: header.tx_id,
5722                            },
5723                        })
5724                    }
5725                    0x17d92b855b61d23a => {
5726                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5727                        let mut req = fidl::new_empty!(
5728                            FrameRemoveBeforeLoadJavaScriptRequest,
5729                            fidl::encoding::DefaultFuchsiaResourceDialect
5730                        );
5731                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameRemoveBeforeLoadJavaScriptRequest>(&header, _body_bytes, handles, &mut req)?;
5732                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5733                        Ok(FrameRequest::RemoveBeforeLoadJavaScript { id: req.id, control_handle })
5734                    }
5735                    0x751d686eb7caa341 => {
5736                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5737                        let mut req = fidl::new_empty!(
5738                            FramePostMessageRequest,
5739                            fidl::encoding::DefaultFuchsiaResourceDialect
5740                        );
5741                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FramePostMessageRequest>(&header, _body_bytes, handles, &mut req)?;
5742                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5743                        Ok(FrameRequest::PostMessage {
5744                            target_origin: req.target_origin,
5745                            message: req.message,
5746
5747                            responder: FramePostMessageResponder {
5748                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5749                                tx_id: header.tx_id,
5750                            },
5751                        })
5752                    }
5753                    0x965ba0fa20e0a56 => {
5754                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5755                        let mut req = fidl::new_empty!(
5756                            FrameSetNavigationEventListenerRequest,
5757                            fidl::encoding::DefaultFuchsiaResourceDialect
5758                        );
5759                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameSetNavigationEventListenerRequest>(&header, _body_bytes, handles, &mut req)?;
5760                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5761                        Ok(FrameRequest::SetNavigationEventListener {
5762                            listener: req.listener,
5763
5764                            control_handle,
5765                        })
5766                    }
5767                    0x5f8b40607f1f578f => {
5768                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5769                        let mut req = fidl::new_empty!(
5770                            FrameSetNavigationEventListener2Request,
5771                            fidl::encoding::DefaultFuchsiaResourceDialect
5772                        );
5773                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameSetNavigationEventListener2Request>(&header, _body_bytes, handles, &mut req)?;
5774                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5775                        Ok(FrameRequest::SetNavigationEventListener2 {
5776                            listener: req.listener,
5777                            flags: req.flags,
5778
5779                            control_handle,
5780                        })
5781                    }
5782                    0x74824b11a71c4b5b => {
5783                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5784                        let mut req = fidl::new_empty!(
5785                            FrameSetJavaScriptLogLevelRequest,
5786                            fidl::encoding::DefaultFuchsiaResourceDialect
5787                        );
5788                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameSetJavaScriptLogLevelRequest>(&header, _body_bytes, handles, &mut req)?;
5789                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5790                        Ok(FrameRequest::SetJavaScriptLogLevel { level: req.level, control_handle })
5791                    }
5792                    0x18f5cbc19fa4687b => {
5793                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5794                        let mut req = fidl::new_empty!(
5795                            FrameSetConsoleLogSinkRequest,
5796                            fidl::encoding::DefaultFuchsiaResourceDialect
5797                        );
5798                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameSetConsoleLogSinkRequest>(&header, _body_bytes, handles, &mut req)?;
5799                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5800                        Ok(FrameRequest::SetConsoleLogSink { sink: req.sink, control_handle })
5801                    }
5802                    0x38e08fe763c6bef6 => {
5803                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5804                        let mut req = fidl::new_empty!(
5805                            FrameConfigureInputTypesRequest,
5806                            fidl::encoding::DefaultFuchsiaResourceDialect
5807                        );
5808                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameConfigureInputTypesRequest>(&header, _body_bytes, handles, &mut req)?;
5809                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5810                        Ok(FrameRequest::ConfigureInputTypes {
5811                            types: req.types,
5812                            allow: req.allow,
5813
5814                            control_handle,
5815                        })
5816                    }
5817                    0x34ddec4e9f11e2aa => {
5818                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5819                        let mut req = fidl::new_empty!(
5820                            FrameSetPopupFrameCreationListenerRequest,
5821                            fidl::encoding::DefaultFuchsiaResourceDialect
5822                        );
5823                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameSetPopupFrameCreationListenerRequest>(&header, _body_bytes, handles, &mut req)?;
5824                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5825                        Ok(FrameRequest::SetPopupFrameCreationListener {
5826                            listener: req.listener,
5827
5828                            control_handle,
5829                        })
5830                    }
5831                    0x2e3f797350ab3281 => {
5832                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5833                        let mut req = fidl::new_empty!(
5834                            FrameSetUrlRequestRewriteRulesRequest,
5835                            fidl::encoding::DefaultFuchsiaResourceDialect
5836                        );
5837                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameSetUrlRequestRewriteRulesRequest>(&header, _body_bytes, handles, &mut req)?;
5838                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5839                        Ok(FrameRequest::SetUrlRequestRewriteRules {
5840                            rules: req.rules,
5841
5842                            responder: FrameSetUrlRequestRewriteRulesResponder {
5843                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5844                                tx_id: header.tx_id,
5845                            },
5846                        })
5847                    }
5848                    0x7da879b6d284c143 => {
5849                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5850                        let mut req = fidl::new_empty!(
5851                            FrameSetMediaSettingsRequest,
5852                            fidl::encoding::DefaultFuchsiaResourceDialect
5853                        );
5854                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameSetMediaSettingsRequest>(&header, _body_bytes, handles, &mut req)?;
5855                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5856                        Ok(FrameRequest::SetMediaSettings {
5857                            settings: req.settings,
5858
5859                            control_handle,
5860                        })
5861                    }
5862                    0x8c7024c7149c901 => {
5863                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5864                        let mut req = fidl::new_empty!(
5865                            FrameForceContentDimensionsRequest,
5866                            fidl::encoding::DefaultFuchsiaResourceDialect
5867                        );
5868                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameForceContentDimensionsRequest>(&header, _body_bytes, handles, &mut req)?;
5869                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5870                        Ok(FrameRequest::ForceContentDimensions {
5871                            web_dips: req.web_dips,
5872
5873                            control_handle,
5874                        })
5875                    }
5876                    0x19574e92a7033f4f => {
5877                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5878                        let mut req = fidl::new_empty!(
5879                            FrameSetPermissionStateRequest,
5880                            fidl::encoding::DefaultFuchsiaResourceDialect
5881                        );
5882                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameSetPermissionStateRequest>(&header, _body_bytes, handles, &mut req)?;
5883                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5884                        Ok(FrameRequest::SetPermissionState {
5885                            permission: req.permission,
5886                            web_origin: req.web_origin,
5887                            state: req.state,
5888
5889                            control_handle,
5890                        })
5891                    }
5892                    0x211071458fc9cf4f => {
5893                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5894                        let mut req = fidl::new_empty!(
5895                            FrameSetBlockMediaLoadingRequest,
5896                            fidl::encoding::DefaultFuchsiaResourceDialect
5897                        );
5898                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameSetBlockMediaLoadingRequest>(&header, _body_bytes, handles, &mut req)?;
5899                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5900                        Ok(FrameRequest::SetBlockMediaLoading {
5901                            blocked: req.blocked,
5902
5903                            control_handle,
5904                        })
5905                    }
5906                    0x6ad4d43da6c129b0 => {
5907                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5908                        let mut req = fidl::new_empty!(
5909                            fidl::encoding::EmptyPayload,
5910                            fidl::encoding::DefaultFuchsiaResourceDialect
5911                        );
5912                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5913                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5914                        Ok(FrameRequest::GetPrivateMemorySize {
5915                            responder: FrameGetPrivateMemorySizeResponder {
5916                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5917                                tx_id: header.tx_id,
5918                            },
5919                        })
5920                    }
5921                    0x602ce35195d66654 => {
5922                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5923                        let mut req = fidl::new_empty!(
5924                            FrameSetNavigationPolicyProviderRequest,
5925                            fidl::encoding::DefaultFuchsiaResourceDialect
5926                        );
5927                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameSetNavigationPolicyProviderRequest>(&header, _body_bytes, handles, &mut req)?;
5928                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5929                        Ok(FrameRequest::SetNavigationPolicyProvider {
5930                            params: req.params,
5931                            provider: req.provider,
5932
5933                            control_handle,
5934                        })
5935                    }
5936                    0x851f4de50c3c27e => {
5937                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5938                        let mut req = fidl::new_empty!(
5939                            FrameSetContentAreaSettingsRequest,
5940                            fidl::encoding::DefaultFuchsiaResourceDialect
5941                        );
5942                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameSetContentAreaSettingsRequest>(&header, _body_bytes, handles, &mut req)?;
5943                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5944                        Ok(FrameRequest::SetContentAreaSettings {
5945                            settings: req.settings,
5946
5947                            control_handle,
5948                        })
5949                    }
5950                    0x6807e04f16f8ee5d => {
5951                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5952                        let mut req = fidl::new_empty!(
5953                            fidl::encoding::EmptyPayload,
5954                            fidl::encoding::DefaultFuchsiaResourceDialect
5955                        );
5956                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5957                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5958                        Ok(FrameRequest::ResetContentAreaSettings { control_handle })
5959                    }
5960                    0x442e84138e65351 => {
5961                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5962                        let mut req = fidl::new_empty!(
5963                            FrameCloseRequest,
5964                            fidl::encoding::DefaultFuchsiaResourceDialect
5965                        );
5966                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameCloseRequest>(&header, _body_bytes, handles, &mut req)?;
5967                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5968                        Ok(FrameRequest::Close { payload: req, control_handle })
5969                    }
5970                    _ => Err(fidl::Error::UnknownOrdinal {
5971                        ordinal: header.ordinal,
5972                        protocol_name: <FrameMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5973                    }),
5974                }))
5975            },
5976        )
5977    }
5978}
5979
5980#[derive(Debug)]
5981pub enum FrameRequest {
5982    /// Creates a new view using the specified `view_token`. Caller should pass the other end of
5983    /// the token to [`fuchsia.ui.gfx/ViewHolderArgs`] to attach the new view to a view tree.
5984    ///
5985    /// See the description of [`CreateContextParams.service_directory`] for additional services
5986    /// that must be present when using this method.
5987    CreateView { view_token: fidl_fuchsia_ui_views::ViewToken, control_handle: FrameControlHandle },
5988    /// Creates a new view using the specified `view_token`. Caller should pass the other end of
5989    /// the token to [`fuchsia.ui.gfx/ViewHolderArgs`] to attach the new view to a view tree.
5990    /// `view_ref` can be cloned before passing it to this method, which will allow clients to
5991    /// track the view.
5992    ///
5993    /// `view_ref_control` must not have the `ZX_RIGHT_DUPLICATE` set, or view creation will fail
5994    /// and `view_token` will be closed.
5995    ///
5996    /// See the description of [`CreateContextParams.service_directory`] for additional services
5997    /// that must be present when using this method.
5998    CreateViewWithViewRef {
5999        view_token: fidl_fuchsia_ui_views::ViewToken,
6000        view_ref_control: fidl_fuchsia_ui_views::ViewRefControl,
6001        view_ref: fidl_fuchsia_ui_views::ViewRef,
6002        control_handle: FrameControlHandle,
6003    },
6004    /// Creates a new Flatland view using the specified `view_creation_token` defined under `args`.
6005    /// Caller should pass the other end of the token to
6006    /// [`fuchsia.ui.composition/Flatland.CreateViewport`] to attach the new Flatland view to its
6007    /// graph.
6008    CreateView2 { args: CreateView2Args, control_handle: FrameControlHandle },
6009    /// Enables headless rendering of the Frame.
6010    ///
6011    /// This is used when content depends on layout and/or animation events firing normally.
6012    /// May only be used on a Context created with [`ContextFeatureFlags.HEADLESS`].
6013    EnableHeadlessRendering { control_handle: FrameControlHandle },
6014    /// Stops headless rendering of the Frame.
6015    ///
6016    /// May only be used on a Context created with [`ContextFeatureFlags.HEADLESS`].
6017    DisableHeadlessRendering { control_handle: FrameControlHandle },
6018    /// Returns a [`fuchsia.media.sessions2/Player`] interface through which media (i.e.
6019    /// video/audio) playback in the frame may be observed, and/or controlled. Only one
6020    /// [`fuchsia.media.sessions2/Player`] may be active at a time, for each [`Frame`].
6021    GetMediaPlayer {
6022        player: fidl::endpoints::ServerEnd<fidl_fuchsia_media_sessions2::PlayerMarker>,
6023        control_handle: FrameControlHandle,
6024    },
6025    /// Returns an interface through which the [`Frame`] may be navigated to a desired URL,
6026    /// reloaded, etc.
6027    ///
6028    /// - `controller`: An asynchronous interface request for the [`Frame`]'s
6029    ///   [`NavigationController`].
6030    GetNavigationController {
6031        controller: fidl::endpoints::ServerEnd<NavigationControllerMarker>,
6032        control_handle: FrameControlHandle,
6033    },
6034    /// Executes a UTF-8 encoded `script` in the [`Frame`] if the [`Frame`]'s URL has an origin
6035    /// which matches entries in `origins`.
6036    ///
6037    /// At least one `origins` entry must be specified. If a wildcard `"*"` is specified in
6038    /// `origins`, then the script will be evaluated unconditionally.
6039    ///
6040    /// Returns the result of executing `script`, as a JSON-encoded string.
6041    ///
6042    /// Note that scripts share the same execution context as the document,
6043    /// meaning that document may modify variables, classes, or objects set by
6044    /// the script in arbitrary or unpredictable ways.
6045    ///
6046    /// If an error occurred, the FrameError will be set to one of these values:
6047    /// - `BUFFER_NOT_UTF8`: `script` is not UTF-8 encoded.
6048    /// - `INVALID_ORIGIN`: The [`Frame`]'s current URL does not match any of the values in
6049    ///   `origins` or `origins` is an empty vector.
6050    ExecuteJavaScript {
6051        origins: Vec<String>,
6052        script: fidl_fuchsia_mem::Buffer,
6053        responder: FrameExecuteJavaScriptResponder,
6054    },
6055    /// Variant of [`Frame.ExecuteJavaScript`] which executes the supplied script without returning
6056    /// a result.
6057    ExecuteJavaScriptNoResult {
6058        origins: Vec<String>,
6059        script: fidl_fuchsia_mem::Buffer,
6060        responder: FrameExecuteJavaScriptNoResultResponder,
6061    },
6062    /// Executes a UTF-8 encoded `script` for every subsequent page load where the [`Frame`]'s URL
6063    /// has an origin reflected in `origins`. The script is executed early, prior to the execution
6064    /// of the document's scripts.
6065    ///
6066    /// Scripts are identified by a client-managed identifier `id`. Any script previously injected
6067    /// using the same `id` will be replaced.
6068    ///
6069    /// The order in which multiple bindings are executed is the same as the order in which the
6070    /// bindings were added. If a script is added which clobbers an existing script of the same
6071    /// `id`, the previous script's precedence in the injection order will be preserved.
6072    ///
6073    /// At least one `origins` entry must be specified. If a wildcard `"*"` is specified in
6074    /// `origins`, then the script will be evaluated unconditionally.
6075    ///
6076    /// If an error occurred, the [`FrameError`] will be set to one of these values:
6077    /// - `BUFFER_NOT_UTF8`: `script` is not UTF-8 encoded.
6078    /// - `INVALID_ORIGIN`: `origins` is an empty vector.
6079    AddBeforeLoadJavaScript {
6080        id: u64,
6081        origins: Vec<String>,
6082        script: fidl_fuchsia_mem::Buffer,
6083        responder: FrameAddBeforeLoadJavaScriptResponder,
6084    },
6085    /// Removes a previously added JavaScript snippet identified by `id`. This is a no-op if there
6086    /// is no JavaScript snippet identified by `id`.
6087    RemoveBeforeLoadJavaScript { id: u64, control_handle: FrameControlHandle },
6088    /// Posts a message to the frame's onMessage handler.
6089    ///
6090    /// `target_origin` restricts message delivery to the specified origin. If `target_origin` is
6091    /// `"*"`, then the message will be sent to the document regardless of its origin.
6092    /// See the
6093    /// [HTML spec](https://html.spec.whatwg.org/multipage/web-messaging.html#posting-messages)
6094    /// section 9.4.3 for more details on how the target origin policy is applied.
6095    ///
6096    /// If an error occurred, the [`FrameError`] will be set to one of these values:
6097    /// - `INTERNAL_ERROR`: The WebEngine failed to create a message pipe.
6098    /// - `BUFFER_NOT_UTF8`: The script in `message`'s `data` property is not UTF-8 encoded.
6099    /// - `INVALID_ORIGIN`: `origins` is an empty vector.
6100    /// - `NO_DATA_IN_MESSAGE`: The `data` property is missing in `message`.
6101    PostMessage { target_origin: String, message: WebMessage, responder: FramePostMessageResponder },
6102    /// Sets the listener for handling page navigation events.
6103    ///
6104    /// - `listener`: The observer to use. Unregisters any existing listener if null.
6105    SetNavigationEventListener {
6106        listener: Option<fidl::endpoints::ClientEnd<NavigationEventListenerMarker>>,
6107        control_handle: FrameControlHandle,
6108    },
6109    /// Sets the listener for handling page navigation events. The listener will receive the
6110    /// current navigation state immediately. After that, it's notified whenever the state changes.
6111    ///
6112    /// - `listener`: The observer to use. Unregisters any existing listener if null.
6113    /// - `flags`: Flags for optional features that should be enabled for the listener.
6114    SetNavigationEventListener2 {
6115        listener: Option<fidl::endpoints::ClientEnd<NavigationEventListenerMarker>>,
6116        flags: NavigationEventListenerFlags,
6117        control_handle: FrameControlHandle,
6118    },
6119    /// If set to a value other than [`ConsoleLogLevel.NONE`], allows web content to log messages
6120    /// to the [`fuchsia.logger/LogSink`] configured for this [`Frame`], via the
6121    /// `console` object (e.g. using `debug()`, `log()`, `info()`, `warn()` and
6122    /// `error()`).
6123    /// The default value is [`ConsoleLogLevel.NONE`].
6124    ///
6125    /// As the system log may be persisted, it is recommended that [`ConsoleLogLevel.NONE`] be used
6126    /// in Incognito and other private browsing modes.
6127    ///
6128    /// Log lines are written to the [`fuchsia.logger/LogsSink`] configured
6129    /// for this [`fuchsia.web/Frame`], with severities mapped as follows:
6130    /// - `debug()`, `log()` and `info()` are logged at [`fuchsia.logger/LogLevelFilter.INFO`]
6131    ///   severity.
6132    /// - `warn()` is logged at [`fuchsia.logger/LogLevelFilter.WARN`] severity.
6133    /// - `error()` is logged at [`fuchsia.logger/LogLevelFilter.ERROR`] severity.
6134    SetJavaScriptLogLevel { level: ConsoleLogLevel, control_handle: FrameControlHandle },
6135    /// Specifies where to emit `console` log output to. By default log output will be routed to a
6136    /// [`fuchsia.logger/LogSink`] obtained via the [`fuchsia.web/Context`]'s service directory.
6137    ///
6138    /// - `sink`: The [`fuchsia.logger/LogSink`] to use to emit logs. Passing a `null` handle
6139    ///   resets logging to use the default [`fuchsia.logger/LogSink`].
6140    SetConsoleLogSink {
6141        sink: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_logger::LogSinkMarker>>,
6142        control_handle: FrameControlHandle,
6143    },
6144    /// Enables or disables the processing of the specified `types` of user inputs.
6145    /// `allow` specifies whether to enable or disable the specified `types`.
6146    /// All input types are enabled by default.
6147    ConfigureInputTypes {
6148        types: InputTypes,
6149        allow: AllowInputState,
6150        control_handle: FrameControlHandle,
6151    },
6152    /// Sets the listener for handling popup frame opened by web content. If no listener is
6153    /// present, then any new popup frame will be blocked.
6154    ///
6155    /// - `listener`: The listener to use. Unregisters any existing listener if null.
6156    SetPopupFrameCreationListener {
6157        listener: Option<fidl::endpoints::ClientEnd<PopupFrameCreationListenerMarker>>,
6158        control_handle: FrameControlHandle,
6159    },
6160    /// Supplies a set of [`UrlRequestRewriteRule`] to apply on every subsequent URL request.
6161    /// - `rules` are cumulative and applied in order.
6162    /// - `rules` are only applied on the first URL request in a redirect chain.
6163    /// - `rules` will be validated before being applied. If `rules` are invalid, the [`Frame`]
6164    ///   will be closed with `ERR_INVALID_ARGS`.
6165    /// - [`Frame.SetUrlRequestRewriteRules`] must not be called again until its acknowledgement
6166    ///   callback has been processed. If this happens, the [`Frame`] will be closed with
6167    ///   `ERR_BAD_STATE`.
6168    SetUrlRequestRewriteRules {
6169        rules: Vec<UrlRequestRewriteRule>,
6170        responder: FrameSetUrlRequestRewriteRulesResponder,
6171    },
6172    /// Sets [`fuchsia.media/FrameMediaSettings`] for the frame. The specified parameters are
6173    /// applied to audio streams that started after this message is processed. Should be called
6174    /// before the Frame is navigated to content in order to ensure that the settings applied to
6175    /// all media streams. Due to request pipelining, this means doing so before calling
6176    /// [`Frame.GetNavigationController()`] and [`NavigationController.LoadUrl()`].
6177    SetMediaSettings { settings: FrameMediaSettings, control_handle: FrameControlHandle },
6178    /// Overrides the dimensions reported to web content. The devicePixelRatio reported to
6179    /// web content will be adjusted in response to changes in the pixel size of the View,
6180    /// rather than changing the size reported to the content. Call with null `web_dips` to
6181    /// remove any prior forced content dimensions.
6182    ForceContentDimensions {
6183        web_dips: Option<Box<fidl_fuchsia_ui_gfx::Vec2>>,
6184        control_handle: FrameControlHandle,
6185    },
6186    /// Sets the permission state for the specified `permission` and `web_origin`. By default, all
6187    /// permissions are denied.
6188    SetPermissionState {
6189        permission: PermissionDescriptor,
6190        web_origin: String,
6191        state: PermissionState,
6192        control_handle: FrameControlHandle,
6193    },
6194    /// Sets whether to block all HTMLMediaElements in the frame from fetching and loading media
6195    /// resources.
6196    ///
6197    /// May be used, for example, to prevent loading media in frames that are not visible.
6198    ///
6199    /// While media loading is blocked, elements with `autoplay` set to `true` will not start
6200    /// playback. The promises returned by calls to `play()` will remain unresolved until loading is
6201    /// unblocked by a call to this method.
6202    ///
6203    /// When media loading is unblocked, elements will begin fetching, resource, loading, and
6204    /// playing as appropriate.
6205    ///
6206    /// Any elements that have begun fetching or loading media resources for the current source
6207    /// before media loading was blocked will continue to fetch, load, and start playback as
6208    /// appropriate. This includes calls to `play()` even after media loading is blocked.
6209    SetBlockMediaLoading { blocked: bool, control_handle: FrameControlHandle },
6210    /// Returns the amount of private (non-shared) physical memory used by the Frame's main
6211    /// document. The returned size might not reflect the memory usage of embedded iframes.
6212    GetPrivateMemorySize { responder: FrameGetPrivateMemorySizeResponder },
6213    /// Sets the navigation policy provider for the [`Frame`]. When set, the [`Frame`] sends
6214    /// [`NavigationPolicyProvider.EvaluateRequestedNavigation`] when processing navigation
6215    /// requests. `params` defines when the message is sent. After sending the
6216    /// `EvaluateRequestedNavigation` message, the [`Frame`] blocks the corresponding navigation
6217    /// until it receives a response.
6218    ///
6219    /// Should be called before `GetNavigationController` to ensure that it is applied to all
6220    /// navigations including the first [`NavigationController.LoadURL`] request.
6221    SetNavigationPolicyProvider {
6222        params: NavigationPolicyProviderParams,
6223        provider: fidl::endpoints::ClientEnd<NavigationPolicyProviderMarker>,
6224        control_handle: FrameControlHandle,
6225    },
6226    /// Sets various settings for how web content should be run in the Frame. May be called at any
6227    /// time, including after the URL has loaded. Each call changes only the specified fields,
6228    /// overwriting any prior value.
6229    ///
6230    /// This method will fail with `ZX_ERR_NOT_SUPPORTED` if any value in [`ContentAreaSettings`]
6231    /// is not supported by the Frame.
6232    SetContentAreaSettings { settings: ContentAreaSettings, control_handle: FrameControlHandle },
6233    /// Reset the Frame's [`ContentAreaSettings`] to default values.
6234    ResetContentAreaSettings { control_handle: FrameControlHandle },
6235    /// Request graceful or immediate teardown of the Frame content and notification of completion
6236    /// via Frame epitaph.
6237    ///
6238    /// Graceful teardown allows unload and cleanup tasks in the implementation and web content
6239    /// (e.g., `unload` event handlers) to run for up to the specified period of time. Immediate
6240    /// teardown only runs the minimum cleanup tasks in the implementation and does not allow web
6241    /// content to run event handlers.
6242    ///
6243    /// * If `timeout` is zero, an immediate teardown is initiated. The channel will close with
6244    ///   `ZX_OK`. This is equivalent to the caller closing the Frame channel.
6245    ///
6246    /// * If `timeout` is non-zero, a graceful teardown is initiated. The channel will close with
6247    ///   `ZX_OK` if the Frame closes within the specified `timeout` and with `ZX_ERR_TIMED_OUT`
6248    ///   otherwise.
6249    ///
6250    /// * If `timeout` is not specified, a reasonable implementation-specific timeout is applied.
6251    ///
6252    /// Subsequent calls to `Close()` will override any previously specified `Close()` timeout.
6253    Close { payload: FrameCloseRequest, control_handle: FrameControlHandle },
6254}
6255
6256impl FrameRequest {
6257    #[allow(irrefutable_let_patterns)]
6258    pub fn into_create_view(
6259        self,
6260    ) -> Option<(fidl_fuchsia_ui_views::ViewToken, FrameControlHandle)> {
6261        if let FrameRequest::CreateView { view_token, control_handle } = self {
6262            Some((view_token, control_handle))
6263        } else {
6264            None
6265        }
6266    }
6267
6268    #[allow(irrefutable_let_patterns)]
6269    pub fn into_create_view_with_view_ref(
6270        self,
6271    ) -> Option<(
6272        fidl_fuchsia_ui_views::ViewToken,
6273        fidl_fuchsia_ui_views::ViewRefControl,
6274        fidl_fuchsia_ui_views::ViewRef,
6275        FrameControlHandle,
6276    )> {
6277        if let FrameRequest::CreateViewWithViewRef {
6278            view_token,
6279            view_ref_control,
6280            view_ref,
6281            control_handle,
6282        } = self
6283        {
6284            Some((view_token, view_ref_control, view_ref, control_handle))
6285        } else {
6286            None
6287        }
6288    }
6289
6290    #[allow(irrefutable_let_patterns)]
6291    pub fn into_create_view2(self) -> Option<(CreateView2Args, FrameControlHandle)> {
6292        if let FrameRequest::CreateView2 { args, control_handle } = self {
6293            Some((args, control_handle))
6294        } else {
6295            None
6296        }
6297    }
6298
6299    #[allow(irrefutable_let_patterns)]
6300    pub fn into_enable_headless_rendering(self) -> Option<(FrameControlHandle)> {
6301        if let FrameRequest::EnableHeadlessRendering { control_handle } = self {
6302            Some((control_handle))
6303        } else {
6304            None
6305        }
6306    }
6307
6308    #[allow(irrefutable_let_patterns)]
6309    pub fn into_disable_headless_rendering(self) -> Option<(FrameControlHandle)> {
6310        if let FrameRequest::DisableHeadlessRendering { control_handle } = self {
6311            Some((control_handle))
6312        } else {
6313            None
6314        }
6315    }
6316
6317    #[allow(irrefutable_let_patterns)]
6318    pub fn into_get_media_player(
6319        self,
6320    ) -> Option<(
6321        fidl::endpoints::ServerEnd<fidl_fuchsia_media_sessions2::PlayerMarker>,
6322        FrameControlHandle,
6323    )> {
6324        if let FrameRequest::GetMediaPlayer { player, control_handle } = self {
6325            Some((player, control_handle))
6326        } else {
6327            None
6328        }
6329    }
6330
6331    #[allow(irrefutable_let_patterns)]
6332    pub fn into_get_navigation_controller(
6333        self,
6334    ) -> Option<(fidl::endpoints::ServerEnd<NavigationControllerMarker>, FrameControlHandle)> {
6335        if let FrameRequest::GetNavigationController { controller, control_handle } = self {
6336            Some((controller, control_handle))
6337        } else {
6338            None
6339        }
6340    }
6341
6342    #[allow(irrefutable_let_patterns)]
6343    pub fn into_execute_java_script(
6344        self,
6345    ) -> Option<(Vec<String>, fidl_fuchsia_mem::Buffer, FrameExecuteJavaScriptResponder)> {
6346        if let FrameRequest::ExecuteJavaScript { origins, script, responder } = self {
6347            Some((origins, script, responder))
6348        } else {
6349            None
6350        }
6351    }
6352
6353    #[allow(irrefutable_let_patterns)]
6354    pub fn into_execute_java_script_no_result(
6355        self,
6356    ) -> Option<(Vec<String>, fidl_fuchsia_mem::Buffer, FrameExecuteJavaScriptNoResultResponder)>
6357    {
6358        if let FrameRequest::ExecuteJavaScriptNoResult { origins, script, responder } = self {
6359            Some((origins, script, responder))
6360        } else {
6361            None
6362        }
6363    }
6364
6365    #[allow(irrefutable_let_patterns)]
6366    pub fn into_add_before_load_java_script(
6367        self,
6368    ) -> Option<(u64, Vec<String>, fidl_fuchsia_mem::Buffer, FrameAddBeforeLoadJavaScriptResponder)>
6369    {
6370        if let FrameRequest::AddBeforeLoadJavaScript { id, origins, script, responder } = self {
6371            Some((id, origins, script, responder))
6372        } else {
6373            None
6374        }
6375    }
6376
6377    #[allow(irrefutable_let_patterns)]
6378    pub fn into_remove_before_load_java_script(self) -> Option<(u64, FrameControlHandle)> {
6379        if let FrameRequest::RemoveBeforeLoadJavaScript { id, control_handle } = self {
6380            Some((id, control_handle))
6381        } else {
6382            None
6383        }
6384    }
6385
6386    #[allow(irrefutable_let_patterns)]
6387    pub fn into_post_message(self) -> Option<(String, WebMessage, FramePostMessageResponder)> {
6388        if let FrameRequest::PostMessage { target_origin, message, responder } = self {
6389            Some((target_origin, message, responder))
6390        } else {
6391            None
6392        }
6393    }
6394
6395    #[allow(irrefutable_let_patterns)]
6396    pub fn into_set_navigation_event_listener(
6397        self,
6398    ) -> Option<(
6399        Option<fidl::endpoints::ClientEnd<NavigationEventListenerMarker>>,
6400        FrameControlHandle,
6401    )> {
6402        if let FrameRequest::SetNavigationEventListener { listener, control_handle } = self {
6403            Some((listener, control_handle))
6404        } else {
6405            None
6406        }
6407    }
6408
6409    #[allow(irrefutable_let_patterns)]
6410    pub fn into_set_navigation_event_listener2(
6411        self,
6412    ) -> Option<(
6413        Option<fidl::endpoints::ClientEnd<NavigationEventListenerMarker>>,
6414        NavigationEventListenerFlags,
6415        FrameControlHandle,
6416    )> {
6417        if let FrameRequest::SetNavigationEventListener2 { listener, flags, control_handle } = self
6418        {
6419            Some((listener, flags, control_handle))
6420        } else {
6421            None
6422        }
6423    }
6424
6425    #[allow(irrefutable_let_patterns)]
6426    pub fn into_set_java_script_log_level(self) -> Option<(ConsoleLogLevel, FrameControlHandle)> {
6427        if let FrameRequest::SetJavaScriptLogLevel { level, control_handle } = self {
6428            Some((level, control_handle))
6429        } else {
6430            None
6431        }
6432    }
6433
6434    #[allow(irrefutable_let_patterns)]
6435    pub fn into_set_console_log_sink(
6436        self,
6437    ) -> Option<(
6438        Option<fidl::endpoints::ClientEnd<fidl_fuchsia_logger::LogSinkMarker>>,
6439        FrameControlHandle,
6440    )> {
6441        if let FrameRequest::SetConsoleLogSink { sink, control_handle } = self {
6442            Some((sink, control_handle))
6443        } else {
6444            None
6445        }
6446    }
6447
6448    #[allow(irrefutable_let_patterns)]
6449    pub fn into_configure_input_types(
6450        self,
6451    ) -> Option<(InputTypes, AllowInputState, FrameControlHandle)> {
6452        if let FrameRequest::ConfigureInputTypes { types, allow, control_handle } = self {
6453            Some((types, allow, control_handle))
6454        } else {
6455            None
6456        }
6457    }
6458
6459    #[allow(irrefutable_let_patterns)]
6460    pub fn into_set_popup_frame_creation_listener(
6461        self,
6462    ) -> Option<(
6463        Option<fidl::endpoints::ClientEnd<PopupFrameCreationListenerMarker>>,
6464        FrameControlHandle,
6465    )> {
6466        if let FrameRequest::SetPopupFrameCreationListener { listener, control_handle } = self {
6467            Some((listener, control_handle))
6468        } else {
6469            None
6470        }
6471    }
6472
6473    #[allow(irrefutable_let_patterns)]
6474    pub fn into_set_url_request_rewrite_rules(
6475        self,
6476    ) -> Option<(Vec<UrlRequestRewriteRule>, FrameSetUrlRequestRewriteRulesResponder)> {
6477        if let FrameRequest::SetUrlRequestRewriteRules { rules, responder } = self {
6478            Some((rules, responder))
6479        } else {
6480            None
6481        }
6482    }
6483
6484    #[allow(irrefutable_let_patterns)]
6485    pub fn into_set_media_settings(self) -> Option<(FrameMediaSettings, FrameControlHandle)> {
6486        if let FrameRequest::SetMediaSettings { settings, control_handle } = self {
6487            Some((settings, control_handle))
6488        } else {
6489            None
6490        }
6491    }
6492
6493    #[allow(irrefutable_let_patterns)]
6494    pub fn into_force_content_dimensions(
6495        self,
6496    ) -> Option<(Option<Box<fidl_fuchsia_ui_gfx::Vec2>>, FrameControlHandle)> {
6497        if let FrameRequest::ForceContentDimensions { web_dips, control_handle } = self {
6498            Some((web_dips, control_handle))
6499        } else {
6500            None
6501        }
6502    }
6503
6504    #[allow(irrefutable_let_patterns)]
6505    pub fn into_set_permission_state(
6506        self,
6507    ) -> Option<(PermissionDescriptor, String, PermissionState, FrameControlHandle)> {
6508        if let FrameRequest::SetPermissionState { permission, web_origin, state, control_handle } =
6509            self
6510        {
6511            Some((permission, web_origin, state, control_handle))
6512        } else {
6513            None
6514        }
6515    }
6516
6517    #[allow(irrefutable_let_patterns)]
6518    pub fn into_set_block_media_loading(self) -> Option<(bool, FrameControlHandle)> {
6519        if let FrameRequest::SetBlockMediaLoading { blocked, control_handle } = self {
6520            Some((blocked, control_handle))
6521        } else {
6522            None
6523        }
6524    }
6525
6526    #[allow(irrefutable_let_patterns)]
6527    pub fn into_get_private_memory_size(self) -> Option<(FrameGetPrivateMemorySizeResponder)> {
6528        if let FrameRequest::GetPrivateMemorySize { responder } = self {
6529            Some((responder))
6530        } else {
6531            None
6532        }
6533    }
6534
6535    #[allow(irrefutable_let_patterns)]
6536    pub fn into_set_navigation_policy_provider(
6537        self,
6538    ) -> Option<(
6539        NavigationPolicyProviderParams,
6540        fidl::endpoints::ClientEnd<NavigationPolicyProviderMarker>,
6541        FrameControlHandle,
6542    )> {
6543        if let FrameRequest::SetNavigationPolicyProvider { params, provider, control_handle } = self
6544        {
6545            Some((params, provider, control_handle))
6546        } else {
6547            None
6548        }
6549    }
6550
6551    #[allow(irrefutable_let_patterns)]
6552    pub fn into_set_content_area_settings(
6553        self,
6554    ) -> Option<(ContentAreaSettings, FrameControlHandle)> {
6555        if let FrameRequest::SetContentAreaSettings { settings, control_handle } = self {
6556            Some((settings, control_handle))
6557        } else {
6558            None
6559        }
6560    }
6561
6562    #[allow(irrefutable_let_patterns)]
6563    pub fn into_reset_content_area_settings(self) -> Option<(FrameControlHandle)> {
6564        if let FrameRequest::ResetContentAreaSettings { control_handle } = self {
6565            Some((control_handle))
6566        } else {
6567            None
6568        }
6569    }
6570
6571    #[allow(irrefutable_let_patterns)]
6572    pub fn into_close(self) -> Option<(FrameCloseRequest, FrameControlHandle)> {
6573        if let FrameRequest::Close { payload, control_handle } = self {
6574            Some((payload, control_handle))
6575        } else {
6576            None
6577        }
6578    }
6579
6580    /// Name of the method defined in FIDL
6581    pub fn method_name(&self) -> &'static str {
6582        match *self {
6583            FrameRequest::CreateView { .. } => "create_view",
6584            FrameRequest::CreateViewWithViewRef { .. } => "create_view_with_view_ref",
6585            FrameRequest::CreateView2 { .. } => "create_view2",
6586            FrameRequest::EnableHeadlessRendering { .. } => "enable_headless_rendering",
6587            FrameRequest::DisableHeadlessRendering { .. } => "disable_headless_rendering",
6588            FrameRequest::GetMediaPlayer { .. } => "get_media_player",
6589            FrameRequest::GetNavigationController { .. } => "get_navigation_controller",
6590            FrameRequest::ExecuteJavaScript { .. } => "execute_java_script",
6591            FrameRequest::ExecuteJavaScriptNoResult { .. } => "execute_java_script_no_result",
6592            FrameRequest::AddBeforeLoadJavaScript { .. } => "add_before_load_java_script",
6593            FrameRequest::RemoveBeforeLoadJavaScript { .. } => "remove_before_load_java_script",
6594            FrameRequest::PostMessage { .. } => "post_message",
6595            FrameRequest::SetNavigationEventListener { .. } => "set_navigation_event_listener",
6596            FrameRequest::SetNavigationEventListener2 { .. } => "set_navigation_event_listener2",
6597            FrameRequest::SetJavaScriptLogLevel { .. } => "set_java_script_log_level",
6598            FrameRequest::SetConsoleLogSink { .. } => "set_console_log_sink",
6599            FrameRequest::ConfigureInputTypes { .. } => "configure_input_types",
6600            FrameRequest::SetPopupFrameCreationListener { .. } => {
6601                "set_popup_frame_creation_listener"
6602            }
6603            FrameRequest::SetUrlRequestRewriteRules { .. } => "set_url_request_rewrite_rules",
6604            FrameRequest::SetMediaSettings { .. } => "set_media_settings",
6605            FrameRequest::ForceContentDimensions { .. } => "force_content_dimensions",
6606            FrameRequest::SetPermissionState { .. } => "set_permission_state",
6607            FrameRequest::SetBlockMediaLoading { .. } => "set_block_media_loading",
6608            FrameRequest::GetPrivateMemorySize { .. } => "get_private_memory_size",
6609            FrameRequest::SetNavigationPolicyProvider { .. } => "set_navigation_policy_provider",
6610            FrameRequest::SetContentAreaSettings { .. } => "set_content_area_settings",
6611            FrameRequest::ResetContentAreaSettings { .. } => "reset_content_area_settings",
6612            FrameRequest::Close { .. } => "close",
6613        }
6614    }
6615}
6616
6617#[derive(Debug, Clone)]
6618pub struct FrameControlHandle {
6619    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6620}
6621
6622impl fidl::endpoints::ControlHandle for FrameControlHandle {
6623    fn shutdown(&self) {
6624        self.inner.shutdown()
6625    }
6626    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6627        self.inner.shutdown_with_epitaph(status)
6628    }
6629
6630    fn is_closed(&self) -> bool {
6631        self.inner.channel().is_closed()
6632    }
6633    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6634        self.inner.channel().on_closed()
6635    }
6636
6637    #[cfg(target_os = "fuchsia")]
6638    fn signal_peer(
6639        &self,
6640        clear_mask: zx::Signals,
6641        set_mask: zx::Signals,
6642    ) -> Result<(), zx_status::Status> {
6643        use fidl::Peered;
6644        self.inner.channel().signal_peer(clear_mask, set_mask)
6645    }
6646}
6647
6648impl FrameControlHandle {}
6649
6650#[must_use = "FIDL methods require a response to be sent"]
6651#[derive(Debug)]
6652pub struct FrameExecuteJavaScriptResponder {
6653    control_handle: std::mem::ManuallyDrop<FrameControlHandle>,
6654    tx_id: u32,
6655}
6656
6657/// Set the the channel to be shutdown (see [`FrameControlHandle::shutdown`])
6658/// if the responder is dropped without sending a response, so that the client
6659/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6660impl std::ops::Drop for FrameExecuteJavaScriptResponder {
6661    fn drop(&mut self) {
6662        self.control_handle.shutdown();
6663        // Safety: drops once, never accessed again
6664        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6665    }
6666}
6667
6668impl fidl::endpoints::Responder for FrameExecuteJavaScriptResponder {
6669    type ControlHandle = FrameControlHandle;
6670
6671    fn control_handle(&self) -> &FrameControlHandle {
6672        &self.control_handle
6673    }
6674
6675    fn drop_without_shutdown(mut self) {
6676        // Safety: drops once, never accessed again due to mem::forget
6677        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6678        // Prevent Drop from running (which would shut down the channel)
6679        std::mem::forget(self);
6680    }
6681}
6682
6683impl FrameExecuteJavaScriptResponder {
6684    /// Sends a response to the FIDL transaction.
6685    ///
6686    /// Sets the channel to shutdown if an error occurs.
6687    pub fn send(
6688        self,
6689        mut result: Result<fidl_fuchsia_mem::Buffer, FrameError>,
6690    ) -> Result<(), fidl::Error> {
6691        let _result = self.send_raw(result);
6692        if _result.is_err() {
6693            self.control_handle.shutdown();
6694        }
6695        self.drop_without_shutdown();
6696        _result
6697    }
6698
6699    /// Similar to "send" but does not shutdown the channel if an error occurs.
6700    pub fn send_no_shutdown_on_err(
6701        self,
6702        mut result: Result<fidl_fuchsia_mem::Buffer, FrameError>,
6703    ) -> Result<(), fidl::Error> {
6704        let _result = self.send_raw(result);
6705        self.drop_without_shutdown();
6706        _result
6707    }
6708
6709    fn send_raw(
6710        &self,
6711        mut result: Result<fidl_fuchsia_mem::Buffer, FrameError>,
6712    ) -> Result<(), fidl::Error> {
6713        self.control_handle.inner.send::<fidl::encoding::ResultType<
6714            FrameExecuteJavaScriptResponse,
6715            FrameError,
6716        >>(
6717            result.as_mut().map_err(|e| *e).map(|result| (result,)),
6718            self.tx_id,
6719            0x79abdd4907000542,
6720            fidl::encoding::DynamicFlags::empty(),
6721        )
6722    }
6723}
6724
6725#[must_use = "FIDL methods require a response to be sent"]
6726#[derive(Debug)]
6727pub struct FrameExecuteJavaScriptNoResultResponder {
6728    control_handle: std::mem::ManuallyDrop<FrameControlHandle>,
6729    tx_id: u32,
6730}
6731
6732/// Set the the channel to be shutdown (see [`FrameControlHandle::shutdown`])
6733/// if the responder is dropped without sending a response, so that the client
6734/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6735impl std::ops::Drop for FrameExecuteJavaScriptNoResultResponder {
6736    fn drop(&mut self) {
6737        self.control_handle.shutdown();
6738        // Safety: drops once, never accessed again
6739        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6740    }
6741}
6742
6743impl fidl::endpoints::Responder for FrameExecuteJavaScriptNoResultResponder {
6744    type ControlHandle = FrameControlHandle;
6745
6746    fn control_handle(&self) -> &FrameControlHandle {
6747        &self.control_handle
6748    }
6749
6750    fn drop_without_shutdown(mut self) {
6751        // Safety: drops once, never accessed again due to mem::forget
6752        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6753        // Prevent Drop from running (which would shut down the channel)
6754        std::mem::forget(self);
6755    }
6756}
6757
6758impl FrameExecuteJavaScriptNoResultResponder {
6759    /// Sends a response to the FIDL transaction.
6760    ///
6761    /// Sets the channel to shutdown if an error occurs.
6762    pub fn send(self, mut result: Result<(), FrameError>) -> 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<(), 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(&self, mut result: Result<(), FrameError>) -> Result<(), fidl::Error> {
6782        self.control_handle
6783            .inner
6784            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FrameError>>(
6785                result,
6786                self.tx_id,
6787                0x16b8491520cbcd63,
6788                fidl::encoding::DynamicFlags::empty(),
6789            )
6790    }
6791}
6792
6793#[must_use = "FIDL methods require a response to be sent"]
6794#[derive(Debug)]
6795pub struct FrameAddBeforeLoadJavaScriptResponder {
6796    control_handle: std::mem::ManuallyDrop<FrameControlHandle>,
6797    tx_id: u32,
6798}
6799
6800/// Set the the channel to be shutdown (see [`FrameControlHandle::shutdown`])
6801/// if the responder is dropped without sending a response, so that the client
6802/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6803impl std::ops::Drop for FrameAddBeforeLoadJavaScriptResponder {
6804    fn drop(&mut self) {
6805        self.control_handle.shutdown();
6806        // Safety: drops once, never accessed again
6807        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6808    }
6809}
6810
6811impl fidl::endpoints::Responder for FrameAddBeforeLoadJavaScriptResponder {
6812    type ControlHandle = FrameControlHandle;
6813
6814    fn control_handle(&self) -> &FrameControlHandle {
6815        &self.control_handle
6816    }
6817
6818    fn drop_without_shutdown(mut self) {
6819        // Safety: drops once, never accessed again due to mem::forget
6820        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6821        // Prevent Drop from running (which would shut down the channel)
6822        std::mem::forget(self);
6823    }
6824}
6825
6826impl FrameAddBeforeLoadJavaScriptResponder {
6827    /// Sends a response to the FIDL transaction.
6828    ///
6829    /// Sets the channel to shutdown if an error occurs.
6830    pub fn send(self, mut result: Result<(), FrameError>) -> Result<(), fidl::Error> {
6831        let _result = self.send_raw(result);
6832        if _result.is_err() {
6833            self.control_handle.shutdown();
6834        }
6835        self.drop_without_shutdown();
6836        _result
6837    }
6838
6839    /// Similar to "send" but does not shutdown the channel if an error occurs.
6840    pub fn send_no_shutdown_on_err(
6841        self,
6842        mut result: Result<(), FrameError>,
6843    ) -> Result<(), fidl::Error> {
6844        let _result = self.send_raw(result);
6845        self.drop_without_shutdown();
6846        _result
6847    }
6848
6849    fn send_raw(&self, mut result: Result<(), FrameError>) -> Result<(), fidl::Error> {
6850        self.control_handle
6851            .inner
6852            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FrameError>>(
6853                result,
6854                self.tx_id,
6855                0x540ac0da59d823e,
6856                fidl::encoding::DynamicFlags::empty(),
6857            )
6858    }
6859}
6860
6861#[must_use = "FIDL methods require a response to be sent"]
6862#[derive(Debug)]
6863pub struct FramePostMessageResponder {
6864    control_handle: std::mem::ManuallyDrop<FrameControlHandle>,
6865    tx_id: u32,
6866}
6867
6868/// Set the the channel to be shutdown (see [`FrameControlHandle::shutdown`])
6869/// if the responder is dropped without sending a response, so that the client
6870/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6871impl std::ops::Drop for FramePostMessageResponder {
6872    fn drop(&mut self) {
6873        self.control_handle.shutdown();
6874        // Safety: drops once, never accessed again
6875        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6876    }
6877}
6878
6879impl fidl::endpoints::Responder for FramePostMessageResponder {
6880    type ControlHandle = FrameControlHandle;
6881
6882    fn control_handle(&self) -> &FrameControlHandle {
6883        &self.control_handle
6884    }
6885
6886    fn drop_without_shutdown(mut self) {
6887        // Safety: drops once, never accessed again due to mem::forget
6888        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6889        // Prevent Drop from running (which would shut down the channel)
6890        std::mem::forget(self);
6891    }
6892}
6893
6894impl FramePostMessageResponder {
6895    /// Sends a response to the FIDL transaction.
6896    ///
6897    /// Sets the channel to shutdown if an error occurs.
6898    pub fn send(self, mut result: Result<(), FrameError>) -> Result<(), fidl::Error> {
6899        let _result = self.send_raw(result);
6900        if _result.is_err() {
6901            self.control_handle.shutdown();
6902        }
6903        self.drop_without_shutdown();
6904        _result
6905    }
6906
6907    /// Similar to "send" but does not shutdown the channel if an error occurs.
6908    pub fn send_no_shutdown_on_err(
6909        self,
6910        mut result: Result<(), FrameError>,
6911    ) -> Result<(), fidl::Error> {
6912        let _result = self.send_raw(result);
6913        self.drop_without_shutdown();
6914        _result
6915    }
6916
6917    fn send_raw(&self, mut result: Result<(), FrameError>) -> Result<(), fidl::Error> {
6918        self.control_handle
6919            .inner
6920            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FrameError>>(
6921                result,
6922                self.tx_id,
6923                0x751d686eb7caa341,
6924                fidl::encoding::DynamicFlags::empty(),
6925            )
6926    }
6927}
6928
6929#[must_use = "FIDL methods require a response to be sent"]
6930#[derive(Debug)]
6931pub struct FrameSetUrlRequestRewriteRulesResponder {
6932    control_handle: std::mem::ManuallyDrop<FrameControlHandle>,
6933    tx_id: u32,
6934}
6935
6936/// Set the the channel to be shutdown (see [`FrameControlHandle::shutdown`])
6937/// if the responder is dropped without sending a response, so that the client
6938/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6939impl std::ops::Drop for FrameSetUrlRequestRewriteRulesResponder {
6940    fn drop(&mut self) {
6941        self.control_handle.shutdown();
6942        // Safety: drops once, never accessed again
6943        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6944    }
6945}
6946
6947impl fidl::endpoints::Responder for FrameSetUrlRequestRewriteRulesResponder {
6948    type ControlHandle = FrameControlHandle;
6949
6950    fn control_handle(&self) -> &FrameControlHandle {
6951        &self.control_handle
6952    }
6953
6954    fn drop_without_shutdown(mut self) {
6955        // Safety: drops once, never accessed again due to mem::forget
6956        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6957        // Prevent Drop from running (which would shut down the channel)
6958        std::mem::forget(self);
6959    }
6960}
6961
6962impl FrameSetUrlRequestRewriteRulesResponder {
6963    /// Sends a response to the FIDL transaction.
6964    ///
6965    /// Sets the channel to shutdown if an error occurs.
6966    pub fn send(self) -> Result<(), fidl::Error> {
6967        let _result = self.send_raw();
6968        if _result.is_err() {
6969            self.control_handle.shutdown();
6970        }
6971        self.drop_without_shutdown();
6972        _result
6973    }
6974
6975    /// Similar to "send" but does not shutdown the channel if an error occurs.
6976    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
6977        let _result = self.send_raw();
6978        self.drop_without_shutdown();
6979        _result
6980    }
6981
6982    fn send_raw(&self) -> Result<(), fidl::Error> {
6983        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
6984            (),
6985            self.tx_id,
6986            0x2e3f797350ab3281,
6987            fidl::encoding::DynamicFlags::empty(),
6988        )
6989    }
6990}
6991
6992#[must_use = "FIDL methods require a response to be sent"]
6993#[derive(Debug)]
6994pub struct FrameGetPrivateMemorySizeResponder {
6995    control_handle: std::mem::ManuallyDrop<FrameControlHandle>,
6996    tx_id: u32,
6997}
6998
6999/// Set the the channel to be shutdown (see [`FrameControlHandle::shutdown`])
7000/// if the responder is dropped without sending a response, so that the client
7001/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7002impl std::ops::Drop for FrameGetPrivateMemorySizeResponder {
7003    fn drop(&mut self) {
7004        self.control_handle.shutdown();
7005        // Safety: drops once, never accessed again
7006        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7007    }
7008}
7009
7010impl fidl::endpoints::Responder for FrameGetPrivateMemorySizeResponder {
7011    type ControlHandle = FrameControlHandle;
7012
7013    fn control_handle(&self) -> &FrameControlHandle {
7014        &self.control_handle
7015    }
7016
7017    fn drop_without_shutdown(mut self) {
7018        // Safety: drops once, never accessed again due to mem::forget
7019        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7020        // Prevent Drop from running (which would shut down the channel)
7021        std::mem::forget(self);
7022    }
7023}
7024
7025impl FrameGetPrivateMemorySizeResponder {
7026    /// Sends a response to the FIDL transaction.
7027    ///
7028    /// Sets the channel to shutdown if an error occurs.
7029    pub fn send(self, mut size_bytes: u64) -> Result<(), fidl::Error> {
7030        let _result = self.send_raw(size_bytes);
7031        if _result.is_err() {
7032            self.control_handle.shutdown();
7033        }
7034        self.drop_without_shutdown();
7035        _result
7036    }
7037
7038    /// Similar to "send" but does not shutdown the channel if an error occurs.
7039    pub fn send_no_shutdown_on_err(self, mut size_bytes: u64) -> Result<(), fidl::Error> {
7040        let _result = self.send_raw(size_bytes);
7041        self.drop_without_shutdown();
7042        _result
7043    }
7044
7045    fn send_raw(&self, mut size_bytes: u64) -> Result<(), fidl::Error> {
7046        self.control_handle.inner.send::<FrameGetPrivateMemorySizeResponse>(
7047            (size_bytes,),
7048            self.tx_id,
7049            0x6ad4d43da6c129b0,
7050            fidl::encoding::DynamicFlags::empty(),
7051        )
7052    }
7053}
7054
7055#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7056pub struct FrameHostMarker;
7057
7058impl fidl::endpoints::ProtocolMarker for FrameHostMarker {
7059    type Proxy = FrameHostProxy;
7060    type RequestStream = FrameHostRequestStream;
7061    #[cfg(target_os = "fuchsia")]
7062    type SynchronousProxy = FrameHostSynchronousProxy;
7063
7064    const DEBUG_NAME: &'static str = "fuchsia.web.FrameHost";
7065}
7066impl fidl::endpoints::DiscoverableProtocolMarker for FrameHostMarker {}
7067
7068pub trait FrameHostProxyInterface: Send + Sync {
7069    fn r#create_frame_with_params(
7070        &self,
7071        params: CreateFrameParams,
7072        frame: fidl::endpoints::ServerEnd<FrameMarker>,
7073    ) -> Result<(), fidl::Error>;
7074}
7075#[derive(Debug)]
7076#[cfg(target_os = "fuchsia")]
7077pub struct FrameHostSynchronousProxy {
7078    client: fidl::client::sync::Client,
7079}
7080
7081#[cfg(target_os = "fuchsia")]
7082impl fidl::endpoints::SynchronousProxy for FrameHostSynchronousProxy {
7083    type Proxy = FrameHostProxy;
7084    type Protocol = FrameHostMarker;
7085
7086    fn from_channel(inner: fidl::Channel) -> Self {
7087        Self::new(inner)
7088    }
7089
7090    fn into_channel(self) -> fidl::Channel {
7091        self.client.into_channel()
7092    }
7093
7094    fn as_channel(&self) -> &fidl::Channel {
7095        self.client.as_channel()
7096    }
7097}
7098
7099#[cfg(target_os = "fuchsia")]
7100impl FrameHostSynchronousProxy {
7101    pub fn new(channel: fidl::Channel) -> Self {
7102        let protocol_name = <FrameHostMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7103        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
7104    }
7105
7106    pub fn into_channel(self) -> fidl::Channel {
7107        self.client.into_channel()
7108    }
7109
7110    /// Waits until an event arrives and returns it. It is safe for other
7111    /// threads to make concurrent requests while waiting for an event.
7112    pub fn wait_for_event(
7113        &self,
7114        deadline: zx::MonotonicInstant,
7115    ) -> Result<FrameHostEvent, fidl::Error> {
7116        FrameHostEvent::decode(self.client.wait_for_event(deadline)?)
7117    }
7118
7119    /// Behaves identically to [`Context.CreateFrameWithParams`].
7120    pub fn r#create_frame_with_params(
7121        &self,
7122        mut params: CreateFrameParams,
7123        mut frame: fidl::endpoints::ServerEnd<FrameMarker>,
7124    ) -> Result<(), fidl::Error> {
7125        self.client.send::<FrameHostCreateFrameWithParamsRequest>(
7126            (&mut params, frame),
7127            0x670186c3a1b3f28,
7128            fidl::encoding::DynamicFlags::empty(),
7129        )
7130    }
7131}
7132
7133#[cfg(target_os = "fuchsia")]
7134impl From<FrameHostSynchronousProxy> for zx::Handle {
7135    fn from(value: FrameHostSynchronousProxy) -> Self {
7136        value.into_channel().into()
7137    }
7138}
7139
7140#[cfg(target_os = "fuchsia")]
7141impl From<fidl::Channel> for FrameHostSynchronousProxy {
7142    fn from(value: fidl::Channel) -> Self {
7143        Self::new(value)
7144    }
7145}
7146
7147#[derive(Debug, Clone)]
7148pub struct FrameHostProxy {
7149    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7150}
7151
7152impl fidl::endpoints::Proxy for FrameHostProxy {
7153    type Protocol = FrameHostMarker;
7154
7155    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7156        Self::new(inner)
7157    }
7158
7159    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7160        self.client.into_channel().map_err(|client| Self { client })
7161    }
7162
7163    fn as_channel(&self) -> &::fidl::AsyncChannel {
7164        self.client.as_channel()
7165    }
7166}
7167
7168impl FrameHostProxy {
7169    /// Create a new Proxy for fuchsia.web/FrameHost.
7170    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7171        let protocol_name = <FrameHostMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7172        Self { client: fidl::client::Client::new(channel, protocol_name) }
7173    }
7174
7175    /// Get a Stream of events from the remote end of the protocol.
7176    ///
7177    /// # Panics
7178    ///
7179    /// Panics if the event stream was already taken.
7180    pub fn take_event_stream(&self) -> FrameHostEventStream {
7181        FrameHostEventStream { event_receiver: self.client.take_event_receiver() }
7182    }
7183
7184    /// Behaves identically to [`Context.CreateFrameWithParams`].
7185    pub fn r#create_frame_with_params(
7186        &self,
7187        mut params: CreateFrameParams,
7188        mut frame: fidl::endpoints::ServerEnd<FrameMarker>,
7189    ) -> Result<(), fidl::Error> {
7190        FrameHostProxyInterface::r#create_frame_with_params(self, params, frame)
7191    }
7192}
7193
7194impl FrameHostProxyInterface for FrameHostProxy {
7195    fn r#create_frame_with_params(
7196        &self,
7197        mut params: CreateFrameParams,
7198        mut frame: fidl::endpoints::ServerEnd<FrameMarker>,
7199    ) -> Result<(), fidl::Error> {
7200        self.client.send::<FrameHostCreateFrameWithParamsRequest>(
7201            (&mut params, frame),
7202            0x670186c3a1b3f28,
7203            fidl::encoding::DynamicFlags::empty(),
7204        )
7205    }
7206}
7207
7208pub struct FrameHostEventStream {
7209    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7210}
7211
7212impl std::marker::Unpin for FrameHostEventStream {}
7213
7214impl futures::stream::FusedStream for FrameHostEventStream {
7215    fn is_terminated(&self) -> bool {
7216        self.event_receiver.is_terminated()
7217    }
7218}
7219
7220impl futures::Stream for FrameHostEventStream {
7221    type Item = Result<FrameHostEvent, fidl::Error>;
7222
7223    fn poll_next(
7224        mut self: std::pin::Pin<&mut Self>,
7225        cx: &mut std::task::Context<'_>,
7226    ) -> std::task::Poll<Option<Self::Item>> {
7227        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7228            &mut self.event_receiver,
7229            cx
7230        )?) {
7231            Some(buf) => std::task::Poll::Ready(Some(FrameHostEvent::decode(buf))),
7232            None => std::task::Poll::Ready(None),
7233        }
7234    }
7235}
7236
7237#[derive(Debug)]
7238pub enum FrameHostEvent {}
7239
7240impl FrameHostEvent {
7241    /// Decodes a message buffer as a [`FrameHostEvent`].
7242    fn decode(
7243        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7244    ) -> Result<FrameHostEvent, fidl::Error> {
7245        let (bytes, _handles) = buf.split_mut();
7246        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7247        debug_assert_eq!(tx_header.tx_id, 0);
7248        match tx_header.ordinal {
7249            _ => Err(fidl::Error::UnknownOrdinal {
7250                ordinal: tx_header.ordinal,
7251                protocol_name: <FrameHostMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7252            }),
7253        }
7254    }
7255}
7256
7257/// A Stream of incoming requests for fuchsia.web/FrameHost.
7258pub struct FrameHostRequestStream {
7259    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7260    is_terminated: bool,
7261}
7262
7263impl std::marker::Unpin for FrameHostRequestStream {}
7264
7265impl futures::stream::FusedStream for FrameHostRequestStream {
7266    fn is_terminated(&self) -> bool {
7267        self.is_terminated
7268    }
7269}
7270
7271impl fidl::endpoints::RequestStream for FrameHostRequestStream {
7272    type Protocol = FrameHostMarker;
7273    type ControlHandle = FrameHostControlHandle;
7274
7275    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7276        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7277    }
7278
7279    fn control_handle(&self) -> Self::ControlHandle {
7280        FrameHostControlHandle { inner: self.inner.clone() }
7281    }
7282
7283    fn into_inner(
7284        self,
7285    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7286    {
7287        (self.inner, self.is_terminated)
7288    }
7289
7290    fn from_inner(
7291        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7292        is_terminated: bool,
7293    ) -> Self {
7294        Self { inner, is_terminated }
7295    }
7296}
7297
7298impl futures::Stream for FrameHostRequestStream {
7299    type Item = Result<FrameHostRequest, fidl::Error>;
7300
7301    fn poll_next(
7302        mut self: std::pin::Pin<&mut Self>,
7303        cx: &mut std::task::Context<'_>,
7304    ) -> std::task::Poll<Option<Self::Item>> {
7305        let this = &mut *self;
7306        if this.inner.check_shutdown(cx) {
7307            this.is_terminated = true;
7308            return std::task::Poll::Ready(None);
7309        }
7310        if this.is_terminated {
7311            panic!("polled FrameHostRequestStream after completion");
7312        }
7313        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7314            |bytes, handles| {
7315                match this.inner.channel().read_etc(cx, bytes, handles) {
7316                    std::task::Poll::Ready(Ok(())) => {}
7317                    std::task::Poll::Pending => return std::task::Poll::Pending,
7318                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7319                        this.is_terminated = true;
7320                        return std::task::Poll::Ready(None);
7321                    }
7322                    std::task::Poll::Ready(Err(e)) => {
7323                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7324                            e.into(),
7325                        ))))
7326                    }
7327                }
7328
7329                // A message has been received from the channel
7330                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7331
7332                std::task::Poll::Ready(Some(match header.ordinal {
7333                    0x670186c3a1b3f28 => {
7334                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
7335                        let mut req = fidl::new_empty!(
7336                            FrameHostCreateFrameWithParamsRequest,
7337                            fidl::encoding::DefaultFuchsiaResourceDialect
7338                        );
7339                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameHostCreateFrameWithParamsRequest>(&header, _body_bytes, handles, &mut req)?;
7340                        let control_handle = FrameHostControlHandle { inner: this.inner.clone() };
7341                        Ok(FrameHostRequest::CreateFrameWithParams {
7342                            params: req.params,
7343                            frame: req.frame,
7344
7345                            control_handle,
7346                        })
7347                    }
7348                    _ => Err(fidl::Error::UnknownOrdinal {
7349                        ordinal: header.ordinal,
7350                        protocol_name:
7351                            <FrameHostMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7352                    }),
7353                }))
7354            },
7355        )
7356    }
7357}
7358
7359/// Used by [`Context`] clients to delegate [`Frame`] hosting capabilities to selected peers.
7360#[derive(Debug)]
7361pub enum FrameHostRequest {
7362    /// Behaves identically to [`Context.CreateFrameWithParams`].
7363    CreateFrameWithParams {
7364        params: CreateFrameParams,
7365        frame: fidl::endpoints::ServerEnd<FrameMarker>,
7366        control_handle: FrameHostControlHandle,
7367    },
7368}
7369
7370impl FrameHostRequest {
7371    #[allow(irrefutable_let_patterns)]
7372    pub fn into_create_frame_with_params(
7373        self,
7374    ) -> Option<(CreateFrameParams, fidl::endpoints::ServerEnd<FrameMarker>, FrameHostControlHandle)>
7375    {
7376        if let FrameHostRequest::CreateFrameWithParams { params, frame, control_handle } = self {
7377            Some((params, frame, control_handle))
7378        } else {
7379            None
7380        }
7381    }
7382
7383    /// Name of the method defined in FIDL
7384    pub fn method_name(&self) -> &'static str {
7385        match *self {
7386            FrameHostRequest::CreateFrameWithParams { .. } => "create_frame_with_params",
7387        }
7388    }
7389}
7390
7391#[derive(Debug, Clone)]
7392pub struct FrameHostControlHandle {
7393    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7394}
7395
7396impl fidl::endpoints::ControlHandle for FrameHostControlHandle {
7397    fn shutdown(&self) {
7398        self.inner.shutdown()
7399    }
7400    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7401        self.inner.shutdown_with_epitaph(status)
7402    }
7403
7404    fn is_closed(&self) -> bool {
7405        self.inner.channel().is_closed()
7406    }
7407    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7408        self.inner.channel().on_closed()
7409    }
7410
7411    #[cfg(target_os = "fuchsia")]
7412    fn signal_peer(
7413        &self,
7414        clear_mask: zx::Signals,
7415        set_mask: zx::Signals,
7416    ) -> Result<(), zx_status::Status> {
7417        use fidl::Peered;
7418        self.inner.channel().signal_peer(clear_mask, set_mask)
7419    }
7420}
7421
7422impl FrameHostControlHandle {}
7423
7424#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7425pub struct MessagePortMarker;
7426
7427impl fidl::endpoints::ProtocolMarker for MessagePortMarker {
7428    type Proxy = MessagePortProxy;
7429    type RequestStream = MessagePortRequestStream;
7430    #[cfg(target_os = "fuchsia")]
7431    type SynchronousProxy = MessagePortSynchronousProxy;
7432
7433    const DEBUG_NAME: &'static str = "(anonymous) MessagePort";
7434}
7435pub type MessagePortPostMessageResult = Result<(), FrameError>;
7436
7437pub trait MessagePortProxyInterface: Send + Sync {
7438    type PostMessageResponseFut: std::future::Future<Output = Result<MessagePortPostMessageResult, fidl::Error>>
7439        + Send;
7440    fn r#post_message(&self, message: WebMessage) -> Self::PostMessageResponseFut;
7441    type ReceiveMessageResponseFut: std::future::Future<Output = Result<WebMessage, fidl::Error>>
7442        + Send;
7443    fn r#receive_message(&self) -> Self::ReceiveMessageResponseFut;
7444}
7445#[derive(Debug)]
7446#[cfg(target_os = "fuchsia")]
7447pub struct MessagePortSynchronousProxy {
7448    client: fidl::client::sync::Client,
7449}
7450
7451#[cfg(target_os = "fuchsia")]
7452impl fidl::endpoints::SynchronousProxy for MessagePortSynchronousProxy {
7453    type Proxy = MessagePortProxy;
7454    type Protocol = MessagePortMarker;
7455
7456    fn from_channel(inner: fidl::Channel) -> Self {
7457        Self::new(inner)
7458    }
7459
7460    fn into_channel(self) -> fidl::Channel {
7461        self.client.into_channel()
7462    }
7463
7464    fn as_channel(&self) -> &fidl::Channel {
7465        self.client.as_channel()
7466    }
7467}
7468
7469#[cfg(target_os = "fuchsia")]
7470impl MessagePortSynchronousProxy {
7471    pub fn new(channel: fidl::Channel) -> Self {
7472        let protocol_name = <MessagePortMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7473        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
7474    }
7475
7476    pub fn into_channel(self) -> fidl::Channel {
7477        self.client.into_channel()
7478    }
7479
7480    /// Waits until an event arrives and returns it. It is safe for other
7481    /// threads to make concurrent requests while waiting for an event.
7482    pub fn wait_for_event(
7483        &self,
7484        deadline: zx::MonotonicInstant,
7485    ) -> Result<MessagePortEvent, fidl::Error> {
7486        MessagePortEvent::decode(self.client.wait_for_event(deadline)?)
7487    }
7488
7489    /// Sends a [`WebMessage`] to the peer. These are processed in order, one at a
7490    /// time. It is not necessary for the caller to wait for the completion callback before calling
7491    /// [`MessagePort.PostMessage`] again.
7492    ///
7493    /// If an error occurred, the [`FrameError`] will be set to one of these value:
7494    /// - `BUFFER_NOT_UTF8`: The script in `message`'s `data` property is not UTF-8 encoded.
7495    /// - `NO_DATA_IN_MESSAGE`: The `data` property is missing in `message`.
7496    pub fn r#post_message(
7497        &self,
7498        mut message: WebMessage,
7499        ___deadline: zx::MonotonicInstant,
7500    ) -> Result<MessagePortPostMessageResult, fidl::Error> {
7501        let _response = self.client.send_query::<
7502            MessagePortPostMessageRequest,
7503            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FrameError>,
7504        >(
7505            (&mut message,),
7506            0x2bcf0a6ed30ffd1f,
7507            fidl::encoding::DynamicFlags::empty(),
7508            ___deadline,
7509        )?;
7510        Ok(_response.map(|x| x))
7511    }
7512
7513    /// Asynchronously reads the next message from the channel. The client should invoke the
7514    /// callback when it is ready to process another message. Unreceived messages are buffered
7515    /// on the sender's side and bounded by its available resources.
7516    pub fn r#receive_message(
7517        &self,
7518        ___deadline: zx::MonotonicInstant,
7519    ) -> Result<WebMessage, fidl::Error> {
7520        let _response = self
7521            .client
7522            .send_query::<fidl::encoding::EmptyPayload, MessagePortReceiveMessageResponse>(
7523                (),
7524                0x6c8a6051690be58d,
7525                fidl::encoding::DynamicFlags::empty(),
7526                ___deadline,
7527            )?;
7528        Ok(_response.message)
7529    }
7530}
7531
7532#[cfg(target_os = "fuchsia")]
7533impl From<MessagePortSynchronousProxy> for zx::Handle {
7534    fn from(value: MessagePortSynchronousProxy) -> Self {
7535        value.into_channel().into()
7536    }
7537}
7538
7539#[cfg(target_os = "fuchsia")]
7540impl From<fidl::Channel> for MessagePortSynchronousProxy {
7541    fn from(value: fidl::Channel) -> Self {
7542        Self::new(value)
7543    }
7544}
7545
7546#[derive(Debug, Clone)]
7547pub struct MessagePortProxy {
7548    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7549}
7550
7551impl fidl::endpoints::Proxy for MessagePortProxy {
7552    type Protocol = MessagePortMarker;
7553
7554    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7555        Self::new(inner)
7556    }
7557
7558    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7559        self.client.into_channel().map_err(|client| Self { client })
7560    }
7561
7562    fn as_channel(&self) -> &::fidl::AsyncChannel {
7563        self.client.as_channel()
7564    }
7565}
7566
7567impl MessagePortProxy {
7568    /// Create a new Proxy for fuchsia.web/MessagePort.
7569    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7570        let protocol_name = <MessagePortMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7571        Self { client: fidl::client::Client::new(channel, protocol_name) }
7572    }
7573
7574    /// Get a Stream of events from the remote end of the protocol.
7575    ///
7576    /// # Panics
7577    ///
7578    /// Panics if the event stream was already taken.
7579    pub fn take_event_stream(&self) -> MessagePortEventStream {
7580        MessagePortEventStream { event_receiver: self.client.take_event_receiver() }
7581    }
7582
7583    /// Sends a [`WebMessage`] to the peer. These are processed in order, one at a
7584    /// time. It is not necessary for the caller to wait for the completion callback before calling
7585    /// [`MessagePort.PostMessage`] again.
7586    ///
7587    /// If an error occurred, the [`FrameError`] will be set to one of these value:
7588    /// - `BUFFER_NOT_UTF8`: The script in `message`'s `data` property is not UTF-8 encoded.
7589    /// - `NO_DATA_IN_MESSAGE`: The `data` property is missing in `message`.
7590    pub fn r#post_message(
7591        &self,
7592        mut message: WebMessage,
7593    ) -> fidl::client::QueryResponseFut<
7594        MessagePortPostMessageResult,
7595        fidl::encoding::DefaultFuchsiaResourceDialect,
7596    > {
7597        MessagePortProxyInterface::r#post_message(self, message)
7598    }
7599
7600    /// Asynchronously reads the next message from the channel. The client should invoke the
7601    /// callback when it is ready to process another message. Unreceived messages are buffered
7602    /// on the sender's side and bounded by its available resources.
7603    pub fn r#receive_message(
7604        &self,
7605    ) -> fidl::client::QueryResponseFut<WebMessage, fidl::encoding::DefaultFuchsiaResourceDialect>
7606    {
7607        MessagePortProxyInterface::r#receive_message(self)
7608    }
7609}
7610
7611impl MessagePortProxyInterface for MessagePortProxy {
7612    type PostMessageResponseFut = fidl::client::QueryResponseFut<
7613        MessagePortPostMessageResult,
7614        fidl::encoding::DefaultFuchsiaResourceDialect,
7615    >;
7616    fn r#post_message(&self, mut message: WebMessage) -> Self::PostMessageResponseFut {
7617        fn _decode(
7618            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7619        ) -> Result<MessagePortPostMessageResult, fidl::Error> {
7620            let _response = fidl::client::decode_transaction_body::<
7621                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FrameError>,
7622                fidl::encoding::DefaultFuchsiaResourceDialect,
7623                0x2bcf0a6ed30ffd1f,
7624            >(_buf?)?;
7625            Ok(_response.map(|x| x))
7626        }
7627        self.client
7628            .send_query_and_decode::<MessagePortPostMessageRequest, MessagePortPostMessageResult>(
7629                (&mut message,),
7630                0x2bcf0a6ed30ffd1f,
7631                fidl::encoding::DynamicFlags::empty(),
7632                _decode,
7633            )
7634    }
7635
7636    type ReceiveMessageResponseFut =
7637        fidl::client::QueryResponseFut<WebMessage, fidl::encoding::DefaultFuchsiaResourceDialect>;
7638    fn r#receive_message(&self) -> Self::ReceiveMessageResponseFut {
7639        fn _decode(
7640            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7641        ) -> Result<WebMessage, fidl::Error> {
7642            let _response = fidl::client::decode_transaction_body::<
7643                MessagePortReceiveMessageResponse,
7644                fidl::encoding::DefaultFuchsiaResourceDialect,
7645                0x6c8a6051690be58d,
7646            >(_buf?)?;
7647            Ok(_response.message)
7648        }
7649        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, WebMessage>(
7650            (),
7651            0x6c8a6051690be58d,
7652            fidl::encoding::DynamicFlags::empty(),
7653            _decode,
7654        )
7655    }
7656}
7657
7658pub struct MessagePortEventStream {
7659    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7660}
7661
7662impl std::marker::Unpin for MessagePortEventStream {}
7663
7664impl futures::stream::FusedStream for MessagePortEventStream {
7665    fn is_terminated(&self) -> bool {
7666        self.event_receiver.is_terminated()
7667    }
7668}
7669
7670impl futures::Stream for MessagePortEventStream {
7671    type Item = Result<MessagePortEvent, fidl::Error>;
7672
7673    fn poll_next(
7674        mut self: std::pin::Pin<&mut Self>,
7675        cx: &mut std::task::Context<'_>,
7676    ) -> std::task::Poll<Option<Self::Item>> {
7677        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7678            &mut self.event_receiver,
7679            cx
7680        )?) {
7681            Some(buf) => std::task::Poll::Ready(Some(MessagePortEvent::decode(buf))),
7682            None => std::task::Poll::Ready(None),
7683        }
7684    }
7685}
7686
7687#[derive(Debug)]
7688pub enum MessagePortEvent {}
7689
7690impl MessagePortEvent {
7691    /// Decodes a message buffer as a [`MessagePortEvent`].
7692    fn decode(
7693        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7694    ) -> Result<MessagePortEvent, fidl::Error> {
7695        let (bytes, _handles) = buf.split_mut();
7696        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7697        debug_assert_eq!(tx_header.tx_id, 0);
7698        match tx_header.ordinal {
7699            _ => Err(fidl::Error::UnknownOrdinal {
7700                ordinal: tx_header.ordinal,
7701                protocol_name: <MessagePortMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7702            }),
7703        }
7704    }
7705}
7706
7707/// A Stream of incoming requests for fuchsia.web/MessagePort.
7708pub struct MessagePortRequestStream {
7709    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7710    is_terminated: bool,
7711}
7712
7713impl std::marker::Unpin for MessagePortRequestStream {}
7714
7715impl futures::stream::FusedStream for MessagePortRequestStream {
7716    fn is_terminated(&self) -> bool {
7717        self.is_terminated
7718    }
7719}
7720
7721impl fidl::endpoints::RequestStream for MessagePortRequestStream {
7722    type Protocol = MessagePortMarker;
7723    type ControlHandle = MessagePortControlHandle;
7724
7725    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7726        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7727    }
7728
7729    fn control_handle(&self) -> Self::ControlHandle {
7730        MessagePortControlHandle { inner: self.inner.clone() }
7731    }
7732
7733    fn into_inner(
7734        self,
7735    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7736    {
7737        (self.inner, self.is_terminated)
7738    }
7739
7740    fn from_inner(
7741        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7742        is_terminated: bool,
7743    ) -> Self {
7744        Self { inner, is_terminated }
7745    }
7746}
7747
7748impl futures::Stream for MessagePortRequestStream {
7749    type Item = Result<MessagePortRequest, fidl::Error>;
7750
7751    fn poll_next(
7752        mut self: std::pin::Pin<&mut Self>,
7753        cx: &mut std::task::Context<'_>,
7754    ) -> std::task::Poll<Option<Self::Item>> {
7755        let this = &mut *self;
7756        if this.inner.check_shutdown(cx) {
7757            this.is_terminated = true;
7758            return std::task::Poll::Ready(None);
7759        }
7760        if this.is_terminated {
7761            panic!("polled MessagePortRequestStream after completion");
7762        }
7763        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7764            |bytes, handles| {
7765                match this.inner.channel().read_etc(cx, bytes, handles) {
7766                    std::task::Poll::Ready(Ok(())) => {}
7767                    std::task::Poll::Pending => return std::task::Poll::Pending,
7768                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7769                        this.is_terminated = true;
7770                        return std::task::Poll::Ready(None);
7771                    }
7772                    std::task::Poll::Ready(Err(e)) => {
7773                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7774                            e.into(),
7775                        ))))
7776                    }
7777                }
7778
7779                // A message has been received from the channel
7780                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7781
7782                std::task::Poll::Ready(Some(match header.ordinal {
7783                    0x2bcf0a6ed30ffd1f => {
7784                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7785                        let mut req = fidl::new_empty!(
7786                            MessagePortPostMessageRequest,
7787                            fidl::encoding::DefaultFuchsiaResourceDialect
7788                        );
7789                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MessagePortPostMessageRequest>(&header, _body_bytes, handles, &mut req)?;
7790                        let control_handle = MessagePortControlHandle { inner: this.inner.clone() };
7791                        Ok(MessagePortRequest::PostMessage {
7792                            message: req.message,
7793
7794                            responder: MessagePortPostMessageResponder {
7795                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7796                                tx_id: header.tx_id,
7797                            },
7798                        })
7799                    }
7800                    0x6c8a6051690be58d => {
7801                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7802                        let mut req = fidl::new_empty!(
7803                            fidl::encoding::EmptyPayload,
7804                            fidl::encoding::DefaultFuchsiaResourceDialect
7805                        );
7806                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7807                        let control_handle = MessagePortControlHandle { inner: this.inner.clone() };
7808                        Ok(MessagePortRequest::ReceiveMessage {
7809                            responder: MessagePortReceiveMessageResponder {
7810                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7811                                tx_id: header.tx_id,
7812                            },
7813                        })
7814                    }
7815                    _ => Err(fidl::Error::UnknownOrdinal {
7816                        ordinal: header.ordinal,
7817                        protocol_name:
7818                            <MessagePortMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7819                    }),
7820                }))
7821            },
7822        )
7823    }
7824}
7825
7826/// Represents one end of an HTML5 MessageChannel. Can be used to send and exchange Messages with
7827/// the peered MessagePort in the Frame's script context. The port is destroyed when either end of
7828/// the MessagePort channel is torn down.
7829#[derive(Debug)]
7830pub enum MessagePortRequest {
7831    /// Sends a [`WebMessage`] to the peer. These are processed in order, one at a
7832    /// time. It is not necessary for the caller to wait for the completion callback before calling
7833    /// [`MessagePort.PostMessage`] again.
7834    ///
7835    /// If an error occurred, the [`FrameError`] will be set to one of these value:
7836    /// - `BUFFER_NOT_UTF8`: The script in `message`'s `data` property is not UTF-8 encoded.
7837    /// - `NO_DATA_IN_MESSAGE`: The `data` property is missing in `message`.
7838    PostMessage { message: WebMessage, responder: MessagePortPostMessageResponder },
7839    /// Asynchronously reads the next message from the channel. The client should invoke the
7840    /// callback when it is ready to process another message. Unreceived messages are buffered
7841    /// on the sender's side and bounded by its available resources.
7842    ReceiveMessage { responder: MessagePortReceiveMessageResponder },
7843}
7844
7845impl MessagePortRequest {
7846    #[allow(irrefutable_let_patterns)]
7847    pub fn into_post_message(self) -> Option<(WebMessage, MessagePortPostMessageResponder)> {
7848        if let MessagePortRequest::PostMessage { message, responder } = self {
7849            Some((message, responder))
7850        } else {
7851            None
7852        }
7853    }
7854
7855    #[allow(irrefutable_let_patterns)]
7856    pub fn into_receive_message(self) -> Option<(MessagePortReceiveMessageResponder)> {
7857        if let MessagePortRequest::ReceiveMessage { responder } = self {
7858            Some((responder))
7859        } else {
7860            None
7861        }
7862    }
7863
7864    /// Name of the method defined in FIDL
7865    pub fn method_name(&self) -> &'static str {
7866        match *self {
7867            MessagePortRequest::PostMessage { .. } => "post_message",
7868            MessagePortRequest::ReceiveMessage { .. } => "receive_message",
7869        }
7870    }
7871}
7872
7873#[derive(Debug, Clone)]
7874pub struct MessagePortControlHandle {
7875    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7876}
7877
7878impl fidl::endpoints::ControlHandle for MessagePortControlHandle {
7879    fn shutdown(&self) {
7880        self.inner.shutdown()
7881    }
7882    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7883        self.inner.shutdown_with_epitaph(status)
7884    }
7885
7886    fn is_closed(&self) -> bool {
7887        self.inner.channel().is_closed()
7888    }
7889    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7890        self.inner.channel().on_closed()
7891    }
7892
7893    #[cfg(target_os = "fuchsia")]
7894    fn signal_peer(
7895        &self,
7896        clear_mask: zx::Signals,
7897        set_mask: zx::Signals,
7898    ) -> Result<(), zx_status::Status> {
7899        use fidl::Peered;
7900        self.inner.channel().signal_peer(clear_mask, set_mask)
7901    }
7902}
7903
7904impl MessagePortControlHandle {}
7905
7906#[must_use = "FIDL methods require a response to be sent"]
7907#[derive(Debug)]
7908pub struct MessagePortPostMessageResponder {
7909    control_handle: std::mem::ManuallyDrop<MessagePortControlHandle>,
7910    tx_id: u32,
7911}
7912
7913/// Set the the channel to be shutdown (see [`MessagePortControlHandle::shutdown`])
7914/// if the responder is dropped without sending a response, so that the client
7915/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7916impl std::ops::Drop for MessagePortPostMessageResponder {
7917    fn drop(&mut self) {
7918        self.control_handle.shutdown();
7919        // Safety: drops once, never accessed again
7920        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7921    }
7922}
7923
7924impl fidl::endpoints::Responder for MessagePortPostMessageResponder {
7925    type ControlHandle = MessagePortControlHandle;
7926
7927    fn control_handle(&self) -> &MessagePortControlHandle {
7928        &self.control_handle
7929    }
7930
7931    fn drop_without_shutdown(mut self) {
7932        // Safety: drops once, never accessed again due to mem::forget
7933        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7934        // Prevent Drop from running (which would shut down the channel)
7935        std::mem::forget(self);
7936    }
7937}
7938
7939impl MessagePortPostMessageResponder {
7940    /// Sends a response to the FIDL transaction.
7941    ///
7942    /// Sets the channel to shutdown if an error occurs.
7943    pub fn send(self, mut result: Result<(), FrameError>) -> Result<(), fidl::Error> {
7944        let _result = self.send_raw(result);
7945        if _result.is_err() {
7946            self.control_handle.shutdown();
7947        }
7948        self.drop_without_shutdown();
7949        _result
7950    }
7951
7952    /// Similar to "send" but does not shutdown the channel if an error occurs.
7953    pub fn send_no_shutdown_on_err(
7954        self,
7955        mut result: Result<(), FrameError>,
7956    ) -> Result<(), fidl::Error> {
7957        let _result = self.send_raw(result);
7958        self.drop_without_shutdown();
7959        _result
7960    }
7961
7962    fn send_raw(&self, mut result: Result<(), FrameError>) -> Result<(), fidl::Error> {
7963        self.control_handle
7964            .inner
7965            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FrameError>>(
7966                result,
7967                self.tx_id,
7968                0x2bcf0a6ed30ffd1f,
7969                fidl::encoding::DynamicFlags::empty(),
7970            )
7971    }
7972}
7973
7974#[must_use = "FIDL methods require a response to be sent"]
7975#[derive(Debug)]
7976pub struct MessagePortReceiveMessageResponder {
7977    control_handle: std::mem::ManuallyDrop<MessagePortControlHandle>,
7978    tx_id: u32,
7979}
7980
7981/// Set the the channel to be shutdown (see [`MessagePortControlHandle::shutdown`])
7982/// if the responder is dropped without sending a response, so that the client
7983/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7984impl std::ops::Drop for MessagePortReceiveMessageResponder {
7985    fn drop(&mut self) {
7986        self.control_handle.shutdown();
7987        // Safety: drops once, never accessed again
7988        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7989    }
7990}
7991
7992impl fidl::endpoints::Responder for MessagePortReceiveMessageResponder {
7993    type ControlHandle = MessagePortControlHandle;
7994
7995    fn control_handle(&self) -> &MessagePortControlHandle {
7996        &self.control_handle
7997    }
7998
7999    fn drop_without_shutdown(mut self) {
8000        // Safety: drops once, never accessed again due to mem::forget
8001        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8002        // Prevent Drop from running (which would shut down the channel)
8003        std::mem::forget(self);
8004    }
8005}
8006
8007impl MessagePortReceiveMessageResponder {
8008    /// Sends a response to the FIDL transaction.
8009    ///
8010    /// Sets the channel to shutdown if an error occurs.
8011    pub fn send(self, mut message: WebMessage) -> Result<(), fidl::Error> {
8012        let _result = self.send_raw(message);
8013        if _result.is_err() {
8014            self.control_handle.shutdown();
8015        }
8016        self.drop_without_shutdown();
8017        _result
8018    }
8019
8020    /// Similar to "send" but does not shutdown the channel if an error occurs.
8021    pub fn send_no_shutdown_on_err(self, mut message: WebMessage) -> Result<(), fidl::Error> {
8022        let _result = self.send_raw(message);
8023        self.drop_without_shutdown();
8024        _result
8025    }
8026
8027    fn send_raw(&self, mut message: WebMessage) -> Result<(), fidl::Error> {
8028        self.control_handle.inner.send::<MessagePortReceiveMessageResponse>(
8029            (&mut message,),
8030            self.tx_id,
8031            0x6c8a6051690be58d,
8032            fidl::encoding::DynamicFlags::empty(),
8033        )
8034    }
8035}
8036
8037#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8038pub struct NavigationControllerMarker;
8039
8040impl fidl::endpoints::ProtocolMarker for NavigationControllerMarker {
8041    type Proxy = NavigationControllerProxy;
8042    type RequestStream = NavigationControllerRequestStream;
8043    #[cfg(target_os = "fuchsia")]
8044    type SynchronousProxy = NavigationControllerSynchronousProxy;
8045
8046    const DEBUG_NAME: &'static str = "(anonymous) NavigationController";
8047}
8048pub type NavigationControllerLoadUrlResult = Result<(), NavigationControllerError>;
8049
8050pub trait NavigationControllerProxyInterface: Send + Sync {
8051    type LoadUrlResponseFut: std::future::Future<Output = Result<NavigationControllerLoadUrlResult, fidl::Error>>
8052        + Send;
8053    fn r#load_url(&self, url: &str, params: LoadUrlParams) -> Self::LoadUrlResponseFut;
8054    fn r#go_back(&self) -> Result<(), fidl::Error>;
8055    fn r#go_forward(&self) -> Result<(), fidl::Error>;
8056    fn r#stop(&self) -> Result<(), fidl::Error>;
8057    fn r#reload(&self, type_: ReloadType) -> Result<(), fidl::Error>;
8058}
8059#[derive(Debug)]
8060#[cfg(target_os = "fuchsia")]
8061pub struct NavigationControllerSynchronousProxy {
8062    client: fidl::client::sync::Client,
8063}
8064
8065#[cfg(target_os = "fuchsia")]
8066impl fidl::endpoints::SynchronousProxy for NavigationControllerSynchronousProxy {
8067    type Proxy = NavigationControllerProxy;
8068    type Protocol = NavigationControllerMarker;
8069
8070    fn from_channel(inner: fidl::Channel) -> Self {
8071        Self::new(inner)
8072    }
8073
8074    fn into_channel(self) -> fidl::Channel {
8075        self.client.into_channel()
8076    }
8077
8078    fn as_channel(&self) -> &fidl::Channel {
8079        self.client.as_channel()
8080    }
8081}
8082
8083#[cfg(target_os = "fuchsia")]
8084impl NavigationControllerSynchronousProxy {
8085    pub fn new(channel: fidl::Channel) -> Self {
8086        let protocol_name =
8087            <NavigationControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8088        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
8089    }
8090
8091    pub fn into_channel(self) -> fidl::Channel {
8092        self.client.into_channel()
8093    }
8094
8095    /// Waits until an event arrives and returns it. It is safe for other
8096    /// threads to make concurrent requests while waiting for an event.
8097    pub fn wait_for_event(
8098        &self,
8099        deadline: zx::MonotonicInstant,
8100    ) -> Result<NavigationControllerEvent, fidl::Error> {
8101        NavigationControllerEvent::decode(self.client.wait_for_event(deadline)?)
8102    }
8103
8104    /// Tells the [`Frame`] to navigate to a `url`.
8105    ///
8106    /// - `url`: The address to navigate to.
8107    /// - `params`: Additional parameters that affect how the resource will be  loaded (e.g.
8108    ///   cookies, HTTP headers, etc.)
8109    ///
8110    /// If an error occurred, the [`NavigationControllerError`] will be set to one of these values:
8111    /// - `INVALID_URL`: The `url` parameter is invalid.
8112    /// - `INVALID_HEADER`: At least one of the headers in [`LoadUrlParams.headers`] is invalid.
8113    pub fn r#load_url(
8114        &self,
8115        mut url: &str,
8116        mut params: LoadUrlParams,
8117        ___deadline: zx::MonotonicInstant,
8118    ) -> Result<NavigationControllerLoadUrlResult, fidl::Error> {
8119        let _response =
8120            self.client
8121                .send_query::<NavigationControllerLoadUrlRequest, fidl::encoding::ResultType<
8122                    fidl::encoding::EmptyStruct,
8123                    NavigationControllerError,
8124                >>(
8125                    (url, &mut params),
8126                    0x78f2ab0a480d0182,
8127                    fidl::encoding::DynamicFlags::empty(),
8128                    ___deadline,
8129                )?;
8130        Ok(_response.map(|x| x))
8131    }
8132
8133    /// Tells the [`Frame`] to navigate to the previous page in its history, if any.
8134    pub fn r#go_back(&self) -> Result<(), fidl::Error> {
8135        self.client.send::<fidl::encoding::EmptyPayload>(
8136            (),
8137            0x2accdd8d87d89c38,
8138            fidl::encoding::DynamicFlags::empty(),
8139        )
8140    }
8141
8142    /// Tells the [`Frame`] to navigate to the next page in its history, if any.
8143    pub fn r#go_forward(&self) -> Result<(), fidl::Error> {
8144        self.client.send::<fidl::encoding::EmptyPayload>(
8145            (),
8146            0x39e4ac955ade2781,
8147            fidl::encoding::DynamicFlags::empty(),
8148        )
8149    }
8150
8151    /// Tells the [`Frame`] to stop the current navigation if a navigation is ongoing.
8152    pub fn r#stop(&self) -> Result<(), fidl::Error> {
8153        self.client.send::<fidl::encoding::EmptyPayload>(
8154            (),
8155            0x2383078ffbe6fea,
8156            fidl::encoding::DynamicFlags::empty(),
8157        )
8158    }
8159
8160    /// Tells the [`Frame`] to reload the current page.
8161    pub fn r#reload(&self, mut type_: ReloadType) -> Result<(), fidl::Error> {
8162        self.client.send::<NavigationControllerReloadRequest>(
8163            (type_,),
8164            0x33faedfe67d6f00,
8165            fidl::encoding::DynamicFlags::empty(),
8166        )
8167    }
8168}
8169
8170#[cfg(target_os = "fuchsia")]
8171impl From<NavigationControllerSynchronousProxy> for zx::Handle {
8172    fn from(value: NavigationControllerSynchronousProxy) -> Self {
8173        value.into_channel().into()
8174    }
8175}
8176
8177#[cfg(target_os = "fuchsia")]
8178impl From<fidl::Channel> for NavigationControllerSynchronousProxy {
8179    fn from(value: fidl::Channel) -> Self {
8180        Self::new(value)
8181    }
8182}
8183
8184#[derive(Debug, Clone)]
8185pub struct NavigationControllerProxy {
8186    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8187}
8188
8189impl fidl::endpoints::Proxy for NavigationControllerProxy {
8190    type Protocol = NavigationControllerMarker;
8191
8192    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8193        Self::new(inner)
8194    }
8195
8196    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8197        self.client.into_channel().map_err(|client| Self { client })
8198    }
8199
8200    fn as_channel(&self) -> &::fidl::AsyncChannel {
8201        self.client.as_channel()
8202    }
8203}
8204
8205impl NavigationControllerProxy {
8206    /// Create a new Proxy for fuchsia.web/NavigationController.
8207    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8208        let protocol_name =
8209            <NavigationControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8210        Self { client: fidl::client::Client::new(channel, protocol_name) }
8211    }
8212
8213    /// Get a Stream of events from the remote end of the protocol.
8214    ///
8215    /// # Panics
8216    ///
8217    /// Panics if the event stream was already taken.
8218    pub fn take_event_stream(&self) -> NavigationControllerEventStream {
8219        NavigationControllerEventStream { event_receiver: self.client.take_event_receiver() }
8220    }
8221
8222    /// Tells the [`Frame`] to navigate to a `url`.
8223    ///
8224    /// - `url`: The address to navigate to.
8225    /// - `params`: Additional parameters that affect how the resource will be  loaded (e.g.
8226    ///   cookies, HTTP headers, etc.)
8227    ///
8228    /// If an error occurred, the [`NavigationControllerError`] will be set to one of these values:
8229    /// - `INVALID_URL`: The `url` parameter is invalid.
8230    /// - `INVALID_HEADER`: At least one of the headers in [`LoadUrlParams.headers`] is invalid.
8231    pub fn r#load_url(
8232        &self,
8233        mut url: &str,
8234        mut params: LoadUrlParams,
8235    ) -> fidl::client::QueryResponseFut<
8236        NavigationControllerLoadUrlResult,
8237        fidl::encoding::DefaultFuchsiaResourceDialect,
8238    > {
8239        NavigationControllerProxyInterface::r#load_url(self, url, params)
8240    }
8241
8242    /// Tells the [`Frame`] to navigate to the previous page in its history, if any.
8243    pub fn r#go_back(&self) -> Result<(), fidl::Error> {
8244        NavigationControllerProxyInterface::r#go_back(self)
8245    }
8246
8247    /// Tells the [`Frame`] to navigate to the next page in its history, if any.
8248    pub fn r#go_forward(&self) -> Result<(), fidl::Error> {
8249        NavigationControllerProxyInterface::r#go_forward(self)
8250    }
8251
8252    /// Tells the [`Frame`] to stop the current navigation if a navigation is ongoing.
8253    pub fn r#stop(&self) -> Result<(), fidl::Error> {
8254        NavigationControllerProxyInterface::r#stop(self)
8255    }
8256
8257    /// Tells the [`Frame`] to reload the current page.
8258    pub fn r#reload(&self, mut type_: ReloadType) -> Result<(), fidl::Error> {
8259        NavigationControllerProxyInterface::r#reload(self, type_)
8260    }
8261}
8262
8263impl NavigationControllerProxyInterface for NavigationControllerProxy {
8264    type LoadUrlResponseFut = fidl::client::QueryResponseFut<
8265        NavigationControllerLoadUrlResult,
8266        fidl::encoding::DefaultFuchsiaResourceDialect,
8267    >;
8268    fn r#load_url(&self, mut url: &str, mut params: LoadUrlParams) -> Self::LoadUrlResponseFut {
8269        fn _decode(
8270            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8271        ) -> Result<NavigationControllerLoadUrlResult, fidl::Error> {
8272            let _response = fidl::client::decode_transaction_body::<
8273                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, NavigationControllerError>,
8274                fidl::encoding::DefaultFuchsiaResourceDialect,
8275                0x78f2ab0a480d0182,
8276            >(_buf?)?;
8277            Ok(_response.map(|x| x))
8278        }
8279        self.client.send_query_and_decode::<
8280            NavigationControllerLoadUrlRequest,
8281            NavigationControllerLoadUrlResult,
8282        >(
8283            (url, &mut params,),
8284            0x78f2ab0a480d0182,
8285            fidl::encoding::DynamicFlags::empty(),
8286            _decode,
8287        )
8288    }
8289
8290    fn r#go_back(&self) -> Result<(), fidl::Error> {
8291        self.client.send::<fidl::encoding::EmptyPayload>(
8292            (),
8293            0x2accdd8d87d89c38,
8294            fidl::encoding::DynamicFlags::empty(),
8295        )
8296    }
8297
8298    fn r#go_forward(&self) -> Result<(), fidl::Error> {
8299        self.client.send::<fidl::encoding::EmptyPayload>(
8300            (),
8301            0x39e4ac955ade2781,
8302            fidl::encoding::DynamicFlags::empty(),
8303        )
8304    }
8305
8306    fn r#stop(&self) -> Result<(), fidl::Error> {
8307        self.client.send::<fidl::encoding::EmptyPayload>(
8308            (),
8309            0x2383078ffbe6fea,
8310            fidl::encoding::DynamicFlags::empty(),
8311        )
8312    }
8313
8314    fn r#reload(&self, mut type_: ReloadType) -> Result<(), fidl::Error> {
8315        self.client.send::<NavigationControllerReloadRequest>(
8316            (type_,),
8317            0x33faedfe67d6f00,
8318            fidl::encoding::DynamicFlags::empty(),
8319        )
8320    }
8321}
8322
8323pub struct NavigationControllerEventStream {
8324    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8325}
8326
8327impl std::marker::Unpin for NavigationControllerEventStream {}
8328
8329impl futures::stream::FusedStream for NavigationControllerEventStream {
8330    fn is_terminated(&self) -> bool {
8331        self.event_receiver.is_terminated()
8332    }
8333}
8334
8335impl futures::Stream for NavigationControllerEventStream {
8336    type Item = Result<NavigationControllerEvent, fidl::Error>;
8337
8338    fn poll_next(
8339        mut self: std::pin::Pin<&mut Self>,
8340        cx: &mut std::task::Context<'_>,
8341    ) -> std::task::Poll<Option<Self::Item>> {
8342        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8343            &mut self.event_receiver,
8344            cx
8345        )?) {
8346            Some(buf) => std::task::Poll::Ready(Some(NavigationControllerEvent::decode(buf))),
8347            None => std::task::Poll::Ready(None),
8348        }
8349    }
8350}
8351
8352#[derive(Debug)]
8353pub enum NavigationControllerEvent {}
8354
8355impl NavigationControllerEvent {
8356    /// Decodes a message buffer as a [`NavigationControllerEvent`].
8357    fn decode(
8358        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8359    ) -> Result<NavigationControllerEvent, fidl::Error> {
8360        let (bytes, _handles) = buf.split_mut();
8361        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8362        debug_assert_eq!(tx_header.tx_id, 0);
8363        match tx_header.ordinal {
8364            _ => Err(fidl::Error::UnknownOrdinal {
8365                ordinal: tx_header.ordinal,
8366                protocol_name:
8367                    <NavigationControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8368            }),
8369        }
8370    }
8371}
8372
8373/// A Stream of incoming requests for fuchsia.web/NavigationController.
8374pub struct NavigationControllerRequestStream {
8375    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8376    is_terminated: bool,
8377}
8378
8379impl std::marker::Unpin for NavigationControllerRequestStream {}
8380
8381impl futures::stream::FusedStream for NavigationControllerRequestStream {
8382    fn is_terminated(&self) -> bool {
8383        self.is_terminated
8384    }
8385}
8386
8387impl fidl::endpoints::RequestStream for NavigationControllerRequestStream {
8388    type Protocol = NavigationControllerMarker;
8389    type ControlHandle = NavigationControllerControlHandle;
8390
8391    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8392        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8393    }
8394
8395    fn control_handle(&self) -> Self::ControlHandle {
8396        NavigationControllerControlHandle { inner: self.inner.clone() }
8397    }
8398
8399    fn into_inner(
8400        self,
8401    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8402    {
8403        (self.inner, self.is_terminated)
8404    }
8405
8406    fn from_inner(
8407        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8408        is_terminated: bool,
8409    ) -> Self {
8410        Self { inner, is_terminated }
8411    }
8412}
8413
8414impl futures::Stream for NavigationControllerRequestStream {
8415    type Item = Result<NavigationControllerRequest, fidl::Error>;
8416
8417    fn poll_next(
8418        mut self: std::pin::Pin<&mut Self>,
8419        cx: &mut std::task::Context<'_>,
8420    ) -> std::task::Poll<Option<Self::Item>> {
8421        let this = &mut *self;
8422        if this.inner.check_shutdown(cx) {
8423            this.is_terminated = true;
8424            return std::task::Poll::Ready(None);
8425        }
8426        if this.is_terminated {
8427            panic!("polled NavigationControllerRequestStream after completion");
8428        }
8429        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8430            |bytes, handles| {
8431                match this.inner.channel().read_etc(cx, bytes, handles) {
8432                    std::task::Poll::Ready(Ok(())) => {}
8433                    std::task::Poll::Pending => return std::task::Poll::Pending,
8434                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8435                        this.is_terminated = true;
8436                        return std::task::Poll::Ready(None);
8437                    }
8438                    std::task::Poll::Ready(Err(e)) => {
8439                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8440                            e.into(),
8441                        ))))
8442                    }
8443                }
8444
8445                // A message has been received from the channel
8446                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8447
8448                std::task::Poll::Ready(Some(match header.ordinal {
8449                0x78f2ab0a480d0182 => {
8450                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8451                    let mut req = fidl::new_empty!(NavigationControllerLoadUrlRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
8452                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NavigationControllerLoadUrlRequest>(&header, _body_bytes, handles, &mut req)?;
8453                    let control_handle = NavigationControllerControlHandle {
8454                        inner: this.inner.clone(),
8455                    };
8456                    Ok(NavigationControllerRequest::LoadUrl {url: req.url,
8457params: req.params,
8458
8459                        responder: NavigationControllerLoadUrlResponder {
8460                            control_handle: std::mem::ManuallyDrop::new(control_handle),
8461                            tx_id: header.tx_id,
8462                        },
8463                    })
8464                }
8465                0x2accdd8d87d89c38 => {
8466                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8467                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
8468                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8469                    let control_handle = NavigationControllerControlHandle {
8470                        inner: this.inner.clone(),
8471                    };
8472                    Ok(NavigationControllerRequest::GoBack {
8473                        control_handle,
8474                    })
8475                }
8476                0x39e4ac955ade2781 => {
8477                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8478                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
8479                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8480                    let control_handle = NavigationControllerControlHandle {
8481                        inner: this.inner.clone(),
8482                    };
8483                    Ok(NavigationControllerRequest::GoForward {
8484                        control_handle,
8485                    })
8486                }
8487                0x2383078ffbe6fea => {
8488                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8489                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
8490                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8491                    let control_handle = NavigationControllerControlHandle {
8492                        inner: this.inner.clone(),
8493                    };
8494                    Ok(NavigationControllerRequest::Stop {
8495                        control_handle,
8496                    })
8497                }
8498                0x33faedfe67d6f00 => {
8499                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8500                    let mut req = fidl::new_empty!(NavigationControllerReloadRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
8501                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NavigationControllerReloadRequest>(&header, _body_bytes, handles, &mut req)?;
8502                    let control_handle = NavigationControllerControlHandle {
8503                        inner: this.inner.clone(),
8504                    };
8505                    Ok(NavigationControllerRequest::Reload {type_: req.type_,
8506
8507                        control_handle,
8508                    })
8509                }
8510                _ => Err(fidl::Error::UnknownOrdinal {
8511                    ordinal: header.ordinal,
8512                    protocol_name: <NavigationControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8513                }),
8514            }))
8515            },
8516        )
8517    }
8518}
8519
8520/// Provides methods for controlling and querying the navigation state of a [`Frame`].
8521#[derive(Debug)]
8522pub enum NavigationControllerRequest {
8523    /// Tells the [`Frame`] to navigate to a `url`.
8524    ///
8525    /// - `url`: The address to navigate to.
8526    /// - `params`: Additional parameters that affect how the resource will be  loaded (e.g.
8527    ///   cookies, HTTP headers, etc.)
8528    ///
8529    /// If an error occurred, the [`NavigationControllerError`] will be set to one of these values:
8530    /// - `INVALID_URL`: The `url` parameter is invalid.
8531    /// - `INVALID_HEADER`: At least one of the headers in [`LoadUrlParams.headers`] is invalid.
8532    LoadUrl { url: String, params: LoadUrlParams, responder: NavigationControllerLoadUrlResponder },
8533    /// Tells the [`Frame`] to navigate to the previous page in its history, if any.
8534    GoBack { control_handle: NavigationControllerControlHandle },
8535    /// Tells the [`Frame`] to navigate to the next page in its history, if any.
8536    GoForward { control_handle: NavigationControllerControlHandle },
8537    /// Tells the [`Frame`] to stop the current navigation if a navigation is ongoing.
8538    Stop { control_handle: NavigationControllerControlHandle },
8539    /// Tells the [`Frame`] to reload the current page.
8540    Reload { type_: ReloadType, control_handle: NavigationControllerControlHandle },
8541}
8542
8543impl NavigationControllerRequest {
8544    #[allow(irrefutable_let_patterns)]
8545    pub fn into_load_url(
8546        self,
8547    ) -> Option<(String, LoadUrlParams, NavigationControllerLoadUrlResponder)> {
8548        if let NavigationControllerRequest::LoadUrl { url, params, responder } = self {
8549            Some((url, params, responder))
8550        } else {
8551            None
8552        }
8553    }
8554
8555    #[allow(irrefutable_let_patterns)]
8556    pub fn into_go_back(self) -> Option<(NavigationControllerControlHandle)> {
8557        if let NavigationControllerRequest::GoBack { control_handle } = self {
8558            Some((control_handle))
8559        } else {
8560            None
8561        }
8562    }
8563
8564    #[allow(irrefutable_let_patterns)]
8565    pub fn into_go_forward(self) -> Option<(NavigationControllerControlHandle)> {
8566        if let NavigationControllerRequest::GoForward { control_handle } = self {
8567            Some((control_handle))
8568        } else {
8569            None
8570        }
8571    }
8572
8573    #[allow(irrefutable_let_patterns)]
8574    pub fn into_stop(self) -> Option<(NavigationControllerControlHandle)> {
8575        if let NavigationControllerRequest::Stop { control_handle } = self {
8576            Some((control_handle))
8577        } else {
8578            None
8579        }
8580    }
8581
8582    #[allow(irrefutable_let_patterns)]
8583    pub fn into_reload(self) -> Option<(ReloadType, NavigationControllerControlHandle)> {
8584        if let NavigationControllerRequest::Reload { type_, control_handle } = self {
8585            Some((type_, control_handle))
8586        } else {
8587            None
8588        }
8589    }
8590
8591    /// Name of the method defined in FIDL
8592    pub fn method_name(&self) -> &'static str {
8593        match *self {
8594            NavigationControllerRequest::LoadUrl { .. } => "load_url",
8595            NavigationControllerRequest::GoBack { .. } => "go_back",
8596            NavigationControllerRequest::GoForward { .. } => "go_forward",
8597            NavigationControllerRequest::Stop { .. } => "stop",
8598            NavigationControllerRequest::Reload { .. } => "reload",
8599        }
8600    }
8601}
8602
8603#[derive(Debug, Clone)]
8604pub struct NavigationControllerControlHandle {
8605    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8606}
8607
8608impl fidl::endpoints::ControlHandle for NavigationControllerControlHandle {
8609    fn shutdown(&self) {
8610        self.inner.shutdown()
8611    }
8612    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8613        self.inner.shutdown_with_epitaph(status)
8614    }
8615
8616    fn is_closed(&self) -> bool {
8617        self.inner.channel().is_closed()
8618    }
8619    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8620        self.inner.channel().on_closed()
8621    }
8622
8623    #[cfg(target_os = "fuchsia")]
8624    fn signal_peer(
8625        &self,
8626        clear_mask: zx::Signals,
8627        set_mask: zx::Signals,
8628    ) -> Result<(), zx_status::Status> {
8629        use fidl::Peered;
8630        self.inner.channel().signal_peer(clear_mask, set_mask)
8631    }
8632}
8633
8634impl NavigationControllerControlHandle {}
8635
8636#[must_use = "FIDL methods require a response to be sent"]
8637#[derive(Debug)]
8638pub struct NavigationControllerLoadUrlResponder {
8639    control_handle: std::mem::ManuallyDrop<NavigationControllerControlHandle>,
8640    tx_id: u32,
8641}
8642
8643/// Set the the channel to be shutdown (see [`NavigationControllerControlHandle::shutdown`])
8644/// if the responder is dropped without sending a response, so that the client
8645/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8646impl std::ops::Drop for NavigationControllerLoadUrlResponder {
8647    fn drop(&mut self) {
8648        self.control_handle.shutdown();
8649        // Safety: drops once, never accessed again
8650        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8651    }
8652}
8653
8654impl fidl::endpoints::Responder for NavigationControllerLoadUrlResponder {
8655    type ControlHandle = NavigationControllerControlHandle;
8656
8657    fn control_handle(&self) -> &NavigationControllerControlHandle {
8658        &self.control_handle
8659    }
8660
8661    fn drop_without_shutdown(mut self) {
8662        // Safety: drops once, never accessed again due to mem::forget
8663        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8664        // Prevent Drop from running (which would shut down the channel)
8665        std::mem::forget(self);
8666    }
8667}
8668
8669impl NavigationControllerLoadUrlResponder {
8670    /// Sends a response to the FIDL transaction.
8671    ///
8672    /// Sets the channel to shutdown if an error occurs.
8673    pub fn send(
8674        self,
8675        mut result: Result<(), NavigationControllerError>,
8676    ) -> Result<(), fidl::Error> {
8677        let _result = self.send_raw(result);
8678        if _result.is_err() {
8679            self.control_handle.shutdown();
8680        }
8681        self.drop_without_shutdown();
8682        _result
8683    }
8684
8685    /// Similar to "send" but does not shutdown the channel if an error occurs.
8686    pub fn send_no_shutdown_on_err(
8687        self,
8688        mut result: Result<(), NavigationControllerError>,
8689    ) -> Result<(), fidl::Error> {
8690        let _result = self.send_raw(result);
8691        self.drop_without_shutdown();
8692        _result
8693    }
8694
8695    fn send_raw(
8696        &self,
8697        mut result: Result<(), NavigationControllerError>,
8698    ) -> Result<(), fidl::Error> {
8699        self.control_handle.inner.send::<fidl::encoding::ResultType<
8700            fidl::encoding::EmptyStruct,
8701            NavigationControllerError,
8702        >>(
8703            result,
8704            self.tx_id,
8705            0x78f2ab0a480d0182,
8706            fidl::encoding::DynamicFlags::empty(),
8707        )
8708    }
8709}
8710
8711#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8712pub struct NavigationEventListenerMarker;
8713
8714impl fidl::endpoints::ProtocolMarker for NavigationEventListenerMarker {
8715    type Proxy = NavigationEventListenerProxy;
8716    type RequestStream = NavigationEventListenerRequestStream;
8717    #[cfg(target_os = "fuchsia")]
8718    type SynchronousProxy = NavigationEventListenerSynchronousProxy;
8719
8720    const DEBUG_NAME: &'static str = "(anonymous) NavigationEventListener";
8721}
8722
8723pub trait NavigationEventListenerProxyInterface: Send + Sync {
8724    type OnNavigationStateChangedResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
8725        + Send;
8726    fn r#on_navigation_state_changed(
8727        &self,
8728        change: NavigationState,
8729    ) -> Self::OnNavigationStateChangedResponseFut;
8730}
8731#[derive(Debug)]
8732#[cfg(target_os = "fuchsia")]
8733pub struct NavigationEventListenerSynchronousProxy {
8734    client: fidl::client::sync::Client,
8735}
8736
8737#[cfg(target_os = "fuchsia")]
8738impl fidl::endpoints::SynchronousProxy for NavigationEventListenerSynchronousProxy {
8739    type Proxy = NavigationEventListenerProxy;
8740    type Protocol = NavigationEventListenerMarker;
8741
8742    fn from_channel(inner: fidl::Channel) -> Self {
8743        Self::new(inner)
8744    }
8745
8746    fn into_channel(self) -> fidl::Channel {
8747        self.client.into_channel()
8748    }
8749
8750    fn as_channel(&self) -> &fidl::Channel {
8751        self.client.as_channel()
8752    }
8753}
8754
8755#[cfg(target_os = "fuchsia")]
8756impl NavigationEventListenerSynchronousProxy {
8757    pub fn new(channel: fidl::Channel) -> Self {
8758        let protocol_name =
8759            <NavigationEventListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8760        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
8761    }
8762
8763    pub fn into_channel(self) -> fidl::Channel {
8764        self.client.into_channel()
8765    }
8766
8767    /// Waits until an event arrives and returns it. It is safe for other
8768    /// threads to make concurrent requests while waiting for an event.
8769    pub fn wait_for_event(
8770        &self,
8771        deadline: zx::MonotonicInstant,
8772    ) -> Result<NavigationEventListenerEvent, fidl::Error> {
8773        NavigationEventListenerEvent::decode(self.client.wait_for_event(deadline)?)
8774    }
8775
8776    /// Called immediately after [`Frame.SetNavigationEventListener`] and every time user-visible
8777    /// navigation state has changed. In the first call, `change` contains the current navigation
8778    /// state (empty before the first navigation request). In every following call, `change` will
8779    /// have values set for all fields that have changed at any time since the previous
8780    /// notification. This means that some fields may have the same value as was previously
8781    /// reported, for example, if they changed to some other value and back again. If a field is
8782    /// unset, then its value has not changed at any time since the previous notification.
8783    ///
8784    /// Implementer must call the acknowledgement callback to receive new navigation events.
8785    pub fn r#on_navigation_state_changed(
8786        &self,
8787        mut change: NavigationState,
8788        ___deadline: zx::MonotonicInstant,
8789    ) -> Result<(), fidl::Error> {
8790        let _response = self.client.send_query::<
8791            NavigationEventListenerOnNavigationStateChangedRequest,
8792            fidl::encoding::EmptyPayload,
8793        >(
8794            (&mut change,),
8795            0x453ac6bcbc82fbb6,
8796            fidl::encoding::DynamicFlags::empty(),
8797            ___deadline,
8798        )?;
8799        Ok(_response)
8800    }
8801}
8802
8803#[cfg(target_os = "fuchsia")]
8804impl From<NavigationEventListenerSynchronousProxy> for zx::Handle {
8805    fn from(value: NavigationEventListenerSynchronousProxy) -> Self {
8806        value.into_channel().into()
8807    }
8808}
8809
8810#[cfg(target_os = "fuchsia")]
8811impl From<fidl::Channel> for NavigationEventListenerSynchronousProxy {
8812    fn from(value: fidl::Channel) -> Self {
8813        Self::new(value)
8814    }
8815}
8816
8817#[derive(Debug, Clone)]
8818pub struct NavigationEventListenerProxy {
8819    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8820}
8821
8822impl fidl::endpoints::Proxy for NavigationEventListenerProxy {
8823    type Protocol = NavigationEventListenerMarker;
8824
8825    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8826        Self::new(inner)
8827    }
8828
8829    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8830        self.client.into_channel().map_err(|client| Self { client })
8831    }
8832
8833    fn as_channel(&self) -> &::fidl::AsyncChannel {
8834        self.client.as_channel()
8835    }
8836}
8837
8838impl NavigationEventListenerProxy {
8839    /// Create a new Proxy for fuchsia.web/NavigationEventListener.
8840    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8841        let protocol_name =
8842            <NavigationEventListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8843        Self { client: fidl::client::Client::new(channel, protocol_name) }
8844    }
8845
8846    /// Get a Stream of events from the remote end of the protocol.
8847    ///
8848    /// # Panics
8849    ///
8850    /// Panics if the event stream was already taken.
8851    pub fn take_event_stream(&self) -> NavigationEventListenerEventStream {
8852        NavigationEventListenerEventStream { event_receiver: self.client.take_event_receiver() }
8853    }
8854
8855    /// Called immediately after [`Frame.SetNavigationEventListener`] and every time user-visible
8856    /// navigation state has changed. In the first call, `change` contains the current navigation
8857    /// state (empty before the first navigation request). In every following call, `change` will
8858    /// have values set for all fields that have changed at any time since the previous
8859    /// notification. This means that some fields may have the same value as was previously
8860    /// reported, for example, if they changed to some other value and back again. If a field is
8861    /// unset, then its value has not changed at any time since the previous notification.
8862    ///
8863    /// Implementer must call the acknowledgement callback to receive new navigation events.
8864    pub fn r#on_navigation_state_changed(
8865        &self,
8866        mut change: NavigationState,
8867    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
8868        NavigationEventListenerProxyInterface::r#on_navigation_state_changed(self, change)
8869    }
8870}
8871
8872impl NavigationEventListenerProxyInterface for NavigationEventListenerProxy {
8873    type OnNavigationStateChangedResponseFut =
8874        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
8875    fn r#on_navigation_state_changed(
8876        &self,
8877        mut change: NavigationState,
8878    ) -> Self::OnNavigationStateChangedResponseFut {
8879        fn _decode(
8880            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8881        ) -> Result<(), fidl::Error> {
8882            let _response = fidl::client::decode_transaction_body::<
8883                fidl::encoding::EmptyPayload,
8884                fidl::encoding::DefaultFuchsiaResourceDialect,
8885                0x453ac6bcbc82fbb6,
8886            >(_buf?)?;
8887            Ok(_response)
8888        }
8889        self.client
8890            .send_query_and_decode::<NavigationEventListenerOnNavigationStateChangedRequest, ()>(
8891                (&mut change,),
8892                0x453ac6bcbc82fbb6,
8893                fidl::encoding::DynamicFlags::empty(),
8894                _decode,
8895            )
8896    }
8897}
8898
8899pub struct NavigationEventListenerEventStream {
8900    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8901}
8902
8903impl std::marker::Unpin for NavigationEventListenerEventStream {}
8904
8905impl futures::stream::FusedStream for NavigationEventListenerEventStream {
8906    fn is_terminated(&self) -> bool {
8907        self.event_receiver.is_terminated()
8908    }
8909}
8910
8911impl futures::Stream for NavigationEventListenerEventStream {
8912    type Item = Result<NavigationEventListenerEvent, fidl::Error>;
8913
8914    fn poll_next(
8915        mut self: std::pin::Pin<&mut Self>,
8916        cx: &mut std::task::Context<'_>,
8917    ) -> std::task::Poll<Option<Self::Item>> {
8918        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8919            &mut self.event_receiver,
8920            cx
8921        )?) {
8922            Some(buf) => std::task::Poll::Ready(Some(NavigationEventListenerEvent::decode(buf))),
8923            None => std::task::Poll::Ready(None),
8924        }
8925    }
8926}
8927
8928#[derive(Debug)]
8929pub enum NavigationEventListenerEvent {}
8930
8931impl NavigationEventListenerEvent {
8932    /// Decodes a message buffer as a [`NavigationEventListenerEvent`].
8933    fn decode(
8934        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8935    ) -> Result<NavigationEventListenerEvent, fidl::Error> {
8936        let (bytes, _handles) = buf.split_mut();
8937        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8938        debug_assert_eq!(tx_header.tx_id, 0);
8939        match tx_header.ordinal {
8940            _ => Err(fidl::Error::UnknownOrdinal {
8941                ordinal: tx_header.ordinal,
8942                protocol_name:
8943                    <NavigationEventListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8944            }),
8945        }
8946    }
8947}
8948
8949/// A Stream of incoming requests for fuchsia.web/NavigationEventListener.
8950pub struct NavigationEventListenerRequestStream {
8951    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8952    is_terminated: bool,
8953}
8954
8955impl std::marker::Unpin for NavigationEventListenerRequestStream {}
8956
8957impl futures::stream::FusedStream for NavigationEventListenerRequestStream {
8958    fn is_terminated(&self) -> bool {
8959        self.is_terminated
8960    }
8961}
8962
8963impl fidl::endpoints::RequestStream for NavigationEventListenerRequestStream {
8964    type Protocol = NavigationEventListenerMarker;
8965    type ControlHandle = NavigationEventListenerControlHandle;
8966
8967    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8968        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8969    }
8970
8971    fn control_handle(&self) -> Self::ControlHandle {
8972        NavigationEventListenerControlHandle { inner: self.inner.clone() }
8973    }
8974
8975    fn into_inner(
8976        self,
8977    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8978    {
8979        (self.inner, self.is_terminated)
8980    }
8981
8982    fn from_inner(
8983        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8984        is_terminated: bool,
8985    ) -> Self {
8986        Self { inner, is_terminated }
8987    }
8988}
8989
8990impl futures::Stream for NavigationEventListenerRequestStream {
8991    type Item = Result<NavigationEventListenerRequest, fidl::Error>;
8992
8993    fn poll_next(
8994        mut self: std::pin::Pin<&mut Self>,
8995        cx: &mut std::task::Context<'_>,
8996    ) -> std::task::Poll<Option<Self::Item>> {
8997        let this = &mut *self;
8998        if this.inner.check_shutdown(cx) {
8999            this.is_terminated = true;
9000            return std::task::Poll::Ready(None);
9001        }
9002        if this.is_terminated {
9003            panic!("polled NavigationEventListenerRequestStream after completion");
9004        }
9005        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
9006            |bytes, handles| {
9007                match this.inner.channel().read_etc(cx, bytes, handles) {
9008                    std::task::Poll::Ready(Ok(())) => {}
9009                    std::task::Poll::Pending => return std::task::Poll::Pending,
9010                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
9011                        this.is_terminated = true;
9012                        return std::task::Poll::Ready(None);
9013                    }
9014                    std::task::Poll::Ready(Err(e)) => {
9015                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
9016                            e.into(),
9017                        ))))
9018                    }
9019                }
9020
9021                // A message has been received from the channel
9022                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9023
9024                std::task::Poll::Ready(Some(match header.ordinal {
9025                0x453ac6bcbc82fbb6 => {
9026                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9027                    let mut req = fidl::new_empty!(NavigationEventListenerOnNavigationStateChangedRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
9028                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NavigationEventListenerOnNavigationStateChangedRequest>(&header, _body_bytes, handles, &mut req)?;
9029                    let control_handle = NavigationEventListenerControlHandle {
9030                        inner: this.inner.clone(),
9031                    };
9032                    Ok(NavigationEventListenerRequest::OnNavigationStateChanged {change: req.change,
9033
9034                        responder: NavigationEventListenerOnNavigationStateChangedResponder {
9035                            control_handle: std::mem::ManuallyDrop::new(control_handle),
9036                            tx_id: header.tx_id,
9037                        },
9038                    })
9039                }
9040                _ => Err(fidl::Error::UnknownOrdinal {
9041                    ordinal: header.ordinal,
9042                    protocol_name: <NavigationEventListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9043                }),
9044            }))
9045            },
9046        )
9047    }
9048}
9049
9050/// Interface supplied by the embedder for receiving notifications about navigation events in a
9051/// [`Frame`].
9052#[derive(Debug)]
9053pub enum NavigationEventListenerRequest {
9054    /// Called immediately after [`Frame.SetNavigationEventListener`] and every time user-visible
9055    /// navigation state has changed. In the first call, `change` contains the current navigation
9056    /// state (empty before the first navigation request). In every following call, `change` will
9057    /// have values set for all fields that have changed at any time since the previous
9058    /// notification. This means that some fields may have the same value as was previously
9059    /// reported, for example, if they changed to some other value and back again. If a field is
9060    /// unset, then its value has not changed at any time since the previous notification.
9061    ///
9062    /// Implementer must call the acknowledgement callback to receive new navigation events.
9063    OnNavigationStateChanged {
9064        change: NavigationState,
9065        responder: NavigationEventListenerOnNavigationStateChangedResponder,
9066    },
9067}
9068
9069impl NavigationEventListenerRequest {
9070    #[allow(irrefutable_let_patterns)]
9071    pub fn into_on_navigation_state_changed(
9072        self,
9073    ) -> Option<(NavigationState, NavigationEventListenerOnNavigationStateChangedResponder)> {
9074        if let NavigationEventListenerRequest::OnNavigationStateChanged { change, responder } = self
9075        {
9076            Some((change, responder))
9077        } else {
9078            None
9079        }
9080    }
9081
9082    /// Name of the method defined in FIDL
9083    pub fn method_name(&self) -> &'static str {
9084        match *self {
9085            NavigationEventListenerRequest::OnNavigationStateChanged { .. } => {
9086                "on_navigation_state_changed"
9087            }
9088        }
9089    }
9090}
9091
9092#[derive(Debug, Clone)]
9093pub struct NavigationEventListenerControlHandle {
9094    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9095}
9096
9097impl fidl::endpoints::ControlHandle for NavigationEventListenerControlHandle {
9098    fn shutdown(&self) {
9099        self.inner.shutdown()
9100    }
9101    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
9102        self.inner.shutdown_with_epitaph(status)
9103    }
9104
9105    fn is_closed(&self) -> bool {
9106        self.inner.channel().is_closed()
9107    }
9108    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
9109        self.inner.channel().on_closed()
9110    }
9111
9112    #[cfg(target_os = "fuchsia")]
9113    fn signal_peer(
9114        &self,
9115        clear_mask: zx::Signals,
9116        set_mask: zx::Signals,
9117    ) -> Result<(), zx_status::Status> {
9118        use fidl::Peered;
9119        self.inner.channel().signal_peer(clear_mask, set_mask)
9120    }
9121}
9122
9123impl NavigationEventListenerControlHandle {}
9124
9125#[must_use = "FIDL methods require a response to be sent"]
9126#[derive(Debug)]
9127pub struct NavigationEventListenerOnNavigationStateChangedResponder {
9128    control_handle: std::mem::ManuallyDrop<NavigationEventListenerControlHandle>,
9129    tx_id: u32,
9130}
9131
9132/// Set the the channel to be shutdown (see [`NavigationEventListenerControlHandle::shutdown`])
9133/// if the responder is dropped without sending a response, so that the client
9134/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9135impl std::ops::Drop for NavigationEventListenerOnNavigationStateChangedResponder {
9136    fn drop(&mut self) {
9137        self.control_handle.shutdown();
9138        // Safety: drops once, never accessed again
9139        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9140    }
9141}
9142
9143impl fidl::endpoints::Responder for NavigationEventListenerOnNavigationStateChangedResponder {
9144    type ControlHandle = NavigationEventListenerControlHandle;
9145
9146    fn control_handle(&self) -> &NavigationEventListenerControlHandle {
9147        &self.control_handle
9148    }
9149
9150    fn drop_without_shutdown(mut self) {
9151        // Safety: drops once, never accessed again due to mem::forget
9152        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9153        // Prevent Drop from running (which would shut down the channel)
9154        std::mem::forget(self);
9155    }
9156}
9157
9158impl NavigationEventListenerOnNavigationStateChangedResponder {
9159    /// Sends a response to the FIDL transaction.
9160    ///
9161    /// Sets the channel to shutdown if an error occurs.
9162    pub fn send(self) -> Result<(), fidl::Error> {
9163        let _result = self.send_raw();
9164        if _result.is_err() {
9165            self.control_handle.shutdown();
9166        }
9167        self.drop_without_shutdown();
9168        _result
9169    }
9170
9171    /// Similar to "send" but does not shutdown the channel if an error occurs.
9172    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
9173        let _result = self.send_raw();
9174        self.drop_without_shutdown();
9175        _result
9176    }
9177
9178    fn send_raw(&self) -> Result<(), fidl::Error> {
9179        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
9180            (),
9181            self.tx_id,
9182            0x453ac6bcbc82fbb6,
9183            fidl::encoding::DynamicFlags::empty(),
9184        )
9185    }
9186}
9187
9188#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9189pub struct NavigationPolicyProviderMarker;
9190
9191impl fidl::endpoints::ProtocolMarker for NavigationPolicyProviderMarker {
9192    type Proxy = NavigationPolicyProviderProxy;
9193    type RequestStream = NavigationPolicyProviderRequestStream;
9194    #[cfg(target_os = "fuchsia")]
9195    type SynchronousProxy = NavigationPolicyProviderSynchronousProxy;
9196
9197    const DEBUG_NAME: &'static str = "(anonymous) NavigationPolicyProvider";
9198}
9199
9200pub trait NavigationPolicyProviderProxyInterface: Send + Sync {
9201    type EvaluateRequestedNavigationResponseFut: std::future::Future<Output = Result<NavigationDecision, fidl::Error>>
9202        + Send;
9203    fn r#evaluate_requested_navigation(
9204        &self,
9205        requested_navigation: &RequestedNavigation,
9206    ) -> Self::EvaluateRequestedNavigationResponseFut;
9207}
9208#[derive(Debug)]
9209#[cfg(target_os = "fuchsia")]
9210pub struct NavigationPolicyProviderSynchronousProxy {
9211    client: fidl::client::sync::Client,
9212}
9213
9214#[cfg(target_os = "fuchsia")]
9215impl fidl::endpoints::SynchronousProxy for NavigationPolicyProviderSynchronousProxy {
9216    type Proxy = NavigationPolicyProviderProxy;
9217    type Protocol = NavigationPolicyProviderMarker;
9218
9219    fn from_channel(inner: fidl::Channel) -> Self {
9220        Self::new(inner)
9221    }
9222
9223    fn into_channel(self) -> fidl::Channel {
9224        self.client.into_channel()
9225    }
9226
9227    fn as_channel(&self) -> &fidl::Channel {
9228        self.client.as_channel()
9229    }
9230}
9231
9232#[cfg(target_os = "fuchsia")]
9233impl NavigationPolicyProviderSynchronousProxy {
9234    pub fn new(channel: fidl::Channel) -> Self {
9235        let protocol_name =
9236            <NavigationPolicyProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9237        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
9238    }
9239
9240    pub fn into_channel(self) -> fidl::Channel {
9241        self.client.into_channel()
9242    }
9243
9244    /// Waits until an event arrives and returns it. It is safe for other
9245    /// threads to make concurrent requests while waiting for an event.
9246    pub fn wait_for_event(
9247        &self,
9248        deadline: zx::MonotonicInstant,
9249    ) -> Result<NavigationPolicyProviderEvent, fidl::Error> {
9250        NavigationPolicyProviderEvent::decode(self.client.wait_for_event(deadline)?)
9251    }
9252
9253    /// Called when the [`Frame`] is processing a navigation request in one of the phase(s)
9254    /// specified in [`NavigationPolicyProviderParams`]. Navigation is paused until the result is
9255    /// received. The returned [`NavigationDecision`] defines how the navigation should proceed.
9256    pub fn r#evaluate_requested_navigation(
9257        &self,
9258        mut requested_navigation: &RequestedNavigation,
9259        ___deadline: zx::MonotonicInstant,
9260    ) -> Result<NavigationDecision, fidl::Error> {
9261        let _response = self.client.send_query::<
9262            NavigationPolicyProviderEvaluateRequestedNavigationRequest,
9263            NavigationPolicyProviderEvaluateRequestedNavigationResponse,
9264        >(
9265            (requested_navigation,),
9266            0x54446b50cf3512b6,
9267            fidl::encoding::DynamicFlags::empty(),
9268            ___deadline,
9269        )?;
9270        Ok(_response.decision)
9271    }
9272}
9273
9274#[cfg(target_os = "fuchsia")]
9275impl From<NavigationPolicyProviderSynchronousProxy> for zx::Handle {
9276    fn from(value: NavigationPolicyProviderSynchronousProxy) -> Self {
9277        value.into_channel().into()
9278    }
9279}
9280
9281#[cfg(target_os = "fuchsia")]
9282impl From<fidl::Channel> for NavigationPolicyProviderSynchronousProxy {
9283    fn from(value: fidl::Channel) -> Self {
9284        Self::new(value)
9285    }
9286}
9287
9288#[derive(Debug, Clone)]
9289pub struct NavigationPolicyProviderProxy {
9290    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
9291}
9292
9293impl fidl::endpoints::Proxy for NavigationPolicyProviderProxy {
9294    type Protocol = NavigationPolicyProviderMarker;
9295
9296    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
9297        Self::new(inner)
9298    }
9299
9300    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
9301        self.client.into_channel().map_err(|client| Self { client })
9302    }
9303
9304    fn as_channel(&self) -> &::fidl::AsyncChannel {
9305        self.client.as_channel()
9306    }
9307}
9308
9309impl NavigationPolicyProviderProxy {
9310    /// Create a new Proxy for fuchsia.web/NavigationPolicyProvider.
9311    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
9312        let protocol_name =
9313            <NavigationPolicyProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9314        Self { client: fidl::client::Client::new(channel, protocol_name) }
9315    }
9316
9317    /// Get a Stream of events from the remote end of the protocol.
9318    ///
9319    /// # Panics
9320    ///
9321    /// Panics if the event stream was already taken.
9322    pub fn take_event_stream(&self) -> NavigationPolicyProviderEventStream {
9323        NavigationPolicyProviderEventStream { event_receiver: self.client.take_event_receiver() }
9324    }
9325
9326    /// Called when the [`Frame`] is processing a navigation request in one of the phase(s)
9327    /// specified in [`NavigationPolicyProviderParams`]. Navigation is paused until the result is
9328    /// received. The returned [`NavigationDecision`] defines how the navigation should proceed.
9329    pub fn r#evaluate_requested_navigation(
9330        &self,
9331        mut requested_navigation: &RequestedNavigation,
9332    ) -> fidl::client::QueryResponseFut<
9333        NavigationDecision,
9334        fidl::encoding::DefaultFuchsiaResourceDialect,
9335    > {
9336        NavigationPolicyProviderProxyInterface::r#evaluate_requested_navigation(
9337            self,
9338            requested_navigation,
9339        )
9340    }
9341}
9342
9343impl NavigationPolicyProviderProxyInterface for NavigationPolicyProviderProxy {
9344    type EvaluateRequestedNavigationResponseFut = fidl::client::QueryResponseFut<
9345        NavigationDecision,
9346        fidl::encoding::DefaultFuchsiaResourceDialect,
9347    >;
9348    fn r#evaluate_requested_navigation(
9349        &self,
9350        mut requested_navigation: &RequestedNavigation,
9351    ) -> Self::EvaluateRequestedNavigationResponseFut {
9352        fn _decode(
9353            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9354        ) -> Result<NavigationDecision, fidl::Error> {
9355            let _response = fidl::client::decode_transaction_body::<
9356                NavigationPolicyProviderEvaluateRequestedNavigationResponse,
9357                fidl::encoding::DefaultFuchsiaResourceDialect,
9358                0x54446b50cf3512b6,
9359            >(_buf?)?;
9360            Ok(_response.decision)
9361        }
9362        self.client.send_query_and_decode::<
9363            NavigationPolicyProviderEvaluateRequestedNavigationRequest,
9364            NavigationDecision,
9365        >(
9366            (requested_navigation,),
9367            0x54446b50cf3512b6,
9368            fidl::encoding::DynamicFlags::empty(),
9369            _decode,
9370        )
9371    }
9372}
9373
9374pub struct NavigationPolicyProviderEventStream {
9375    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
9376}
9377
9378impl std::marker::Unpin for NavigationPolicyProviderEventStream {}
9379
9380impl futures::stream::FusedStream for NavigationPolicyProviderEventStream {
9381    fn is_terminated(&self) -> bool {
9382        self.event_receiver.is_terminated()
9383    }
9384}
9385
9386impl futures::Stream for NavigationPolicyProviderEventStream {
9387    type Item = Result<NavigationPolicyProviderEvent, fidl::Error>;
9388
9389    fn poll_next(
9390        mut self: std::pin::Pin<&mut Self>,
9391        cx: &mut std::task::Context<'_>,
9392    ) -> std::task::Poll<Option<Self::Item>> {
9393        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
9394            &mut self.event_receiver,
9395            cx
9396        )?) {
9397            Some(buf) => std::task::Poll::Ready(Some(NavigationPolicyProviderEvent::decode(buf))),
9398            None => std::task::Poll::Ready(None),
9399        }
9400    }
9401}
9402
9403#[derive(Debug)]
9404pub enum NavigationPolicyProviderEvent {}
9405
9406impl NavigationPolicyProviderEvent {
9407    /// Decodes a message buffer as a [`NavigationPolicyProviderEvent`].
9408    fn decode(
9409        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
9410    ) -> Result<NavigationPolicyProviderEvent, fidl::Error> {
9411        let (bytes, _handles) = buf.split_mut();
9412        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9413        debug_assert_eq!(tx_header.tx_id, 0);
9414        match tx_header.ordinal {
9415            _ => Err(fidl::Error::UnknownOrdinal {
9416                ordinal: tx_header.ordinal,
9417                protocol_name:
9418                    <NavigationPolicyProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9419            }),
9420        }
9421    }
9422}
9423
9424/// A Stream of incoming requests for fuchsia.web/NavigationPolicyProvider.
9425pub struct NavigationPolicyProviderRequestStream {
9426    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9427    is_terminated: bool,
9428}
9429
9430impl std::marker::Unpin for NavigationPolicyProviderRequestStream {}
9431
9432impl futures::stream::FusedStream for NavigationPolicyProviderRequestStream {
9433    fn is_terminated(&self) -> bool {
9434        self.is_terminated
9435    }
9436}
9437
9438impl fidl::endpoints::RequestStream for NavigationPolicyProviderRequestStream {
9439    type Protocol = NavigationPolicyProviderMarker;
9440    type ControlHandle = NavigationPolicyProviderControlHandle;
9441
9442    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
9443        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
9444    }
9445
9446    fn control_handle(&self) -> Self::ControlHandle {
9447        NavigationPolicyProviderControlHandle { inner: self.inner.clone() }
9448    }
9449
9450    fn into_inner(
9451        self,
9452    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
9453    {
9454        (self.inner, self.is_terminated)
9455    }
9456
9457    fn from_inner(
9458        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9459        is_terminated: bool,
9460    ) -> Self {
9461        Self { inner, is_terminated }
9462    }
9463}
9464
9465impl futures::Stream for NavigationPolicyProviderRequestStream {
9466    type Item = Result<NavigationPolicyProviderRequest, fidl::Error>;
9467
9468    fn poll_next(
9469        mut self: std::pin::Pin<&mut Self>,
9470        cx: &mut std::task::Context<'_>,
9471    ) -> std::task::Poll<Option<Self::Item>> {
9472        let this = &mut *self;
9473        if this.inner.check_shutdown(cx) {
9474            this.is_terminated = true;
9475            return std::task::Poll::Ready(None);
9476        }
9477        if this.is_terminated {
9478            panic!("polled NavigationPolicyProviderRequestStream after completion");
9479        }
9480        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
9481            |bytes, handles| {
9482                match this.inner.channel().read_etc(cx, bytes, handles) {
9483                    std::task::Poll::Ready(Ok(())) => {}
9484                    std::task::Poll::Pending => return std::task::Poll::Pending,
9485                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
9486                        this.is_terminated = true;
9487                        return std::task::Poll::Ready(None);
9488                    }
9489                    std::task::Poll::Ready(Err(e)) => {
9490                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
9491                            e.into(),
9492                        ))))
9493                    }
9494                }
9495
9496                // A message has been received from the channel
9497                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9498
9499                std::task::Poll::Ready(Some(match header.ordinal {
9500                0x54446b50cf3512b6 => {
9501                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9502                    let mut req = fidl::new_empty!(NavigationPolicyProviderEvaluateRequestedNavigationRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
9503                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NavigationPolicyProviderEvaluateRequestedNavigationRequest>(&header, _body_bytes, handles, &mut req)?;
9504                    let control_handle = NavigationPolicyProviderControlHandle {
9505                        inner: this.inner.clone(),
9506                    };
9507                    Ok(NavigationPolicyProviderRequest::EvaluateRequestedNavigation {requested_navigation: req.requested_navigation,
9508
9509                        responder: NavigationPolicyProviderEvaluateRequestedNavigationResponder {
9510                            control_handle: std::mem::ManuallyDrop::new(control_handle),
9511                            tx_id: header.tx_id,
9512                        },
9513                    })
9514                }
9515                _ => Err(fidl::Error::UnknownOrdinal {
9516                    ordinal: header.ordinal,
9517                    protocol_name: <NavigationPolicyProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9518                }),
9519            }))
9520            },
9521        )
9522    }
9523}
9524
9525#[derive(Debug)]
9526pub enum NavigationPolicyProviderRequest {
9527    /// Called when the [`Frame`] is processing a navigation request in one of the phase(s)
9528    /// specified in [`NavigationPolicyProviderParams`]. Navigation is paused until the result is
9529    /// received. The returned [`NavigationDecision`] defines how the navigation should proceed.
9530    EvaluateRequestedNavigation {
9531        requested_navigation: RequestedNavigation,
9532        responder: NavigationPolicyProviderEvaluateRequestedNavigationResponder,
9533    },
9534}
9535
9536impl NavigationPolicyProviderRequest {
9537    #[allow(irrefutable_let_patterns)]
9538    pub fn into_evaluate_requested_navigation(
9539        self,
9540    ) -> Option<(RequestedNavigation, NavigationPolicyProviderEvaluateRequestedNavigationResponder)>
9541    {
9542        if let NavigationPolicyProviderRequest::EvaluateRequestedNavigation {
9543            requested_navigation,
9544            responder,
9545        } = self
9546        {
9547            Some((requested_navigation, responder))
9548        } else {
9549            None
9550        }
9551    }
9552
9553    /// Name of the method defined in FIDL
9554    pub fn method_name(&self) -> &'static str {
9555        match *self {
9556            NavigationPolicyProviderRequest::EvaluateRequestedNavigation { .. } => {
9557                "evaluate_requested_navigation"
9558            }
9559        }
9560    }
9561}
9562
9563#[derive(Debug, Clone)]
9564pub struct NavigationPolicyProviderControlHandle {
9565    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9566}
9567
9568impl fidl::endpoints::ControlHandle for NavigationPolicyProviderControlHandle {
9569    fn shutdown(&self) {
9570        self.inner.shutdown()
9571    }
9572    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
9573        self.inner.shutdown_with_epitaph(status)
9574    }
9575
9576    fn is_closed(&self) -> bool {
9577        self.inner.channel().is_closed()
9578    }
9579    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
9580        self.inner.channel().on_closed()
9581    }
9582
9583    #[cfg(target_os = "fuchsia")]
9584    fn signal_peer(
9585        &self,
9586        clear_mask: zx::Signals,
9587        set_mask: zx::Signals,
9588    ) -> Result<(), zx_status::Status> {
9589        use fidl::Peered;
9590        self.inner.channel().signal_peer(clear_mask, set_mask)
9591    }
9592}
9593
9594impl NavigationPolicyProviderControlHandle {}
9595
9596#[must_use = "FIDL methods require a response to be sent"]
9597#[derive(Debug)]
9598pub struct NavigationPolicyProviderEvaluateRequestedNavigationResponder {
9599    control_handle: std::mem::ManuallyDrop<NavigationPolicyProviderControlHandle>,
9600    tx_id: u32,
9601}
9602
9603/// Set the the channel to be shutdown (see [`NavigationPolicyProviderControlHandle::shutdown`])
9604/// if the responder is dropped without sending a response, so that the client
9605/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9606impl std::ops::Drop for NavigationPolicyProviderEvaluateRequestedNavigationResponder {
9607    fn drop(&mut self) {
9608        self.control_handle.shutdown();
9609        // Safety: drops once, never accessed again
9610        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9611    }
9612}
9613
9614impl fidl::endpoints::Responder for NavigationPolicyProviderEvaluateRequestedNavigationResponder {
9615    type ControlHandle = NavigationPolicyProviderControlHandle;
9616
9617    fn control_handle(&self) -> &NavigationPolicyProviderControlHandle {
9618        &self.control_handle
9619    }
9620
9621    fn drop_without_shutdown(mut self) {
9622        // Safety: drops once, never accessed again due to mem::forget
9623        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9624        // Prevent Drop from running (which would shut down the channel)
9625        std::mem::forget(self);
9626    }
9627}
9628
9629impl NavigationPolicyProviderEvaluateRequestedNavigationResponder {
9630    /// Sends a response to the FIDL transaction.
9631    ///
9632    /// Sets the channel to shutdown if an error occurs.
9633    pub fn send(self, mut decision: NavigationDecision) -> Result<(), fidl::Error> {
9634        let _result = self.send_raw(decision);
9635        if _result.is_err() {
9636            self.control_handle.shutdown();
9637        }
9638        self.drop_without_shutdown();
9639        _result
9640    }
9641
9642    /// Similar to "send" but does not shutdown the channel if an error occurs.
9643    pub fn send_no_shutdown_on_err(
9644        self,
9645        mut decision: NavigationDecision,
9646    ) -> Result<(), fidl::Error> {
9647        let _result = self.send_raw(decision);
9648        self.drop_without_shutdown();
9649        _result
9650    }
9651
9652    fn send_raw(&self, mut decision: NavigationDecision) -> Result<(), fidl::Error> {
9653        self.control_handle
9654            .inner
9655            .send::<NavigationPolicyProviderEvaluateRequestedNavigationResponse>(
9656                (&mut decision,),
9657                self.tx_id,
9658                0x54446b50cf3512b6,
9659                fidl::encoding::DynamicFlags::empty(),
9660            )
9661    }
9662}
9663
9664#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9665pub struct PopupFrameCreationListenerMarker;
9666
9667impl fidl::endpoints::ProtocolMarker for PopupFrameCreationListenerMarker {
9668    type Proxy = PopupFrameCreationListenerProxy;
9669    type RequestStream = PopupFrameCreationListenerRequestStream;
9670    #[cfg(target_os = "fuchsia")]
9671    type SynchronousProxy = PopupFrameCreationListenerSynchronousProxy;
9672
9673    const DEBUG_NAME: &'static str = "(anonymous) PopupFrameCreationListener";
9674}
9675
9676pub trait PopupFrameCreationListenerProxyInterface: Send + Sync {
9677    type OnPopupFrameCreatedResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
9678        + Send;
9679    fn r#on_popup_frame_created(
9680        &self,
9681        frame: fidl::endpoints::ClientEnd<FrameMarker>,
9682        info: PopupFrameCreationInfo,
9683    ) -> Self::OnPopupFrameCreatedResponseFut;
9684}
9685#[derive(Debug)]
9686#[cfg(target_os = "fuchsia")]
9687pub struct PopupFrameCreationListenerSynchronousProxy {
9688    client: fidl::client::sync::Client,
9689}
9690
9691#[cfg(target_os = "fuchsia")]
9692impl fidl::endpoints::SynchronousProxy for PopupFrameCreationListenerSynchronousProxy {
9693    type Proxy = PopupFrameCreationListenerProxy;
9694    type Protocol = PopupFrameCreationListenerMarker;
9695
9696    fn from_channel(inner: fidl::Channel) -> Self {
9697        Self::new(inner)
9698    }
9699
9700    fn into_channel(self) -> fidl::Channel {
9701        self.client.into_channel()
9702    }
9703
9704    fn as_channel(&self) -> &fidl::Channel {
9705        self.client.as_channel()
9706    }
9707}
9708
9709#[cfg(target_os = "fuchsia")]
9710impl PopupFrameCreationListenerSynchronousProxy {
9711    pub fn new(channel: fidl::Channel) -> Self {
9712        let protocol_name =
9713            <PopupFrameCreationListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9714        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
9715    }
9716
9717    pub fn into_channel(self) -> fidl::Channel {
9718        self.client.into_channel()
9719    }
9720
9721    /// Waits until an event arrives and returns it. It is safe for other
9722    /// threads to make concurrent requests while waiting for an event.
9723    pub fn wait_for_event(
9724        &self,
9725        deadline: zx::MonotonicInstant,
9726    ) -> Result<PopupFrameCreationListenerEvent, fidl::Error> {
9727        PopupFrameCreationListenerEvent::decode(self.client.wait_for_event(deadline)?)
9728    }
9729
9730    /// Called when a [`Frame`] has created a new popup `frame`. Information about the popup frame,
9731    /// and how it was created, is provided via `info`. Additional popup frames are delivered after
9732    /// the acknowledgement callback is invoked.
9733    pub fn r#on_popup_frame_created(
9734        &self,
9735        mut frame: fidl::endpoints::ClientEnd<FrameMarker>,
9736        mut info: PopupFrameCreationInfo,
9737        ___deadline: zx::MonotonicInstant,
9738    ) -> Result<(), fidl::Error> {
9739        let _response = self.client.send_query::<
9740            PopupFrameCreationListenerOnPopupFrameCreatedRequest,
9741            fidl::encoding::EmptyPayload,
9742        >(
9743            (frame, &mut info,),
9744            0x19b212672dc41d51,
9745            fidl::encoding::DynamicFlags::empty(),
9746            ___deadline,
9747        )?;
9748        Ok(_response)
9749    }
9750}
9751
9752#[cfg(target_os = "fuchsia")]
9753impl From<PopupFrameCreationListenerSynchronousProxy> for zx::Handle {
9754    fn from(value: PopupFrameCreationListenerSynchronousProxy) -> Self {
9755        value.into_channel().into()
9756    }
9757}
9758
9759#[cfg(target_os = "fuchsia")]
9760impl From<fidl::Channel> for PopupFrameCreationListenerSynchronousProxy {
9761    fn from(value: fidl::Channel) -> Self {
9762        Self::new(value)
9763    }
9764}
9765
9766#[derive(Debug, Clone)]
9767pub struct PopupFrameCreationListenerProxy {
9768    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
9769}
9770
9771impl fidl::endpoints::Proxy for PopupFrameCreationListenerProxy {
9772    type Protocol = PopupFrameCreationListenerMarker;
9773
9774    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
9775        Self::new(inner)
9776    }
9777
9778    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
9779        self.client.into_channel().map_err(|client| Self { client })
9780    }
9781
9782    fn as_channel(&self) -> &::fidl::AsyncChannel {
9783        self.client.as_channel()
9784    }
9785}
9786
9787impl PopupFrameCreationListenerProxy {
9788    /// Create a new Proxy for fuchsia.web/PopupFrameCreationListener.
9789    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
9790        let protocol_name =
9791            <PopupFrameCreationListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9792        Self { client: fidl::client::Client::new(channel, protocol_name) }
9793    }
9794
9795    /// Get a Stream of events from the remote end of the protocol.
9796    ///
9797    /// # Panics
9798    ///
9799    /// Panics if the event stream was already taken.
9800    pub fn take_event_stream(&self) -> PopupFrameCreationListenerEventStream {
9801        PopupFrameCreationListenerEventStream { event_receiver: self.client.take_event_receiver() }
9802    }
9803
9804    /// Called when a [`Frame`] has created a new popup `frame`. Information about the popup frame,
9805    /// and how it was created, is provided via `info`. Additional popup frames are delivered after
9806    /// the acknowledgement callback is invoked.
9807    pub fn r#on_popup_frame_created(
9808        &self,
9809        mut frame: fidl::endpoints::ClientEnd<FrameMarker>,
9810        mut info: PopupFrameCreationInfo,
9811    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
9812        PopupFrameCreationListenerProxyInterface::r#on_popup_frame_created(self, frame, info)
9813    }
9814}
9815
9816impl PopupFrameCreationListenerProxyInterface for PopupFrameCreationListenerProxy {
9817    type OnPopupFrameCreatedResponseFut =
9818        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
9819    fn r#on_popup_frame_created(
9820        &self,
9821        mut frame: fidl::endpoints::ClientEnd<FrameMarker>,
9822        mut info: PopupFrameCreationInfo,
9823    ) -> Self::OnPopupFrameCreatedResponseFut {
9824        fn _decode(
9825            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9826        ) -> Result<(), fidl::Error> {
9827            let _response = fidl::client::decode_transaction_body::<
9828                fidl::encoding::EmptyPayload,
9829                fidl::encoding::DefaultFuchsiaResourceDialect,
9830                0x19b212672dc41d51,
9831            >(_buf?)?;
9832            Ok(_response)
9833        }
9834        self.client
9835            .send_query_and_decode::<PopupFrameCreationListenerOnPopupFrameCreatedRequest, ()>(
9836                (frame, &mut info),
9837                0x19b212672dc41d51,
9838                fidl::encoding::DynamicFlags::empty(),
9839                _decode,
9840            )
9841    }
9842}
9843
9844pub struct PopupFrameCreationListenerEventStream {
9845    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
9846}
9847
9848impl std::marker::Unpin for PopupFrameCreationListenerEventStream {}
9849
9850impl futures::stream::FusedStream for PopupFrameCreationListenerEventStream {
9851    fn is_terminated(&self) -> bool {
9852        self.event_receiver.is_terminated()
9853    }
9854}
9855
9856impl futures::Stream for PopupFrameCreationListenerEventStream {
9857    type Item = Result<PopupFrameCreationListenerEvent, fidl::Error>;
9858
9859    fn poll_next(
9860        mut self: std::pin::Pin<&mut Self>,
9861        cx: &mut std::task::Context<'_>,
9862    ) -> std::task::Poll<Option<Self::Item>> {
9863        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
9864            &mut self.event_receiver,
9865            cx
9866        )?) {
9867            Some(buf) => std::task::Poll::Ready(Some(PopupFrameCreationListenerEvent::decode(buf))),
9868            None => std::task::Poll::Ready(None),
9869        }
9870    }
9871}
9872
9873#[derive(Debug)]
9874pub enum PopupFrameCreationListenerEvent {}
9875
9876impl PopupFrameCreationListenerEvent {
9877    /// Decodes a message buffer as a [`PopupFrameCreationListenerEvent`].
9878    fn decode(
9879        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
9880    ) -> Result<PopupFrameCreationListenerEvent, fidl::Error> {
9881        let (bytes, _handles) = buf.split_mut();
9882        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9883        debug_assert_eq!(tx_header.tx_id, 0);
9884        match tx_header.ordinal {
9885            _ => Err(fidl::Error::UnknownOrdinal {
9886                ordinal: tx_header.ordinal,
9887                protocol_name: <PopupFrameCreationListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9888            })
9889        }
9890    }
9891}
9892
9893/// A Stream of incoming requests for fuchsia.web/PopupFrameCreationListener.
9894pub struct PopupFrameCreationListenerRequestStream {
9895    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9896    is_terminated: bool,
9897}
9898
9899impl std::marker::Unpin for PopupFrameCreationListenerRequestStream {}
9900
9901impl futures::stream::FusedStream for PopupFrameCreationListenerRequestStream {
9902    fn is_terminated(&self) -> bool {
9903        self.is_terminated
9904    }
9905}
9906
9907impl fidl::endpoints::RequestStream for PopupFrameCreationListenerRequestStream {
9908    type Protocol = PopupFrameCreationListenerMarker;
9909    type ControlHandle = PopupFrameCreationListenerControlHandle;
9910
9911    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
9912        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
9913    }
9914
9915    fn control_handle(&self) -> Self::ControlHandle {
9916        PopupFrameCreationListenerControlHandle { inner: self.inner.clone() }
9917    }
9918
9919    fn into_inner(
9920        self,
9921    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
9922    {
9923        (self.inner, self.is_terminated)
9924    }
9925
9926    fn from_inner(
9927        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9928        is_terminated: bool,
9929    ) -> Self {
9930        Self { inner, is_terminated }
9931    }
9932}
9933
9934impl futures::Stream for PopupFrameCreationListenerRequestStream {
9935    type Item = Result<PopupFrameCreationListenerRequest, fidl::Error>;
9936
9937    fn poll_next(
9938        mut self: std::pin::Pin<&mut Self>,
9939        cx: &mut std::task::Context<'_>,
9940    ) -> std::task::Poll<Option<Self::Item>> {
9941        let this = &mut *self;
9942        if this.inner.check_shutdown(cx) {
9943            this.is_terminated = true;
9944            return std::task::Poll::Ready(None);
9945        }
9946        if this.is_terminated {
9947            panic!("polled PopupFrameCreationListenerRequestStream after completion");
9948        }
9949        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
9950            |bytes, handles| {
9951                match this.inner.channel().read_etc(cx, bytes, handles) {
9952                    std::task::Poll::Ready(Ok(())) => {}
9953                    std::task::Poll::Pending => return std::task::Poll::Pending,
9954                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
9955                        this.is_terminated = true;
9956                        return std::task::Poll::Ready(None);
9957                    }
9958                    std::task::Poll::Ready(Err(e)) => {
9959                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
9960                            e.into(),
9961                        ))))
9962                    }
9963                }
9964
9965                // A message has been received from the channel
9966                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9967
9968                std::task::Poll::Ready(Some(match header.ordinal {
9969                0x19b212672dc41d51 => {
9970                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9971                    let mut req = fidl::new_empty!(PopupFrameCreationListenerOnPopupFrameCreatedRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
9972                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PopupFrameCreationListenerOnPopupFrameCreatedRequest>(&header, _body_bytes, handles, &mut req)?;
9973                    let control_handle = PopupFrameCreationListenerControlHandle {
9974                        inner: this.inner.clone(),
9975                    };
9976                    Ok(PopupFrameCreationListenerRequest::OnPopupFrameCreated {frame: req.frame,
9977info: req.info,
9978
9979                        responder: PopupFrameCreationListenerOnPopupFrameCreatedResponder {
9980                            control_handle: std::mem::ManuallyDrop::new(control_handle),
9981                            tx_id: header.tx_id,
9982                        },
9983                    })
9984                }
9985                _ => Err(fidl::Error::UnknownOrdinal {
9986                    ordinal: header.ordinal,
9987                    protocol_name: <PopupFrameCreationListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9988                }),
9989            }))
9990            },
9991        )
9992    }
9993}
9994
9995#[derive(Debug)]
9996pub enum PopupFrameCreationListenerRequest {
9997    /// Called when a [`Frame`] has created a new popup `frame`. Information about the popup frame,
9998    /// and how it was created, is provided via `info`. Additional popup frames are delivered after
9999    /// the acknowledgement callback is invoked.
10000    OnPopupFrameCreated {
10001        frame: fidl::endpoints::ClientEnd<FrameMarker>,
10002        info: PopupFrameCreationInfo,
10003        responder: PopupFrameCreationListenerOnPopupFrameCreatedResponder,
10004    },
10005}
10006
10007impl PopupFrameCreationListenerRequest {
10008    #[allow(irrefutable_let_patterns)]
10009    pub fn into_on_popup_frame_created(
10010        self,
10011    ) -> Option<(
10012        fidl::endpoints::ClientEnd<FrameMarker>,
10013        PopupFrameCreationInfo,
10014        PopupFrameCreationListenerOnPopupFrameCreatedResponder,
10015    )> {
10016        if let PopupFrameCreationListenerRequest::OnPopupFrameCreated { frame, info, responder } =
10017            self
10018        {
10019            Some((frame, info, responder))
10020        } else {
10021            None
10022        }
10023    }
10024
10025    /// Name of the method defined in FIDL
10026    pub fn method_name(&self) -> &'static str {
10027        match *self {
10028            PopupFrameCreationListenerRequest::OnPopupFrameCreated { .. } => {
10029                "on_popup_frame_created"
10030            }
10031        }
10032    }
10033}
10034
10035#[derive(Debug, Clone)]
10036pub struct PopupFrameCreationListenerControlHandle {
10037    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10038}
10039
10040impl fidl::endpoints::ControlHandle for PopupFrameCreationListenerControlHandle {
10041    fn shutdown(&self) {
10042        self.inner.shutdown()
10043    }
10044    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
10045        self.inner.shutdown_with_epitaph(status)
10046    }
10047
10048    fn is_closed(&self) -> bool {
10049        self.inner.channel().is_closed()
10050    }
10051    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
10052        self.inner.channel().on_closed()
10053    }
10054
10055    #[cfg(target_os = "fuchsia")]
10056    fn signal_peer(
10057        &self,
10058        clear_mask: zx::Signals,
10059        set_mask: zx::Signals,
10060    ) -> Result<(), zx_status::Status> {
10061        use fidl::Peered;
10062        self.inner.channel().signal_peer(clear_mask, set_mask)
10063    }
10064}
10065
10066impl PopupFrameCreationListenerControlHandle {}
10067
10068#[must_use = "FIDL methods require a response to be sent"]
10069#[derive(Debug)]
10070pub struct PopupFrameCreationListenerOnPopupFrameCreatedResponder {
10071    control_handle: std::mem::ManuallyDrop<PopupFrameCreationListenerControlHandle>,
10072    tx_id: u32,
10073}
10074
10075/// Set the the channel to be shutdown (see [`PopupFrameCreationListenerControlHandle::shutdown`])
10076/// if the responder is dropped without sending a response, so that the client
10077/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10078impl std::ops::Drop for PopupFrameCreationListenerOnPopupFrameCreatedResponder {
10079    fn drop(&mut self) {
10080        self.control_handle.shutdown();
10081        // Safety: drops once, never accessed again
10082        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10083    }
10084}
10085
10086impl fidl::endpoints::Responder for PopupFrameCreationListenerOnPopupFrameCreatedResponder {
10087    type ControlHandle = PopupFrameCreationListenerControlHandle;
10088
10089    fn control_handle(&self) -> &PopupFrameCreationListenerControlHandle {
10090        &self.control_handle
10091    }
10092
10093    fn drop_without_shutdown(mut self) {
10094        // Safety: drops once, never accessed again due to mem::forget
10095        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10096        // Prevent Drop from running (which would shut down the channel)
10097        std::mem::forget(self);
10098    }
10099}
10100
10101impl PopupFrameCreationListenerOnPopupFrameCreatedResponder {
10102    /// Sends a response to the FIDL transaction.
10103    ///
10104    /// Sets the channel to shutdown if an error occurs.
10105    pub fn send(self) -> Result<(), fidl::Error> {
10106        let _result = self.send_raw();
10107        if _result.is_err() {
10108            self.control_handle.shutdown();
10109        }
10110        self.drop_without_shutdown();
10111        _result
10112    }
10113
10114    /// Similar to "send" but does not shutdown the channel if an error occurs.
10115    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
10116        let _result = self.send_raw();
10117        self.drop_without_shutdown();
10118        _result
10119    }
10120
10121    fn send_raw(&self) -> Result<(), fidl::Error> {
10122        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
10123            (),
10124            self.tx_id,
10125            0x19b212672dc41d51,
10126            fidl::encoding::DynamicFlags::empty(),
10127        )
10128    }
10129}
10130
10131mod internal {
10132    use super::*;
10133
10134    impl fidl::encoding::ResourceTypeMarker for ContextCreateFrameRequest {
10135        type Borrowed<'a> = &'a mut Self;
10136        fn take_or_borrow<'a>(
10137            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10138        ) -> Self::Borrowed<'a> {
10139            value
10140        }
10141    }
10142
10143    unsafe impl fidl::encoding::TypeMarker for ContextCreateFrameRequest {
10144        type Owned = Self;
10145
10146        #[inline(always)]
10147        fn inline_align(_context: fidl::encoding::Context) -> usize {
10148            4
10149        }
10150
10151        #[inline(always)]
10152        fn inline_size(_context: fidl::encoding::Context) -> usize {
10153            4
10154        }
10155    }
10156
10157    unsafe impl
10158        fidl::encoding::Encode<
10159            ContextCreateFrameRequest,
10160            fidl::encoding::DefaultFuchsiaResourceDialect,
10161        > for &mut ContextCreateFrameRequest
10162    {
10163        #[inline]
10164        unsafe fn encode(
10165            self,
10166            encoder: &mut fidl::encoding::Encoder<
10167                '_,
10168                fidl::encoding::DefaultFuchsiaResourceDialect,
10169            >,
10170            offset: usize,
10171            _depth: fidl::encoding::Depth,
10172        ) -> fidl::Result<()> {
10173            encoder.debug_check_bounds::<ContextCreateFrameRequest>(offset);
10174            // Delegate to tuple encoding.
10175            fidl::encoding::Encode::<ContextCreateFrameRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10176                (
10177                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FrameMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.frame),
10178                ),
10179                encoder, offset, _depth
10180            )
10181        }
10182    }
10183    unsafe impl<
10184            T0: fidl::encoding::Encode<
10185                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FrameMarker>>,
10186                fidl::encoding::DefaultFuchsiaResourceDialect,
10187            >,
10188        >
10189        fidl::encoding::Encode<
10190            ContextCreateFrameRequest,
10191            fidl::encoding::DefaultFuchsiaResourceDialect,
10192        > for (T0,)
10193    {
10194        #[inline]
10195        unsafe fn encode(
10196            self,
10197            encoder: &mut fidl::encoding::Encoder<
10198                '_,
10199                fidl::encoding::DefaultFuchsiaResourceDialect,
10200            >,
10201            offset: usize,
10202            depth: fidl::encoding::Depth,
10203        ) -> fidl::Result<()> {
10204            encoder.debug_check_bounds::<ContextCreateFrameRequest>(offset);
10205            // Zero out padding regions. There's no need to apply masks
10206            // because the unmasked parts will be overwritten by fields.
10207            // Write the fields.
10208            self.0.encode(encoder, offset + 0, depth)?;
10209            Ok(())
10210        }
10211    }
10212
10213    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10214        for ContextCreateFrameRequest
10215    {
10216        #[inline(always)]
10217        fn new_empty() -> Self {
10218            Self {
10219                frame: fidl::new_empty!(
10220                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FrameMarker>>,
10221                    fidl::encoding::DefaultFuchsiaResourceDialect
10222                ),
10223            }
10224        }
10225
10226        #[inline]
10227        unsafe fn decode(
10228            &mut self,
10229            decoder: &mut fidl::encoding::Decoder<
10230                '_,
10231                fidl::encoding::DefaultFuchsiaResourceDialect,
10232            >,
10233            offset: usize,
10234            _depth: fidl::encoding::Depth,
10235        ) -> fidl::Result<()> {
10236            decoder.debug_check_bounds::<Self>(offset);
10237            // Verify that padding bytes are zero.
10238            fidl::decode!(
10239                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FrameMarker>>,
10240                fidl::encoding::DefaultFuchsiaResourceDialect,
10241                &mut self.frame,
10242                decoder,
10243                offset + 0,
10244                _depth
10245            )?;
10246            Ok(())
10247        }
10248    }
10249
10250    impl fidl::encoding::ResourceTypeMarker for ContextCreateFrameWithParamsRequest {
10251        type Borrowed<'a> = &'a mut Self;
10252        fn take_or_borrow<'a>(
10253            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10254        ) -> Self::Borrowed<'a> {
10255            value
10256        }
10257    }
10258
10259    unsafe impl fidl::encoding::TypeMarker for ContextCreateFrameWithParamsRequest {
10260        type Owned = Self;
10261
10262        #[inline(always)]
10263        fn inline_align(_context: fidl::encoding::Context) -> usize {
10264            8
10265        }
10266
10267        #[inline(always)]
10268        fn inline_size(_context: fidl::encoding::Context) -> usize {
10269            24
10270        }
10271    }
10272
10273    unsafe impl
10274        fidl::encoding::Encode<
10275            ContextCreateFrameWithParamsRequest,
10276            fidl::encoding::DefaultFuchsiaResourceDialect,
10277        > for &mut ContextCreateFrameWithParamsRequest
10278    {
10279        #[inline]
10280        unsafe fn encode(
10281            self,
10282            encoder: &mut fidl::encoding::Encoder<
10283                '_,
10284                fidl::encoding::DefaultFuchsiaResourceDialect,
10285            >,
10286            offset: usize,
10287            _depth: fidl::encoding::Depth,
10288        ) -> fidl::Result<()> {
10289            encoder.debug_check_bounds::<ContextCreateFrameWithParamsRequest>(offset);
10290            // Delegate to tuple encoding.
10291            fidl::encoding::Encode::<ContextCreateFrameWithParamsRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10292                (
10293                    <CreateFrameParams as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.params),
10294                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FrameMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.frame),
10295                ),
10296                encoder, offset, _depth
10297            )
10298        }
10299    }
10300    unsafe impl<
10301            T0: fidl::encoding::Encode<
10302                CreateFrameParams,
10303                fidl::encoding::DefaultFuchsiaResourceDialect,
10304            >,
10305            T1: fidl::encoding::Encode<
10306                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FrameMarker>>,
10307                fidl::encoding::DefaultFuchsiaResourceDialect,
10308            >,
10309        >
10310        fidl::encoding::Encode<
10311            ContextCreateFrameWithParamsRequest,
10312            fidl::encoding::DefaultFuchsiaResourceDialect,
10313        > for (T0, T1)
10314    {
10315        #[inline]
10316        unsafe fn encode(
10317            self,
10318            encoder: &mut fidl::encoding::Encoder<
10319                '_,
10320                fidl::encoding::DefaultFuchsiaResourceDialect,
10321            >,
10322            offset: usize,
10323            depth: fidl::encoding::Depth,
10324        ) -> fidl::Result<()> {
10325            encoder.debug_check_bounds::<ContextCreateFrameWithParamsRequest>(offset);
10326            // Zero out padding regions. There's no need to apply masks
10327            // because the unmasked parts will be overwritten by fields.
10328            unsafe {
10329                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
10330                (ptr as *mut u64).write_unaligned(0);
10331            }
10332            // Write the fields.
10333            self.0.encode(encoder, offset + 0, depth)?;
10334            self.1.encode(encoder, offset + 16, depth)?;
10335            Ok(())
10336        }
10337    }
10338
10339    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10340        for ContextCreateFrameWithParamsRequest
10341    {
10342        #[inline(always)]
10343        fn new_empty() -> Self {
10344            Self {
10345                params: fidl::new_empty!(
10346                    CreateFrameParams,
10347                    fidl::encoding::DefaultFuchsiaResourceDialect
10348                ),
10349                frame: fidl::new_empty!(
10350                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FrameMarker>>,
10351                    fidl::encoding::DefaultFuchsiaResourceDialect
10352                ),
10353            }
10354        }
10355
10356        #[inline]
10357        unsafe fn decode(
10358            &mut self,
10359            decoder: &mut fidl::encoding::Decoder<
10360                '_,
10361                fidl::encoding::DefaultFuchsiaResourceDialect,
10362            >,
10363            offset: usize,
10364            _depth: fidl::encoding::Depth,
10365        ) -> fidl::Result<()> {
10366            decoder.debug_check_bounds::<Self>(offset);
10367            // Verify that padding bytes are zero.
10368            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
10369            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10370            let mask = 0xffffffff00000000u64;
10371            let maskedval = padval & mask;
10372            if maskedval != 0 {
10373                return Err(fidl::Error::NonZeroPadding {
10374                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
10375                });
10376            }
10377            fidl::decode!(
10378                CreateFrameParams,
10379                fidl::encoding::DefaultFuchsiaResourceDialect,
10380                &mut self.params,
10381                decoder,
10382                offset + 0,
10383                _depth
10384            )?;
10385            fidl::decode!(
10386                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FrameMarker>>,
10387                fidl::encoding::DefaultFuchsiaResourceDialect,
10388                &mut self.frame,
10389                decoder,
10390                offset + 16,
10391                _depth
10392            )?;
10393            Ok(())
10394        }
10395    }
10396
10397    impl fidl::encoding::ResourceTypeMarker for ContextGetCookieManagerRequest {
10398        type Borrowed<'a> = &'a mut Self;
10399        fn take_or_borrow<'a>(
10400            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10401        ) -> Self::Borrowed<'a> {
10402            value
10403        }
10404    }
10405
10406    unsafe impl fidl::encoding::TypeMarker for ContextGetCookieManagerRequest {
10407        type Owned = Self;
10408
10409        #[inline(always)]
10410        fn inline_align(_context: fidl::encoding::Context) -> usize {
10411            4
10412        }
10413
10414        #[inline(always)]
10415        fn inline_size(_context: fidl::encoding::Context) -> usize {
10416            4
10417        }
10418    }
10419
10420    unsafe impl
10421        fidl::encoding::Encode<
10422            ContextGetCookieManagerRequest,
10423            fidl::encoding::DefaultFuchsiaResourceDialect,
10424        > for &mut ContextGetCookieManagerRequest
10425    {
10426        #[inline]
10427        unsafe fn encode(
10428            self,
10429            encoder: &mut fidl::encoding::Encoder<
10430                '_,
10431                fidl::encoding::DefaultFuchsiaResourceDialect,
10432            >,
10433            offset: usize,
10434            _depth: fidl::encoding::Depth,
10435        ) -> fidl::Result<()> {
10436            encoder.debug_check_bounds::<ContextGetCookieManagerRequest>(offset);
10437            // Delegate to tuple encoding.
10438            fidl::encoding::Encode::<ContextGetCookieManagerRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10439                (
10440                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookieManagerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.manager),
10441                ),
10442                encoder, offset, _depth
10443            )
10444        }
10445    }
10446    unsafe impl<
10447            T0: fidl::encoding::Encode<
10448                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookieManagerMarker>>,
10449                fidl::encoding::DefaultFuchsiaResourceDialect,
10450            >,
10451        >
10452        fidl::encoding::Encode<
10453            ContextGetCookieManagerRequest,
10454            fidl::encoding::DefaultFuchsiaResourceDialect,
10455        > for (T0,)
10456    {
10457        #[inline]
10458        unsafe fn encode(
10459            self,
10460            encoder: &mut fidl::encoding::Encoder<
10461                '_,
10462                fidl::encoding::DefaultFuchsiaResourceDialect,
10463            >,
10464            offset: usize,
10465            depth: fidl::encoding::Depth,
10466        ) -> fidl::Result<()> {
10467            encoder.debug_check_bounds::<ContextGetCookieManagerRequest>(offset);
10468            // Zero out padding regions. There's no need to apply masks
10469            // because the unmasked parts will be overwritten by fields.
10470            // Write the fields.
10471            self.0.encode(encoder, offset + 0, depth)?;
10472            Ok(())
10473        }
10474    }
10475
10476    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10477        for ContextGetCookieManagerRequest
10478    {
10479        #[inline(always)]
10480        fn new_empty() -> Self {
10481            Self {
10482                manager: fidl::new_empty!(
10483                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookieManagerMarker>>,
10484                    fidl::encoding::DefaultFuchsiaResourceDialect
10485                ),
10486            }
10487        }
10488
10489        #[inline]
10490        unsafe fn decode(
10491            &mut self,
10492            decoder: &mut fidl::encoding::Decoder<
10493                '_,
10494                fidl::encoding::DefaultFuchsiaResourceDialect,
10495            >,
10496            offset: usize,
10497            _depth: fidl::encoding::Depth,
10498        ) -> fidl::Result<()> {
10499            decoder.debug_check_bounds::<Self>(offset);
10500            // Verify that padding bytes are zero.
10501            fidl::decode!(
10502                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookieManagerMarker>>,
10503                fidl::encoding::DefaultFuchsiaResourceDialect,
10504                &mut self.manager,
10505                decoder,
10506                offset + 0,
10507                _depth
10508            )?;
10509            Ok(())
10510        }
10511    }
10512
10513    impl fidl::encoding::ResourceTypeMarker for ContextProviderCreateRequest {
10514        type Borrowed<'a> = &'a mut Self;
10515        fn take_or_borrow<'a>(
10516            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10517        ) -> Self::Borrowed<'a> {
10518            value
10519        }
10520    }
10521
10522    unsafe impl fidl::encoding::TypeMarker for ContextProviderCreateRequest {
10523        type Owned = Self;
10524
10525        #[inline(always)]
10526        fn inline_align(_context: fidl::encoding::Context) -> usize {
10527            8
10528        }
10529
10530        #[inline(always)]
10531        fn inline_size(_context: fidl::encoding::Context) -> usize {
10532            24
10533        }
10534    }
10535
10536    unsafe impl
10537        fidl::encoding::Encode<
10538            ContextProviderCreateRequest,
10539            fidl::encoding::DefaultFuchsiaResourceDialect,
10540        > for &mut ContextProviderCreateRequest
10541    {
10542        #[inline]
10543        unsafe fn encode(
10544            self,
10545            encoder: &mut fidl::encoding::Encoder<
10546                '_,
10547                fidl::encoding::DefaultFuchsiaResourceDialect,
10548            >,
10549            offset: usize,
10550            _depth: fidl::encoding::Depth,
10551        ) -> fidl::Result<()> {
10552            encoder.debug_check_bounds::<ContextProviderCreateRequest>(offset);
10553            // Delegate to tuple encoding.
10554            fidl::encoding::Encode::<ContextProviderCreateRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10555                (
10556                    <CreateContextParams as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.params),
10557                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ContextMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.context),
10558                ),
10559                encoder, offset, _depth
10560            )
10561        }
10562    }
10563    unsafe impl<
10564            T0: fidl::encoding::Encode<
10565                CreateContextParams,
10566                fidl::encoding::DefaultFuchsiaResourceDialect,
10567            >,
10568            T1: fidl::encoding::Encode<
10569                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ContextMarker>>,
10570                fidl::encoding::DefaultFuchsiaResourceDialect,
10571            >,
10572        >
10573        fidl::encoding::Encode<
10574            ContextProviderCreateRequest,
10575            fidl::encoding::DefaultFuchsiaResourceDialect,
10576        > for (T0, T1)
10577    {
10578        #[inline]
10579        unsafe fn encode(
10580            self,
10581            encoder: &mut fidl::encoding::Encoder<
10582                '_,
10583                fidl::encoding::DefaultFuchsiaResourceDialect,
10584            >,
10585            offset: usize,
10586            depth: fidl::encoding::Depth,
10587        ) -> fidl::Result<()> {
10588            encoder.debug_check_bounds::<ContextProviderCreateRequest>(offset);
10589            // Zero out padding regions. There's no need to apply masks
10590            // because the unmasked parts will be overwritten by fields.
10591            unsafe {
10592                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
10593                (ptr as *mut u64).write_unaligned(0);
10594            }
10595            // Write the fields.
10596            self.0.encode(encoder, offset + 0, depth)?;
10597            self.1.encode(encoder, offset + 16, depth)?;
10598            Ok(())
10599        }
10600    }
10601
10602    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10603        for ContextProviderCreateRequest
10604    {
10605        #[inline(always)]
10606        fn new_empty() -> Self {
10607            Self {
10608                params: fidl::new_empty!(
10609                    CreateContextParams,
10610                    fidl::encoding::DefaultFuchsiaResourceDialect
10611                ),
10612                context: fidl::new_empty!(
10613                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ContextMarker>>,
10614                    fidl::encoding::DefaultFuchsiaResourceDialect
10615                ),
10616            }
10617        }
10618
10619        #[inline]
10620        unsafe fn decode(
10621            &mut self,
10622            decoder: &mut fidl::encoding::Decoder<
10623                '_,
10624                fidl::encoding::DefaultFuchsiaResourceDialect,
10625            >,
10626            offset: usize,
10627            _depth: fidl::encoding::Depth,
10628        ) -> fidl::Result<()> {
10629            decoder.debug_check_bounds::<Self>(offset);
10630            // Verify that padding bytes are zero.
10631            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
10632            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10633            let mask = 0xffffffff00000000u64;
10634            let maskedval = padval & mask;
10635            if maskedval != 0 {
10636                return Err(fidl::Error::NonZeroPadding {
10637                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
10638                });
10639            }
10640            fidl::decode!(
10641                CreateContextParams,
10642                fidl::encoding::DefaultFuchsiaResourceDialect,
10643                &mut self.params,
10644                decoder,
10645                offset + 0,
10646                _depth
10647            )?;
10648            fidl::decode!(
10649                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ContextMarker>>,
10650                fidl::encoding::DefaultFuchsiaResourceDialect,
10651                &mut self.context,
10652                decoder,
10653                offset + 16,
10654                _depth
10655            )?;
10656            Ok(())
10657        }
10658    }
10659
10660    impl fidl::encoding::ResourceTypeMarker for CookieManagerGetCookieListRequest {
10661        type Borrowed<'a> = &'a mut Self;
10662        fn take_or_borrow<'a>(
10663            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10664        ) -> Self::Borrowed<'a> {
10665            value
10666        }
10667    }
10668
10669    unsafe impl fidl::encoding::TypeMarker for CookieManagerGetCookieListRequest {
10670        type Owned = Self;
10671
10672        #[inline(always)]
10673        fn inline_align(_context: fidl::encoding::Context) -> usize {
10674            8
10675        }
10676
10677        #[inline(always)]
10678        fn inline_size(_context: fidl::encoding::Context) -> usize {
10679            40
10680        }
10681    }
10682
10683    unsafe impl
10684        fidl::encoding::Encode<
10685            CookieManagerGetCookieListRequest,
10686            fidl::encoding::DefaultFuchsiaResourceDialect,
10687        > for &mut CookieManagerGetCookieListRequest
10688    {
10689        #[inline]
10690        unsafe fn encode(
10691            self,
10692            encoder: &mut fidl::encoding::Encoder<
10693                '_,
10694                fidl::encoding::DefaultFuchsiaResourceDialect,
10695            >,
10696            offset: usize,
10697            _depth: fidl::encoding::Depth,
10698        ) -> fidl::Result<()> {
10699            encoder.debug_check_bounds::<CookieManagerGetCookieListRequest>(offset);
10700            // Delegate to tuple encoding.
10701            fidl::encoding::Encode::<CookieManagerGetCookieListRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10702                (
10703                    <fidl::encoding::Optional<fidl::encoding::BoundedString<65536>> as fidl::encoding::ValueTypeMarker>::borrow(&self.url),
10704                    <fidl::encoding::Optional<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
10705                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookiesIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.cookies),
10706                ),
10707                encoder, offset, _depth
10708            )
10709        }
10710    }
10711    unsafe impl<
10712            T0: fidl::encoding::Encode<
10713                fidl::encoding::Optional<fidl::encoding::BoundedString<65536>>,
10714                fidl::encoding::DefaultFuchsiaResourceDialect,
10715            >,
10716            T1: fidl::encoding::Encode<
10717                fidl::encoding::Optional<fidl::encoding::UnboundedString>,
10718                fidl::encoding::DefaultFuchsiaResourceDialect,
10719            >,
10720            T2: fidl::encoding::Encode<
10721                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookiesIteratorMarker>>,
10722                fidl::encoding::DefaultFuchsiaResourceDialect,
10723            >,
10724        >
10725        fidl::encoding::Encode<
10726            CookieManagerGetCookieListRequest,
10727            fidl::encoding::DefaultFuchsiaResourceDialect,
10728        > for (T0, T1, T2)
10729    {
10730        #[inline]
10731        unsafe fn encode(
10732            self,
10733            encoder: &mut fidl::encoding::Encoder<
10734                '_,
10735                fidl::encoding::DefaultFuchsiaResourceDialect,
10736            >,
10737            offset: usize,
10738            depth: fidl::encoding::Depth,
10739        ) -> fidl::Result<()> {
10740            encoder.debug_check_bounds::<CookieManagerGetCookieListRequest>(offset);
10741            // Zero out padding regions. There's no need to apply masks
10742            // because the unmasked parts will be overwritten by fields.
10743            unsafe {
10744                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
10745                (ptr as *mut u64).write_unaligned(0);
10746            }
10747            // Write the fields.
10748            self.0.encode(encoder, offset + 0, depth)?;
10749            self.1.encode(encoder, offset + 16, depth)?;
10750            self.2.encode(encoder, offset + 32, depth)?;
10751            Ok(())
10752        }
10753    }
10754
10755    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10756        for CookieManagerGetCookieListRequest
10757    {
10758        #[inline(always)]
10759        fn new_empty() -> Self {
10760            Self {
10761                url: fidl::new_empty!(
10762                    fidl::encoding::Optional<fidl::encoding::BoundedString<65536>>,
10763                    fidl::encoding::DefaultFuchsiaResourceDialect
10764                ),
10765                name: fidl::new_empty!(
10766                    fidl::encoding::Optional<fidl::encoding::UnboundedString>,
10767                    fidl::encoding::DefaultFuchsiaResourceDialect
10768                ),
10769                cookies: fidl::new_empty!(
10770                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookiesIteratorMarker>>,
10771                    fidl::encoding::DefaultFuchsiaResourceDialect
10772                ),
10773            }
10774        }
10775
10776        #[inline]
10777        unsafe fn decode(
10778            &mut self,
10779            decoder: &mut fidl::encoding::Decoder<
10780                '_,
10781                fidl::encoding::DefaultFuchsiaResourceDialect,
10782            >,
10783            offset: usize,
10784            _depth: fidl::encoding::Depth,
10785        ) -> fidl::Result<()> {
10786            decoder.debug_check_bounds::<Self>(offset);
10787            // Verify that padding bytes are zero.
10788            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
10789            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10790            let mask = 0xffffffff00000000u64;
10791            let maskedval = padval & mask;
10792            if maskedval != 0 {
10793                return Err(fidl::Error::NonZeroPadding {
10794                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
10795                });
10796            }
10797            fidl::decode!(
10798                fidl::encoding::Optional<fidl::encoding::BoundedString<65536>>,
10799                fidl::encoding::DefaultFuchsiaResourceDialect,
10800                &mut self.url,
10801                decoder,
10802                offset + 0,
10803                _depth
10804            )?;
10805            fidl::decode!(
10806                fidl::encoding::Optional<fidl::encoding::UnboundedString>,
10807                fidl::encoding::DefaultFuchsiaResourceDialect,
10808                &mut self.name,
10809                decoder,
10810                offset + 16,
10811                _depth
10812            )?;
10813            fidl::decode!(
10814                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookiesIteratorMarker>>,
10815                fidl::encoding::DefaultFuchsiaResourceDialect,
10816                &mut self.cookies,
10817                decoder,
10818                offset + 32,
10819                _depth
10820            )?;
10821            Ok(())
10822        }
10823    }
10824
10825    impl fidl::encoding::ResourceTypeMarker for CookieManagerObserveCookieChangesRequest {
10826        type Borrowed<'a> = &'a mut Self;
10827        fn take_or_borrow<'a>(
10828            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10829        ) -> Self::Borrowed<'a> {
10830            value
10831        }
10832    }
10833
10834    unsafe impl fidl::encoding::TypeMarker for CookieManagerObserveCookieChangesRequest {
10835        type Owned = Self;
10836
10837        #[inline(always)]
10838        fn inline_align(_context: fidl::encoding::Context) -> usize {
10839            8
10840        }
10841
10842        #[inline(always)]
10843        fn inline_size(_context: fidl::encoding::Context) -> usize {
10844            40
10845        }
10846    }
10847
10848    unsafe impl
10849        fidl::encoding::Encode<
10850            CookieManagerObserveCookieChangesRequest,
10851            fidl::encoding::DefaultFuchsiaResourceDialect,
10852        > for &mut CookieManagerObserveCookieChangesRequest
10853    {
10854        #[inline]
10855        unsafe fn encode(
10856            self,
10857            encoder: &mut fidl::encoding::Encoder<
10858                '_,
10859                fidl::encoding::DefaultFuchsiaResourceDialect,
10860            >,
10861            offset: usize,
10862            _depth: fidl::encoding::Depth,
10863        ) -> fidl::Result<()> {
10864            encoder.debug_check_bounds::<CookieManagerObserveCookieChangesRequest>(offset);
10865            // Delegate to tuple encoding.
10866            fidl::encoding::Encode::<CookieManagerObserveCookieChangesRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10867                (
10868                    <fidl::encoding::Optional<fidl::encoding::BoundedString<65536>> as fidl::encoding::ValueTypeMarker>::borrow(&self.url),
10869                    <fidl::encoding::Optional<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
10870                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookiesIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.changes),
10871                ),
10872                encoder, offset, _depth
10873            )
10874        }
10875    }
10876    unsafe impl<
10877            T0: fidl::encoding::Encode<
10878                fidl::encoding::Optional<fidl::encoding::BoundedString<65536>>,
10879                fidl::encoding::DefaultFuchsiaResourceDialect,
10880            >,
10881            T1: fidl::encoding::Encode<
10882                fidl::encoding::Optional<fidl::encoding::UnboundedString>,
10883                fidl::encoding::DefaultFuchsiaResourceDialect,
10884            >,
10885            T2: fidl::encoding::Encode<
10886                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookiesIteratorMarker>>,
10887                fidl::encoding::DefaultFuchsiaResourceDialect,
10888            >,
10889        >
10890        fidl::encoding::Encode<
10891            CookieManagerObserveCookieChangesRequest,
10892            fidl::encoding::DefaultFuchsiaResourceDialect,
10893        > for (T0, T1, T2)
10894    {
10895        #[inline]
10896        unsafe fn encode(
10897            self,
10898            encoder: &mut fidl::encoding::Encoder<
10899                '_,
10900                fidl::encoding::DefaultFuchsiaResourceDialect,
10901            >,
10902            offset: usize,
10903            depth: fidl::encoding::Depth,
10904        ) -> fidl::Result<()> {
10905            encoder.debug_check_bounds::<CookieManagerObserveCookieChangesRequest>(offset);
10906            // Zero out padding regions. There's no need to apply masks
10907            // because the unmasked parts will be overwritten by fields.
10908            unsafe {
10909                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
10910                (ptr as *mut u64).write_unaligned(0);
10911            }
10912            // Write the fields.
10913            self.0.encode(encoder, offset + 0, depth)?;
10914            self.1.encode(encoder, offset + 16, depth)?;
10915            self.2.encode(encoder, offset + 32, depth)?;
10916            Ok(())
10917        }
10918    }
10919
10920    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10921        for CookieManagerObserveCookieChangesRequest
10922    {
10923        #[inline(always)]
10924        fn new_empty() -> Self {
10925            Self {
10926                url: fidl::new_empty!(
10927                    fidl::encoding::Optional<fidl::encoding::BoundedString<65536>>,
10928                    fidl::encoding::DefaultFuchsiaResourceDialect
10929                ),
10930                name: fidl::new_empty!(
10931                    fidl::encoding::Optional<fidl::encoding::UnboundedString>,
10932                    fidl::encoding::DefaultFuchsiaResourceDialect
10933                ),
10934                changes: fidl::new_empty!(
10935                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookiesIteratorMarker>>,
10936                    fidl::encoding::DefaultFuchsiaResourceDialect
10937                ),
10938            }
10939        }
10940
10941        #[inline]
10942        unsafe fn decode(
10943            &mut self,
10944            decoder: &mut fidl::encoding::Decoder<
10945                '_,
10946                fidl::encoding::DefaultFuchsiaResourceDialect,
10947            >,
10948            offset: usize,
10949            _depth: fidl::encoding::Depth,
10950        ) -> fidl::Result<()> {
10951            decoder.debug_check_bounds::<Self>(offset);
10952            // Verify that padding bytes are zero.
10953            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
10954            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10955            let mask = 0xffffffff00000000u64;
10956            let maskedval = padval & mask;
10957            if maskedval != 0 {
10958                return Err(fidl::Error::NonZeroPadding {
10959                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
10960                });
10961            }
10962            fidl::decode!(
10963                fidl::encoding::Optional<fidl::encoding::BoundedString<65536>>,
10964                fidl::encoding::DefaultFuchsiaResourceDialect,
10965                &mut self.url,
10966                decoder,
10967                offset + 0,
10968                _depth
10969            )?;
10970            fidl::decode!(
10971                fidl::encoding::Optional<fidl::encoding::UnboundedString>,
10972                fidl::encoding::DefaultFuchsiaResourceDialect,
10973                &mut self.name,
10974                decoder,
10975                offset + 16,
10976                _depth
10977            )?;
10978            fidl::decode!(
10979                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookiesIteratorMarker>>,
10980                fidl::encoding::DefaultFuchsiaResourceDialect,
10981                &mut self.changes,
10982                decoder,
10983                offset + 32,
10984                _depth
10985            )?;
10986            Ok(())
10987        }
10988    }
10989
10990    impl fidl::encoding::ResourceTypeMarker for CookiesIteratorGetNextResponse {
10991        type Borrowed<'a> = &'a mut Self;
10992        fn take_or_borrow<'a>(
10993            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10994        ) -> Self::Borrowed<'a> {
10995            value
10996        }
10997    }
10998
10999    unsafe impl fidl::encoding::TypeMarker for CookiesIteratorGetNextResponse {
11000        type Owned = Self;
11001
11002        #[inline(always)]
11003        fn inline_align(_context: fidl::encoding::Context) -> usize {
11004            8
11005        }
11006
11007        #[inline(always)]
11008        fn inline_size(_context: fidl::encoding::Context) -> usize {
11009            16
11010        }
11011    }
11012
11013    unsafe impl
11014        fidl::encoding::Encode<
11015            CookiesIteratorGetNextResponse,
11016            fidl::encoding::DefaultFuchsiaResourceDialect,
11017        > for &mut CookiesIteratorGetNextResponse
11018    {
11019        #[inline]
11020        unsafe fn encode(
11021            self,
11022            encoder: &mut fidl::encoding::Encoder<
11023                '_,
11024                fidl::encoding::DefaultFuchsiaResourceDialect,
11025            >,
11026            offset: usize,
11027            _depth: fidl::encoding::Depth,
11028        ) -> fidl::Result<()> {
11029            encoder.debug_check_bounds::<CookiesIteratorGetNextResponse>(offset);
11030            // Delegate to tuple encoding.
11031            fidl::encoding::Encode::<CookiesIteratorGetNextResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11032                (
11033                    <fidl::encoding::UnboundedVector<Cookie> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.changed_cookies),
11034                ),
11035                encoder, offset, _depth
11036            )
11037        }
11038    }
11039    unsafe impl<
11040            T0: fidl::encoding::Encode<
11041                fidl::encoding::UnboundedVector<Cookie>,
11042                fidl::encoding::DefaultFuchsiaResourceDialect,
11043            >,
11044        >
11045        fidl::encoding::Encode<
11046            CookiesIteratorGetNextResponse,
11047            fidl::encoding::DefaultFuchsiaResourceDialect,
11048        > for (T0,)
11049    {
11050        #[inline]
11051        unsafe fn encode(
11052            self,
11053            encoder: &mut fidl::encoding::Encoder<
11054                '_,
11055                fidl::encoding::DefaultFuchsiaResourceDialect,
11056            >,
11057            offset: usize,
11058            depth: fidl::encoding::Depth,
11059        ) -> fidl::Result<()> {
11060            encoder.debug_check_bounds::<CookiesIteratorGetNextResponse>(offset);
11061            // Zero out padding regions. There's no need to apply masks
11062            // because the unmasked parts will be overwritten by fields.
11063            // Write the fields.
11064            self.0.encode(encoder, offset + 0, depth)?;
11065            Ok(())
11066        }
11067    }
11068
11069    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11070        for CookiesIteratorGetNextResponse
11071    {
11072        #[inline(always)]
11073        fn new_empty() -> Self {
11074            Self {
11075                changed_cookies: fidl::new_empty!(
11076                    fidl::encoding::UnboundedVector<Cookie>,
11077                    fidl::encoding::DefaultFuchsiaResourceDialect
11078                ),
11079            }
11080        }
11081
11082        #[inline]
11083        unsafe fn decode(
11084            &mut self,
11085            decoder: &mut fidl::encoding::Decoder<
11086                '_,
11087                fidl::encoding::DefaultFuchsiaResourceDialect,
11088            >,
11089            offset: usize,
11090            _depth: fidl::encoding::Depth,
11091        ) -> fidl::Result<()> {
11092            decoder.debug_check_bounds::<Self>(offset);
11093            // Verify that padding bytes are zero.
11094            fidl::decode!(
11095                fidl::encoding::UnboundedVector<Cookie>,
11096                fidl::encoding::DefaultFuchsiaResourceDialect,
11097                &mut self.changed_cookies,
11098                decoder,
11099                offset + 0,
11100                _depth
11101            )?;
11102            Ok(())
11103        }
11104    }
11105
11106    impl fidl::encoding::ResourceTypeMarker for DebugEnableDevToolsRequest {
11107        type Borrowed<'a> = &'a mut Self;
11108        fn take_or_borrow<'a>(
11109            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11110        ) -> Self::Borrowed<'a> {
11111            value
11112        }
11113    }
11114
11115    unsafe impl fidl::encoding::TypeMarker for DebugEnableDevToolsRequest {
11116        type Owned = Self;
11117
11118        #[inline(always)]
11119        fn inline_align(_context: fidl::encoding::Context) -> usize {
11120            4
11121        }
11122
11123        #[inline(always)]
11124        fn inline_size(_context: fidl::encoding::Context) -> usize {
11125            4
11126        }
11127    }
11128
11129    unsafe impl
11130        fidl::encoding::Encode<
11131            DebugEnableDevToolsRequest,
11132            fidl::encoding::DefaultFuchsiaResourceDialect,
11133        > for &mut DebugEnableDevToolsRequest
11134    {
11135        #[inline]
11136        unsafe fn encode(
11137            self,
11138            encoder: &mut fidl::encoding::Encoder<
11139                '_,
11140                fidl::encoding::DefaultFuchsiaResourceDialect,
11141            >,
11142            offset: usize,
11143            _depth: fidl::encoding::Depth,
11144        ) -> fidl::Result<()> {
11145            encoder.debug_check_bounds::<DebugEnableDevToolsRequest>(offset);
11146            // Delegate to tuple encoding.
11147            fidl::encoding::Encode::<DebugEnableDevToolsRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11148                (
11149                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DevToolsListenerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.listener),
11150                ),
11151                encoder, offset, _depth
11152            )
11153        }
11154    }
11155    unsafe impl<
11156            T0: fidl::encoding::Encode<
11157                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DevToolsListenerMarker>>,
11158                fidl::encoding::DefaultFuchsiaResourceDialect,
11159            >,
11160        >
11161        fidl::encoding::Encode<
11162            DebugEnableDevToolsRequest,
11163            fidl::encoding::DefaultFuchsiaResourceDialect,
11164        > for (T0,)
11165    {
11166        #[inline]
11167        unsafe fn encode(
11168            self,
11169            encoder: &mut fidl::encoding::Encoder<
11170                '_,
11171                fidl::encoding::DefaultFuchsiaResourceDialect,
11172            >,
11173            offset: usize,
11174            depth: fidl::encoding::Depth,
11175        ) -> fidl::Result<()> {
11176            encoder.debug_check_bounds::<DebugEnableDevToolsRequest>(offset);
11177            // Zero out padding regions. There's no need to apply masks
11178            // because the unmasked parts will be overwritten by fields.
11179            // Write the fields.
11180            self.0.encode(encoder, offset + 0, depth)?;
11181            Ok(())
11182        }
11183    }
11184
11185    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11186        for DebugEnableDevToolsRequest
11187    {
11188        #[inline(always)]
11189        fn new_empty() -> Self {
11190            Self {
11191                listener: fidl::new_empty!(
11192                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DevToolsListenerMarker>>,
11193                    fidl::encoding::DefaultFuchsiaResourceDialect
11194                ),
11195            }
11196        }
11197
11198        #[inline]
11199        unsafe fn decode(
11200            &mut self,
11201            decoder: &mut fidl::encoding::Decoder<
11202                '_,
11203                fidl::encoding::DefaultFuchsiaResourceDialect,
11204            >,
11205            offset: usize,
11206            _depth: fidl::encoding::Depth,
11207        ) -> fidl::Result<()> {
11208            decoder.debug_check_bounds::<Self>(offset);
11209            // Verify that padding bytes are zero.
11210            fidl::decode!(
11211                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DevToolsListenerMarker>>,
11212                fidl::encoding::DefaultFuchsiaResourceDialect,
11213                &mut self.listener,
11214                decoder,
11215                offset + 0,
11216                _depth
11217            )?;
11218            Ok(())
11219        }
11220    }
11221
11222    impl fidl::encoding::ResourceTypeMarker for DevToolsListenerOnContextDevToolsAvailableRequest {
11223        type Borrowed<'a> = &'a mut Self;
11224        fn take_or_borrow<'a>(
11225            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11226        ) -> Self::Borrowed<'a> {
11227            value
11228        }
11229    }
11230
11231    unsafe impl fidl::encoding::TypeMarker for DevToolsListenerOnContextDevToolsAvailableRequest {
11232        type Owned = Self;
11233
11234        #[inline(always)]
11235        fn inline_align(_context: fidl::encoding::Context) -> usize {
11236            4
11237        }
11238
11239        #[inline(always)]
11240        fn inline_size(_context: fidl::encoding::Context) -> usize {
11241            4
11242        }
11243    }
11244
11245    unsafe impl
11246        fidl::encoding::Encode<
11247            DevToolsListenerOnContextDevToolsAvailableRequest,
11248            fidl::encoding::DefaultFuchsiaResourceDialect,
11249        > for &mut DevToolsListenerOnContextDevToolsAvailableRequest
11250    {
11251        #[inline]
11252        unsafe fn encode(
11253            self,
11254            encoder: &mut fidl::encoding::Encoder<
11255                '_,
11256                fidl::encoding::DefaultFuchsiaResourceDialect,
11257            >,
11258            offset: usize,
11259            _depth: fidl::encoding::Depth,
11260        ) -> fidl::Result<()> {
11261            encoder.debug_check_bounds::<DevToolsListenerOnContextDevToolsAvailableRequest>(offset);
11262            // Delegate to tuple encoding.
11263            fidl::encoding::Encode::<
11264                DevToolsListenerOnContextDevToolsAvailableRequest,
11265                fidl::encoding::DefaultFuchsiaResourceDialect,
11266            >::encode(
11267                (<fidl::encoding::Endpoint<
11268                    fidl::endpoints::ServerEnd<DevToolsPerContextListenerMarker>,
11269                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11270                    &mut self.listener
11271                ),),
11272                encoder,
11273                offset,
11274                _depth,
11275            )
11276        }
11277    }
11278    unsafe impl<
11279            T0: fidl::encoding::Encode<
11280                fidl::encoding::Endpoint<
11281                    fidl::endpoints::ServerEnd<DevToolsPerContextListenerMarker>,
11282                >,
11283                fidl::encoding::DefaultFuchsiaResourceDialect,
11284            >,
11285        >
11286        fidl::encoding::Encode<
11287            DevToolsListenerOnContextDevToolsAvailableRequest,
11288            fidl::encoding::DefaultFuchsiaResourceDialect,
11289        > for (T0,)
11290    {
11291        #[inline]
11292        unsafe fn encode(
11293            self,
11294            encoder: &mut fidl::encoding::Encoder<
11295                '_,
11296                fidl::encoding::DefaultFuchsiaResourceDialect,
11297            >,
11298            offset: usize,
11299            depth: fidl::encoding::Depth,
11300        ) -> fidl::Result<()> {
11301            encoder.debug_check_bounds::<DevToolsListenerOnContextDevToolsAvailableRequest>(offset);
11302            // Zero out padding regions. There's no need to apply masks
11303            // because the unmasked parts will be overwritten by fields.
11304            // Write the fields.
11305            self.0.encode(encoder, offset + 0, depth)?;
11306            Ok(())
11307        }
11308    }
11309
11310    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11311        for DevToolsListenerOnContextDevToolsAvailableRequest
11312    {
11313        #[inline(always)]
11314        fn new_empty() -> Self {
11315            Self {
11316                listener: fidl::new_empty!(
11317                    fidl::encoding::Endpoint<
11318                        fidl::endpoints::ServerEnd<DevToolsPerContextListenerMarker>,
11319                    >,
11320                    fidl::encoding::DefaultFuchsiaResourceDialect
11321                ),
11322            }
11323        }
11324
11325        #[inline]
11326        unsafe fn decode(
11327            &mut self,
11328            decoder: &mut fidl::encoding::Decoder<
11329                '_,
11330                fidl::encoding::DefaultFuchsiaResourceDialect,
11331            >,
11332            offset: usize,
11333            _depth: fidl::encoding::Depth,
11334        ) -> fidl::Result<()> {
11335            decoder.debug_check_bounds::<Self>(offset);
11336            // Verify that padding bytes are zero.
11337            fidl::decode!(
11338                fidl::encoding::Endpoint<
11339                    fidl::endpoints::ServerEnd<DevToolsPerContextListenerMarker>,
11340                >,
11341                fidl::encoding::DefaultFuchsiaResourceDialect,
11342                &mut self.listener,
11343                decoder,
11344                offset + 0,
11345                _depth
11346            )?;
11347            Ok(())
11348        }
11349    }
11350
11351    impl fidl::encoding::ResourceTypeMarker for FrameAddBeforeLoadJavaScriptRequest {
11352        type Borrowed<'a> = &'a mut Self;
11353        fn take_or_borrow<'a>(
11354            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11355        ) -> Self::Borrowed<'a> {
11356            value
11357        }
11358    }
11359
11360    unsafe impl fidl::encoding::TypeMarker for FrameAddBeforeLoadJavaScriptRequest {
11361        type Owned = Self;
11362
11363        #[inline(always)]
11364        fn inline_align(_context: fidl::encoding::Context) -> usize {
11365            8
11366        }
11367
11368        #[inline(always)]
11369        fn inline_size(_context: fidl::encoding::Context) -> usize {
11370            40
11371        }
11372    }
11373
11374    unsafe impl
11375        fidl::encoding::Encode<
11376            FrameAddBeforeLoadJavaScriptRequest,
11377            fidl::encoding::DefaultFuchsiaResourceDialect,
11378        > for &mut FrameAddBeforeLoadJavaScriptRequest
11379    {
11380        #[inline]
11381        unsafe fn encode(
11382            self,
11383            encoder: &mut fidl::encoding::Encoder<
11384                '_,
11385                fidl::encoding::DefaultFuchsiaResourceDialect,
11386            >,
11387            offset: usize,
11388            _depth: fidl::encoding::Depth,
11389        ) -> fidl::Result<()> {
11390            encoder.debug_check_bounds::<FrameAddBeforeLoadJavaScriptRequest>(offset);
11391            // Delegate to tuple encoding.
11392            fidl::encoding::Encode::<FrameAddBeforeLoadJavaScriptRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11393                (
11394                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
11395                    <fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>> as fidl::encoding::ValueTypeMarker>::borrow(&self.origins),
11396                    <fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.script),
11397                ),
11398                encoder, offset, _depth
11399            )
11400        }
11401    }
11402    unsafe impl<
11403            T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
11404            T1: fidl::encoding::Encode<
11405                fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>>,
11406                fidl::encoding::DefaultFuchsiaResourceDialect,
11407            >,
11408            T2: fidl::encoding::Encode<
11409                fidl_fuchsia_mem::Buffer,
11410                fidl::encoding::DefaultFuchsiaResourceDialect,
11411            >,
11412        >
11413        fidl::encoding::Encode<
11414            FrameAddBeforeLoadJavaScriptRequest,
11415            fidl::encoding::DefaultFuchsiaResourceDialect,
11416        > for (T0, T1, T2)
11417    {
11418        #[inline]
11419        unsafe fn encode(
11420            self,
11421            encoder: &mut fidl::encoding::Encoder<
11422                '_,
11423                fidl::encoding::DefaultFuchsiaResourceDialect,
11424            >,
11425            offset: usize,
11426            depth: fidl::encoding::Depth,
11427        ) -> fidl::Result<()> {
11428            encoder.debug_check_bounds::<FrameAddBeforeLoadJavaScriptRequest>(offset);
11429            // Zero out padding regions. There's no need to apply masks
11430            // because the unmasked parts will be overwritten by fields.
11431            // Write the fields.
11432            self.0.encode(encoder, offset + 0, depth)?;
11433            self.1.encode(encoder, offset + 8, depth)?;
11434            self.2.encode(encoder, offset + 24, depth)?;
11435            Ok(())
11436        }
11437    }
11438
11439    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11440        for FrameAddBeforeLoadJavaScriptRequest
11441    {
11442        #[inline(always)]
11443        fn new_empty() -> Self {
11444            Self {
11445                id: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
11446                origins: fidl::new_empty!(
11447                    fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>>,
11448                    fidl::encoding::DefaultFuchsiaResourceDialect
11449                ),
11450                script: fidl::new_empty!(
11451                    fidl_fuchsia_mem::Buffer,
11452                    fidl::encoding::DefaultFuchsiaResourceDialect
11453                ),
11454            }
11455        }
11456
11457        #[inline]
11458        unsafe fn decode(
11459            &mut self,
11460            decoder: &mut fidl::encoding::Decoder<
11461                '_,
11462                fidl::encoding::DefaultFuchsiaResourceDialect,
11463            >,
11464            offset: usize,
11465            _depth: fidl::encoding::Depth,
11466        ) -> fidl::Result<()> {
11467            decoder.debug_check_bounds::<Self>(offset);
11468            // Verify that padding bytes are zero.
11469            fidl::decode!(
11470                u64,
11471                fidl::encoding::DefaultFuchsiaResourceDialect,
11472                &mut self.id,
11473                decoder,
11474                offset + 0,
11475                _depth
11476            )?;
11477            fidl::decode!(
11478                fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>>,
11479                fidl::encoding::DefaultFuchsiaResourceDialect,
11480                &mut self.origins,
11481                decoder,
11482                offset + 8,
11483                _depth
11484            )?;
11485            fidl::decode!(
11486                fidl_fuchsia_mem::Buffer,
11487                fidl::encoding::DefaultFuchsiaResourceDialect,
11488                &mut self.script,
11489                decoder,
11490                offset + 24,
11491                _depth
11492            )?;
11493            Ok(())
11494        }
11495    }
11496
11497    impl fidl::encoding::ResourceTypeMarker for FrameCreateView2Request {
11498        type Borrowed<'a> = &'a mut Self;
11499        fn take_or_borrow<'a>(
11500            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11501        ) -> Self::Borrowed<'a> {
11502            value
11503        }
11504    }
11505
11506    unsafe impl fidl::encoding::TypeMarker for FrameCreateView2Request {
11507        type Owned = Self;
11508
11509        #[inline(always)]
11510        fn inline_align(_context: fidl::encoding::Context) -> usize {
11511            8
11512        }
11513
11514        #[inline(always)]
11515        fn inline_size(_context: fidl::encoding::Context) -> usize {
11516            16
11517        }
11518    }
11519
11520    unsafe impl
11521        fidl::encoding::Encode<
11522            FrameCreateView2Request,
11523            fidl::encoding::DefaultFuchsiaResourceDialect,
11524        > for &mut FrameCreateView2Request
11525    {
11526        #[inline]
11527        unsafe fn encode(
11528            self,
11529            encoder: &mut fidl::encoding::Encoder<
11530                '_,
11531                fidl::encoding::DefaultFuchsiaResourceDialect,
11532            >,
11533            offset: usize,
11534            _depth: fidl::encoding::Depth,
11535        ) -> fidl::Result<()> {
11536            encoder.debug_check_bounds::<FrameCreateView2Request>(offset);
11537            // Delegate to tuple encoding.
11538            fidl::encoding::Encode::<
11539                FrameCreateView2Request,
11540                fidl::encoding::DefaultFuchsiaResourceDialect,
11541            >::encode(
11542                (<CreateView2Args as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11543                    &mut self.args,
11544                ),),
11545                encoder,
11546                offset,
11547                _depth,
11548            )
11549        }
11550    }
11551    unsafe impl<
11552            T0: fidl::encoding::Encode<CreateView2Args, fidl::encoding::DefaultFuchsiaResourceDialect>,
11553        >
11554        fidl::encoding::Encode<
11555            FrameCreateView2Request,
11556            fidl::encoding::DefaultFuchsiaResourceDialect,
11557        > for (T0,)
11558    {
11559        #[inline]
11560        unsafe fn encode(
11561            self,
11562            encoder: &mut fidl::encoding::Encoder<
11563                '_,
11564                fidl::encoding::DefaultFuchsiaResourceDialect,
11565            >,
11566            offset: usize,
11567            depth: fidl::encoding::Depth,
11568        ) -> fidl::Result<()> {
11569            encoder.debug_check_bounds::<FrameCreateView2Request>(offset);
11570            // Zero out padding regions. There's no need to apply masks
11571            // because the unmasked parts will be overwritten by fields.
11572            // Write the fields.
11573            self.0.encode(encoder, offset + 0, depth)?;
11574            Ok(())
11575        }
11576    }
11577
11578    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11579        for FrameCreateView2Request
11580    {
11581        #[inline(always)]
11582        fn new_empty() -> Self {
11583            Self {
11584                args: fidl::new_empty!(
11585                    CreateView2Args,
11586                    fidl::encoding::DefaultFuchsiaResourceDialect
11587                ),
11588            }
11589        }
11590
11591        #[inline]
11592        unsafe fn decode(
11593            &mut self,
11594            decoder: &mut fidl::encoding::Decoder<
11595                '_,
11596                fidl::encoding::DefaultFuchsiaResourceDialect,
11597            >,
11598            offset: usize,
11599            _depth: fidl::encoding::Depth,
11600        ) -> fidl::Result<()> {
11601            decoder.debug_check_bounds::<Self>(offset);
11602            // Verify that padding bytes are zero.
11603            fidl::decode!(
11604                CreateView2Args,
11605                fidl::encoding::DefaultFuchsiaResourceDialect,
11606                &mut self.args,
11607                decoder,
11608                offset + 0,
11609                _depth
11610            )?;
11611            Ok(())
11612        }
11613    }
11614
11615    impl fidl::encoding::ResourceTypeMarker for FrameCreateViewRequest {
11616        type Borrowed<'a> = &'a mut Self;
11617        fn take_or_borrow<'a>(
11618            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11619        ) -> Self::Borrowed<'a> {
11620            value
11621        }
11622    }
11623
11624    unsafe impl fidl::encoding::TypeMarker for FrameCreateViewRequest {
11625        type Owned = Self;
11626
11627        #[inline(always)]
11628        fn inline_align(_context: fidl::encoding::Context) -> usize {
11629            4
11630        }
11631
11632        #[inline(always)]
11633        fn inline_size(_context: fidl::encoding::Context) -> usize {
11634            4
11635        }
11636    }
11637
11638    unsafe impl
11639        fidl::encoding::Encode<
11640            FrameCreateViewRequest,
11641            fidl::encoding::DefaultFuchsiaResourceDialect,
11642        > for &mut FrameCreateViewRequest
11643    {
11644        #[inline]
11645        unsafe fn encode(
11646            self,
11647            encoder: &mut fidl::encoding::Encoder<
11648                '_,
11649                fidl::encoding::DefaultFuchsiaResourceDialect,
11650            >,
11651            offset: usize,
11652            _depth: fidl::encoding::Depth,
11653        ) -> fidl::Result<()> {
11654            encoder.debug_check_bounds::<FrameCreateViewRequest>(offset);
11655            // Delegate to tuple encoding.
11656            fidl::encoding::Encode::<FrameCreateViewRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11657                (
11658                    <fidl_fuchsia_ui_views::ViewToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.view_token),
11659                ),
11660                encoder, offset, _depth
11661            )
11662        }
11663    }
11664    unsafe impl<
11665            T0: fidl::encoding::Encode<
11666                fidl_fuchsia_ui_views::ViewToken,
11667                fidl::encoding::DefaultFuchsiaResourceDialect,
11668            >,
11669        >
11670        fidl::encoding::Encode<
11671            FrameCreateViewRequest,
11672            fidl::encoding::DefaultFuchsiaResourceDialect,
11673        > for (T0,)
11674    {
11675        #[inline]
11676        unsafe fn encode(
11677            self,
11678            encoder: &mut fidl::encoding::Encoder<
11679                '_,
11680                fidl::encoding::DefaultFuchsiaResourceDialect,
11681            >,
11682            offset: usize,
11683            depth: fidl::encoding::Depth,
11684        ) -> fidl::Result<()> {
11685            encoder.debug_check_bounds::<FrameCreateViewRequest>(offset);
11686            // Zero out padding regions. There's no need to apply masks
11687            // because the unmasked parts will be overwritten by fields.
11688            // Write the fields.
11689            self.0.encode(encoder, offset + 0, depth)?;
11690            Ok(())
11691        }
11692    }
11693
11694    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11695        for FrameCreateViewRequest
11696    {
11697        #[inline(always)]
11698        fn new_empty() -> Self {
11699            Self {
11700                view_token: fidl::new_empty!(
11701                    fidl_fuchsia_ui_views::ViewToken,
11702                    fidl::encoding::DefaultFuchsiaResourceDialect
11703                ),
11704            }
11705        }
11706
11707        #[inline]
11708        unsafe fn decode(
11709            &mut self,
11710            decoder: &mut fidl::encoding::Decoder<
11711                '_,
11712                fidl::encoding::DefaultFuchsiaResourceDialect,
11713            >,
11714            offset: usize,
11715            _depth: fidl::encoding::Depth,
11716        ) -> fidl::Result<()> {
11717            decoder.debug_check_bounds::<Self>(offset);
11718            // Verify that padding bytes are zero.
11719            fidl::decode!(
11720                fidl_fuchsia_ui_views::ViewToken,
11721                fidl::encoding::DefaultFuchsiaResourceDialect,
11722                &mut self.view_token,
11723                decoder,
11724                offset + 0,
11725                _depth
11726            )?;
11727            Ok(())
11728        }
11729    }
11730
11731    impl fidl::encoding::ResourceTypeMarker for FrameCreateViewWithViewRefRequest {
11732        type Borrowed<'a> = &'a mut Self;
11733        fn take_or_borrow<'a>(
11734            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11735        ) -> Self::Borrowed<'a> {
11736            value
11737        }
11738    }
11739
11740    unsafe impl fidl::encoding::TypeMarker for FrameCreateViewWithViewRefRequest {
11741        type Owned = Self;
11742
11743        #[inline(always)]
11744        fn inline_align(_context: fidl::encoding::Context) -> usize {
11745            4
11746        }
11747
11748        #[inline(always)]
11749        fn inline_size(_context: fidl::encoding::Context) -> usize {
11750            12
11751        }
11752    }
11753
11754    unsafe impl
11755        fidl::encoding::Encode<
11756            FrameCreateViewWithViewRefRequest,
11757            fidl::encoding::DefaultFuchsiaResourceDialect,
11758        > for &mut FrameCreateViewWithViewRefRequest
11759    {
11760        #[inline]
11761        unsafe fn encode(
11762            self,
11763            encoder: &mut fidl::encoding::Encoder<
11764                '_,
11765                fidl::encoding::DefaultFuchsiaResourceDialect,
11766            >,
11767            offset: usize,
11768            _depth: fidl::encoding::Depth,
11769        ) -> fidl::Result<()> {
11770            encoder.debug_check_bounds::<FrameCreateViewWithViewRefRequest>(offset);
11771            // Delegate to tuple encoding.
11772            fidl::encoding::Encode::<FrameCreateViewWithViewRefRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11773                (
11774                    <fidl_fuchsia_ui_views::ViewToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.view_token),
11775                    <fidl_fuchsia_ui_views::ViewRefControl as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.view_ref_control),
11776                    <fidl_fuchsia_ui_views::ViewRef as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.view_ref),
11777                ),
11778                encoder, offset, _depth
11779            )
11780        }
11781    }
11782    unsafe impl<
11783            T0: fidl::encoding::Encode<
11784                fidl_fuchsia_ui_views::ViewToken,
11785                fidl::encoding::DefaultFuchsiaResourceDialect,
11786            >,
11787            T1: fidl::encoding::Encode<
11788                fidl_fuchsia_ui_views::ViewRefControl,
11789                fidl::encoding::DefaultFuchsiaResourceDialect,
11790            >,
11791            T2: fidl::encoding::Encode<
11792                fidl_fuchsia_ui_views::ViewRef,
11793                fidl::encoding::DefaultFuchsiaResourceDialect,
11794            >,
11795        >
11796        fidl::encoding::Encode<
11797            FrameCreateViewWithViewRefRequest,
11798            fidl::encoding::DefaultFuchsiaResourceDialect,
11799        > for (T0, T1, T2)
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::<FrameCreateViewWithViewRefRequest>(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            self.1.encode(encoder, offset + 4, depth)?;
11817            self.2.encode(encoder, offset + 8, depth)?;
11818            Ok(())
11819        }
11820    }
11821
11822    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11823        for FrameCreateViewWithViewRefRequest
11824    {
11825        #[inline(always)]
11826        fn new_empty() -> Self {
11827            Self {
11828                view_token: fidl::new_empty!(
11829                    fidl_fuchsia_ui_views::ViewToken,
11830                    fidl::encoding::DefaultFuchsiaResourceDialect
11831                ),
11832                view_ref_control: fidl::new_empty!(
11833                    fidl_fuchsia_ui_views::ViewRefControl,
11834                    fidl::encoding::DefaultFuchsiaResourceDialect
11835                ),
11836                view_ref: fidl::new_empty!(
11837                    fidl_fuchsia_ui_views::ViewRef,
11838                    fidl::encoding::DefaultFuchsiaResourceDialect
11839                ),
11840            }
11841        }
11842
11843        #[inline]
11844        unsafe fn decode(
11845            &mut self,
11846            decoder: &mut fidl::encoding::Decoder<
11847                '_,
11848                fidl::encoding::DefaultFuchsiaResourceDialect,
11849            >,
11850            offset: usize,
11851            _depth: fidl::encoding::Depth,
11852        ) -> fidl::Result<()> {
11853            decoder.debug_check_bounds::<Self>(offset);
11854            // Verify that padding bytes are zero.
11855            fidl::decode!(
11856                fidl_fuchsia_ui_views::ViewToken,
11857                fidl::encoding::DefaultFuchsiaResourceDialect,
11858                &mut self.view_token,
11859                decoder,
11860                offset + 0,
11861                _depth
11862            )?;
11863            fidl::decode!(
11864                fidl_fuchsia_ui_views::ViewRefControl,
11865                fidl::encoding::DefaultFuchsiaResourceDialect,
11866                &mut self.view_ref_control,
11867                decoder,
11868                offset + 4,
11869                _depth
11870            )?;
11871            fidl::decode!(
11872                fidl_fuchsia_ui_views::ViewRef,
11873                fidl::encoding::DefaultFuchsiaResourceDialect,
11874                &mut self.view_ref,
11875                decoder,
11876                offset + 8,
11877                _depth
11878            )?;
11879            Ok(())
11880        }
11881    }
11882
11883    impl fidl::encoding::ResourceTypeMarker for FrameExecuteJavaScriptNoResultRequest {
11884        type Borrowed<'a> = &'a mut Self;
11885        fn take_or_borrow<'a>(
11886            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11887        ) -> Self::Borrowed<'a> {
11888            value
11889        }
11890    }
11891
11892    unsafe impl fidl::encoding::TypeMarker for FrameExecuteJavaScriptNoResultRequest {
11893        type Owned = Self;
11894
11895        #[inline(always)]
11896        fn inline_align(_context: fidl::encoding::Context) -> usize {
11897            8
11898        }
11899
11900        #[inline(always)]
11901        fn inline_size(_context: fidl::encoding::Context) -> usize {
11902            32
11903        }
11904    }
11905
11906    unsafe impl
11907        fidl::encoding::Encode<
11908            FrameExecuteJavaScriptNoResultRequest,
11909            fidl::encoding::DefaultFuchsiaResourceDialect,
11910        > for &mut FrameExecuteJavaScriptNoResultRequest
11911    {
11912        #[inline]
11913        unsafe fn encode(
11914            self,
11915            encoder: &mut fidl::encoding::Encoder<
11916                '_,
11917                fidl::encoding::DefaultFuchsiaResourceDialect,
11918            >,
11919            offset: usize,
11920            _depth: fidl::encoding::Depth,
11921        ) -> fidl::Result<()> {
11922            encoder.debug_check_bounds::<FrameExecuteJavaScriptNoResultRequest>(offset);
11923            // Delegate to tuple encoding.
11924            fidl::encoding::Encode::<FrameExecuteJavaScriptNoResultRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11925                (
11926                    <fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>> as fidl::encoding::ValueTypeMarker>::borrow(&self.origins),
11927                    <fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.script),
11928                ),
11929                encoder, offset, _depth
11930            )
11931        }
11932    }
11933    unsafe impl<
11934            T0: fidl::encoding::Encode<
11935                fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>>,
11936                fidl::encoding::DefaultFuchsiaResourceDialect,
11937            >,
11938            T1: fidl::encoding::Encode<
11939                fidl_fuchsia_mem::Buffer,
11940                fidl::encoding::DefaultFuchsiaResourceDialect,
11941            >,
11942        >
11943        fidl::encoding::Encode<
11944            FrameExecuteJavaScriptNoResultRequest,
11945            fidl::encoding::DefaultFuchsiaResourceDialect,
11946        > for (T0, T1)
11947    {
11948        #[inline]
11949        unsafe fn encode(
11950            self,
11951            encoder: &mut fidl::encoding::Encoder<
11952                '_,
11953                fidl::encoding::DefaultFuchsiaResourceDialect,
11954            >,
11955            offset: usize,
11956            depth: fidl::encoding::Depth,
11957        ) -> fidl::Result<()> {
11958            encoder.debug_check_bounds::<FrameExecuteJavaScriptNoResultRequest>(offset);
11959            // Zero out padding regions. There's no need to apply masks
11960            // because the unmasked parts will be overwritten by fields.
11961            // Write the fields.
11962            self.0.encode(encoder, offset + 0, depth)?;
11963            self.1.encode(encoder, offset + 16, depth)?;
11964            Ok(())
11965        }
11966    }
11967
11968    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11969        for FrameExecuteJavaScriptNoResultRequest
11970    {
11971        #[inline(always)]
11972        fn new_empty() -> Self {
11973            Self {
11974                origins: fidl::new_empty!(
11975                    fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>>,
11976                    fidl::encoding::DefaultFuchsiaResourceDialect
11977                ),
11978                script: fidl::new_empty!(
11979                    fidl_fuchsia_mem::Buffer,
11980                    fidl::encoding::DefaultFuchsiaResourceDialect
11981                ),
11982            }
11983        }
11984
11985        #[inline]
11986        unsafe fn decode(
11987            &mut self,
11988            decoder: &mut fidl::encoding::Decoder<
11989                '_,
11990                fidl::encoding::DefaultFuchsiaResourceDialect,
11991            >,
11992            offset: usize,
11993            _depth: fidl::encoding::Depth,
11994        ) -> fidl::Result<()> {
11995            decoder.debug_check_bounds::<Self>(offset);
11996            // Verify that padding bytes are zero.
11997            fidl::decode!(
11998                fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>>,
11999                fidl::encoding::DefaultFuchsiaResourceDialect,
12000                &mut self.origins,
12001                decoder,
12002                offset + 0,
12003                _depth
12004            )?;
12005            fidl::decode!(
12006                fidl_fuchsia_mem::Buffer,
12007                fidl::encoding::DefaultFuchsiaResourceDialect,
12008                &mut self.script,
12009                decoder,
12010                offset + 16,
12011                _depth
12012            )?;
12013            Ok(())
12014        }
12015    }
12016
12017    impl fidl::encoding::ResourceTypeMarker for FrameExecuteJavaScriptRequest {
12018        type Borrowed<'a> = &'a mut Self;
12019        fn take_or_borrow<'a>(
12020            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12021        ) -> Self::Borrowed<'a> {
12022            value
12023        }
12024    }
12025
12026    unsafe impl fidl::encoding::TypeMarker for FrameExecuteJavaScriptRequest {
12027        type Owned = Self;
12028
12029        #[inline(always)]
12030        fn inline_align(_context: fidl::encoding::Context) -> usize {
12031            8
12032        }
12033
12034        #[inline(always)]
12035        fn inline_size(_context: fidl::encoding::Context) -> usize {
12036            32
12037        }
12038    }
12039
12040    unsafe impl
12041        fidl::encoding::Encode<
12042            FrameExecuteJavaScriptRequest,
12043            fidl::encoding::DefaultFuchsiaResourceDialect,
12044        > for &mut FrameExecuteJavaScriptRequest
12045    {
12046        #[inline]
12047        unsafe fn encode(
12048            self,
12049            encoder: &mut fidl::encoding::Encoder<
12050                '_,
12051                fidl::encoding::DefaultFuchsiaResourceDialect,
12052            >,
12053            offset: usize,
12054            _depth: fidl::encoding::Depth,
12055        ) -> fidl::Result<()> {
12056            encoder.debug_check_bounds::<FrameExecuteJavaScriptRequest>(offset);
12057            // Delegate to tuple encoding.
12058            fidl::encoding::Encode::<FrameExecuteJavaScriptRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
12059                (
12060                    <fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>> as fidl::encoding::ValueTypeMarker>::borrow(&self.origins),
12061                    <fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.script),
12062                ),
12063                encoder, offset, _depth
12064            )
12065        }
12066    }
12067    unsafe impl<
12068            T0: fidl::encoding::Encode<
12069                fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>>,
12070                fidl::encoding::DefaultFuchsiaResourceDialect,
12071            >,
12072            T1: fidl::encoding::Encode<
12073                fidl_fuchsia_mem::Buffer,
12074                fidl::encoding::DefaultFuchsiaResourceDialect,
12075            >,
12076        >
12077        fidl::encoding::Encode<
12078            FrameExecuteJavaScriptRequest,
12079            fidl::encoding::DefaultFuchsiaResourceDialect,
12080        > for (T0, T1)
12081    {
12082        #[inline]
12083        unsafe fn encode(
12084            self,
12085            encoder: &mut fidl::encoding::Encoder<
12086                '_,
12087                fidl::encoding::DefaultFuchsiaResourceDialect,
12088            >,
12089            offset: usize,
12090            depth: fidl::encoding::Depth,
12091        ) -> fidl::Result<()> {
12092            encoder.debug_check_bounds::<FrameExecuteJavaScriptRequest>(offset);
12093            // Zero out padding regions. There's no need to apply masks
12094            // because the unmasked parts will be overwritten by fields.
12095            // Write the fields.
12096            self.0.encode(encoder, offset + 0, depth)?;
12097            self.1.encode(encoder, offset + 16, depth)?;
12098            Ok(())
12099        }
12100    }
12101
12102    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12103        for FrameExecuteJavaScriptRequest
12104    {
12105        #[inline(always)]
12106        fn new_empty() -> Self {
12107            Self {
12108                origins: fidl::new_empty!(
12109                    fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>>,
12110                    fidl::encoding::DefaultFuchsiaResourceDialect
12111                ),
12112                script: fidl::new_empty!(
12113                    fidl_fuchsia_mem::Buffer,
12114                    fidl::encoding::DefaultFuchsiaResourceDialect
12115                ),
12116            }
12117        }
12118
12119        #[inline]
12120        unsafe fn decode(
12121            &mut self,
12122            decoder: &mut fidl::encoding::Decoder<
12123                '_,
12124                fidl::encoding::DefaultFuchsiaResourceDialect,
12125            >,
12126            offset: usize,
12127            _depth: fidl::encoding::Depth,
12128        ) -> fidl::Result<()> {
12129            decoder.debug_check_bounds::<Self>(offset);
12130            // Verify that padding bytes are zero.
12131            fidl::decode!(
12132                fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>>,
12133                fidl::encoding::DefaultFuchsiaResourceDialect,
12134                &mut self.origins,
12135                decoder,
12136                offset + 0,
12137                _depth
12138            )?;
12139            fidl::decode!(
12140                fidl_fuchsia_mem::Buffer,
12141                fidl::encoding::DefaultFuchsiaResourceDialect,
12142                &mut self.script,
12143                decoder,
12144                offset + 16,
12145                _depth
12146            )?;
12147            Ok(())
12148        }
12149    }
12150
12151    impl fidl::encoding::ResourceTypeMarker for FrameGetMediaPlayerRequest {
12152        type Borrowed<'a> = &'a mut Self;
12153        fn take_or_borrow<'a>(
12154            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12155        ) -> Self::Borrowed<'a> {
12156            value
12157        }
12158    }
12159
12160    unsafe impl fidl::encoding::TypeMarker for FrameGetMediaPlayerRequest {
12161        type Owned = Self;
12162
12163        #[inline(always)]
12164        fn inline_align(_context: fidl::encoding::Context) -> usize {
12165            4
12166        }
12167
12168        #[inline(always)]
12169        fn inline_size(_context: fidl::encoding::Context) -> usize {
12170            4
12171        }
12172    }
12173
12174    unsafe impl
12175        fidl::encoding::Encode<
12176            FrameGetMediaPlayerRequest,
12177            fidl::encoding::DefaultFuchsiaResourceDialect,
12178        > for &mut FrameGetMediaPlayerRequest
12179    {
12180        #[inline]
12181        unsafe fn encode(
12182            self,
12183            encoder: &mut fidl::encoding::Encoder<
12184                '_,
12185                fidl::encoding::DefaultFuchsiaResourceDialect,
12186            >,
12187            offset: usize,
12188            _depth: fidl::encoding::Depth,
12189        ) -> fidl::Result<()> {
12190            encoder.debug_check_bounds::<FrameGetMediaPlayerRequest>(offset);
12191            // Delegate to tuple encoding.
12192            fidl::encoding::Encode::<
12193                FrameGetMediaPlayerRequest,
12194                fidl::encoding::DefaultFuchsiaResourceDialect,
12195            >::encode(
12196                (<fidl::encoding::Endpoint<
12197                    fidl::endpoints::ServerEnd<fidl_fuchsia_media_sessions2::PlayerMarker>,
12198                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12199                    &mut self.player
12200                ),),
12201                encoder,
12202                offset,
12203                _depth,
12204            )
12205        }
12206    }
12207    unsafe impl<
12208            T0: fidl::encoding::Encode<
12209                fidl::encoding::Endpoint<
12210                    fidl::endpoints::ServerEnd<fidl_fuchsia_media_sessions2::PlayerMarker>,
12211                >,
12212                fidl::encoding::DefaultFuchsiaResourceDialect,
12213            >,
12214        >
12215        fidl::encoding::Encode<
12216            FrameGetMediaPlayerRequest,
12217            fidl::encoding::DefaultFuchsiaResourceDialect,
12218        > for (T0,)
12219    {
12220        #[inline]
12221        unsafe fn encode(
12222            self,
12223            encoder: &mut fidl::encoding::Encoder<
12224                '_,
12225                fidl::encoding::DefaultFuchsiaResourceDialect,
12226            >,
12227            offset: usize,
12228            depth: fidl::encoding::Depth,
12229        ) -> fidl::Result<()> {
12230            encoder.debug_check_bounds::<FrameGetMediaPlayerRequest>(offset);
12231            // Zero out padding regions. There's no need to apply masks
12232            // because the unmasked parts will be overwritten by fields.
12233            // Write the fields.
12234            self.0.encode(encoder, offset + 0, depth)?;
12235            Ok(())
12236        }
12237    }
12238
12239    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12240        for FrameGetMediaPlayerRequest
12241    {
12242        #[inline(always)]
12243        fn new_empty() -> Self {
12244            Self {
12245                player: fidl::new_empty!(
12246                    fidl::encoding::Endpoint<
12247                        fidl::endpoints::ServerEnd<fidl_fuchsia_media_sessions2::PlayerMarker>,
12248                    >,
12249                    fidl::encoding::DefaultFuchsiaResourceDialect
12250                ),
12251            }
12252        }
12253
12254        #[inline]
12255        unsafe fn decode(
12256            &mut self,
12257            decoder: &mut fidl::encoding::Decoder<
12258                '_,
12259                fidl::encoding::DefaultFuchsiaResourceDialect,
12260            >,
12261            offset: usize,
12262            _depth: fidl::encoding::Depth,
12263        ) -> fidl::Result<()> {
12264            decoder.debug_check_bounds::<Self>(offset);
12265            // Verify that padding bytes are zero.
12266            fidl::decode!(
12267                fidl::encoding::Endpoint<
12268                    fidl::endpoints::ServerEnd<fidl_fuchsia_media_sessions2::PlayerMarker>,
12269                >,
12270                fidl::encoding::DefaultFuchsiaResourceDialect,
12271                &mut self.player,
12272                decoder,
12273                offset + 0,
12274                _depth
12275            )?;
12276            Ok(())
12277        }
12278    }
12279
12280    impl fidl::encoding::ResourceTypeMarker for FrameGetNavigationControllerRequest {
12281        type Borrowed<'a> = &'a mut Self;
12282        fn take_or_borrow<'a>(
12283            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12284        ) -> Self::Borrowed<'a> {
12285            value
12286        }
12287    }
12288
12289    unsafe impl fidl::encoding::TypeMarker for FrameGetNavigationControllerRequest {
12290        type Owned = Self;
12291
12292        #[inline(always)]
12293        fn inline_align(_context: fidl::encoding::Context) -> usize {
12294            4
12295        }
12296
12297        #[inline(always)]
12298        fn inline_size(_context: fidl::encoding::Context) -> usize {
12299            4
12300        }
12301    }
12302
12303    unsafe impl
12304        fidl::encoding::Encode<
12305            FrameGetNavigationControllerRequest,
12306            fidl::encoding::DefaultFuchsiaResourceDialect,
12307        > for &mut FrameGetNavigationControllerRequest
12308    {
12309        #[inline]
12310        unsafe fn encode(
12311            self,
12312            encoder: &mut fidl::encoding::Encoder<
12313                '_,
12314                fidl::encoding::DefaultFuchsiaResourceDialect,
12315            >,
12316            offset: usize,
12317            _depth: fidl::encoding::Depth,
12318        ) -> fidl::Result<()> {
12319            encoder.debug_check_bounds::<FrameGetNavigationControllerRequest>(offset);
12320            // Delegate to tuple encoding.
12321            fidl::encoding::Encode::<
12322                FrameGetNavigationControllerRequest,
12323                fidl::encoding::DefaultFuchsiaResourceDialect,
12324            >::encode(
12325                (
12326                    <fidl::encoding::Endpoint<
12327                        fidl::endpoints::ServerEnd<NavigationControllerMarker>,
12328                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12329                        &mut self.controller
12330                    ),
12331                ),
12332                encoder,
12333                offset,
12334                _depth,
12335            )
12336        }
12337    }
12338    unsafe impl<
12339            T0: fidl::encoding::Encode<
12340                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NavigationControllerMarker>>,
12341                fidl::encoding::DefaultFuchsiaResourceDialect,
12342            >,
12343        >
12344        fidl::encoding::Encode<
12345            FrameGetNavigationControllerRequest,
12346            fidl::encoding::DefaultFuchsiaResourceDialect,
12347        > for (T0,)
12348    {
12349        #[inline]
12350        unsafe fn encode(
12351            self,
12352            encoder: &mut fidl::encoding::Encoder<
12353                '_,
12354                fidl::encoding::DefaultFuchsiaResourceDialect,
12355            >,
12356            offset: usize,
12357            depth: fidl::encoding::Depth,
12358        ) -> fidl::Result<()> {
12359            encoder.debug_check_bounds::<FrameGetNavigationControllerRequest>(offset);
12360            // Zero out padding regions. There's no need to apply masks
12361            // because the unmasked parts will be overwritten by fields.
12362            // Write the fields.
12363            self.0.encode(encoder, offset + 0, depth)?;
12364            Ok(())
12365        }
12366    }
12367
12368    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12369        for FrameGetNavigationControllerRequest
12370    {
12371        #[inline(always)]
12372        fn new_empty() -> Self {
12373            Self {
12374                controller: fidl::new_empty!(
12375                    fidl::encoding::Endpoint<
12376                        fidl::endpoints::ServerEnd<NavigationControllerMarker>,
12377                    >,
12378                    fidl::encoding::DefaultFuchsiaResourceDialect
12379                ),
12380            }
12381        }
12382
12383        #[inline]
12384        unsafe fn decode(
12385            &mut self,
12386            decoder: &mut fidl::encoding::Decoder<
12387                '_,
12388                fidl::encoding::DefaultFuchsiaResourceDialect,
12389            >,
12390            offset: usize,
12391            _depth: fidl::encoding::Depth,
12392        ) -> fidl::Result<()> {
12393            decoder.debug_check_bounds::<Self>(offset);
12394            // Verify that padding bytes are zero.
12395            fidl::decode!(
12396                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NavigationControllerMarker>>,
12397                fidl::encoding::DefaultFuchsiaResourceDialect,
12398                &mut self.controller,
12399                decoder,
12400                offset + 0,
12401                _depth
12402            )?;
12403            Ok(())
12404        }
12405    }
12406
12407    impl fidl::encoding::ResourceTypeMarker for FrameHostCreateFrameWithParamsRequest {
12408        type Borrowed<'a> = &'a mut Self;
12409        fn take_or_borrow<'a>(
12410            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12411        ) -> Self::Borrowed<'a> {
12412            value
12413        }
12414    }
12415
12416    unsafe impl fidl::encoding::TypeMarker for FrameHostCreateFrameWithParamsRequest {
12417        type Owned = Self;
12418
12419        #[inline(always)]
12420        fn inline_align(_context: fidl::encoding::Context) -> usize {
12421            8
12422        }
12423
12424        #[inline(always)]
12425        fn inline_size(_context: fidl::encoding::Context) -> usize {
12426            24
12427        }
12428    }
12429
12430    unsafe impl
12431        fidl::encoding::Encode<
12432            FrameHostCreateFrameWithParamsRequest,
12433            fidl::encoding::DefaultFuchsiaResourceDialect,
12434        > for &mut FrameHostCreateFrameWithParamsRequest
12435    {
12436        #[inline]
12437        unsafe fn encode(
12438            self,
12439            encoder: &mut fidl::encoding::Encoder<
12440                '_,
12441                fidl::encoding::DefaultFuchsiaResourceDialect,
12442            >,
12443            offset: usize,
12444            _depth: fidl::encoding::Depth,
12445        ) -> fidl::Result<()> {
12446            encoder.debug_check_bounds::<FrameHostCreateFrameWithParamsRequest>(offset);
12447            // Delegate to tuple encoding.
12448            fidl::encoding::Encode::<FrameHostCreateFrameWithParamsRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
12449                (
12450                    <CreateFrameParams as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.params),
12451                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FrameMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.frame),
12452                ),
12453                encoder, offset, _depth
12454            )
12455        }
12456    }
12457    unsafe impl<
12458            T0: fidl::encoding::Encode<
12459                CreateFrameParams,
12460                fidl::encoding::DefaultFuchsiaResourceDialect,
12461            >,
12462            T1: fidl::encoding::Encode<
12463                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FrameMarker>>,
12464                fidl::encoding::DefaultFuchsiaResourceDialect,
12465            >,
12466        >
12467        fidl::encoding::Encode<
12468            FrameHostCreateFrameWithParamsRequest,
12469            fidl::encoding::DefaultFuchsiaResourceDialect,
12470        > for (T0, T1)
12471    {
12472        #[inline]
12473        unsafe fn encode(
12474            self,
12475            encoder: &mut fidl::encoding::Encoder<
12476                '_,
12477                fidl::encoding::DefaultFuchsiaResourceDialect,
12478            >,
12479            offset: usize,
12480            depth: fidl::encoding::Depth,
12481        ) -> fidl::Result<()> {
12482            encoder.debug_check_bounds::<FrameHostCreateFrameWithParamsRequest>(offset);
12483            // Zero out padding regions. There's no need to apply masks
12484            // because the unmasked parts will be overwritten by fields.
12485            unsafe {
12486                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
12487                (ptr as *mut u64).write_unaligned(0);
12488            }
12489            // Write the fields.
12490            self.0.encode(encoder, offset + 0, depth)?;
12491            self.1.encode(encoder, offset + 16, depth)?;
12492            Ok(())
12493        }
12494    }
12495
12496    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12497        for FrameHostCreateFrameWithParamsRequest
12498    {
12499        #[inline(always)]
12500        fn new_empty() -> Self {
12501            Self {
12502                params: fidl::new_empty!(
12503                    CreateFrameParams,
12504                    fidl::encoding::DefaultFuchsiaResourceDialect
12505                ),
12506                frame: fidl::new_empty!(
12507                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FrameMarker>>,
12508                    fidl::encoding::DefaultFuchsiaResourceDialect
12509                ),
12510            }
12511        }
12512
12513        #[inline]
12514        unsafe fn decode(
12515            &mut self,
12516            decoder: &mut fidl::encoding::Decoder<
12517                '_,
12518                fidl::encoding::DefaultFuchsiaResourceDialect,
12519            >,
12520            offset: usize,
12521            _depth: fidl::encoding::Depth,
12522        ) -> fidl::Result<()> {
12523            decoder.debug_check_bounds::<Self>(offset);
12524            // Verify that padding bytes are zero.
12525            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
12526            let padval = unsafe { (ptr as *const u64).read_unaligned() };
12527            let mask = 0xffffffff00000000u64;
12528            let maskedval = padval & mask;
12529            if maskedval != 0 {
12530                return Err(fidl::Error::NonZeroPadding {
12531                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
12532                });
12533            }
12534            fidl::decode!(
12535                CreateFrameParams,
12536                fidl::encoding::DefaultFuchsiaResourceDialect,
12537                &mut self.params,
12538                decoder,
12539                offset + 0,
12540                _depth
12541            )?;
12542            fidl::decode!(
12543                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FrameMarker>>,
12544                fidl::encoding::DefaultFuchsiaResourceDialect,
12545                &mut self.frame,
12546                decoder,
12547                offset + 16,
12548                _depth
12549            )?;
12550            Ok(())
12551        }
12552    }
12553
12554    impl fidl::encoding::ResourceTypeMarker for FramePostMessageRequest {
12555        type Borrowed<'a> = &'a mut Self;
12556        fn take_or_borrow<'a>(
12557            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12558        ) -> Self::Borrowed<'a> {
12559            value
12560        }
12561    }
12562
12563    unsafe impl fidl::encoding::TypeMarker for FramePostMessageRequest {
12564        type Owned = Self;
12565
12566        #[inline(always)]
12567        fn inline_align(_context: fidl::encoding::Context) -> usize {
12568            8
12569        }
12570
12571        #[inline(always)]
12572        fn inline_size(_context: fidl::encoding::Context) -> usize {
12573            32
12574        }
12575    }
12576
12577    unsafe impl
12578        fidl::encoding::Encode<
12579            FramePostMessageRequest,
12580            fidl::encoding::DefaultFuchsiaResourceDialect,
12581        > for &mut FramePostMessageRequest
12582    {
12583        #[inline]
12584        unsafe fn encode(
12585            self,
12586            encoder: &mut fidl::encoding::Encoder<
12587                '_,
12588                fidl::encoding::DefaultFuchsiaResourceDialect,
12589            >,
12590            offset: usize,
12591            _depth: fidl::encoding::Depth,
12592        ) -> fidl::Result<()> {
12593            encoder.debug_check_bounds::<FramePostMessageRequest>(offset);
12594            // Delegate to tuple encoding.
12595            fidl::encoding::Encode::<FramePostMessageRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
12596                (
12597                    <fidl::encoding::BoundedString<65536> as fidl::encoding::ValueTypeMarker>::borrow(&self.target_origin),
12598                    <WebMessage as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.message),
12599                ),
12600                encoder, offset, _depth
12601            )
12602        }
12603    }
12604    unsafe impl<
12605            T0: fidl::encoding::Encode<
12606                fidl::encoding::BoundedString<65536>,
12607                fidl::encoding::DefaultFuchsiaResourceDialect,
12608            >,
12609            T1: fidl::encoding::Encode<WebMessage, fidl::encoding::DefaultFuchsiaResourceDialect>,
12610        >
12611        fidl::encoding::Encode<
12612            FramePostMessageRequest,
12613            fidl::encoding::DefaultFuchsiaResourceDialect,
12614        > for (T0, T1)
12615    {
12616        #[inline]
12617        unsafe fn encode(
12618            self,
12619            encoder: &mut fidl::encoding::Encoder<
12620                '_,
12621                fidl::encoding::DefaultFuchsiaResourceDialect,
12622            >,
12623            offset: usize,
12624            depth: fidl::encoding::Depth,
12625        ) -> fidl::Result<()> {
12626            encoder.debug_check_bounds::<FramePostMessageRequest>(offset);
12627            // Zero out padding regions. There's no need to apply masks
12628            // because the unmasked parts will be overwritten by fields.
12629            // Write the fields.
12630            self.0.encode(encoder, offset + 0, depth)?;
12631            self.1.encode(encoder, offset + 16, depth)?;
12632            Ok(())
12633        }
12634    }
12635
12636    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12637        for FramePostMessageRequest
12638    {
12639        #[inline(always)]
12640        fn new_empty() -> Self {
12641            Self {
12642                target_origin: fidl::new_empty!(
12643                    fidl::encoding::BoundedString<65536>,
12644                    fidl::encoding::DefaultFuchsiaResourceDialect
12645                ),
12646                message: fidl::new_empty!(
12647                    WebMessage,
12648                    fidl::encoding::DefaultFuchsiaResourceDialect
12649                ),
12650            }
12651        }
12652
12653        #[inline]
12654        unsafe fn decode(
12655            &mut self,
12656            decoder: &mut fidl::encoding::Decoder<
12657                '_,
12658                fidl::encoding::DefaultFuchsiaResourceDialect,
12659            >,
12660            offset: usize,
12661            _depth: fidl::encoding::Depth,
12662        ) -> fidl::Result<()> {
12663            decoder.debug_check_bounds::<Self>(offset);
12664            // Verify that padding bytes are zero.
12665            fidl::decode!(
12666                fidl::encoding::BoundedString<65536>,
12667                fidl::encoding::DefaultFuchsiaResourceDialect,
12668                &mut self.target_origin,
12669                decoder,
12670                offset + 0,
12671                _depth
12672            )?;
12673            fidl::decode!(
12674                WebMessage,
12675                fidl::encoding::DefaultFuchsiaResourceDialect,
12676                &mut self.message,
12677                decoder,
12678                offset + 16,
12679                _depth
12680            )?;
12681            Ok(())
12682        }
12683    }
12684
12685    impl fidl::encoding::ResourceTypeMarker for FrameSetConsoleLogSinkRequest {
12686        type Borrowed<'a> = &'a mut Self;
12687        fn take_or_borrow<'a>(
12688            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12689        ) -> Self::Borrowed<'a> {
12690            value
12691        }
12692    }
12693
12694    unsafe impl fidl::encoding::TypeMarker for FrameSetConsoleLogSinkRequest {
12695        type Owned = Self;
12696
12697        #[inline(always)]
12698        fn inline_align(_context: fidl::encoding::Context) -> usize {
12699            4
12700        }
12701
12702        #[inline(always)]
12703        fn inline_size(_context: fidl::encoding::Context) -> usize {
12704            4
12705        }
12706    }
12707
12708    unsafe impl
12709        fidl::encoding::Encode<
12710            FrameSetConsoleLogSinkRequest,
12711            fidl::encoding::DefaultFuchsiaResourceDialect,
12712        > for &mut FrameSetConsoleLogSinkRequest
12713    {
12714        #[inline]
12715        unsafe fn encode(
12716            self,
12717            encoder: &mut fidl::encoding::Encoder<
12718                '_,
12719                fidl::encoding::DefaultFuchsiaResourceDialect,
12720            >,
12721            offset: usize,
12722            _depth: fidl::encoding::Depth,
12723        ) -> fidl::Result<()> {
12724            encoder.debug_check_bounds::<FrameSetConsoleLogSinkRequest>(offset);
12725            // Delegate to tuple encoding.
12726            fidl::encoding::Encode::<
12727                FrameSetConsoleLogSinkRequest,
12728                fidl::encoding::DefaultFuchsiaResourceDialect,
12729            >::encode(
12730                (<fidl::encoding::Optional<
12731                    fidl::encoding::Endpoint<
12732                        fidl::endpoints::ClientEnd<fidl_fuchsia_logger::LogSinkMarker>,
12733                    >,
12734                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12735                    &mut self.sink
12736                ),),
12737                encoder,
12738                offset,
12739                _depth,
12740            )
12741        }
12742    }
12743    unsafe impl<
12744            T0: fidl::encoding::Encode<
12745                fidl::encoding::Optional<
12746                    fidl::encoding::Endpoint<
12747                        fidl::endpoints::ClientEnd<fidl_fuchsia_logger::LogSinkMarker>,
12748                    >,
12749                >,
12750                fidl::encoding::DefaultFuchsiaResourceDialect,
12751            >,
12752        >
12753        fidl::encoding::Encode<
12754            FrameSetConsoleLogSinkRequest,
12755            fidl::encoding::DefaultFuchsiaResourceDialect,
12756        > for (T0,)
12757    {
12758        #[inline]
12759        unsafe fn encode(
12760            self,
12761            encoder: &mut fidl::encoding::Encoder<
12762                '_,
12763                fidl::encoding::DefaultFuchsiaResourceDialect,
12764            >,
12765            offset: usize,
12766            depth: fidl::encoding::Depth,
12767        ) -> fidl::Result<()> {
12768            encoder.debug_check_bounds::<FrameSetConsoleLogSinkRequest>(offset);
12769            // Zero out padding regions. There's no need to apply masks
12770            // because the unmasked parts will be overwritten by fields.
12771            // Write the fields.
12772            self.0.encode(encoder, offset + 0, depth)?;
12773            Ok(())
12774        }
12775    }
12776
12777    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12778        for FrameSetConsoleLogSinkRequest
12779    {
12780        #[inline(always)]
12781        fn new_empty() -> Self {
12782            Self {
12783                sink: fidl::new_empty!(
12784                    fidl::encoding::Optional<
12785                        fidl::encoding::Endpoint<
12786                            fidl::endpoints::ClientEnd<fidl_fuchsia_logger::LogSinkMarker>,
12787                        >,
12788                    >,
12789                    fidl::encoding::DefaultFuchsiaResourceDialect
12790                ),
12791            }
12792        }
12793
12794        #[inline]
12795        unsafe fn decode(
12796            &mut self,
12797            decoder: &mut fidl::encoding::Decoder<
12798                '_,
12799                fidl::encoding::DefaultFuchsiaResourceDialect,
12800            >,
12801            offset: usize,
12802            _depth: fidl::encoding::Depth,
12803        ) -> fidl::Result<()> {
12804            decoder.debug_check_bounds::<Self>(offset);
12805            // Verify that padding bytes are zero.
12806            fidl::decode!(
12807                fidl::encoding::Optional<
12808                    fidl::encoding::Endpoint<
12809                        fidl::endpoints::ClientEnd<fidl_fuchsia_logger::LogSinkMarker>,
12810                    >,
12811                >,
12812                fidl::encoding::DefaultFuchsiaResourceDialect,
12813                &mut self.sink,
12814                decoder,
12815                offset + 0,
12816                _depth
12817            )?;
12818            Ok(())
12819        }
12820    }
12821
12822    impl fidl::encoding::ResourceTypeMarker for FrameSetNavigationEventListener2Request {
12823        type Borrowed<'a> = &'a mut Self;
12824        fn take_or_borrow<'a>(
12825            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12826        ) -> Self::Borrowed<'a> {
12827            value
12828        }
12829    }
12830
12831    unsafe impl fidl::encoding::TypeMarker for FrameSetNavigationEventListener2Request {
12832        type Owned = Self;
12833
12834        #[inline(always)]
12835        fn inline_align(_context: fidl::encoding::Context) -> usize {
12836            8
12837        }
12838
12839        #[inline(always)]
12840        fn inline_size(_context: fidl::encoding::Context) -> usize {
12841            16
12842        }
12843    }
12844
12845    unsafe impl
12846        fidl::encoding::Encode<
12847            FrameSetNavigationEventListener2Request,
12848            fidl::encoding::DefaultFuchsiaResourceDialect,
12849        > for &mut FrameSetNavigationEventListener2Request
12850    {
12851        #[inline]
12852        unsafe fn encode(
12853            self,
12854            encoder: &mut fidl::encoding::Encoder<
12855                '_,
12856                fidl::encoding::DefaultFuchsiaResourceDialect,
12857            >,
12858            offset: usize,
12859            _depth: fidl::encoding::Depth,
12860        ) -> fidl::Result<()> {
12861            encoder.debug_check_bounds::<FrameSetNavigationEventListener2Request>(offset);
12862            // Delegate to tuple encoding.
12863            fidl::encoding::Encode::<
12864                FrameSetNavigationEventListener2Request,
12865                fidl::encoding::DefaultFuchsiaResourceDialect,
12866            >::encode(
12867                (
12868                    <fidl::encoding::Optional<
12869                        fidl::encoding::Endpoint<
12870                            fidl::endpoints::ClientEnd<NavigationEventListenerMarker>,
12871                        >,
12872                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12873                        &mut self.listener
12874                    ),
12875                    <NavigationEventListenerFlags as fidl::encoding::ValueTypeMarker>::borrow(
12876                        &self.flags,
12877                    ),
12878                ),
12879                encoder,
12880                offset,
12881                _depth,
12882            )
12883        }
12884    }
12885    unsafe impl<
12886            T0: fidl::encoding::Encode<
12887                fidl::encoding::Optional<
12888                    fidl::encoding::Endpoint<
12889                        fidl::endpoints::ClientEnd<NavigationEventListenerMarker>,
12890                    >,
12891                >,
12892                fidl::encoding::DefaultFuchsiaResourceDialect,
12893            >,
12894            T1: fidl::encoding::Encode<
12895                NavigationEventListenerFlags,
12896                fidl::encoding::DefaultFuchsiaResourceDialect,
12897            >,
12898        >
12899        fidl::encoding::Encode<
12900            FrameSetNavigationEventListener2Request,
12901            fidl::encoding::DefaultFuchsiaResourceDialect,
12902        > for (T0, T1)
12903    {
12904        #[inline]
12905        unsafe fn encode(
12906            self,
12907            encoder: &mut fidl::encoding::Encoder<
12908                '_,
12909                fidl::encoding::DefaultFuchsiaResourceDialect,
12910            >,
12911            offset: usize,
12912            depth: fidl::encoding::Depth,
12913        ) -> fidl::Result<()> {
12914            encoder.debug_check_bounds::<FrameSetNavigationEventListener2Request>(offset);
12915            // Zero out padding regions. There's no need to apply masks
12916            // because the unmasked parts will be overwritten by fields.
12917            unsafe {
12918                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
12919                (ptr as *mut u64).write_unaligned(0);
12920            }
12921            // Write the fields.
12922            self.0.encode(encoder, offset + 0, depth)?;
12923            self.1.encode(encoder, offset + 8, depth)?;
12924            Ok(())
12925        }
12926    }
12927
12928    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12929        for FrameSetNavigationEventListener2Request
12930    {
12931        #[inline(always)]
12932        fn new_empty() -> Self {
12933            Self {
12934                listener: fidl::new_empty!(
12935                    fidl::encoding::Optional<
12936                        fidl::encoding::Endpoint<
12937                            fidl::endpoints::ClientEnd<NavigationEventListenerMarker>,
12938                        >,
12939                    >,
12940                    fidl::encoding::DefaultFuchsiaResourceDialect
12941                ),
12942                flags: fidl::new_empty!(
12943                    NavigationEventListenerFlags,
12944                    fidl::encoding::DefaultFuchsiaResourceDialect
12945                ),
12946            }
12947        }
12948
12949        #[inline]
12950        unsafe fn decode(
12951            &mut self,
12952            decoder: &mut fidl::encoding::Decoder<
12953                '_,
12954                fidl::encoding::DefaultFuchsiaResourceDialect,
12955            >,
12956            offset: usize,
12957            _depth: fidl::encoding::Depth,
12958        ) -> fidl::Result<()> {
12959            decoder.debug_check_bounds::<Self>(offset);
12960            // Verify that padding bytes are zero.
12961            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
12962            let padval = unsafe { (ptr as *const u64).read_unaligned() };
12963            let mask = 0xffffffff00000000u64;
12964            let maskedval = padval & mask;
12965            if maskedval != 0 {
12966                return Err(fidl::Error::NonZeroPadding {
12967                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
12968                });
12969            }
12970            fidl::decode!(
12971                fidl::encoding::Optional<
12972                    fidl::encoding::Endpoint<
12973                        fidl::endpoints::ClientEnd<NavigationEventListenerMarker>,
12974                    >,
12975                >,
12976                fidl::encoding::DefaultFuchsiaResourceDialect,
12977                &mut self.listener,
12978                decoder,
12979                offset + 0,
12980                _depth
12981            )?;
12982            fidl::decode!(
12983                NavigationEventListenerFlags,
12984                fidl::encoding::DefaultFuchsiaResourceDialect,
12985                &mut self.flags,
12986                decoder,
12987                offset + 8,
12988                _depth
12989            )?;
12990            Ok(())
12991        }
12992    }
12993
12994    impl fidl::encoding::ResourceTypeMarker for FrameSetNavigationEventListenerRequest {
12995        type Borrowed<'a> = &'a mut Self;
12996        fn take_or_borrow<'a>(
12997            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12998        ) -> Self::Borrowed<'a> {
12999            value
13000        }
13001    }
13002
13003    unsafe impl fidl::encoding::TypeMarker for FrameSetNavigationEventListenerRequest {
13004        type Owned = Self;
13005
13006        #[inline(always)]
13007        fn inline_align(_context: fidl::encoding::Context) -> usize {
13008            4
13009        }
13010
13011        #[inline(always)]
13012        fn inline_size(_context: fidl::encoding::Context) -> usize {
13013            4
13014        }
13015    }
13016
13017    unsafe impl
13018        fidl::encoding::Encode<
13019            FrameSetNavigationEventListenerRequest,
13020            fidl::encoding::DefaultFuchsiaResourceDialect,
13021        > for &mut FrameSetNavigationEventListenerRequest
13022    {
13023        #[inline]
13024        unsafe fn encode(
13025            self,
13026            encoder: &mut fidl::encoding::Encoder<
13027                '_,
13028                fidl::encoding::DefaultFuchsiaResourceDialect,
13029            >,
13030            offset: usize,
13031            _depth: fidl::encoding::Depth,
13032        ) -> fidl::Result<()> {
13033            encoder.debug_check_bounds::<FrameSetNavigationEventListenerRequest>(offset);
13034            // Delegate to tuple encoding.
13035            fidl::encoding::Encode::<
13036                FrameSetNavigationEventListenerRequest,
13037                fidl::encoding::DefaultFuchsiaResourceDialect,
13038            >::encode(
13039                (<fidl::encoding::Optional<
13040                    fidl::encoding::Endpoint<
13041                        fidl::endpoints::ClientEnd<NavigationEventListenerMarker>,
13042                    >,
13043                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13044                    &mut self.listener
13045                ),),
13046                encoder,
13047                offset,
13048                _depth,
13049            )
13050        }
13051    }
13052    unsafe impl<
13053            T0: fidl::encoding::Encode<
13054                fidl::encoding::Optional<
13055                    fidl::encoding::Endpoint<
13056                        fidl::endpoints::ClientEnd<NavigationEventListenerMarker>,
13057                    >,
13058                >,
13059                fidl::encoding::DefaultFuchsiaResourceDialect,
13060            >,
13061        >
13062        fidl::encoding::Encode<
13063            FrameSetNavigationEventListenerRequest,
13064            fidl::encoding::DefaultFuchsiaResourceDialect,
13065        > for (T0,)
13066    {
13067        #[inline]
13068        unsafe fn encode(
13069            self,
13070            encoder: &mut fidl::encoding::Encoder<
13071                '_,
13072                fidl::encoding::DefaultFuchsiaResourceDialect,
13073            >,
13074            offset: usize,
13075            depth: fidl::encoding::Depth,
13076        ) -> fidl::Result<()> {
13077            encoder.debug_check_bounds::<FrameSetNavigationEventListenerRequest>(offset);
13078            // Zero out padding regions. There's no need to apply masks
13079            // because the unmasked parts will be overwritten by fields.
13080            // Write the fields.
13081            self.0.encode(encoder, offset + 0, depth)?;
13082            Ok(())
13083        }
13084    }
13085
13086    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13087        for FrameSetNavigationEventListenerRequest
13088    {
13089        #[inline(always)]
13090        fn new_empty() -> Self {
13091            Self {
13092                listener: fidl::new_empty!(
13093                    fidl::encoding::Optional<
13094                        fidl::encoding::Endpoint<
13095                            fidl::endpoints::ClientEnd<NavigationEventListenerMarker>,
13096                        >,
13097                    >,
13098                    fidl::encoding::DefaultFuchsiaResourceDialect
13099                ),
13100            }
13101        }
13102
13103        #[inline]
13104        unsafe fn decode(
13105            &mut self,
13106            decoder: &mut fidl::encoding::Decoder<
13107                '_,
13108                fidl::encoding::DefaultFuchsiaResourceDialect,
13109            >,
13110            offset: usize,
13111            _depth: fidl::encoding::Depth,
13112        ) -> fidl::Result<()> {
13113            decoder.debug_check_bounds::<Self>(offset);
13114            // Verify that padding bytes are zero.
13115            fidl::decode!(
13116                fidl::encoding::Optional<
13117                    fidl::encoding::Endpoint<
13118                        fidl::endpoints::ClientEnd<NavigationEventListenerMarker>,
13119                    >,
13120                >,
13121                fidl::encoding::DefaultFuchsiaResourceDialect,
13122                &mut self.listener,
13123                decoder,
13124                offset + 0,
13125                _depth
13126            )?;
13127            Ok(())
13128        }
13129    }
13130
13131    impl fidl::encoding::ResourceTypeMarker for FrameSetNavigationPolicyProviderRequest {
13132        type Borrowed<'a> = &'a mut Self;
13133        fn take_or_borrow<'a>(
13134            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13135        ) -> Self::Borrowed<'a> {
13136            value
13137        }
13138    }
13139
13140    unsafe impl fidl::encoding::TypeMarker for FrameSetNavigationPolicyProviderRequest {
13141        type Owned = Self;
13142
13143        #[inline(always)]
13144        fn inline_align(_context: fidl::encoding::Context) -> usize {
13145            8
13146        }
13147
13148        #[inline(always)]
13149        fn inline_size(_context: fidl::encoding::Context) -> usize {
13150            24
13151        }
13152    }
13153
13154    unsafe impl
13155        fidl::encoding::Encode<
13156            FrameSetNavigationPolicyProviderRequest,
13157            fidl::encoding::DefaultFuchsiaResourceDialect,
13158        > for &mut FrameSetNavigationPolicyProviderRequest
13159    {
13160        #[inline]
13161        unsafe fn encode(
13162            self,
13163            encoder: &mut fidl::encoding::Encoder<
13164                '_,
13165                fidl::encoding::DefaultFuchsiaResourceDialect,
13166            >,
13167            offset: usize,
13168            _depth: fidl::encoding::Depth,
13169        ) -> fidl::Result<()> {
13170            encoder.debug_check_bounds::<FrameSetNavigationPolicyProviderRequest>(offset);
13171            // Delegate to tuple encoding.
13172            fidl::encoding::Encode::<
13173                FrameSetNavigationPolicyProviderRequest,
13174                fidl::encoding::DefaultFuchsiaResourceDialect,
13175            >::encode(
13176                (
13177                    <NavigationPolicyProviderParams as fidl::encoding::ValueTypeMarker>::borrow(
13178                        &self.params,
13179                    ),
13180                    <fidl::encoding::Endpoint<
13181                        fidl::endpoints::ClientEnd<NavigationPolicyProviderMarker>,
13182                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13183                        &mut self.provider
13184                    ),
13185                ),
13186                encoder,
13187                offset,
13188                _depth,
13189            )
13190        }
13191    }
13192    unsafe impl<
13193            T0: fidl::encoding::Encode<
13194                NavigationPolicyProviderParams,
13195                fidl::encoding::DefaultFuchsiaResourceDialect,
13196            >,
13197            T1: fidl::encoding::Encode<
13198                fidl::encoding::Endpoint<
13199                    fidl::endpoints::ClientEnd<NavigationPolicyProviderMarker>,
13200                >,
13201                fidl::encoding::DefaultFuchsiaResourceDialect,
13202            >,
13203        >
13204        fidl::encoding::Encode<
13205            FrameSetNavigationPolicyProviderRequest,
13206            fidl::encoding::DefaultFuchsiaResourceDialect,
13207        > for (T0, T1)
13208    {
13209        #[inline]
13210        unsafe fn encode(
13211            self,
13212            encoder: &mut fidl::encoding::Encoder<
13213                '_,
13214                fidl::encoding::DefaultFuchsiaResourceDialect,
13215            >,
13216            offset: usize,
13217            depth: fidl::encoding::Depth,
13218        ) -> fidl::Result<()> {
13219            encoder.debug_check_bounds::<FrameSetNavigationPolicyProviderRequest>(offset);
13220            // Zero out padding regions. There's no need to apply masks
13221            // because the unmasked parts will be overwritten by fields.
13222            unsafe {
13223                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
13224                (ptr as *mut u64).write_unaligned(0);
13225            }
13226            // Write the fields.
13227            self.0.encode(encoder, offset + 0, depth)?;
13228            self.1.encode(encoder, offset + 16, depth)?;
13229            Ok(())
13230        }
13231    }
13232
13233    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13234        for FrameSetNavigationPolicyProviderRequest
13235    {
13236        #[inline(always)]
13237        fn new_empty() -> Self {
13238            Self {
13239                params: fidl::new_empty!(
13240                    NavigationPolicyProviderParams,
13241                    fidl::encoding::DefaultFuchsiaResourceDialect
13242                ),
13243                provider: fidl::new_empty!(
13244                    fidl::encoding::Endpoint<
13245                        fidl::endpoints::ClientEnd<NavigationPolicyProviderMarker>,
13246                    >,
13247                    fidl::encoding::DefaultFuchsiaResourceDialect
13248                ),
13249            }
13250        }
13251
13252        #[inline]
13253        unsafe fn decode(
13254            &mut self,
13255            decoder: &mut fidl::encoding::Decoder<
13256                '_,
13257                fidl::encoding::DefaultFuchsiaResourceDialect,
13258            >,
13259            offset: usize,
13260            _depth: fidl::encoding::Depth,
13261        ) -> fidl::Result<()> {
13262            decoder.debug_check_bounds::<Self>(offset);
13263            // Verify that padding bytes are zero.
13264            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
13265            let padval = unsafe { (ptr as *const u64).read_unaligned() };
13266            let mask = 0xffffffff00000000u64;
13267            let maskedval = padval & mask;
13268            if maskedval != 0 {
13269                return Err(fidl::Error::NonZeroPadding {
13270                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
13271                });
13272            }
13273            fidl::decode!(
13274                NavigationPolicyProviderParams,
13275                fidl::encoding::DefaultFuchsiaResourceDialect,
13276                &mut self.params,
13277                decoder,
13278                offset + 0,
13279                _depth
13280            )?;
13281            fidl::decode!(
13282                fidl::encoding::Endpoint<
13283                    fidl::endpoints::ClientEnd<NavigationPolicyProviderMarker>,
13284                >,
13285                fidl::encoding::DefaultFuchsiaResourceDialect,
13286                &mut self.provider,
13287                decoder,
13288                offset + 16,
13289                _depth
13290            )?;
13291            Ok(())
13292        }
13293    }
13294
13295    impl fidl::encoding::ResourceTypeMarker for FrameSetPopupFrameCreationListenerRequest {
13296        type Borrowed<'a> = &'a mut Self;
13297        fn take_or_borrow<'a>(
13298            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13299        ) -> Self::Borrowed<'a> {
13300            value
13301        }
13302    }
13303
13304    unsafe impl fidl::encoding::TypeMarker for FrameSetPopupFrameCreationListenerRequest {
13305        type Owned = Self;
13306
13307        #[inline(always)]
13308        fn inline_align(_context: fidl::encoding::Context) -> usize {
13309            4
13310        }
13311
13312        #[inline(always)]
13313        fn inline_size(_context: fidl::encoding::Context) -> usize {
13314            4
13315        }
13316    }
13317
13318    unsafe impl
13319        fidl::encoding::Encode<
13320            FrameSetPopupFrameCreationListenerRequest,
13321            fidl::encoding::DefaultFuchsiaResourceDialect,
13322        > for &mut FrameSetPopupFrameCreationListenerRequest
13323    {
13324        #[inline]
13325        unsafe fn encode(
13326            self,
13327            encoder: &mut fidl::encoding::Encoder<
13328                '_,
13329                fidl::encoding::DefaultFuchsiaResourceDialect,
13330            >,
13331            offset: usize,
13332            _depth: fidl::encoding::Depth,
13333        ) -> fidl::Result<()> {
13334            encoder.debug_check_bounds::<FrameSetPopupFrameCreationListenerRequest>(offset);
13335            // Delegate to tuple encoding.
13336            fidl::encoding::Encode::<
13337                FrameSetPopupFrameCreationListenerRequest,
13338                fidl::encoding::DefaultFuchsiaResourceDialect,
13339            >::encode(
13340                (<fidl::encoding::Optional<
13341                    fidl::encoding::Endpoint<
13342                        fidl::endpoints::ClientEnd<PopupFrameCreationListenerMarker>,
13343                    >,
13344                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13345                    &mut self.listener
13346                ),),
13347                encoder,
13348                offset,
13349                _depth,
13350            )
13351        }
13352    }
13353    unsafe impl<
13354            T0: fidl::encoding::Encode<
13355                fidl::encoding::Optional<
13356                    fidl::encoding::Endpoint<
13357                        fidl::endpoints::ClientEnd<PopupFrameCreationListenerMarker>,
13358                    >,
13359                >,
13360                fidl::encoding::DefaultFuchsiaResourceDialect,
13361            >,
13362        >
13363        fidl::encoding::Encode<
13364            FrameSetPopupFrameCreationListenerRequest,
13365            fidl::encoding::DefaultFuchsiaResourceDialect,
13366        > for (T0,)
13367    {
13368        #[inline]
13369        unsafe fn encode(
13370            self,
13371            encoder: &mut fidl::encoding::Encoder<
13372                '_,
13373                fidl::encoding::DefaultFuchsiaResourceDialect,
13374            >,
13375            offset: usize,
13376            depth: fidl::encoding::Depth,
13377        ) -> fidl::Result<()> {
13378            encoder.debug_check_bounds::<FrameSetPopupFrameCreationListenerRequest>(offset);
13379            // Zero out padding regions. There's no need to apply masks
13380            // because the unmasked parts will be overwritten by fields.
13381            // Write the fields.
13382            self.0.encode(encoder, offset + 0, depth)?;
13383            Ok(())
13384        }
13385    }
13386
13387    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13388        for FrameSetPopupFrameCreationListenerRequest
13389    {
13390        #[inline(always)]
13391        fn new_empty() -> Self {
13392            Self {
13393                listener: fidl::new_empty!(
13394                    fidl::encoding::Optional<
13395                        fidl::encoding::Endpoint<
13396                            fidl::endpoints::ClientEnd<PopupFrameCreationListenerMarker>,
13397                        >,
13398                    >,
13399                    fidl::encoding::DefaultFuchsiaResourceDialect
13400                ),
13401            }
13402        }
13403
13404        #[inline]
13405        unsafe fn decode(
13406            &mut self,
13407            decoder: &mut fidl::encoding::Decoder<
13408                '_,
13409                fidl::encoding::DefaultFuchsiaResourceDialect,
13410            >,
13411            offset: usize,
13412            _depth: fidl::encoding::Depth,
13413        ) -> fidl::Result<()> {
13414            decoder.debug_check_bounds::<Self>(offset);
13415            // Verify that padding bytes are zero.
13416            fidl::decode!(
13417                fidl::encoding::Optional<
13418                    fidl::encoding::Endpoint<
13419                        fidl::endpoints::ClientEnd<PopupFrameCreationListenerMarker>,
13420                    >,
13421                >,
13422                fidl::encoding::DefaultFuchsiaResourceDialect,
13423                &mut self.listener,
13424                decoder,
13425                offset + 0,
13426                _depth
13427            )?;
13428            Ok(())
13429        }
13430    }
13431
13432    impl fidl::encoding::ResourceTypeMarker for FrameExecuteJavaScriptResponse {
13433        type Borrowed<'a> = &'a mut Self;
13434        fn take_or_borrow<'a>(
13435            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13436        ) -> Self::Borrowed<'a> {
13437            value
13438        }
13439    }
13440
13441    unsafe impl fidl::encoding::TypeMarker for FrameExecuteJavaScriptResponse {
13442        type Owned = Self;
13443
13444        #[inline(always)]
13445        fn inline_align(_context: fidl::encoding::Context) -> usize {
13446            8
13447        }
13448
13449        #[inline(always)]
13450        fn inline_size(_context: fidl::encoding::Context) -> usize {
13451            16
13452        }
13453    }
13454
13455    unsafe impl
13456        fidl::encoding::Encode<
13457            FrameExecuteJavaScriptResponse,
13458            fidl::encoding::DefaultFuchsiaResourceDialect,
13459        > for &mut FrameExecuteJavaScriptResponse
13460    {
13461        #[inline]
13462        unsafe fn encode(
13463            self,
13464            encoder: &mut fidl::encoding::Encoder<
13465                '_,
13466                fidl::encoding::DefaultFuchsiaResourceDialect,
13467            >,
13468            offset: usize,
13469            _depth: fidl::encoding::Depth,
13470        ) -> fidl::Result<()> {
13471            encoder.debug_check_bounds::<FrameExecuteJavaScriptResponse>(offset);
13472            // Delegate to tuple encoding.
13473            fidl::encoding::Encode::<
13474                FrameExecuteJavaScriptResponse,
13475                fidl::encoding::DefaultFuchsiaResourceDialect,
13476            >::encode(
13477                (<fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13478                    &mut self.result,
13479                ),),
13480                encoder,
13481                offset,
13482                _depth,
13483            )
13484        }
13485    }
13486    unsafe impl<
13487            T0: fidl::encoding::Encode<
13488                fidl_fuchsia_mem::Buffer,
13489                fidl::encoding::DefaultFuchsiaResourceDialect,
13490            >,
13491        >
13492        fidl::encoding::Encode<
13493            FrameExecuteJavaScriptResponse,
13494            fidl::encoding::DefaultFuchsiaResourceDialect,
13495        > for (T0,)
13496    {
13497        #[inline]
13498        unsafe fn encode(
13499            self,
13500            encoder: &mut fidl::encoding::Encoder<
13501                '_,
13502                fidl::encoding::DefaultFuchsiaResourceDialect,
13503            >,
13504            offset: usize,
13505            depth: fidl::encoding::Depth,
13506        ) -> fidl::Result<()> {
13507            encoder.debug_check_bounds::<FrameExecuteJavaScriptResponse>(offset);
13508            // Zero out padding regions. There's no need to apply masks
13509            // because the unmasked parts will be overwritten by fields.
13510            // Write the fields.
13511            self.0.encode(encoder, offset + 0, depth)?;
13512            Ok(())
13513        }
13514    }
13515
13516    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13517        for FrameExecuteJavaScriptResponse
13518    {
13519        #[inline(always)]
13520        fn new_empty() -> Self {
13521            Self {
13522                result: fidl::new_empty!(
13523                    fidl_fuchsia_mem::Buffer,
13524                    fidl::encoding::DefaultFuchsiaResourceDialect
13525                ),
13526            }
13527        }
13528
13529        #[inline]
13530        unsafe fn decode(
13531            &mut self,
13532            decoder: &mut fidl::encoding::Decoder<
13533                '_,
13534                fidl::encoding::DefaultFuchsiaResourceDialect,
13535            >,
13536            offset: usize,
13537            _depth: fidl::encoding::Depth,
13538        ) -> fidl::Result<()> {
13539            decoder.debug_check_bounds::<Self>(offset);
13540            // Verify that padding bytes are zero.
13541            fidl::decode!(
13542                fidl_fuchsia_mem::Buffer,
13543                fidl::encoding::DefaultFuchsiaResourceDialect,
13544                &mut self.result,
13545                decoder,
13546                offset + 0,
13547                _depth
13548            )?;
13549            Ok(())
13550        }
13551    }
13552
13553    impl fidl::encoding::ResourceTypeMarker for MessagePortPostMessageRequest {
13554        type Borrowed<'a> = &'a mut Self;
13555        fn take_or_borrow<'a>(
13556            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13557        ) -> Self::Borrowed<'a> {
13558            value
13559        }
13560    }
13561
13562    unsafe impl fidl::encoding::TypeMarker for MessagePortPostMessageRequest {
13563        type Owned = Self;
13564
13565        #[inline(always)]
13566        fn inline_align(_context: fidl::encoding::Context) -> usize {
13567            8
13568        }
13569
13570        #[inline(always)]
13571        fn inline_size(_context: fidl::encoding::Context) -> usize {
13572            16
13573        }
13574    }
13575
13576    unsafe impl
13577        fidl::encoding::Encode<
13578            MessagePortPostMessageRequest,
13579            fidl::encoding::DefaultFuchsiaResourceDialect,
13580        > for &mut MessagePortPostMessageRequest
13581    {
13582        #[inline]
13583        unsafe fn encode(
13584            self,
13585            encoder: &mut fidl::encoding::Encoder<
13586                '_,
13587                fidl::encoding::DefaultFuchsiaResourceDialect,
13588            >,
13589            offset: usize,
13590            _depth: fidl::encoding::Depth,
13591        ) -> fidl::Result<()> {
13592            encoder.debug_check_bounds::<MessagePortPostMessageRequest>(offset);
13593            // Delegate to tuple encoding.
13594            fidl::encoding::Encode::<
13595                MessagePortPostMessageRequest,
13596                fidl::encoding::DefaultFuchsiaResourceDialect,
13597            >::encode(
13598                (<WebMessage as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13599                    &mut self.message,
13600                ),),
13601                encoder,
13602                offset,
13603                _depth,
13604            )
13605        }
13606    }
13607    unsafe impl<T0: fidl::encoding::Encode<WebMessage, fidl::encoding::DefaultFuchsiaResourceDialect>>
13608        fidl::encoding::Encode<
13609            MessagePortPostMessageRequest,
13610            fidl::encoding::DefaultFuchsiaResourceDialect,
13611        > for (T0,)
13612    {
13613        #[inline]
13614        unsafe fn encode(
13615            self,
13616            encoder: &mut fidl::encoding::Encoder<
13617                '_,
13618                fidl::encoding::DefaultFuchsiaResourceDialect,
13619            >,
13620            offset: usize,
13621            depth: fidl::encoding::Depth,
13622        ) -> fidl::Result<()> {
13623            encoder.debug_check_bounds::<MessagePortPostMessageRequest>(offset);
13624            // Zero out padding regions. There's no need to apply masks
13625            // because the unmasked parts will be overwritten by fields.
13626            // Write the fields.
13627            self.0.encode(encoder, offset + 0, depth)?;
13628            Ok(())
13629        }
13630    }
13631
13632    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13633        for MessagePortPostMessageRequest
13634    {
13635        #[inline(always)]
13636        fn new_empty() -> Self {
13637            Self {
13638                message: fidl::new_empty!(
13639                    WebMessage,
13640                    fidl::encoding::DefaultFuchsiaResourceDialect
13641                ),
13642            }
13643        }
13644
13645        #[inline]
13646        unsafe fn decode(
13647            &mut self,
13648            decoder: &mut fidl::encoding::Decoder<
13649                '_,
13650                fidl::encoding::DefaultFuchsiaResourceDialect,
13651            >,
13652            offset: usize,
13653            _depth: fidl::encoding::Depth,
13654        ) -> fidl::Result<()> {
13655            decoder.debug_check_bounds::<Self>(offset);
13656            // Verify that padding bytes are zero.
13657            fidl::decode!(
13658                WebMessage,
13659                fidl::encoding::DefaultFuchsiaResourceDialect,
13660                &mut self.message,
13661                decoder,
13662                offset + 0,
13663                _depth
13664            )?;
13665            Ok(())
13666        }
13667    }
13668
13669    impl fidl::encoding::ResourceTypeMarker for MessagePortReceiveMessageResponse {
13670        type Borrowed<'a> = &'a mut Self;
13671        fn take_or_borrow<'a>(
13672            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13673        ) -> Self::Borrowed<'a> {
13674            value
13675        }
13676    }
13677
13678    unsafe impl fidl::encoding::TypeMarker for MessagePortReceiveMessageResponse {
13679        type Owned = Self;
13680
13681        #[inline(always)]
13682        fn inline_align(_context: fidl::encoding::Context) -> usize {
13683            8
13684        }
13685
13686        #[inline(always)]
13687        fn inline_size(_context: fidl::encoding::Context) -> usize {
13688            16
13689        }
13690    }
13691
13692    unsafe impl
13693        fidl::encoding::Encode<
13694            MessagePortReceiveMessageResponse,
13695            fidl::encoding::DefaultFuchsiaResourceDialect,
13696        > for &mut MessagePortReceiveMessageResponse
13697    {
13698        #[inline]
13699        unsafe fn encode(
13700            self,
13701            encoder: &mut fidl::encoding::Encoder<
13702                '_,
13703                fidl::encoding::DefaultFuchsiaResourceDialect,
13704            >,
13705            offset: usize,
13706            _depth: fidl::encoding::Depth,
13707        ) -> fidl::Result<()> {
13708            encoder.debug_check_bounds::<MessagePortReceiveMessageResponse>(offset);
13709            // Delegate to tuple encoding.
13710            fidl::encoding::Encode::<
13711                MessagePortReceiveMessageResponse,
13712                fidl::encoding::DefaultFuchsiaResourceDialect,
13713            >::encode(
13714                (<WebMessage as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13715                    &mut self.message,
13716                ),),
13717                encoder,
13718                offset,
13719                _depth,
13720            )
13721        }
13722    }
13723    unsafe impl<T0: fidl::encoding::Encode<WebMessage, fidl::encoding::DefaultFuchsiaResourceDialect>>
13724        fidl::encoding::Encode<
13725            MessagePortReceiveMessageResponse,
13726            fidl::encoding::DefaultFuchsiaResourceDialect,
13727        > for (T0,)
13728    {
13729        #[inline]
13730        unsafe fn encode(
13731            self,
13732            encoder: &mut fidl::encoding::Encoder<
13733                '_,
13734                fidl::encoding::DefaultFuchsiaResourceDialect,
13735            >,
13736            offset: usize,
13737            depth: fidl::encoding::Depth,
13738        ) -> fidl::Result<()> {
13739            encoder.debug_check_bounds::<MessagePortReceiveMessageResponse>(offset);
13740            // Zero out padding regions. There's no need to apply masks
13741            // because the unmasked parts will be overwritten by fields.
13742            // Write the fields.
13743            self.0.encode(encoder, offset + 0, depth)?;
13744            Ok(())
13745        }
13746    }
13747
13748    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13749        for MessagePortReceiveMessageResponse
13750    {
13751        #[inline(always)]
13752        fn new_empty() -> Self {
13753            Self {
13754                message: fidl::new_empty!(
13755                    WebMessage,
13756                    fidl::encoding::DefaultFuchsiaResourceDialect
13757                ),
13758            }
13759        }
13760
13761        #[inline]
13762        unsafe fn decode(
13763            &mut self,
13764            decoder: &mut fidl::encoding::Decoder<
13765                '_,
13766                fidl::encoding::DefaultFuchsiaResourceDialect,
13767            >,
13768            offset: usize,
13769            _depth: fidl::encoding::Depth,
13770        ) -> fidl::Result<()> {
13771            decoder.debug_check_bounds::<Self>(offset);
13772            // Verify that padding bytes are zero.
13773            fidl::decode!(
13774                WebMessage,
13775                fidl::encoding::DefaultFuchsiaResourceDialect,
13776                &mut self.message,
13777                decoder,
13778                offset + 0,
13779                _depth
13780            )?;
13781            Ok(())
13782        }
13783    }
13784
13785    impl fidl::encoding::ResourceTypeMarker for NavigationControllerLoadUrlRequest {
13786        type Borrowed<'a> = &'a mut Self;
13787        fn take_or_borrow<'a>(
13788            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13789        ) -> Self::Borrowed<'a> {
13790            value
13791        }
13792    }
13793
13794    unsafe impl fidl::encoding::TypeMarker for NavigationControllerLoadUrlRequest {
13795        type Owned = Self;
13796
13797        #[inline(always)]
13798        fn inline_align(_context: fidl::encoding::Context) -> usize {
13799            8
13800        }
13801
13802        #[inline(always)]
13803        fn inline_size(_context: fidl::encoding::Context) -> usize {
13804            32
13805        }
13806    }
13807
13808    unsafe impl
13809        fidl::encoding::Encode<
13810            NavigationControllerLoadUrlRequest,
13811            fidl::encoding::DefaultFuchsiaResourceDialect,
13812        > for &mut NavigationControllerLoadUrlRequest
13813    {
13814        #[inline]
13815        unsafe fn encode(
13816            self,
13817            encoder: &mut fidl::encoding::Encoder<
13818                '_,
13819                fidl::encoding::DefaultFuchsiaResourceDialect,
13820            >,
13821            offset: usize,
13822            _depth: fidl::encoding::Depth,
13823        ) -> fidl::Result<()> {
13824            encoder.debug_check_bounds::<NavigationControllerLoadUrlRequest>(offset);
13825            // Delegate to tuple encoding.
13826            fidl::encoding::Encode::<NavigationControllerLoadUrlRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
13827                (
13828                    <fidl::encoding::BoundedString<65536> as fidl::encoding::ValueTypeMarker>::borrow(&self.url),
13829                    <LoadUrlParams as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.params),
13830                ),
13831                encoder, offset, _depth
13832            )
13833        }
13834    }
13835    unsafe impl<
13836            T0: fidl::encoding::Encode<
13837                fidl::encoding::BoundedString<65536>,
13838                fidl::encoding::DefaultFuchsiaResourceDialect,
13839            >,
13840            T1: fidl::encoding::Encode<LoadUrlParams, fidl::encoding::DefaultFuchsiaResourceDialect>,
13841        >
13842        fidl::encoding::Encode<
13843            NavigationControllerLoadUrlRequest,
13844            fidl::encoding::DefaultFuchsiaResourceDialect,
13845        > for (T0, T1)
13846    {
13847        #[inline]
13848        unsafe fn encode(
13849            self,
13850            encoder: &mut fidl::encoding::Encoder<
13851                '_,
13852                fidl::encoding::DefaultFuchsiaResourceDialect,
13853            >,
13854            offset: usize,
13855            depth: fidl::encoding::Depth,
13856        ) -> fidl::Result<()> {
13857            encoder.debug_check_bounds::<NavigationControllerLoadUrlRequest>(offset);
13858            // Zero out padding regions. There's no need to apply masks
13859            // because the unmasked parts will be overwritten by fields.
13860            // Write the fields.
13861            self.0.encode(encoder, offset + 0, depth)?;
13862            self.1.encode(encoder, offset + 16, depth)?;
13863            Ok(())
13864        }
13865    }
13866
13867    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13868        for NavigationControllerLoadUrlRequest
13869    {
13870        #[inline(always)]
13871        fn new_empty() -> Self {
13872            Self {
13873                url: fidl::new_empty!(
13874                    fidl::encoding::BoundedString<65536>,
13875                    fidl::encoding::DefaultFuchsiaResourceDialect
13876                ),
13877                params: fidl::new_empty!(
13878                    LoadUrlParams,
13879                    fidl::encoding::DefaultFuchsiaResourceDialect
13880                ),
13881            }
13882        }
13883
13884        #[inline]
13885        unsafe fn decode(
13886            &mut self,
13887            decoder: &mut fidl::encoding::Decoder<
13888                '_,
13889                fidl::encoding::DefaultFuchsiaResourceDialect,
13890            >,
13891            offset: usize,
13892            _depth: fidl::encoding::Depth,
13893        ) -> fidl::Result<()> {
13894            decoder.debug_check_bounds::<Self>(offset);
13895            // Verify that padding bytes are zero.
13896            fidl::decode!(
13897                fidl::encoding::BoundedString<65536>,
13898                fidl::encoding::DefaultFuchsiaResourceDialect,
13899                &mut self.url,
13900                decoder,
13901                offset + 0,
13902                _depth
13903            )?;
13904            fidl::decode!(
13905                LoadUrlParams,
13906                fidl::encoding::DefaultFuchsiaResourceDialect,
13907                &mut self.params,
13908                decoder,
13909                offset + 16,
13910                _depth
13911            )?;
13912            Ok(())
13913        }
13914    }
13915
13916    impl fidl::encoding::ResourceTypeMarker for NavigationEventListenerOnNavigationStateChangedRequest {
13917        type Borrowed<'a> = &'a mut Self;
13918        fn take_or_borrow<'a>(
13919            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13920        ) -> Self::Borrowed<'a> {
13921            value
13922        }
13923    }
13924
13925    unsafe impl fidl::encoding::TypeMarker for NavigationEventListenerOnNavigationStateChangedRequest {
13926        type Owned = Self;
13927
13928        #[inline(always)]
13929        fn inline_align(_context: fidl::encoding::Context) -> usize {
13930            8
13931        }
13932
13933        #[inline(always)]
13934        fn inline_size(_context: fidl::encoding::Context) -> usize {
13935            16
13936        }
13937    }
13938
13939    unsafe impl
13940        fidl::encoding::Encode<
13941            NavigationEventListenerOnNavigationStateChangedRequest,
13942            fidl::encoding::DefaultFuchsiaResourceDialect,
13943        > for &mut NavigationEventListenerOnNavigationStateChangedRequest
13944    {
13945        #[inline]
13946        unsafe fn encode(
13947            self,
13948            encoder: &mut fidl::encoding::Encoder<
13949                '_,
13950                fidl::encoding::DefaultFuchsiaResourceDialect,
13951            >,
13952            offset: usize,
13953            _depth: fidl::encoding::Depth,
13954        ) -> fidl::Result<()> {
13955            encoder.debug_check_bounds::<NavigationEventListenerOnNavigationStateChangedRequest>(
13956                offset,
13957            );
13958            // Delegate to tuple encoding.
13959            fidl::encoding::Encode::<
13960                NavigationEventListenerOnNavigationStateChangedRequest,
13961                fidl::encoding::DefaultFuchsiaResourceDialect,
13962            >::encode(
13963                (<NavigationState as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13964                    &mut self.change,
13965                ),),
13966                encoder,
13967                offset,
13968                _depth,
13969            )
13970        }
13971    }
13972    unsafe impl<
13973            T0: fidl::encoding::Encode<NavigationState, fidl::encoding::DefaultFuchsiaResourceDialect>,
13974        >
13975        fidl::encoding::Encode<
13976            NavigationEventListenerOnNavigationStateChangedRequest,
13977            fidl::encoding::DefaultFuchsiaResourceDialect,
13978        > for (T0,)
13979    {
13980        #[inline]
13981        unsafe fn encode(
13982            self,
13983            encoder: &mut fidl::encoding::Encoder<
13984                '_,
13985                fidl::encoding::DefaultFuchsiaResourceDialect,
13986            >,
13987            offset: usize,
13988            depth: fidl::encoding::Depth,
13989        ) -> fidl::Result<()> {
13990            encoder.debug_check_bounds::<NavigationEventListenerOnNavigationStateChangedRequest>(
13991                offset,
13992            );
13993            // Zero out padding regions. There's no need to apply masks
13994            // because the unmasked parts will be overwritten by fields.
13995            // Write the fields.
13996            self.0.encode(encoder, offset + 0, depth)?;
13997            Ok(())
13998        }
13999    }
14000
14001    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14002        for NavigationEventListenerOnNavigationStateChangedRequest
14003    {
14004        #[inline(always)]
14005        fn new_empty() -> Self {
14006            Self {
14007                change: fidl::new_empty!(
14008                    NavigationState,
14009                    fidl::encoding::DefaultFuchsiaResourceDialect
14010                ),
14011            }
14012        }
14013
14014        #[inline]
14015        unsafe fn decode(
14016            &mut self,
14017            decoder: &mut fidl::encoding::Decoder<
14018                '_,
14019                fidl::encoding::DefaultFuchsiaResourceDialect,
14020            >,
14021            offset: usize,
14022            _depth: fidl::encoding::Depth,
14023        ) -> fidl::Result<()> {
14024            decoder.debug_check_bounds::<Self>(offset);
14025            // Verify that padding bytes are zero.
14026            fidl::decode!(
14027                NavigationState,
14028                fidl::encoding::DefaultFuchsiaResourceDialect,
14029                &mut self.change,
14030                decoder,
14031                offset + 0,
14032                _depth
14033            )?;
14034            Ok(())
14035        }
14036    }
14037
14038    impl fidl::encoding::ResourceTypeMarker
14039        for NavigationPolicyProviderEvaluateRequestedNavigationResponse
14040    {
14041        type Borrowed<'a> = &'a mut Self;
14042        fn take_or_borrow<'a>(
14043            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14044        ) -> Self::Borrowed<'a> {
14045            value
14046        }
14047    }
14048
14049    unsafe impl fidl::encoding::TypeMarker
14050        for NavigationPolicyProviderEvaluateRequestedNavigationResponse
14051    {
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            NavigationPolicyProviderEvaluateRequestedNavigationResponse,
14068            fidl::encoding::DefaultFuchsiaResourceDialect,
14069        > for &mut NavigationPolicyProviderEvaluateRequestedNavigationResponse
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
14082                .debug_check_bounds::<NavigationPolicyProviderEvaluateRequestedNavigationResponse>(
14083                    offset,
14084                );
14085            // Delegate to tuple encoding.
14086            fidl::encoding::Encode::<
14087                NavigationPolicyProviderEvaluateRequestedNavigationResponse,
14088                fidl::encoding::DefaultFuchsiaResourceDialect,
14089            >::encode(
14090                (<NavigationDecision as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
14091                    &mut self.decision,
14092                ),),
14093                encoder,
14094                offset,
14095                _depth,
14096            )
14097        }
14098    }
14099    unsafe impl<
14100            T0: fidl::encoding::Encode<
14101                NavigationDecision,
14102                fidl::encoding::DefaultFuchsiaResourceDialect,
14103            >,
14104        >
14105        fidl::encoding::Encode<
14106            NavigationPolicyProviderEvaluateRequestedNavigationResponse,
14107            fidl::encoding::DefaultFuchsiaResourceDialect,
14108        > for (T0,)
14109    {
14110        #[inline]
14111        unsafe fn encode(
14112            self,
14113            encoder: &mut fidl::encoding::Encoder<
14114                '_,
14115                fidl::encoding::DefaultFuchsiaResourceDialect,
14116            >,
14117            offset: usize,
14118            depth: fidl::encoding::Depth,
14119        ) -> fidl::Result<()> {
14120            encoder
14121                .debug_check_bounds::<NavigationPolicyProviderEvaluateRequestedNavigationResponse>(
14122                    offset,
14123                );
14124            // Zero out padding regions. There's no need to apply masks
14125            // because the unmasked parts will be overwritten by fields.
14126            // Write the fields.
14127            self.0.encode(encoder, offset + 0, depth)?;
14128            Ok(())
14129        }
14130    }
14131
14132    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14133        for NavigationPolicyProviderEvaluateRequestedNavigationResponse
14134    {
14135        #[inline(always)]
14136        fn new_empty() -> Self {
14137            Self {
14138                decision: fidl::new_empty!(
14139                    NavigationDecision,
14140                    fidl::encoding::DefaultFuchsiaResourceDialect
14141                ),
14142            }
14143        }
14144
14145        #[inline]
14146        unsafe fn decode(
14147            &mut self,
14148            decoder: &mut fidl::encoding::Decoder<
14149                '_,
14150                fidl::encoding::DefaultFuchsiaResourceDialect,
14151            >,
14152            offset: usize,
14153            _depth: fidl::encoding::Depth,
14154        ) -> fidl::Result<()> {
14155            decoder.debug_check_bounds::<Self>(offset);
14156            // Verify that padding bytes are zero.
14157            fidl::decode!(
14158                NavigationDecision,
14159                fidl::encoding::DefaultFuchsiaResourceDialect,
14160                &mut self.decision,
14161                decoder,
14162                offset + 0,
14163                _depth
14164            )?;
14165            Ok(())
14166        }
14167    }
14168
14169    impl fidl::encoding::ResourceTypeMarker for PopupFrameCreationListenerOnPopupFrameCreatedRequest {
14170        type Borrowed<'a> = &'a mut Self;
14171        fn take_or_borrow<'a>(
14172            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14173        ) -> Self::Borrowed<'a> {
14174            value
14175        }
14176    }
14177
14178    unsafe impl fidl::encoding::TypeMarker for PopupFrameCreationListenerOnPopupFrameCreatedRequest {
14179        type Owned = Self;
14180
14181        #[inline(always)]
14182        fn inline_align(_context: fidl::encoding::Context) -> usize {
14183            8
14184        }
14185
14186        #[inline(always)]
14187        fn inline_size(_context: fidl::encoding::Context) -> usize {
14188            24
14189        }
14190    }
14191
14192    unsafe impl
14193        fidl::encoding::Encode<
14194            PopupFrameCreationListenerOnPopupFrameCreatedRequest,
14195            fidl::encoding::DefaultFuchsiaResourceDialect,
14196        > for &mut PopupFrameCreationListenerOnPopupFrameCreatedRequest
14197    {
14198        #[inline]
14199        unsafe fn encode(
14200            self,
14201            encoder: &mut fidl::encoding::Encoder<
14202                '_,
14203                fidl::encoding::DefaultFuchsiaResourceDialect,
14204            >,
14205            offset: usize,
14206            _depth: fidl::encoding::Depth,
14207        ) -> fidl::Result<()> {
14208            encoder
14209                .debug_check_bounds::<PopupFrameCreationListenerOnPopupFrameCreatedRequest>(offset);
14210            // Delegate to tuple encoding.
14211            fidl::encoding::Encode::<PopupFrameCreationListenerOnPopupFrameCreatedRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
14212                (
14213                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<FrameMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.frame),
14214                    <PopupFrameCreationInfo as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.info),
14215                ),
14216                encoder, offset, _depth
14217            )
14218        }
14219    }
14220    unsafe impl<
14221            T0: fidl::encoding::Encode<
14222                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<FrameMarker>>,
14223                fidl::encoding::DefaultFuchsiaResourceDialect,
14224            >,
14225            T1: fidl::encoding::Encode<
14226                PopupFrameCreationInfo,
14227                fidl::encoding::DefaultFuchsiaResourceDialect,
14228            >,
14229        >
14230        fidl::encoding::Encode<
14231            PopupFrameCreationListenerOnPopupFrameCreatedRequest,
14232            fidl::encoding::DefaultFuchsiaResourceDialect,
14233        > for (T0, T1)
14234    {
14235        #[inline]
14236        unsafe fn encode(
14237            self,
14238            encoder: &mut fidl::encoding::Encoder<
14239                '_,
14240                fidl::encoding::DefaultFuchsiaResourceDialect,
14241            >,
14242            offset: usize,
14243            depth: fidl::encoding::Depth,
14244        ) -> fidl::Result<()> {
14245            encoder
14246                .debug_check_bounds::<PopupFrameCreationListenerOnPopupFrameCreatedRequest>(offset);
14247            // Zero out padding regions. There's no need to apply masks
14248            // because the unmasked parts will be overwritten by fields.
14249            unsafe {
14250                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
14251                (ptr as *mut u64).write_unaligned(0);
14252            }
14253            // Write the fields.
14254            self.0.encode(encoder, offset + 0, depth)?;
14255            self.1.encode(encoder, offset + 8, depth)?;
14256            Ok(())
14257        }
14258    }
14259
14260    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14261        for PopupFrameCreationListenerOnPopupFrameCreatedRequest
14262    {
14263        #[inline(always)]
14264        fn new_empty() -> Self {
14265            Self {
14266                frame: fidl::new_empty!(
14267                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<FrameMarker>>,
14268                    fidl::encoding::DefaultFuchsiaResourceDialect
14269                ),
14270                info: fidl::new_empty!(
14271                    PopupFrameCreationInfo,
14272                    fidl::encoding::DefaultFuchsiaResourceDialect
14273                ),
14274            }
14275        }
14276
14277        #[inline]
14278        unsafe fn decode(
14279            &mut self,
14280            decoder: &mut fidl::encoding::Decoder<
14281                '_,
14282                fidl::encoding::DefaultFuchsiaResourceDialect,
14283            >,
14284            offset: usize,
14285            _depth: fidl::encoding::Depth,
14286        ) -> fidl::Result<()> {
14287            decoder.debug_check_bounds::<Self>(offset);
14288            // Verify that padding bytes are zero.
14289            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
14290            let padval = unsafe { (ptr as *const u64).read_unaligned() };
14291            let mask = 0xffffffff00000000u64;
14292            let maskedval = padval & mask;
14293            if maskedval != 0 {
14294                return Err(fidl::Error::NonZeroPadding {
14295                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
14296                });
14297            }
14298            fidl::decode!(
14299                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<FrameMarker>>,
14300                fidl::encoding::DefaultFuchsiaResourceDialect,
14301                &mut self.frame,
14302                decoder,
14303                offset + 0,
14304                _depth
14305            )?;
14306            fidl::decode!(
14307                PopupFrameCreationInfo,
14308                fidl::encoding::DefaultFuchsiaResourceDialect,
14309                &mut self.info,
14310                decoder,
14311                offset + 8,
14312                _depth
14313            )?;
14314            Ok(())
14315        }
14316    }
14317
14318    impl ContentDirectoryProvider {
14319        #[inline(always)]
14320        fn max_ordinal_present(&self) -> u64 {
14321            if let Some(_) = self.directory {
14322                return 2;
14323            }
14324            if let Some(_) = self.name {
14325                return 1;
14326            }
14327            0
14328        }
14329    }
14330
14331    impl fidl::encoding::ResourceTypeMarker for ContentDirectoryProvider {
14332        type Borrowed<'a> = &'a mut Self;
14333        fn take_or_borrow<'a>(
14334            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14335        ) -> Self::Borrowed<'a> {
14336            value
14337        }
14338    }
14339
14340    unsafe impl fidl::encoding::TypeMarker for ContentDirectoryProvider {
14341        type Owned = Self;
14342
14343        #[inline(always)]
14344        fn inline_align(_context: fidl::encoding::Context) -> usize {
14345            8
14346        }
14347
14348        #[inline(always)]
14349        fn inline_size(_context: fidl::encoding::Context) -> usize {
14350            16
14351        }
14352    }
14353
14354    unsafe impl
14355        fidl::encoding::Encode<
14356            ContentDirectoryProvider,
14357            fidl::encoding::DefaultFuchsiaResourceDialect,
14358        > for &mut ContentDirectoryProvider
14359    {
14360        unsafe fn encode(
14361            self,
14362            encoder: &mut fidl::encoding::Encoder<
14363                '_,
14364                fidl::encoding::DefaultFuchsiaResourceDialect,
14365            >,
14366            offset: usize,
14367            mut depth: fidl::encoding::Depth,
14368        ) -> fidl::Result<()> {
14369            encoder.debug_check_bounds::<ContentDirectoryProvider>(offset);
14370            // Vector header
14371            let max_ordinal: u64 = self.max_ordinal_present();
14372            encoder.write_num(max_ordinal, offset);
14373            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
14374            // Calling encoder.out_of_line_offset(0) is not allowed.
14375            if max_ordinal == 0 {
14376                return Ok(());
14377            }
14378            depth.increment()?;
14379            let envelope_size = 8;
14380            let bytes_len = max_ordinal as usize * envelope_size;
14381            #[allow(unused_variables)]
14382            let offset = encoder.out_of_line_offset(bytes_len);
14383            let mut _prev_end_offset: usize = 0;
14384            if 1 > max_ordinal {
14385                return Ok(());
14386            }
14387
14388            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14389            // are envelope_size bytes.
14390            let cur_offset: usize = (1 - 1) * envelope_size;
14391
14392            // Zero reserved fields.
14393            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14394
14395            // Safety:
14396            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14397            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14398            //   envelope_size bytes, there is always sufficient room.
14399            fidl::encoding::encode_in_envelope_optional::<
14400                fidl::encoding::BoundedString<255>,
14401                fidl::encoding::DefaultFuchsiaResourceDialect,
14402            >(
14403                self.name.as_ref().map(
14404                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow,
14405                ),
14406                encoder,
14407                offset + cur_offset,
14408                depth,
14409            )?;
14410
14411            _prev_end_offset = cur_offset + envelope_size;
14412            if 2 > max_ordinal {
14413                return Ok(());
14414            }
14415
14416            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14417            // are envelope_size bytes.
14418            let cur_offset: usize = (2 - 1) * envelope_size;
14419
14420            // Zero reserved fields.
14421            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14422
14423            // Safety:
14424            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14425            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14426            //   envelope_size bytes, there is always sufficient room.
14427            fidl::encoding::encode_in_envelope_optional::<
14428                fidl::encoding::Endpoint<
14429                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
14430                >,
14431                fidl::encoding::DefaultFuchsiaResourceDialect,
14432            >(
14433                self.directory.as_mut().map(
14434                    <fidl::encoding::Endpoint<
14435                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
14436                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
14437                ),
14438                encoder,
14439                offset + cur_offset,
14440                depth,
14441            )?;
14442
14443            _prev_end_offset = cur_offset + envelope_size;
14444
14445            Ok(())
14446        }
14447    }
14448
14449    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14450        for ContentDirectoryProvider
14451    {
14452        #[inline(always)]
14453        fn new_empty() -> Self {
14454            Self::default()
14455        }
14456
14457        unsafe fn decode(
14458            &mut self,
14459            decoder: &mut fidl::encoding::Decoder<
14460                '_,
14461                fidl::encoding::DefaultFuchsiaResourceDialect,
14462            >,
14463            offset: usize,
14464            mut depth: fidl::encoding::Depth,
14465        ) -> fidl::Result<()> {
14466            decoder.debug_check_bounds::<Self>(offset);
14467            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
14468                None => return Err(fidl::Error::NotNullable),
14469                Some(len) => len,
14470            };
14471            // Calling decoder.out_of_line_offset(0) is not allowed.
14472            if len == 0 {
14473                return Ok(());
14474            };
14475            depth.increment()?;
14476            let envelope_size = 8;
14477            let bytes_len = len * envelope_size;
14478            let offset = decoder.out_of_line_offset(bytes_len)?;
14479            // Decode the envelope for each type.
14480            let mut _next_ordinal_to_read = 0;
14481            let mut next_offset = offset;
14482            let end_offset = offset + bytes_len;
14483            _next_ordinal_to_read += 1;
14484            if next_offset >= end_offset {
14485                return Ok(());
14486            }
14487
14488            // Decode unknown envelopes for gaps in ordinals.
14489            while _next_ordinal_to_read < 1 {
14490                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14491                _next_ordinal_to_read += 1;
14492                next_offset += envelope_size;
14493            }
14494
14495            let next_out_of_line = decoder.next_out_of_line();
14496            let handles_before = decoder.remaining_handles();
14497            if let Some((inlined, num_bytes, num_handles)) =
14498                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14499            {
14500                let member_inline_size =
14501                    <fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
14502                        decoder.context,
14503                    );
14504                if inlined != (member_inline_size <= 4) {
14505                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14506                }
14507                let inner_offset;
14508                let mut inner_depth = depth.clone();
14509                if inlined {
14510                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14511                    inner_offset = next_offset;
14512                } else {
14513                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14514                    inner_depth.increment()?;
14515                }
14516                let val_ref = self.name.get_or_insert_with(|| {
14517                    fidl::new_empty!(
14518                        fidl::encoding::BoundedString<255>,
14519                        fidl::encoding::DefaultFuchsiaResourceDialect
14520                    )
14521                });
14522                fidl::decode!(
14523                    fidl::encoding::BoundedString<255>,
14524                    fidl::encoding::DefaultFuchsiaResourceDialect,
14525                    val_ref,
14526                    decoder,
14527                    inner_offset,
14528                    inner_depth
14529                )?;
14530                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14531                {
14532                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14533                }
14534                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14535                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14536                }
14537            }
14538
14539            next_offset += envelope_size;
14540            _next_ordinal_to_read += 1;
14541            if next_offset >= end_offset {
14542                return Ok(());
14543            }
14544
14545            // Decode unknown envelopes for gaps in ordinals.
14546            while _next_ordinal_to_read < 2 {
14547                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14548                _next_ordinal_to_read += 1;
14549                next_offset += envelope_size;
14550            }
14551
14552            let next_out_of_line = decoder.next_out_of_line();
14553            let handles_before = decoder.remaining_handles();
14554            if let Some((inlined, num_bytes, num_handles)) =
14555                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14556            {
14557                let member_inline_size = <fidl::encoding::Endpoint<
14558                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
14559                > as fidl::encoding::TypeMarker>::inline_size(
14560                    decoder.context
14561                );
14562                if inlined != (member_inline_size <= 4) {
14563                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14564                }
14565                let inner_offset;
14566                let mut inner_depth = depth.clone();
14567                if inlined {
14568                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14569                    inner_offset = next_offset;
14570                } else {
14571                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14572                    inner_depth.increment()?;
14573                }
14574                let val_ref = self.directory.get_or_insert_with(|| {
14575                    fidl::new_empty!(
14576                        fidl::encoding::Endpoint<
14577                            fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
14578                        >,
14579                        fidl::encoding::DefaultFuchsiaResourceDialect
14580                    )
14581                });
14582                fidl::decode!(
14583                    fidl::encoding::Endpoint<
14584                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
14585                    >,
14586                    fidl::encoding::DefaultFuchsiaResourceDialect,
14587                    val_ref,
14588                    decoder,
14589                    inner_offset,
14590                    inner_depth
14591                )?;
14592                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14593                {
14594                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14595                }
14596                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14597                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14598                }
14599            }
14600
14601            next_offset += envelope_size;
14602
14603            // Decode the remaining unknown envelopes.
14604            while next_offset < end_offset {
14605                _next_ordinal_to_read += 1;
14606                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14607                next_offset += envelope_size;
14608            }
14609
14610            Ok(())
14611        }
14612    }
14613
14614    impl Cookie {
14615        #[inline(always)]
14616        fn max_ordinal_present(&self) -> u64 {
14617            if let Some(_) = self.value {
14618                return 2;
14619            }
14620            if let Some(_) = self.id {
14621                return 1;
14622            }
14623            0
14624        }
14625    }
14626
14627    impl fidl::encoding::ResourceTypeMarker for Cookie {
14628        type Borrowed<'a> = &'a mut Self;
14629        fn take_or_borrow<'a>(
14630            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14631        ) -> Self::Borrowed<'a> {
14632            value
14633        }
14634    }
14635
14636    unsafe impl fidl::encoding::TypeMarker for Cookie {
14637        type Owned = Self;
14638
14639        #[inline(always)]
14640        fn inline_align(_context: fidl::encoding::Context) -> usize {
14641            8
14642        }
14643
14644        #[inline(always)]
14645        fn inline_size(_context: fidl::encoding::Context) -> usize {
14646            16
14647        }
14648    }
14649
14650    unsafe impl fidl::encoding::Encode<Cookie, fidl::encoding::DefaultFuchsiaResourceDialect>
14651        for &mut Cookie
14652    {
14653        unsafe fn encode(
14654            self,
14655            encoder: &mut fidl::encoding::Encoder<
14656                '_,
14657                fidl::encoding::DefaultFuchsiaResourceDialect,
14658            >,
14659            offset: usize,
14660            mut depth: fidl::encoding::Depth,
14661        ) -> fidl::Result<()> {
14662            encoder.debug_check_bounds::<Cookie>(offset);
14663            // Vector header
14664            let max_ordinal: u64 = self.max_ordinal_present();
14665            encoder.write_num(max_ordinal, offset);
14666            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
14667            // Calling encoder.out_of_line_offset(0) is not allowed.
14668            if max_ordinal == 0 {
14669                return Ok(());
14670            }
14671            depth.increment()?;
14672            let envelope_size = 8;
14673            let bytes_len = max_ordinal as usize * envelope_size;
14674            #[allow(unused_variables)]
14675            let offset = encoder.out_of_line_offset(bytes_len);
14676            let mut _prev_end_offset: usize = 0;
14677            if 1 > max_ordinal {
14678                return Ok(());
14679            }
14680
14681            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14682            // are envelope_size bytes.
14683            let cur_offset: usize = (1 - 1) * envelope_size;
14684
14685            // Zero reserved fields.
14686            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14687
14688            // Safety:
14689            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14690            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14691            //   envelope_size bytes, there is always sufficient room.
14692            fidl::encoding::encode_in_envelope_optional::<
14693                CookieId,
14694                fidl::encoding::DefaultFuchsiaResourceDialect,
14695            >(
14696                self.id.as_ref().map(<CookieId as fidl::encoding::ValueTypeMarker>::borrow),
14697                encoder,
14698                offset + cur_offset,
14699                depth,
14700            )?;
14701
14702            _prev_end_offset = cur_offset + envelope_size;
14703            if 2 > max_ordinal {
14704                return Ok(());
14705            }
14706
14707            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14708            // are envelope_size bytes.
14709            let cur_offset: usize = (2 - 1) * envelope_size;
14710
14711            // Zero reserved fields.
14712            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14713
14714            // Safety:
14715            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14716            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14717            //   envelope_size bytes, there is always sufficient room.
14718            fidl::encoding::encode_in_envelope_optional::<
14719                fidl::encoding::UnboundedString,
14720                fidl::encoding::DefaultFuchsiaResourceDialect,
14721            >(
14722                self.value.as_ref().map(
14723                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
14724                ),
14725                encoder,
14726                offset + cur_offset,
14727                depth,
14728            )?;
14729
14730            _prev_end_offset = cur_offset + envelope_size;
14731
14732            Ok(())
14733        }
14734    }
14735
14736    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Cookie {
14737        #[inline(always)]
14738        fn new_empty() -> Self {
14739            Self::default()
14740        }
14741
14742        unsafe fn decode(
14743            &mut self,
14744            decoder: &mut fidl::encoding::Decoder<
14745                '_,
14746                fidl::encoding::DefaultFuchsiaResourceDialect,
14747            >,
14748            offset: usize,
14749            mut depth: fidl::encoding::Depth,
14750        ) -> fidl::Result<()> {
14751            decoder.debug_check_bounds::<Self>(offset);
14752            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
14753                None => return Err(fidl::Error::NotNullable),
14754                Some(len) => len,
14755            };
14756            // Calling decoder.out_of_line_offset(0) is not allowed.
14757            if len == 0 {
14758                return Ok(());
14759            };
14760            depth.increment()?;
14761            let envelope_size = 8;
14762            let bytes_len = len * envelope_size;
14763            let offset = decoder.out_of_line_offset(bytes_len)?;
14764            // Decode the envelope for each type.
14765            let mut _next_ordinal_to_read = 0;
14766            let mut next_offset = offset;
14767            let end_offset = offset + bytes_len;
14768            _next_ordinal_to_read += 1;
14769            if next_offset >= end_offset {
14770                return Ok(());
14771            }
14772
14773            // Decode unknown envelopes for gaps in ordinals.
14774            while _next_ordinal_to_read < 1 {
14775                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14776                _next_ordinal_to_read += 1;
14777                next_offset += envelope_size;
14778            }
14779
14780            let next_out_of_line = decoder.next_out_of_line();
14781            let handles_before = decoder.remaining_handles();
14782            if let Some((inlined, num_bytes, num_handles)) =
14783                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14784            {
14785                let member_inline_size =
14786                    <CookieId as fidl::encoding::TypeMarker>::inline_size(decoder.context);
14787                if inlined != (member_inline_size <= 4) {
14788                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14789                }
14790                let inner_offset;
14791                let mut inner_depth = depth.clone();
14792                if inlined {
14793                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14794                    inner_offset = next_offset;
14795                } else {
14796                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14797                    inner_depth.increment()?;
14798                }
14799                let val_ref = self.id.get_or_insert_with(|| {
14800                    fidl::new_empty!(CookieId, fidl::encoding::DefaultFuchsiaResourceDialect)
14801                });
14802                fidl::decode!(
14803                    CookieId,
14804                    fidl::encoding::DefaultFuchsiaResourceDialect,
14805                    val_ref,
14806                    decoder,
14807                    inner_offset,
14808                    inner_depth
14809                )?;
14810                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14811                {
14812                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14813                }
14814                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14815                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14816                }
14817            }
14818
14819            next_offset += envelope_size;
14820            _next_ordinal_to_read += 1;
14821            if next_offset >= end_offset {
14822                return Ok(());
14823            }
14824
14825            // Decode unknown envelopes for gaps in ordinals.
14826            while _next_ordinal_to_read < 2 {
14827                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14828                _next_ordinal_to_read += 1;
14829                next_offset += envelope_size;
14830            }
14831
14832            let next_out_of_line = decoder.next_out_of_line();
14833            let handles_before = decoder.remaining_handles();
14834            if let Some((inlined, num_bytes, num_handles)) =
14835                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14836            {
14837                let member_inline_size =
14838                    <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
14839                        decoder.context,
14840                    );
14841                if inlined != (member_inline_size <= 4) {
14842                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14843                }
14844                let inner_offset;
14845                let mut inner_depth = depth.clone();
14846                if inlined {
14847                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14848                    inner_offset = next_offset;
14849                } else {
14850                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14851                    inner_depth.increment()?;
14852                }
14853                let val_ref = self.value.get_or_insert_with(|| {
14854                    fidl::new_empty!(
14855                        fidl::encoding::UnboundedString,
14856                        fidl::encoding::DefaultFuchsiaResourceDialect
14857                    )
14858                });
14859                fidl::decode!(
14860                    fidl::encoding::UnboundedString,
14861                    fidl::encoding::DefaultFuchsiaResourceDialect,
14862                    val_ref,
14863                    decoder,
14864                    inner_offset,
14865                    inner_depth
14866                )?;
14867                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14868                {
14869                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14870                }
14871                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14872                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14873                }
14874            }
14875
14876            next_offset += envelope_size;
14877
14878            // Decode the remaining unknown envelopes.
14879            while next_offset < end_offset {
14880                _next_ordinal_to_read += 1;
14881                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14882                next_offset += envelope_size;
14883            }
14884
14885            Ok(())
14886        }
14887    }
14888
14889    impl CreateContextParams {
14890        #[inline(always)]
14891        fn max_ordinal_present(&self) -> u64 {
14892            if let Some(_) = self.data_quota_bytes {
14893                return 13;
14894            }
14895            if let Some(_) = self.cdm_data_quota_bytes {
14896                return 12;
14897            }
14898            if let Some(_) = self.cdm_data_directory {
14899                return 11;
14900            }
14901            if let Some(_) = self.cors_exempt_headers {
14902                return 10;
14903            }
14904            if let Some(_) = self.unsafely_treat_insecure_origins_as_secure {
14905                return 9;
14906            }
14907            if let Some(_) = self.playready_key_system {
14908                return 8;
14909            }
14910            if let Some(_) = self.features {
14911                return 7;
14912            }
14913            if let Some(_) = self.content_directories {
14914                return 6;
14915            }
14916            if let Some(_) = self.remote_debugging_port {
14917                return 5;
14918            }
14919            if let Some(_) = self.user_agent_version {
14920                return 4;
14921            }
14922            if let Some(_) = self.user_agent_product {
14923                return 3;
14924            }
14925            if let Some(_) = self.data_directory {
14926                return 2;
14927            }
14928            if let Some(_) = self.service_directory {
14929                return 1;
14930            }
14931            0
14932        }
14933    }
14934
14935    impl fidl::encoding::ResourceTypeMarker for CreateContextParams {
14936        type Borrowed<'a> = &'a mut Self;
14937        fn take_or_borrow<'a>(
14938            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14939        ) -> Self::Borrowed<'a> {
14940            value
14941        }
14942    }
14943
14944    unsafe impl fidl::encoding::TypeMarker for CreateContextParams {
14945        type Owned = Self;
14946
14947        #[inline(always)]
14948        fn inline_align(_context: fidl::encoding::Context) -> usize {
14949            8
14950        }
14951
14952        #[inline(always)]
14953        fn inline_size(_context: fidl::encoding::Context) -> usize {
14954            16
14955        }
14956    }
14957
14958    unsafe impl
14959        fidl::encoding::Encode<CreateContextParams, fidl::encoding::DefaultFuchsiaResourceDialect>
14960        for &mut CreateContextParams
14961    {
14962        unsafe fn encode(
14963            self,
14964            encoder: &mut fidl::encoding::Encoder<
14965                '_,
14966                fidl::encoding::DefaultFuchsiaResourceDialect,
14967            >,
14968            offset: usize,
14969            mut depth: fidl::encoding::Depth,
14970        ) -> fidl::Result<()> {
14971            encoder.debug_check_bounds::<CreateContextParams>(offset);
14972            // Vector header
14973            let max_ordinal: u64 = self.max_ordinal_present();
14974            encoder.write_num(max_ordinal, offset);
14975            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
14976            // Calling encoder.out_of_line_offset(0) is not allowed.
14977            if max_ordinal == 0 {
14978                return Ok(());
14979            }
14980            depth.increment()?;
14981            let envelope_size = 8;
14982            let bytes_len = max_ordinal as usize * envelope_size;
14983            #[allow(unused_variables)]
14984            let offset = encoder.out_of_line_offset(bytes_len);
14985            let mut _prev_end_offset: usize = 0;
14986            if 1 > max_ordinal {
14987                return Ok(());
14988            }
14989
14990            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14991            // are envelope_size bytes.
14992            let cur_offset: usize = (1 - 1) * envelope_size;
14993
14994            // Zero reserved fields.
14995            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14996
14997            // Safety:
14998            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14999            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15000            //   envelope_size bytes, there is always sufficient room.
15001            fidl::encoding::encode_in_envelope_optional::<
15002                fidl::encoding::Endpoint<
15003                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15004                >,
15005                fidl::encoding::DefaultFuchsiaResourceDialect,
15006            >(
15007                self.service_directory.as_mut().map(
15008                    <fidl::encoding::Endpoint<
15009                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15010                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
15011                ),
15012                encoder,
15013                offset + cur_offset,
15014                depth,
15015            )?;
15016
15017            _prev_end_offset = cur_offset + envelope_size;
15018            if 2 > max_ordinal {
15019                return Ok(());
15020            }
15021
15022            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15023            // are envelope_size bytes.
15024            let cur_offset: usize = (2 - 1) * envelope_size;
15025
15026            // Zero reserved fields.
15027            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15028
15029            // Safety:
15030            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15031            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15032            //   envelope_size bytes, there is always sufficient room.
15033            fidl::encoding::encode_in_envelope_optional::<
15034                fidl::encoding::Endpoint<
15035                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15036                >,
15037                fidl::encoding::DefaultFuchsiaResourceDialect,
15038            >(
15039                self.data_directory.as_mut().map(
15040                    <fidl::encoding::Endpoint<
15041                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15042                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
15043                ),
15044                encoder,
15045                offset + cur_offset,
15046                depth,
15047            )?;
15048
15049            _prev_end_offset = cur_offset + envelope_size;
15050            if 3 > max_ordinal {
15051                return Ok(());
15052            }
15053
15054            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15055            // are envelope_size bytes.
15056            let cur_offset: usize = (3 - 1) * envelope_size;
15057
15058            // Zero reserved fields.
15059            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15060
15061            // Safety:
15062            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15063            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15064            //   envelope_size bytes, there is always sufficient room.
15065            fidl::encoding::encode_in_envelope_optional::<
15066                fidl::encoding::BoundedString<128>,
15067                fidl::encoding::DefaultFuchsiaResourceDialect,
15068            >(
15069                self.user_agent_product.as_ref().map(
15070                    <fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow,
15071                ),
15072                encoder,
15073                offset + cur_offset,
15074                depth,
15075            )?;
15076
15077            _prev_end_offset = cur_offset + envelope_size;
15078            if 4 > max_ordinal {
15079                return Ok(());
15080            }
15081
15082            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15083            // are envelope_size bytes.
15084            let cur_offset: usize = (4 - 1) * envelope_size;
15085
15086            // Zero reserved fields.
15087            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15088
15089            // Safety:
15090            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15091            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15092            //   envelope_size bytes, there is always sufficient room.
15093            fidl::encoding::encode_in_envelope_optional::<
15094                fidl::encoding::BoundedString<128>,
15095                fidl::encoding::DefaultFuchsiaResourceDialect,
15096            >(
15097                self.user_agent_version.as_ref().map(
15098                    <fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow,
15099                ),
15100                encoder,
15101                offset + cur_offset,
15102                depth,
15103            )?;
15104
15105            _prev_end_offset = cur_offset + envelope_size;
15106            if 5 > max_ordinal {
15107                return Ok(());
15108            }
15109
15110            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15111            // are envelope_size bytes.
15112            let cur_offset: usize = (5 - 1) * envelope_size;
15113
15114            // Zero reserved fields.
15115            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15116
15117            // Safety:
15118            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15119            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15120            //   envelope_size bytes, there is always sufficient room.
15121            fidl::encoding::encode_in_envelope_optional::<
15122                u16,
15123                fidl::encoding::DefaultFuchsiaResourceDialect,
15124            >(
15125                self.remote_debugging_port
15126                    .as_ref()
15127                    .map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
15128                encoder,
15129                offset + cur_offset,
15130                depth,
15131            )?;
15132
15133            _prev_end_offset = cur_offset + envelope_size;
15134            if 6 > max_ordinal {
15135                return Ok(());
15136            }
15137
15138            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15139            // are envelope_size bytes.
15140            let cur_offset: usize = (6 - 1) * envelope_size;
15141
15142            // Zero reserved fields.
15143            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15144
15145            // Safety:
15146            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15147            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15148            //   envelope_size bytes, there is always sufficient room.
15149            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<ContentDirectoryProvider, 100>, fidl::encoding::DefaultFuchsiaResourceDialect>(
15150            self.content_directories.as_mut().map(<fidl::encoding::Vector<ContentDirectoryProvider, 100> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
15151            encoder, offset + cur_offset, depth
15152        )?;
15153
15154            _prev_end_offset = cur_offset + envelope_size;
15155            if 7 > max_ordinal {
15156                return Ok(());
15157            }
15158
15159            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15160            // are envelope_size bytes.
15161            let cur_offset: usize = (7 - 1) * envelope_size;
15162
15163            // Zero reserved fields.
15164            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15165
15166            // Safety:
15167            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15168            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15169            //   envelope_size bytes, there is always sufficient room.
15170            fidl::encoding::encode_in_envelope_optional::<
15171                ContextFeatureFlags,
15172                fidl::encoding::DefaultFuchsiaResourceDialect,
15173            >(
15174                self.features
15175                    .as_ref()
15176                    .map(<ContextFeatureFlags as fidl::encoding::ValueTypeMarker>::borrow),
15177                encoder,
15178                offset + cur_offset,
15179                depth,
15180            )?;
15181
15182            _prev_end_offset = cur_offset + envelope_size;
15183            if 8 > max_ordinal {
15184                return Ok(());
15185            }
15186
15187            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15188            // are envelope_size bytes.
15189            let cur_offset: usize = (8 - 1) * envelope_size;
15190
15191            // Zero reserved fields.
15192            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15193
15194            // Safety:
15195            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15196            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15197            //   envelope_size bytes, there is always sufficient room.
15198            fidl::encoding::encode_in_envelope_optional::<
15199                fidl::encoding::BoundedString<128>,
15200                fidl::encoding::DefaultFuchsiaResourceDialect,
15201            >(
15202                self.playready_key_system.as_ref().map(
15203                    <fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow,
15204                ),
15205                encoder,
15206                offset + cur_offset,
15207                depth,
15208            )?;
15209
15210            _prev_end_offset = cur_offset + envelope_size;
15211            if 9 > max_ordinal {
15212                return Ok(());
15213            }
15214
15215            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15216            // are envelope_size bytes.
15217            let cur_offset: usize = (9 - 1) * envelope_size;
15218
15219            // Zero reserved fields.
15220            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15221
15222            // Safety:
15223            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15224            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15225            //   envelope_size bytes, there is always sufficient room.
15226            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl::encoding::BoundedString<513>, 100>, fidl::encoding::DefaultFuchsiaResourceDialect>(
15227            self.unsafely_treat_insecure_origins_as_secure.as_ref().map(<fidl::encoding::Vector<fidl::encoding::BoundedString<513>, 100> as fidl::encoding::ValueTypeMarker>::borrow),
15228            encoder, offset + cur_offset, depth
15229        )?;
15230
15231            _prev_end_offset = cur_offset + envelope_size;
15232            if 10 > 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 = (10 - 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::<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedVector<u8>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
15248            self.cors_exempt_headers.as_ref().map(<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedVector<u8>> as fidl::encoding::ValueTypeMarker>::borrow),
15249            encoder, offset + cur_offset, depth
15250        )?;
15251
15252            _prev_end_offset = cur_offset + envelope_size;
15253            if 11 > max_ordinal {
15254                return Ok(());
15255            }
15256
15257            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15258            // are envelope_size bytes.
15259            let cur_offset: usize = (11 - 1) * envelope_size;
15260
15261            // Zero reserved fields.
15262            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15263
15264            // Safety:
15265            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15266            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15267            //   envelope_size bytes, there is always sufficient room.
15268            fidl::encoding::encode_in_envelope_optional::<
15269                fidl::encoding::Endpoint<
15270                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15271                >,
15272                fidl::encoding::DefaultFuchsiaResourceDialect,
15273            >(
15274                self.cdm_data_directory.as_mut().map(
15275                    <fidl::encoding::Endpoint<
15276                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15277                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
15278                ),
15279                encoder,
15280                offset + cur_offset,
15281                depth,
15282            )?;
15283
15284            _prev_end_offset = cur_offset + envelope_size;
15285            if 12 > max_ordinal {
15286                return Ok(());
15287            }
15288
15289            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15290            // are envelope_size bytes.
15291            let cur_offset: usize = (12 - 1) * envelope_size;
15292
15293            // Zero reserved fields.
15294            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15295
15296            // Safety:
15297            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15298            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15299            //   envelope_size bytes, there is always sufficient room.
15300            fidl::encoding::encode_in_envelope_optional::<
15301                u64,
15302                fidl::encoding::DefaultFuchsiaResourceDialect,
15303            >(
15304                self.cdm_data_quota_bytes
15305                    .as_ref()
15306                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
15307                encoder,
15308                offset + cur_offset,
15309                depth,
15310            )?;
15311
15312            _prev_end_offset = cur_offset + envelope_size;
15313            if 13 > max_ordinal {
15314                return Ok(());
15315            }
15316
15317            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15318            // are envelope_size bytes.
15319            let cur_offset: usize = (13 - 1) * envelope_size;
15320
15321            // Zero reserved fields.
15322            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15323
15324            // Safety:
15325            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15326            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15327            //   envelope_size bytes, there is always sufficient room.
15328            fidl::encoding::encode_in_envelope_optional::<
15329                u64,
15330                fidl::encoding::DefaultFuchsiaResourceDialect,
15331            >(
15332                self.data_quota_bytes
15333                    .as_ref()
15334                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
15335                encoder,
15336                offset + cur_offset,
15337                depth,
15338            )?;
15339
15340            _prev_end_offset = cur_offset + envelope_size;
15341
15342            Ok(())
15343        }
15344    }
15345
15346    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
15347        for CreateContextParams
15348    {
15349        #[inline(always)]
15350        fn new_empty() -> Self {
15351            Self::default()
15352        }
15353
15354        unsafe fn decode(
15355            &mut self,
15356            decoder: &mut fidl::encoding::Decoder<
15357                '_,
15358                fidl::encoding::DefaultFuchsiaResourceDialect,
15359            >,
15360            offset: usize,
15361            mut depth: fidl::encoding::Depth,
15362        ) -> fidl::Result<()> {
15363            decoder.debug_check_bounds::<Self>(offset);
15364            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
15365                None => return Err(fidl::Error::NotNullable),
15366                Some(len) => len,
15367            };
15368            // Calling decoder.out_of_line_offset(0) is not allowed.
15369            if len == 0 {
15370                return Ok(());
15371            };
15372            depth.increment()?;
15373            let envelope_size = 8;
15374            let bytes_len = len * envelope_size;
15375            let offset = decoder.out_of_line_offset(bytes_len)?;
15376            // Decode the envelope for each type.
15377            let mut _next_ordinal_to_read = 0;
15378            let mut next_offset = offset;
15379            let end_offset = offset + bytes_len;
15380            _next_ordinal_to_read += 1;
15381            if next_offset >= end_offset {
15382                return Ok(());
15383            }
15384
15385            // Decode unknown envelopes for gaps in ordinals.
15386            while _next_ordinal_to_read < 1 {
15387                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15388                _next_ordinal_to_read += 1;
15389                next_offset += envelope_size;
15390            }
15391
15392            let next_out_of_line = decoder.next_out_of_line();
15393            let handles_before = decoder.remaining_handles();
15394            if let Some((inlined, num_bytes, num_handles)) =
15395                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15396            {
15397                let member_inline_size = <fidl::encoding::Endpoint<
15398                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15399                > as fidl::encoding::TypeMarker>::inline_size(
15400                    decoder.context
15401                );
15402                if inlined != (member_inline_size <= 4) {
15403                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15404                }
15405                let inner_offset;
15406                let mut inner_depth = depth.clone();
15407                if inlined {
15408                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15409                    inner_offset = next_offset;
15410                } else {
15411                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15412                    inner_depth.increment()?;
15413                }
15414                let val_ref = self.service_directory.get_or_insert_with(|| {
15415                    fidl::new_empty!(
15416                        fidl::encoding::Endpoint<
15417                            fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15418                        >,
15419                        fidl::encoding::DefaultFuchsiaResourceDialect
15420                    )
15421                });
15422                fidl::decode!(
15423                    fidl::encoding::Endpoint<
15424                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15425                    >,
15426                    fidl::encoding::DefaultFuchsiaResourceDialect,
15427                    val_ref,
15428                    decoder,
15429                    inner_offset,
15430                    inner_depth
15431                )?;
15432                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15433                {
15434                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15435                }
15436                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15437                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15438                }
15439            }
15440
15441            next_offset += envelope_size;
15442            _next_ordinal_to_read += 1;
15443            if next_offset >= end_offset {
15444                return Ok(());
15445            }
15446
15447            // Decode unknown envelopes for gaps in ordinals.
15448            while _next_ordinal_to_read < 2 {
15449                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15450                _next_ordinal_to_read += 1;
15451                next_offset += envelope_size;
15452            }
15453
15454            let next_out_of_line = decoder.next_out_of_line();
15455            let handles_before = decoder.remaining_handles();
15456            if let Some((inlined, num_bytes, num_handles)) =
15457                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15458            {
15459                let member_inline_size = <fidl::encoding::Endpoint<
15460                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15461                > as fidl::encoding::TypeMarker>::inline_size(
15462                    decoder.context
15463                );
15464                if inlined != (member_inline_size <= 4) {
15465                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15466                }
15467                let inner_offset;
15468                let mut inner_depth = depth.clone();
15469                if inlined {
15470                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15471                    inner_offset = next_offset;
15472                } else {
15473                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15474                    inner_depth.increment()?;
15475                }
15476                let val_ref = self.data_directory.get_or_insert_with(|| {
15477                    fidl::new_empty!(
15478                        fidl::encoding::Endpoint<
15479                            fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15480                        >,
15481                        fidl::encoding::DefaultFuchsiaResourceDialect
15482                    )
15483                });
15484                fidl::decode!(
15485                    fidl::encoding::Endpoint<
15486                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15487                    >,
15488                    fidl::encoding::DefaultFuchsiaResourceDialect,
15489                    val_ref,
15490                    decoder,
15491                    inner_offset,
15492                    inner_depth
15493                )?;
15494                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15495                {
15496                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15497                }
15498                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15499                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15500                }
15501            }
15502
15503            next_offset += envelope_size;
15504            _next_ordinal_to_read += 1;
15505            if next_offset >= end_offset {
15506                return Ok(());
15507            }
15508
15509            // Decode unknown envelopes for gaps in ordinals.
15510            while _next_ordinal_to_read < 3 {
15511                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15512                _next_ordinal_to_read += 1;
15513                next_offset += envelope_size;
15514            }
15515
15516            let next_out_of_line = decoder.next_out_of_line();
15517            let handles_before = decoder.remaining_handles();
15518            if let Some((inlined, num_bytes, num_handles)) =
15519                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15520            {
15521                let member_inline_size =
15522                    <fidl::encoding::BoundedString<128> as fidl::encoding::TypeMarker>::inline_size(
15523                        decoder.context,
15524                    );
15525                if inlined != (member_inline_size <= 4) {
15526                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15527                }
15528                let inner_offset;
15529                let mut inner_depth = depth.clone();
15530                if inlined {
15531                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15532                    inner_offset = next_offset;
15533                } else {
15534                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15535                    inner_depth.increment()?;
15536                }
15537                let val_ref = self.user_agent_product.get_or_insert_with(|| {
15538                    fidl::new_empty!(
15539                        fidl::encoding::BoundedString<128>,
15540                        fidl::encoding::DefaultFuchsiaResourceDialect
15541                    )
15542                });
15543                fidl::decode!(
15544                    fidl::encoding::BoundedString<128>,
15545                    fidl::encoding::DefaultFuchsiaResourceDialect,
15546                    val_ref,
15547                    decoder,
15548                    inner_offset,
15549                    inner_depth
15550                )?;
15551                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15552                {
15553                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15554                }
15555                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15556                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15557                }
15558            }
15559
15560            next_offset += envelope_size;
15561            _next_ordinal_to_read += 1;
15562            if next_offset >= end_offset {
15563                return Ok(());
15564            }
15565
15566            // Decode unknown envelopes for gaps in ordinals.
15567            while _next_ordinal_to_read < 4 {
15568                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15569                _next_ordinal_to_read += 1;
15570                next_offset += envelope_size;
15571            }
15572
15573            let next_out_of_line = decoder.next_out_of_line();
15574            let handles_before = decoder.remaining_handles();
15575            if let Some((inlined, num_bytes, num_handles)) =
15576                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15577            {
15578                let member_inline_size =
15579                    <fidl::encoding::BoundedString<128> as fidl::encoding::TypeMarker>::inline_size(
15580                        decoder.context,
15581                    );
15582                if inlined != (member_inline_size <= 4) {
15583                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15584                }
15585                let inner_offset;
15586                let mut inner_depth = depth.clone();
15587                if inlined {
15588                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15589                    inner_offset = next_offset;
15590                } else {
15591                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15592                    inner_depth.increment()?;
15593                }
15594                let val_ref = self.user_agent_version.get_or_insert_with(|| {
15595                    fidl::new_empty!(
15596                        fidl::encoding::BoundedString<128>,
15597                        fidl::encoding::DefaultFuchsiaResourceDialect
15598                    )
15599                });
15600                fidl::decode!(
15601                    fidl::encoding::BoundedString<128>,
15602                    fidl::encoding::DefaultFuchsiaResourceDialect,
15603                    val_ref,
15604                    decoder,
15605                    inner_offset,
15606                    inner_depth
15607                )?;
15608                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15609                {
15610                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15611                }
15612                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15613                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15614                }
15615            }
15616
15617            next_offset += envelope_size;
15618            _next_ordinal_to_read += 1;
15619            if next_offset >= end_offset {
15620                return Ok(());
15621            }
15622
15623            // Decode unknown envelopes for gaps in ordinals.
15624            while _next_ordinal_to_read < 5 {
15625                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15626                _next_ordinal_to_read += 1;
15627                next_offset += envelope_size;
15628            }
15629
15630            let next_out_of_line = decoder.next_out_of_line();
15631            let handles_before = decoder.remaining_handles();
15632            if let Some((inlined, num_bytes, num_handles)) =
15633                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15634            {
15635                let member_inline_size =
15636                    <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
15637                if inlined != (member_inline_size <= 4) {
15638                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15639                }
15640                let inner_offset;
15641                let mut inner_depth = depth.clone();
15642                if inlined {
15643                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15644                    inner_offset = next_offset;
15645                } else {
15646                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15647                    inner_depth.increment()?;
15648                }
15649                let val_ref = self.remote_debugging_port.get_or_insert_with(|| {
15650                    fidl::new_empty!(u16, fidl::encoding::DefaultFuchsiaResourceDialect)
15651                });
15652                fidl::decode!(
15653                    u16,
15654                    fidl::encoding::DefaultFuchsiaResourceDialect,
15655                    val_ref,
15656                    decoder,
15657                    inner_offset,
15658                    inner_depth
15659                )?;
15660                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15661                {
15662                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15663                }
15664                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15665                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15666                }
15667            }
15668
15669            next_offset += envelope_size;
15670            _next_ordinal_to_read += 1;
15671            if next_offset >= end_offset {
15672                return Ok(());
15673            }
15674
15675            // Decode unknown envelopes for gaps in ordinals.
15676            while _next_ordinal_to_read < 6 {
15677                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15678                _next_ordinal_to_read += 1;
15679                next_offset += envelope_size;
15680            }
15681
15682            let next_out_of_line = decoder.next_out_of_line();
15683            let handles_before = decoder.remaining_handles();
15684            if let Some((inlined, num_bytes, num_handles)) =
15685                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15686            {
15687                let member_inline_size = <fidl::encoding::Vector<ContentDirectoryProvider, 100> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
15688                if inlined != (member_inline_size <= 4) {
15689                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15690                }
15691                let inner_offset;
15692                let mut inner_depth = depth.clone();
15693                if inlined {
15694                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15695                    inner_offset = next_offset;
15696                } else {
15697                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15698                    inner_depth.increment()?;
15699                }
15700                let val_ref =
15701                self.content_directories.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<ContentDirectoryProvider, 100>, fidl::encoding::DefaultFuchsiaResourceDialect));
15702                fidl::decode!(fidl::encoding::Vector<ContentDirectoryProvider, 100>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
15703                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15704                {
15705                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15706                }
15707                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15708                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15709                }
15710            }
15711
15712            next_offset += envelope_size;
15713            _next_ordinal_to_read += 1;
15714            if next_offset >= end_offset {
15715                return Ok(());
15716            }
15717
15718            // Decode unknown envelopes for gaps in ordinals.
15719            while _next_ordinal_to_read < 7 {
15720                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15721                _next_ordinal_to_read += 1;
15722                next_offset += envelope_size;
15723            }
15724
15725            let next_out_of_line = decoder.next_out_of_line();
15726            let handles_before = decoder.remaining_handles();
15727            if let Some((inlined, num_bytes, num_handles)) =
15728                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15729            {
15730                let member_inline_size =
15731                    <ContextFeatureFlags as fidl::encoding::TypeMarker>::inline_size(
15732                        decoder.context,
15733                    );
15734                if inlined != (member_inline_size <= 4) {
15735                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15736                }
15737                let inner_offset;
15738                let mut inner_depth = depth.clone();
15739                if inlined {
15740                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15741                    inner_offset = next_offset;
15742                } else {
15743                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15744                    inner_depth.increment()?;
15745                }
15746                let val_ref = self.features.get_or_insert_with(|| {
15747                    fidl::new_empty!(
15748                        ContextFeatureFlags,
15749                        fidl::encoding::DefaultFuchsiaResourceDialect
15750                    )
15751                });
15752                fidl::decode!(
15753                    ContextFeatureFlags,
15754                    fidl::encoding::DefaultFuchsiaResourceDialect,
15755                    val_ref,
15756                    decoder,
15757                    inner_offset,
15758                    inner_depth
15759                )?;
15760                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15761                {
15762                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15763                }
15764                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15765                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15766                }
15767            }
15768
15769            next_offset += envelope_size;
15770            _next_ordinal_to_read += 1;
15771            if next_offset >= end_offset {
15772                return Ok(());
15773            }
15774
15775            // Decode unknown envelopes for gaps in ordinals.
15776            while _next_ordinal_to_read < 8 {
15777                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15778                _next_ordinal_to_read += 1;
15779                next_offset += envelope_size;
15780            }
15781
15782            let next_out_of_line = decoder.next_out_of_line();
15783            let handles_before = decoder.remaining_handles();
15784            if let Some((inlined, num_bytes, num_handles)) =
15785                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15786            {
15787                let member_inline_size =
15788                    <fidl::encoding::BoundedString<128> as fidl::encoding::TypeMarker>::inline_size(
15789                        decoder.context,
15790                    );
15791                if inlined != (member_inline_size <= 4) {
15792                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15793                }
15794                let inner_offset;
15795                let mut inner_depth = depth.clone();
15796                if inlined {
15797                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15798                    inner_offset = next_offset;
15799                } else {
15800                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15801                    inner_depth.increment()?;
15802                }
15803                let val_ref = self.playready_key_system.get_or_insert_with(|| {
15804                    fidl::new_empty!(
15805                        fidl::encoding::BoundedString<128>,
15806                        fidl::encoding::DefaultFuchsiaResourceDialect
15807                    )
15808                });
15809                fidl::decode!(
15810                    fidl::encoding::BoundedString<128>,
15811                    fidl::encoding::DefaultFuchsiaResourceDialect,
15812                    val_ref,
15813                    decoder,
15814                    inner_offset,
15815                    inner_depth
15816                )?;
15817                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15818                {
15819                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15820                }
15821                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15822                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15823                }
15824            }
15825
15826            next_offset += envelope_size;
15827            _next_ordinal_to_read += 1;
15828            if next_offset >= end_offset {
15829                return Ok(());
15830            }
15831
15832            // Decode unknown envelopes for gaps in ordinals.
15833            while _next_ordinal_to_read < 9 {
15834                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15835                _next_ordinal_to_read += 1;
15836                next_offset += envelope_size;
15837            }
15838
15839            let next_out_of_line = decoder.next_out_of_line();
15840            let handles_before = decoder.remaining_handles();
15841            if let Some((inlined, num_bytes, num_handles)) =
15842                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15843            {
15844                let member_inline_size = <fidl::encoding::Vector<
15845                    fidl::encoding::BoundedString<513>,
15846                    100,
15847                > as fidl::encoding::TypeMarker>::inline_size(
15848                    decoder.context
15849                );
15850                if inlined != (member_inline_size <= 4) {
15851                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15852                }
15853                let inner_offset;
15854                let mut inner_depth = depth.clone();
15855                if inlined {
15856                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15857                    inner_offset = next_offset;
15858                } else {
15859                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15860                    inner_depth.increment()?;
15861                }
15862                let val_ref =
15863                    self.unsafely_treat_insecure_origins_as_secure.get_or_insert_with(|| {
15864                        fidl::new_empty!(
15865                            fidl::encoding::Vector<fidl::encoding::BoundedString<513>, 100>,
15866                            fidl::encoding::DefaultFuchsiaResourceDialect
15867                        )
15868                    });
15869                fidl::decode!(
15870                    fidl::encoding::Vector<fidl::encoding::BoundedString<513>, 100>,
15871                    fidl::encoding::DefaultFuchsiaResourceDialect,
15872                    val_ref,
15873                    decoder,
15874                    inner_offset,
15875                    inner_depth
15876                )?;
15877                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15878                {
15879                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15880                }
15881                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15882                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15883                }
15884            }
15885
15886            next_offset += envelope_size;
15887            _next_ordinal_to_read += 1;
15888            if next_offset >= end_offset {
15889                return Ok(());
15890            }
15891
15892            // Decode unknown envelopes for gaps in ordinals.
15893            while _next_ordinal_to_read < 10 {
15894                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15895                _next_ordinal_to_read += 1;
15896                next_offset += envelope_size;
15897            }
15898
15899            let next_out_of_line = decoder.next_out_of_line();
15900            let handles_before = decoder.remaining_handles();
15901            if let Some((inlined, num_bytes, num_handles)) =
15902                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15903            {
15904                let member_inline_size = <fidl::encoding::UnboundedVector<
15905                    fidl::encoding::UnboundedVector<u8>,
15906                > as fidl::encoding::TypeMarker>::inline_size(
15907                    decoder.context
15908                );
15909                if inlined != (member_inline_size <= 4) {
15910                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15911                }
15912                let inner_offset;
15913                let mut inner_depth = depth.clone();
15914                if inlined {
15915                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15916                    inner_offset = next_offset;
15917                } else {
15918                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15919                    inner_depth.increment()?;
15920                }
15921                let val_ref = self.cors_exempt_headers.get_or_insert_with(|| {
15922                    fidl::new_empty!(
15923                        fidl::encoding::UnboundedVector<fidl::encoding::UnboundedVector<u8>>,
15924                        fidl::encoding::DefaultFuchsiaResourceDialect
15925                    )
15926                });
15927                fidl::decode!(
15928                    fidl::encoding::UnboundedVector<fidl::encoding::UnboundedVector<u8>>,
15929                    fidl::encoding::DefaultFuchsiaResourceDialect,
15930                    val_ref,
15931                    decoder,
15932                    inner_offset,
15933                    inner_depth
15934                )?;
15935                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15936                {
15937                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15938                }
15939                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15940                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15941                }
15942            }
15943
15944            next_offset += envelope_size;
15945            _next_ordinal_to_read += 1;
15946            if next_offset >= end_offset {
15947                return Ok(());
15948            }
15949
15950            // Decode unknown envelopes for gaps in ordinals.
15951            while _next_ordinal_to_read < 11 {
15952                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15953                _next_ordinal_to_read += 1;
15954                next_offset += envelope_size;
15955            }
15956
15957            let next_out_of_line = decoder.next_out_of_line();
15958            let handles_before = decoder.remaining_handles();
15959            if let Some((inlined, num_bytes, num_handles)) =
15960                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15961            {
15962                let member_inline_size = <fidl::encoding::Endpoint<
15963                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15964                > as fidl::encoding::TypeMarker>::inline_size(
15965                    decoder.context
15966                );
15967                if inlined != (member_inline_size <= 4) {
15968                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15969                }
15970                let inner_offset;
15971                let mut inner_depth = depth.clone();
15972                if inlined {
15973                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15974                    inner_offset = next_offset;
15975                } else {
15976                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15977                    inner_depth.increment()?;
15978                }
15979                let val_ref = self.cdm_data_directory.get_or_insert_with(|| {
15980                    fidl::new_empty!(
15981                        fidl::encoding::Endpoint<
15982                            fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15983                        >,
15984                        fidl::encoding::DefaultFuchsiaResourceDialect
15985                    )
15986                });
15987                fidl::decode!(
15988                    fidl::encoding::Endpoint<
15989                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15990                    >,
15991                    fidl::encoding::DefaultFuchsiaResourceDialect,
15992                    val_ref,
15993                    decoder,
15994                    inner_offset,
15995                    inner_depth
15996                )?;
15997                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15998                {
15999                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16000                }
16001                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16002                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16003                }
16004            }
16005
16006            next_offset += envelope_size;
16007            _next_ordinal_to_read += 1;
16008            if next_offset >= end_offset {
16009                return Ok(());
16010            }
16011
16012            // Decode unknown envelopes for gaps in ordinals.
16013            while _next_ordinal_to_read < 12 {
16014                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16015                _next_ordinal_to_read += 1;
16016                next_offset += envelope_size;
16017            }
16018
16019            let next_out_of_line = decoder.next_out_of_line();
16020            let handles_before = decoder.remaining_handles();
16021            if let Some((inlined, num_bytes, num_handles)) =
16022                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16023            {
16024                let member_inline_size =
16025                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16026                if inlined != (member_inline_size <= 4) {
16027                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16028                }
16029                let inner_offset;
16030                let mut inner_depth = depth.clone();
16031                if inlined {
16032                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16033                    inner_offset = next_offset;
16034                } else {
16035                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16036                    inner_depth.increment()?;
16037                }
16038                let val_ref = self.cdm_data_quota_bytes.get_or_insert_with(|| {
16039                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
16040                });
16041                fidl::decode!(
16042                    u64,
16043                    fidl::encoding::DefaultFuchsiaResourceDialect,
16044                    val_ref,
16045                    decoder,
16046                    inner_offset,
16047                    inner_depth
16048                )?;
16049                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16050                {
16051                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16052                }
16053                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16054                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16055                }
16056            }
16057
16058            next_offset += envelope_size;
16059            _next_ordinal_to_read += 1;
16060            if next_offset >= end_offset {
16061                return Ok(());
16062            }
16063
16064            // Decode unknown envelopes for gaps in ordinals.
16065            while _next_ordinal_to_read < 13 {
16066                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16067                _next_ordinal_to_read += 1;
16068                next_offset += envelope_size;
16069            }
16070
16071            let next_out_of_line = decoder.next_out_of_line();
16072            let handles_before = decoder.remaining_handles();
16073            if let Some((inlined, num_bytes, num_handles)) =
16074                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16075            {
16076                let member_inline_size =
16077                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16078                if inlined != (member_inline_size <= 4) {
16079                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16080                }
16081                let inner_offset;
16082                let mut inner_depth = depth.clone();
16083                if inlined {
16084                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16085                    inner_offset = next_offset;
16086                } else {
16087                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16088                    inner_depth.increment()?;
16089                }
16090                let val_ref = self.data_quota_bytes.get_or_insert_with(|| {
16091                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
16092                });
16093                fidl::decode!(
16094                    u64,
16095                    fidl::encoding::DefaultFuchsiaResourceDialect,
16096                    val_ref,
16097                    decoder,
16098                    inner_offset,
16099                    inner_depth
16100                )?;
16101                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16102                {
16103                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16104                }
16105                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16106                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16107                }
16108            }
16109
16110            next_offset += envelope_size;
16111
16112            // Decode the remaining unknown envelopes.
16113            while next_offset < end_offset {
16114                _next_ordinal_to_read += 1;
16115                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16116                next_offset += envelope_size;
16117            }
16118
16119            Ok(())
16120        }
16121    }
16122
16123    impl CreateFrameParams {
16124        #[inline(always)]
16125        fn max_ordinal_present(&self) -> u64 {
16126            if let Some(_) = self.explicit_sites_filter_error_page {
16127                return 4;
16128            }
16129            if let Some(_) = self.debug_name {
16130                return 2;
16131            }
16132            if let Some(_) = self.enable_remote_debugging {
16133                return 1;
16134            }
16135            0
16136        }
16137    }
16138
16139    impl fidl::encoding::ResourceTypeMarker for CreateFrameParams {
16140        type Borrowed<'a> = &'a mut Self;
16141        fn take_or_borrow<'a>(
16142            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
16143        ) -> Self::Borrowed<'a> {
16144            value
16145        }
16146    }
16147
16148    unsafe impl fidl::encoding::TypeMarker for CreateFrameParams {
16149        type Owned = Self;
16150
16151        #[inline(always)]
16152        fn inline_align(_context: fidl::encoding::Context) -> usize {
16153            8
16154        }
16155
16156        #[inline(always)]
16157        fn inline_size(_context: fidl::encoding::Context) -> usize {
16158            16
16159        }
16160    }
16161
16162    unsafe impl
16163        fidl::encoding::Encode<CreateFrameParams, fidl::encoding::DefaultFuchsiaResourceDialect>
16164        for &mut CreateFrameParams
16165    {
16166        unsafe fn encode(
16167            self,
16168            encoder: &mut fidl::encoding::Encoder<
16169                '_,
16170                fidl::encoding::DefaultFuchsiaResourceDialect,
16171            >,
16172            offset: usize,
16173            mut depth: fidl::encoding::Depth,
16174        ) -> fidl::Result<()> {
16175            encoder.debug_check_bounds::<CreateFrameParams>(offset);
16176            // Vector header
16177            let max_ordinal: u64 = self.max_ordinal_present();
16178            encoder.write_num(max_ordinal, offset);
16179            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
16180            // Calling encoder.out_of_line_offset(0) is not allowed.
16181            if max_ordinal == 0 {
16182                return Ok(());
16183            }
16184            depth.increment()?;
16185            let envelope_size = 8;
16186            let bytes_len = max_ordinal as usize * envelope_size;
16187            #[allow(unused_variables)]
16188            let offset = encoder.out_of_line_offset(bytes_len);
16189            let mut _prev_end_offset: usize = 0;
16190            if 1 > max_ordinal {
16191                return Ok(());
16192            }
16193
16194            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16195            // are envelope_size bytes.
16196            let cur_offset: usize = (1 - 1) * envelope_size;
16197
16198            // Zero reserved fields.
16199            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16200
16201            // Safety:
16202            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16203            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16204            //   envelope_size bytes, there is always sufficient room.
16205            fidl::encoding::encode_in_envelope_optional::<
16206                bool,
16207                fidl::encoding::DefaultFuchsiaResourceDialect,
16208            >(
16209                self.enable_remote_debugging
16210                    .as_ref()
16211                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
16212                encoder,
16213                offset + cur_offset,
16214                depth,
16215            )?;
16216
16217            _prev_end_offset = cur_offset + envelope_size;
16218            if 2 > max_ordinal {
16219                return Ok(());
16220            }
16221
16222            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16223            // are envelope_size bytes.
16224            let cur_offset: usize = (2 - 1) * envelope_size;
16225
16226            // Zero reserved fields.
16227            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16228
16229            // Safety:
16230            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16231            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16232            //   envelope_size bytes, there is always sufficient room.
16233            fidl::encoding::encode_in_envelope_optional::<
16234                fidl::encoding::UnboundedString,
16235                fidl::encoding::DefaultFuchsiaResourceDialect,
16236            >(
16237                self.debug_name.as_ref().map(
16238                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
16239                ),
16240                encoder,
16241                offset + cur_offset,
16242                depth,
16243            )?;
16244
16245            _prev_end_offset = cur_offset + envelope_size;
16246            if 4 > max_ordinal {
16247                return Ok(());
16248            }
16249
16250            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16251            // are envelope_size bytes.
16252            let cur_offset: usize = (4 - 1) * envelope_size;
16253
16254            // Zero reserved fields.
16255            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16256
16257            // Safety:
16258            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16259            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16260            //   envelope_size bytes, there is always sufficient room.
16261            fidl::encoding::encode_in_envelope_optional::<
16262                fidl_fuchsia_mem::Data,
16263                fidl::encoding::DefaultFuchsiaResourceDialect,
16264            >(
16265                self.explicit_sites_filter_error_page.as_mut().map(
16266                    <fidl_fuchsia_mem::Data as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
16267                ),
16268                encoder,
16269                offset + cur_offset,
16270                depth,
16271            )?;
16272
16273            _prev_end_offset = cur_offset + envelope_size;
16274
16275            Ok(())
16276        }
16277    }
16278
16279    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
16280        for CreateFrameParams
16281    {
16282        #[inline(always)]
16283        fn new_empty() -> Self {
16284            Self::default()
16285        }
16286
16287        unsafe fn decode(
16288            &mut self,
16289            decoder: &mut fidl::encoding::Decoder<
16290                '_,
16291                fidl::encoding::DefaultFuchsiaResourceDialect,
16292            >,
16293            offset: usize,
16294            mut depth: fidl::encoding::Depth,
16295        ) -> fidl::Result<()> {
16296            decoder.debug_check_bounds::<Self>(offset);
16297            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
16298                None => return Err(fidl::Error::NotNullable),
16299                Some(len) => len,
16300            };
16301            // Calling decoder.out_of_line_offset(0) is not allowed.
16302            if len == 0 {
16303                return Ok(());
16304            };
16305            depth.increment()?;
16306            let envelope_size = 8;
16307            let bytes_len = len * envelope_size;
16308            let offset = decoder.out_of_line_offset(bytes_len)?;
16309            // Decode the envelope for each type.
16310            let mut _next_ordinal_to_read = 0;
16311            let mut next_offset = offset;
16312            let end_offset = offset + bytes_len;
16313            _next_ordinal_to_read += 1;
16314            if next_offset >= end_offset {
16315                return Ok(());
16316            }
16317
16318            // Decode unknown envelopes for gaps in ordinals.
16319            while _next_ordinal_to_read < 1 {
16320                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16321                _next_ordinal_to_read += 1;
16322                next_offset += envelope_size;
16323            }
16324
16325            let next_out_of_line = decoder.next_out_of_line();
16326            let handles_before = decoder.remaining_handles();
16327            if let Some((inlined, num_bytes, num_handles)) =
16328                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16329            {
16330                let member_inline_size =
16331                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16332                if inlined != (member_inline_size <= 4) {
16333                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16334                }
16335                let inner_offset;
16336                let mut inner_depth = depth.clone();
16337                if inlined {
16338                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16339                    inner_offset = next_offset;
16340                } else {
16341                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16342                    inner_depth.increment()?;
16343                }
16344                let val_ref = self.enable_remote_debugging.get_or_insert_with(|| {
16345                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
16346                });
16347                fidl::decode!(
16348                    bool,
16349                    fidl::encoding::DefaultFuchsiaResourceDialect,
16350                    val_ref,
16351                    decoder,
16352                    inner_offset,
16353                    inner_depth
16354                )?;
16355                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16356                {
16357                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16358                }
16359                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16360                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16361                }
16362            }
16363
16364            next_offset += envelope_size;
16365            _next_ordinal_to_read += 1;
16366            if next_offset >= end_offset {
16367                return Ok(());
16368            }
16369
16370            // Decode unknown envelopes for gaps in ordinals.
16371            while _next_ordinal_to_read < 2 {
16372                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16373                _next_ordinal_to_read += 1;
16374                next_offset += envelope_size;
16375            }
16376
16377            let next_out_of_line = decoder.next_out_of_line();
16378            let handles_before = decoder.remaining_handles();
16379            if let Some((inlined, num_bytes, num_handles)) =
16380                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16381            {
16382                let member_inline_size =
16383                    <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
16384                        decoder.context,
16385                    );
16386                if inlined != (member_inline_size <= 4) {
16387                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16388                }
16389                let inner_offset;
16390                let mut inner_depth = depth.clone();
16391                if inlined {
16392                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16393                    inner_offset = next_offset;
16394                } else {
16395                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16396                    inner_depth.increment()?;
16397                }
16398                let val_ref = self.debug_name.get_or_insert_with(|| {
16399                    fidl::new_empty!(
16400                        fidl::encoding::UnboundedString,
16401                        fidl::encoding::DefaultFuchsiaResourceDialect
16402                    )
16403                });
16404                fidl::decode!(
16405                    fidl::encoding::UnboundedString,
16406                    fidl::encoding::DefaultFuchsiaResourceDialect,
16407                    val_ref,
16408                    decoder,
16409                    inner_offset,
16410                    inner_depth
16411                )?;
16412                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16413                {
16414                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16415                }
16416                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16417                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16418                }
16419            }
16420
16421            next_offset += envelope_size;
16422            _next_ordinal_to_read += 1;
16423            if next_offset >= end_offset {
16424                return Ok(());
16425            }
16426
16427            // Decode unknown envelopes for gaps in ordinals.
16428            while _next_ordinal_to_read < 4 {
16429                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16430                _next_ordinal_to_read += 1;
16431                next_offset += envelope_size;
16432            }
16433
16434            let next_out_of_line = decoder.next_out_of_line();
16435            let handles_before = decoder.remaining_handles();
16436            if let Some((inlined, num_bytes, num_handles)) =
16437                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16438            {
16439                let member_inline_size =
16440                    <fidl_fuchsia_mem::Data as fidl::encoding::TypeMarker>::inline_size(
16441                        decoder.context,
16442                    );
16443                if inlined != (member_inline_size <= 4) {
16444                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16445                }
16446                let inner_offset;
16447                let mut inner_depth = depth.clone();
16448                if inlined {
16449                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16450                    inner_offset = next_offset;
16451                } else {
16452                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16453                    inner_depth.increment()?;
16454                }
16455                let val_ref = self.explicit_sites_filter_error_page.get_or_insert_with(|| {
16456                    fidl::new_empty!(
16457                        fidl_fuchsia_mem::Data,
16458                        fidl::encoding::DefaultFuchsiaResourceDialect
16459                    )
16460                });
16461                fidl::decode!(
16462                    fidl_fuchsia_mem::Data,
16463                    fidl::encoding::DefaultFuchsiaResourceDialect,
16464                    val_ref,
16465                    decoder,
16466                    inner_offset,
16467                    inner_depth
16468                )?;
16469                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16470                {
16471                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16472                }
16473                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16474                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16475                }
16476            }
16477
16478            next_offset += envelope_size;
16479
16480            // Decode the remaining unknown envelopes.
16481            while next_offset < end_offset {
16482                _next_ordinal_to_read += 1;
16483                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16484                next_offset += envelope_size;
16485            }
16486
16487            Ok(())
16488        }
16489    }
16490
16491    impl CreateView2Args {
16492        #[inline(always)]
16493        fn max_ordinal_present(&self) -> u64 {
16494            if let Some(_) = self.view_creation_token {
16495                return 1;
16496            }
16497            0
16498        }
16499    }
16500
16501    impl fidl::encoding::ResourceTypeMarker for CreateView2Args {
16502        type Borrowed<'a> = &'a mut Self;
16503        fn take_or_borrow<'a>(
16504            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
16505        ) -> Self::Borrowed<'a> {
16506            value
16507        }
16508    }
16509
16510    unsafe impl fidl::encoding::TypeMarker for CreateView2Args {
16511        type Owned = Self;
16512
16513        #[inline(always)]
16514        fn inline_align(_context: fidl::encoding::Context) -> usize {
16515            8
16516        }
16517
16518        #[inline(always)]
16519        fn inline_size(_context: fidl::encoding::Context) -> usize {
16520            16
16521        }
16522    }
16523
16524    unsafe impl
16525        fidl::encoding::Encode<CreateView2Args, fidl::encoding::DefaultFuchsiaResourceDialect>
16526        for &mut CreateView2Args
16527    {
16528        unsafe fn encode(
16529            self,
16530            encoder: &mut fidl::encoding::Encoder<
16531                '_,
16532                fidl::encoding::DefaultFuchsiaResourceDialect,
16533            >,
16534            offset: usize,
16535            mut depth: fidl::encoding::Depth,
16536        ) -> fidl::Result<()> {
16537            encoder.debug_check_bounds::<CreateView2Args>(offset);
16538            // Vector header
16539            let max_ordinal: u64 = self.max_ordinal_present();
16540            encoder.write_num(max_ordinal, offset);
16541            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
16542            // Calling encoder.out_of_line_offset(0) is not allowed.
16543            if max_ordinal == 0 {
16544                return Ok(());
16545            }
16546            depth.increment()?;
16547            let envelope_size = 8;
16548            let bytes_len = max_ordinal as usize * envelope_size;
16549            #[allow(unused_variables)]
16550            let offset = encoder.out_of_line_offset(bytes_len);
16551            let mut _prev_end_offset: usize = 0;
16552            if 1 > max_ordinal {
16553                return Ok(());
16554            }
16555
16556            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16557            // are envelope_size bytes.
16558            let cur_offset: usize = (1 - 1) * envelope_size;
16559
16560            // Zero reserved fields.
16561            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16562
16563            // Safety:
16564            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16565            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16566            //   envelope_size bytes, there is always sufficient room.
16567            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_ui_views::ViewCreationToken, fidl::encoding::DefaultFuchsiaResourceDialect>(
16568            self.view_creation_token.as_mut().map(<fidl_fuchsia_ui_views::ViewCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
16569            encoder, offset + cur_offset, depth
16570        )?;
16571
16572            _prev_end_offset = cur_offset + envelope_size;
16573
16574            Ok(())
16575        }
16576    }
16577
16578    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
16579        for CreateView2Args
16580    {
16581        #[inline(always)]
16582        fn new_empty() -> Self {
16583            Self::default()
16584        }
16585
16586        unsafe fn decode(
16587            &mut self,
16588            decoder: &mut fidl::encoding::Decoder<
16589                '_,
16590                fidl::encoding::DefaultFuchsiaResourceDialect,
16591            >,
16592            offset: usize,
16593            mut depth: fidl::encoding::Depth,
16594        ) -> fidl::Result<()> {
16595            decoder.debug_check_bounds::<Self>(offset);
16596            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
16597                None => return Err(fidl::Error::NotNullable),
16598                Some(len) => len,
16599            };
16600            // Calling decoder.out_of_line_offset(0) is not allowed.
16601            if len == 0 {
16602                return Ok(());
16603            };
16604            depth.increment()?;
16605            let envelope_size = 8;
16606            let bytes_len = len * envelope_size;
16607            let offset = decoder.out_of_line_offset(bytes_len)?;
16608            // Decode the envelope for each type.
16609            let mut _next_ordinal_to_read = 0;
16610            let mut next_offset = offset;
16611            let end_offset = offset + bytes_len;
16612            _next_ordinal_to_read += 1;
16613            if next_offset >= end_offset {
16614                return Ok(());
16615            }
16616
16617            // Decode unknown envelopes for gaps in ordinals.
16618            while _next_ordinal_to_read < 1 {
16619                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16620                _next_ordinal_to_read += 1;
16621                next_offset += envelope_size;
16622            }
16623
16624            let next_out_of_line = decoder.next_out_of_line();
16625            let handles_before = decoder.remaining_handles();
16626            if let Some((inlined, num_bytes, num_handles)) =
16627                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16628            {
16629                let member_inline_size = <fidl_fuchsia_ui_views::ViewCreationToken as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16630                if inlined != (member_inline_size <= 4) {
16631                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16632                }
16633                let inner_offset;
16634                let mut inner_depth = depth.clone();
16635                if inlined {
16636                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16637                    inner_offset = next_offset;
16638                } else {
16639                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16640                    inner_depth.increment()?;
16641                }
16642                let val_ref = self.view_creation_token.get_or_insert_with(|| {
16643                    fidl::new_empty!(
16644                        fidl_fuchsia_ui_views::ViewCreationToken,
16645                        fidl::encoding::DefaultFuchsiaResourceDialect
16646                    )
16647                });
16648                fidl::decode!(
16649                    fidl_fuchsia_ui_views::ViewCreationToken,
16650                    fidl::encoding::DefaultFuchsiaResourceDialect,
16651                    val_ref,
16652                    decoder,
16653                    inner_offset,
16654                    inner_depth
16655                )?;
16656                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16657                {
16658                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16659                }
16660                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16661                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16662                }
16663            }
16664
16665            next_offset += envelope_size;
16666
16667            // Decode the remaining unknown envelopes.
16668            while next_offset < end_offset {
16669                _next_ordinal_to_read += 1;
16670                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16671                next_offset += envelope_size;
16672            }
16673
16674            Ok(())
16675        }
16676    }
16677
16678    impl Favicon {
16679        #[inline(always)]
16680        fn max_ordinal_present(&self) -> u64 {
16681            if let Some(_) = self.height {
16682                return 3;
16683            }
16684            if let Some(_) = self.width {
16685                return 2;
16686            }
16687            if let Some(_) = self.data {
16688                return 1;
16689            }
16690            0
16691        }
16692    }
16693
16694    impl fidl::encoding::ResourceTypeMarker for Favicon {
16695        type Borrowed<'a> = &'a mut Self;
16696        fn take_or_borrow<'a>(
16697            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
16698        ) -> Self::Borrowed<'a> {
16699            value
16700        }
16701    }
16702
16703    unsafe impl fidl::encoding::TypeMarker for Favicon {
16704        type Owned = Self;
16705
16706        #[inline(always)]
16707        fn inline_align(_context: fidl::encoding::Context) -> usize {
16708            8
16709        }
16710
16711        #[inline(always)]
16712        fn inline_size(_context: fidl::encoding::Context) -> usize {
16713            16
16714        }
16715    }
16716
16717    unsafe impl fidl::encoding::Encode<Favicon, fidl::encoding::DefaultFuchsiaResourceDialect>
16718        for &mut Favicon
16719    {
16720        unsafe fn encode(
16721            self,
16722            encoder: &mut fidl::encoding::Encoder<
16723                '_,
16724                fidl::encoding::DefaultFuchsiaResourceDialect,
16725            >,
16726            offset: usize,
16727            mut depth: fidl::encoding::Depth,
16728        ) -> fidl::Result<()> {
16729            encoder.debug_check_bounds::<Favicon>(offset);
16730            // Vector header
16731            let max_ordinal: u64 = self.max_ordinal_present();
16732            encoder.write_num(max_ordinal, offset);
16733            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
16734            // Calling encoder.out_of_line_offset(0) is not allowed.
16735            if max_ordinal == 0 {
16736                return Ok(());
16737            }
16738            depth.increment()?;
16739            let envelope_size = 8;
16740            let bytes_len = max_ordinal as usize * envelope_size;
16741            #[allow(unused_variables)]
16742            let offset = encoder.out_of_line_offset(bytes_len);
16743            let mut _prev_end_offset: usize = 0;
16744            if 1 > max_ordinal {
16745                return Ok(());
16746            }
16747
16748            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16749            // are envelope_size bytes.
16750            let cur_offset: usize = (1 - 1) * envelope_size;
16751
16752            // Zero reserved fields.
16753            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16754
16755            // Safety:
16756            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16757            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16758            //   envelope_size bytes, there is always sufficient room.
16759            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_mem::Buffer, fidl::encoding::DefaultFuchsiaResourceDialect>(
16760            self.data.as_mut().map(<fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
16761            encoder, offset + cur_offset, depth
16762        )?;
16763
16764            _prev_end_offset = cur_offset + envelope_size;
16765            if 2 > max_ordinal {
16766                return Ok(());
16767            }
16768
16769            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16770            // are envelope_size bytes.
16771            let cur_offset: usize = (2 - 1) * envelope_size;
16772
16773            // Zero reserved fields.
16774            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16775
16776            // Safety:
16777            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16778            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16779            //   envelope_size bytes, there is always sufficient room.
16780            fidl::encoding::encode_in_envelope_optional::<
16781                u32,
16782                fidl::encoding::DefaultFuchsiaResourceDialect,
16783            >(
16784                self.width.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
16785                encoder,
16786                offset + cur_offset,
16787                depth,
16788            )?;
16789
16790            _prev_end_offset = cur_offset + envelope_size;
16791            if 3 > max_ordinal {
16792                return Ok(());
16793            }
16794
16795            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16796            // are envelope_size bytes.
16797            let cur_offset: usize = (3 - 1) * envelope_size;
16798
16799            // Zero reserved fields.
16800            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16801
16802            // Safety:
16803            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16804            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16805            //   envelope_size bytes, there is always sufficient room.
16806            fidl::encoding::encode_in_envelope_optional::<
16807                u32,
16808                fidl::encoding::DefaultFuchsiaResourceDialect,
16809            >(
16810                self.height.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
16811                encoder,
16812                offset + cur_offset,
16813                depth,
16814            )?;
16815
16816            _prev_end_offset = cur_offset + envelope_size;
16817
16818            Ok(())
16819        }
16820    }
16821
16822    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Favicon {
16823        #[inline(always)]
16824        fn new_empty() -> Self {
16825            Self::default()
16826        }
16827
16828        unsafe fn decode(
16829            &mut self,
16830            decoder: &mut fidl::encoding::Decoder<
16831                '_,
16832                fidl::encoding::DefaultFuchsiaResourceDialect,
16833            >,
16834            offset: usize,
16835            mut depth: fidl::encoding::Depth,
16836        ) -> fidl::Result<()> {
16837            decoder.debug_check_bounds::<Self>(offset);
16838            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
16839                None => return Err(fidl::Error::NotNullable),
16840                Some(len) => len,
16841            };
16842            // Calling decoder.out_of_line_offset(0) is not allowed.
16843            if len == 0 {
16844                return Ok(());
16845            };
16846            depth.increment()?;
16847            let envelope_size = 8;
16848            let bytes_len = len * envelope_size;
16849            let offset = decoder.out_of_line_offset(bytes_len)?;
16850            // Decode the envelope for each type.
16851            let mut _next_ordinal_to_read = 0;
16852            let mut next_offset = offset;
16853            let end_offset = offset + bytes_len;
16854            _next_ordinal_to_read += 1;
16855            if next_offset >= end_offset {
16856                return Ok(());
16857            }
16858
16859            // Decode unknown envelopes for gaps in ordinals.
16860            while _next_ordinal_to_read < 1 {
16861                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16862                _next_ordinal_to_read += 1;
16863                next_offset += envelope_size;
16864            }
16865
16866            let next_out_of_line = decoder.next_out_of_line();
16867            let handles_before = decoder.remaining_handles();
16868            if let Some((inlined, num_bytes, num_handles)) =
16869                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16870            {
16871                let member_inline_size =
16872                    <fidl_fuchsia_mem::Buffer as fidl::encoding::TypeMarker>::inline_size(
16873                        decoder.context,
16874                    );
16875                if inlined != (member_inline_size <= 4) {
16876                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16877                }
16878                let inner_offset;
16879                let mut inner_depth = depth.clone();
16880                if inlined {
16881                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16882                    inner_offset = next_offset;
16883                } else {
16884                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16885                    inner_depth.increment()?;
16886                }
16887                let val_ref = self.data.get_or_insert_with(|| {
16888                    fidl::new_empty!(
16889                        fidl_fuchsia_mem::Buffer,
16890                        fidl::encoding::DefaultFuchsiaResourceDialect
16891                    )
16892                });
16893                fidl::decode!(
16894                    fidl_fuchsia_mem::Buffer,
16895                    fidl::encoding::DefaultFuchsiaResourceDialect,
16896                    val_ref,
16897                    decoder,
16898                    inner_offset,
16899                    inner_depth
16900                )?;
16901                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16902                {
16903                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16904                }
16905                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16906                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16907                }
16908            }
16909
16910            next_offset += envelope_size;
16911            _next_ordinal_to_read += 1;
16912            if next_offset >= end_offset {
16913                return Ok(());
16914            }
16915
16916            // Decode unknown envelopes for gaps in ordinals.
16917            while _next_ordinal_to_read < 2 {
16918                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16919                _next_ordinal_to_read += 1;
16920                next_offset += envelope_size;
16921            }
16922
16923            let next_out_of_line = decoder.next_out_of_line();
16924            let handles_before = decoder.remaining_handles();
16925            if let Some((inlined, num_bytes, num_handles)) =
16926                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16927            {
16928                let member_inline_size =
16929                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16930                if inlined != (member_inline_size <= 4) {
16931                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16932                }
16933                let inner_offset;
16934                let mut inner_depth = depth.clone();
16935                if inlined {
16936                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16937                    inner_offset = next_offset;
16938                } else {
16939                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16940                    inner_depth.increment()?;
16941                }
16942                let val_ref = self.width.get_or_insert_with(|| {
16943                    fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
16944                });
16945                fidl::decode!(
16946                    u32,
16947                    fidl::encoding::DefaultFuchsiaResourceDialect,
16948                    val_ref,
16949                    decoder,
16950                    inner_offset,
16951                    inner_depth
16952                )?;
16953                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16954                {
16955                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16956                }
16957                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16958                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16959                }
16960            }
16961
16962            next_offset += envelope_size;
16963            _next_ordinal_to_read += 1;
16964            if next_offset >= end_offset {
16965                return Ok(());
16966            }
16967
16968            // Decode unknown envelopes for gaps in ordinals.
16969            while _next_ordinal_to_read < 3 {
16970                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16971                _next_ordinal_to_read += 1;
16972                next_offset += envelope_size;
16973            }
16974
16975            let next_out_of_line = decoder.next_out_of_line();
16976            let handles_before = decoder.remaining_handles();
16977            if let Some((inlined, num_bytes, num_handles)) =
16978                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16979            {
16980                let member_inline_size =
16981                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16982                if inlined != (member_inline_size <= 4) {
16983                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16984                }
16985                let inner_offset;
16986                let mut inner_depth = depth.clone();
16987                if inlined {
16988                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16989                    inner_offset = next_offset;
16990                } else {
16991                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16992                    inner_depth.increment()?;
16993                }
16994                let val_ref = self.height.get_or_insert_with(|| {
16995                    fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
16996                });
16997                fidl::decode!(
16998                    u32,
16999                    fidl::encoding::DefaultFuchsiaResourceDialect,
17000                    val_ref,
17001                    decoder,
17002                    inner_offset,
17003                    inner_depth
17004                )?;
17005                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17006                {
17007                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17008                }
17009                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17010                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17011                }
17012            }
17013
17014            next_offset += envelope_size;
17015
17016            // Decode the remaining unknown envelopes.
17017            while next_offset < end_offset {
17018                _next_ordinal_to_read += 1;
17019                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17020                next_offset += envelope_size;
17021            }
17022
17023            Ok(())
17024        }
17025    }
17026
17027    impl LoadUrlParams {
17028        #[inline(always)]
17029        fn max_ordinal_present(&self) -> u64 {
17030            if let Some(_) = self.headers {
17031                return 4;
17032            }
17033            if let Some(_) = self.was_user_activated {
17034                return 3;
17035            }
17036            if let Some(_) = self.referrer_url {
17037                return 2;
17038            }
17039            if let Some(_) = self.type_ {
17040                return 1;
17041            }
17042            0
17043        }
17044    }
17045
17046    impl fidl::encoding::ResourceTypeMarker for LoadUrlParams {
17047        type Borrowed<'a> = &'a mut Self;
17048        fn take_or_borrow<'a>(
17049            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
17050        ) -> Self::Borrowed<'a> {
17051            value
17052        }
17053    }
17054
17055    unsafe impl fidl::encoding::TypeMarker for LoadUrlParams {
17056        type Owned = Self;
17057
17058        #[inline(always)]
17059        fn inline_align(_context: fidl::encoding::Context) -> usize {
17060            8
17061        }
17062
17063        #[inline(always)]
17064        fn inline_size(_context: fidl::encoding::Context) -> usize {
17065            16
17066        }
17067    }
17068
17069    unsafe impl fidl::encoding::Encode<LoadUrlParams, fidl::encoding::DefaultFuchsiaResourceDialect>
17070        for &mut LoadUrlParams
17071    {
17072        unsafe fn encode(
17073            self,
17074            encoder: &mut fidl::encoding::Encoder<
17075                '_,
17076                fidl::encoding::DefaultFuchsiaResourceDialect,
17077            >,
17078            offset: usize,
17079            mut depth: fidl::encoding::Depth,
17080        ) -> fidl::Result<()> {
17081            encoder.debug_check_bounds::<LoadUrlParams>(offset);
17082            // Vector header
17083            let max_ordinal: u64 = self.max_ordinal_present();
17084            encoder.write_num(max_ordinal, offset);
17085            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
17086            // Calling encoder.out_of_line_offset(0) is not allowed.
17087            if max_ordinal == 0 {
17088                return Ok(());
17089            }
17090            depth.increment()?;
17091            let envelope_size = 8;
17092            let bytes_len = max_ordinal as usize * envelope_size;
17093            #[allow(unused_variables)]
17094            let offset = encoder.out_of_line_offset(bytes_len);
17095            let mut _prev_end_offset: usize = 0;
17096            if 1 > max_ordinal {
17097                return Ok(());
17098            }
17099
17100            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17101            // are envelope_size bytes.
17102            let cur_offset: usize = (1 - 1) * envelope_size;
17103
17104            // Zero reserved fields.
17105            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17106
17107            // Safety:
17108            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17109            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17110            //   envelope_size bytes, there is always sufficient room.
17111            fidl::encoding::encode_in_envelope_optional::<
17112                LoadUrlReason,
17113                fidl::encoding::DefaultFuchsiaResourceDialect,
17114            >(
17115                self.type_.as_ref().map(<LoadUrlReason as fidl::encoding::ValueTypeMarker>::borrow),
17116                encoder,
17117                offset + cur_offset,
17118                depth,
17119            )?;
17120
17121            _prev_end_offset = cur_offset + envelope_size;
17122            if 2 > max_ordinal {
17123                return Ok(());
17124            }
17125
17126            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17127            // are envelope_size bytes.
17128            let cur_offset: usize = (2 - 1) * envelope_size;
17129
17130            // Zero reserved fields.
17131            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17132
17133            // Safety:
17134            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17135            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17136            //   envelope_size bytes, there is always sufficient room.
17137            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<65536>, fidl::encoding::DefaultFuchsiaResourceDialect>(
17138            self.referrer_url.as_ref().map(<fidl::encoding::BoundedString<65536> as fidl::encoding::ValueTypeMarker>::borrow),
17139            encoder, offset + cur_offset, depth
17140        )?;
17141
17142            _prev_end_offset = cur_offset + envelope_size;
17143            if 3 > max_ordinal {
17144                return Ok(());
17145            }
17146
17147            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17148            // are envelope_size bytes.
17149            let cur_offset: usize = (3 - 1) * envelope_size;
17150
17151            // Zero reserved fields.
17152            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17153
17154            // Safety:
17155            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17156            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17157            //   envelope_size bytes, there is always sufficient room.
17158            fidl::encoding::encode_in_envelope_optional::<
17159                bool,
17160                fidl::encoding::DefaultFuchsiaResourceDialect,
17161            >(
17162                self.was_user_activated
17163                    .as_ref()
17164                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
17165                encoder,
17166                offset + cur_offset,
17167                depth,
17168            )?;
17169
17170            _prev_end_offset = cur_offset + envelope_size;
17171            if 4 > max_ordinal {
17172                return Ok(());
17173            }
17174
17175            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17176            // are envelope_size bytes.
17177            let cur_offset: usize = (4 - 1) * envelope_size;
17178
17179            // Zero reserved fields.
17180            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17181
17182            // Safety:
17183            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17184            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17185            //   envelope_size bytes, there is always sufficient room.
17186            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl_fuchsia_net_http::Header>, fidl::encoding::DefaultFuchsiaResourceDialect>(
17187            self.headers.as_ref().map(<fidl::encoding::UnboundedVector<fidl_fuchsia_net_http::Header> as fidl::encoding::ValueTypeMarker>::borrow),
17188            encoder, offset + cur_offset, depth
17189        )?;
17190
17191            _prev_end_offset = cur_offset + envelope_size;
17192
17193            Ok(())
17194        }
17195    }
17196
17197    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for LoadUrlParams {
17198        #[inline(always)]
17199        fn new_empty() -> Self {
17200            Self::default()
17201        }
17202
17203        unsafe fn decode(
17204            &mut self,
17205            decoder: &mut fidl::encoding::Decoder<
17206                '_,
17207                fidl::encoding::DefaultFuchsiaResourceDialect,
17208            >,
17209            offset: usize,
17210            mut depth: fidl::encoding::Depth,
17211        ) -> fidl::Result<()> {
17212            decoder.debug_check_bounds::<Self>(offset);
17213            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
17214                None => return Err(fidl::Error::NotNullable),
17215                Some(len) => len,
17216            };
17217            // Calling decoder.out_of_line_offset(0) is not allowed.
17218            if len == 0 {
17219                return Ok(());
17220            };
17221            depth.increment()?;
17222            let envelope_size = 8;
17223            let bytes_len = len * envelope_size;
17224            let offset = decoder.out_of_line_offset(bytes_len)?;
17225            // Decode the envelope for each type.
17226            let mut _next_ordinal_to_read = 0;
17227            let mut next_offset = offset;
17228            let end_offset = offset + bytes_len;
17229            _next_ordinal_to_read += 1;
17230            if next_offset >= end_offset {
17231                return Ok(());
17232            }
17233
17234            // Decode unknown envelopes for gaps in ordinals.
17235            while _next_ordinal_to_read < 1 {
17236                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17237                _next_ordinal_to_read += 1;
17238                next_offset += envelope_size;
17239            }
17240
17241            let next_out_of_line = decoder.next_out_of_line();
17242            let handles_before = decoder.remaining_handles();
17243            if let Some((inlined, num_bytes, num_handles)) =
17244                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17245            {
17246                let member_inline_size =
17247                    <LoadUrlReason as fidl::encoding::TypeMarker>::inline_size(decoder.context);
17248                if inlined != (member_inline_size <= 4) {
17249                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17250                }
17251                let inner_offset;
17252                let mut inner_depth = depth.clone();
17253                if inlined {
17254                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17255                    inner_offset = next_offset;
17256                } else {
17257                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17258                    inner_depth.increment()?;
17259                }
17260                let val_ref = self.type_.get_or_insert_with(|| {
17261                    fidl::new_empty!(LoadUrlReason, fidl::encoding::DefaultFuchsiaResourceDialect)
17262                });
17263                fidl::decode!(
17264                    LoadUrlReason,
17265                    fidl::encoding::DefaultFuchsiaResourceDialect,
17266                    val_ref,
17267                    decoder,
17268                    inner_offset,
17269                    inner_depth
17270                )?;
17271                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17272                {
17273                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17274                }
17275                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17276                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17277                }
17278            }
17279
17280            next_offset += envelope_size;
17281            _next_ordinal_to_read += 1;
17282            if next_offset >= end_offset {
17283                return Ok(());
17284            }
17285
17286            // Decode unknown envelopes for gaps in ordinals.
17287            while _next_ordinal_to_read < 2 {
17288                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17289                _next_ordinal_to_read += 1;
17290                next_offset += envelope_size;
17291            }
17292
17293            let next_out_of_line = decoder.next_out_of_line();
17294            let handles_before = decoder.remaining_handles();
17295            if let Some((inlined, num_bytes, num_handles)) =
17296                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17297            {
17298                let member_inline_size = <fidl::encoding::BoundedString<65536> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
17299                if inlined != (member_inline_size <= 4) {
17300                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17301                }
17302                let inner_offset;
17303                let mut inner_depth = depth.clone();
17304                if inlined {
17305                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17306                    inner_offset = next_offset;
17307                } else {
17308                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17309                    inner_depth.increment()?;
17310                }
17311                let val_ref = self.referrer_url.get_or_insert_with(|| {
17312                    fidl::new_empty!(
17313                        fidl::encoding::BoundedString<65536>,
17314                        fidl::encoding::DefaultFuchsiaResourceDialect
17315                    )
17316                });
17317                fidl::decode!(
17318                    fidl::encoding::BoundedString<65536>,
17319                    fidl::encoding::DefaultFuchsiaResourceDialect,
17320                    val_ref,
17321                    decoder,
17322                    inner_offset,
17323                    inner_depth
17324                )?;
17325                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17326                {
17327                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17328                }
17329                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17330                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17331                }
17332            }
17333
17334            next_offset += envelope_size;
17335            _next_ordinal_to_read += 1;
17336            if next_offset >= end_offset {
17337                return Ok(());
17338            }
17339
17340            // Decode unknown envelopes for gaps in ordinals.
17341            while _next_ordinal_to_read < 3 {
17342                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17343                _next_ordinal_to_read += 1;
17344                next_offset += envelope_size;
17345            }
17346
17347            let next_out_of_line = decoder.next_out_of_line();
17348            let handles_before = decoder.remaining_handles();
17349            if let Some((inlined, num_bytes, num_handles)) =
17350                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17351            {
17352                let member_inline_size =
17353                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
17354                if inlined != (member_inline_size <= 4) {
17355                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17356                }
17357                let inner_offset;
17358                let mut inner_depth = depth.clone();
17359                if inlined {
17360                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17361                    inner_offset = next_offset;
17362                } else {
17363                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17364                    inner_depth.increment()?;
17365                }
17366                let val_ref = self.was_user_activated.get_or_insert_with(|| {
17367                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
17368                });
17369                fidl::decode!(
17370                    bool,
17371                    fidl::encoding::DefaultFuchsiaResourceDialect,
17372                    val_ref,
17373                    decoder,
17374                    inner_offset,
17375                    inner_depth
17376                )?;
17377                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17378                {
17379                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17380                }
17381                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17382                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17383                }
17384            }
17385
17386            next_offset += envelope_size;
17387            _next_ordinal_to_read += 1;
17388            if next_offset >= end_offset {
17389                return Ok(());
17390            }
17391
17392            // Decode unknown envelopes for gaps in ordinals.
17393            while _next_ordinal_to_read < 4 {
17394                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17395                _next_ordinal_to_read += 1;
17396                next_offset += envelope_size;
17397            }
17398
17399            let next_out_of_line = decoder.next_out_of_line();
17400            let handles_before = decoder.remaining_handles();
17401            if let Some((inlined, num_bytes, num_handles)) =
17402                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17403            {
17404                let member_inline_size = <fidl::encoding::UnboundedVector<
17405                    fidl_fuchsia_net_http::Header,
17406                > as fidl::encoding::TypeMarker>::inline_size(
17407                    decoder.context
17408                );
17409                if inlined != (member_inline_size <= 4) {
17410                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17411                }
17412                let inner_offset;
17413                let mut inner_depth = depth.clone();
17414                if inlined {
17415                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17416                    inner_offset = next_offset;
17417                } else {
17418                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17419                    inner_depth.increment()?;
17420                }
17421                let val_ref = self.headers.get_or_insert_with(|| {
17422                    fidl::new_empty!(
17423                        fidl::encoding::UnboundedVector<fidl_fuchsia_net_http::Header>,
17424                        fidl::encoding::DefaultFuchsiaResourceDialect
17425                    )
17426                });
17427                fidl::decode!(
17428                    fidl::encoding::UnboundedVector<fidl_fuchsia_net_http::Header>,
17429                    fidl::encoding::DefaultFuchsiaResourceDialect,
17430                    val_ref,
17431                    decoder,
17432                    inner_offset,
17433                    inner_depth
17434                )?;
17435                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17436                {
17437                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17438                }
17439                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17440                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17441                }
17442            }
17443
17444            next_offset += envelope_size;
17445
17446            // Decode the remaining unknown envelopes.
17447            while next_offset < end_offset {
17448                _next_ordinal_to_read += 1;
17449                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17450                next_offset += envelope_size;
17451            }
17452
17453            Ok(())
17454        }
17455    }
17456
17457    impl NavigationState {
17458        #[inline(always)]
17459        fn max_ordinal_present(&self) -> u64 {
17460            if let Some(_) = self.error_detail {
17461                return 8;
17462            }
17463            if let Some(_) = self.favicon {
17464                return 7;
17465            }
17466            if let Some(_) = self.is_main_document_loaded {
17467                return 6;
17468            }
17469            if let Some(_) = self.can_go_back {
17470                return 5;
17471            }
17472            if let Some(_) = self.can_go_forward {
17473                return 4;
17474            }
17475            if let Some(_) = self.page_type {
17476                return 3;
17477            }
17478            if let Some(_) = self.title {
17479                return 2;
17480            }
17481            if let Some(_) = self.url {
17482                return 1;
17483            }
17484            0
17485        }
17486    }
17487
17488    impl fidl::encoding::ResourceTypeMarker for NavigationState {
17489        type Borrowed<'a> = &'a mut Self;
17490        fn take_or_borrow<'a>(
17491            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
17492        ) -> Self::Borrowed<'a> {
17493            value
17494        }
17495    }
17496
17497    unsafe impl fidl::encoding::TypeMarker for NavigationState {
17498        type Owned = Self;
17499
17500        #[inline(always)]
17501        fn inline_align(_context: fidl::encoding::Context) -> usize {
17502            8
17503        }
17504
17505        #[inline(always)]
17506        fn inline_size(_context: fidl::encoding::Context) -> usize {
17507            16
17508        }
17509    }
17510
17511    unsafe impl
17512        fidl::encoding::Encode<NavigationState, fidl::encoding::DefaultFuchsiaResourceDialect>
17513        for &mut NavigationState
17514    {
17515        unsafe fn encode(
17516            self,
17517            encoder: &mut fidl::encoding::Encoder<
17518                '_,
17519                fidl::encoding::DefaultFuchsiaResourceDialect,
17520            >,
17521            offset: usize,
17522            mut depth: fidl::encoding::Depth,
17523        ) -> fidl::Result<()> {
17524            encoder.debug_check_bounds::<NavigationState>(offset);
17525            // Vector header
17526            let max_ordinal: u64 = self.max_ordinal_present();
17527            encoder.write_num(max_ordinal, offset);
17528            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
17529            // Calling encoder.out_of_line_offset(0) is not allowed.
17530            if max_ordinal == 0 {
17531                return Ok(());
17532            }
17533            depth.increment()?;
17534            let envelope_size = 8;
17535            let bytes_len = max_ordinal as usize * envelope_size;
17536            #[allow(unused_variables)]
17537            let offset = encoder.out_of_line_offset(bytes_len);
17538            let mut _prev_end_offset: usize = 0;
17539            if 1 > max_ordinal {
17540                return Ok(());
17541            }
17542
17543            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17544            // are envelope_size bytes.
17545            let cur_offset: usize = (1 - 1) * envelope_size;
17546
17547            // Zero reserved fields.
17548            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17549
17550            // Safety:
17551            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17552            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17553            //   envelope_size bytes, there is always sufficient room.
17554            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<65536>, fidl::encoding::DefaultFuchsiaResourceDialect>(
17555            self.url.as_ref().map(<fidl::encoding::BoundedString<65536> as fidl::encoding::ValueTypeMarker>::borrow),
17556            encoder, offset + cur_offset, depth
17557        )?;
17558
17559            _prev_end_offset = cur_offset + envelope_size;
17560            if 2 > max_ordinal {
17561                return Ok(());
17562            }
17563
17564            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17565            // are envelope_size bytes.
17566            let cur_offset: usize = (2 - 1) * envelope_size;
17567
17568            // Zero reserved fields.
17569            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17570
17571            // Safety:
17572            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17573            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17574            //   envelope_size bytes, there is always sufficient room.
17575            fidl::encoding::encode_in_envelope_optional::<
17576                fidl::encoding::UnboundedString,
17577                fidl::encoding::DefaultFuchsiaResourceDialect,
17578            >(
17579                self.title.as_ref().map(
17580                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
17581                ),
17582                encoder,
17583                offset + cur_offset,
17584                depth,
17585            )?;
17586
17587            _prev_end_offset = cur_offset + envelope_size;
17588            if 3 > max_ordinal {
17589                return Ok(());
17590            }
17591
17592            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17593            // are envelope_size bytes.
17594            let cur_offset: usize = (3 - 1) * envelope_size;
17595
17596            // Zero reserved fields.
17597            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17598
17599            // Safety:
17600            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17601            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17602            //   envelope_size bytes, there is always sufficient room.
17603            fidl::encoding::encode_in_envelope_optional::<
17604                PageType,
17605                fidl::encoding::DefaultFuchsiaResourceDialect,
17606            >(
17607                self.page_type.as_ref().map(<PageType as fidl::encoding::ValueTypeMarker>::borrow),
17608                encoder,
17609                offset + cur_offset,
17610                depth,
17611            )?;
17612
17613            _prev_end_offset = cur_offset + envelope_size;
17614            if 4 > max_ordinal {
17615                return Ok(());
17616            }
17617
17618            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17619            // are envelope_size bytes.
17620            let cur_offset: usize = (4 - 1) * envelope_size;
17621
17622            // Zero reserved fields.
17623            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17624
17625            // Safety:
17626            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17627            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17628            //   envelope_size bytes, there is always sufficient room.
17629            fidl::encoding::encode_in_envelope_optional::<
17630                bool,
17631                fidl::encoding::DefaultFuchsiaResourceDialect,
17632            >(
17633                self.can_go_forward.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
17634                encoder,
17635                offset + cur_offset,
17636                depth,
17637            )?;
17638
17639            _prev_end_offset = cur_offset + envelope_size;
17640            if 5 > max_ordinal {
17641                return Ok(());
17642            }
17643
17644            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17645            // are envelope_size bytes.
17646            let cur_offset: usize = (5 - 1) * envelope_size;
17647
17648            // Zero reserved fields.
17649            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17650
17651            // Safety:
17652            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17653            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17654            //   envelope_size bytes, there is always sufficient room.
17655            fidl::encoding::encode_in_envelope_optional::<
17656                bool,
17657                fidl::encoding::DefaultFuchsiaResourceDialect,
17658            >(
17659                self.can_go_back.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
17660                encoder,
17661                offset + cur_offset,
17662                depth,
17663            )?;
17664
17665            _prev_end_offset = cur_offset + envelope_size;
17666            if 6 > max_ordinal {
17667                return Ok(());
17668            }
17669
17670            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17671            // are envelope_size bytes.
17672            let cur_offset: usize = (6 - 1) * envelope_size;
17673
17674            // Zero reserved fields.
17675            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17676
17677            // Safety:
17678            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17679            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17680            //   envelope_size bytes, there is always sufficient room.
17681            fidl::encoding::encode_in_envelope_optional::<
17682                bool,
17683                fidl::encoding::DefaultFuchsiaResourceDialect,
17684            >(
17685                self.is_main_document_loaded
17686                    .as_ref()
17687                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
17688                encoder,
17689                offset + cur_offset,
17690                depth,
17691            )?;
17692
17693            _prev_end_offset = cur_offset + envelope_size;
17694            if 7 > max_ordinal {
17695                return Ok(());
17696            }
17697
17698            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17699            // are envelope_size bytes.
17700            let cur_offset: usize = (7 - 1) * envelope_size;
17701
17702            // Zero reserved fields.
17703            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17704
17705            // Safety:
17706            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17707            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17708            //   envelope_size bytes, there is always sufficient room.
17709            fidl::encoding::encode_in_envelope_optional::<
17710                Favicon,
17711                fidl::encoding::DefaultFuchsiaResourceDialect,
17712            >(
17713                self.favicon
17714                    .as_mut()
17715                    .map(<Favicon as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
17716                encoder,
17717                offset + cur_offset,
17718                depth,
17719            )?;
17720
17721            _prev_end_offset = cur_offset + envelope_size;
17722            if 8 > max_ordinal {
17723                return Ok(());
17724            }
17725
17726            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17727            // are envelope_size bytes.
17728            let cur_offset: usize = (8 - 1) * envelope_size;
17729
17730            // Zero reserved fields.
17731            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17732
17733            // Safety:
17734            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17735            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17736            //   envelope_size bytes, there is always sufficient room.
17737            fidl::encoding::encode_in_envelope_optional::<
17738                ErrorDetail,
17739                fidl::encoding::DefaultFuchsiaResourceDialect,
17740            >(
17741                self.error_detail
17742                    .as_ref()
17743                    .map(<ErrorDetail as fidl::encoding::ValueTypeMarker>::borrow),
17744                encoder,
17745                offset + cur_offset,
17746                depth,
17747            )?;
17748
17749            _prev_end_offset = cur_offset + envelope_size;
17750
17751            Ok(())
17752        }
17753    }
17754
17755    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
17756        for NavigationState
17757    {
17758        #[inline(always)]
17759        fn new_empty() -> Self {
17760            Self::default()
17761        }
17762
17763        unsafe fn decode(
17764            &mut self,
17765            decoder: &mut fidl::encoding::Decoder<
17766                '_,
17767                fidl::encoding::DefaultFuchsiaResourceDialect,
17768            >,
17769            offset: usize,
17770            mut depth: fidl::encoding::Depth,
17771        ) -> fidl::Result<()> {
17772            decoder.debug_check_bounds::<Self>(offset);
17773            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
17774                None => return Err(fidl::Error::NotNullable),
17775                Some(len) => len,
17776            };
17777            // Calling decoder.out_of_line_offset(0) is not allowed.
17778            if len == 0 {
17779                return Ok(());
17780            };
17781            depth.increment()?;
17782            let envelope_size = 8;
17783            let bytes_len = len * envelope_size;
17784            let offset = decoder.out_of_line_offset(bytes_len)?;
17785            // Decode the envelope for each type.
17786            let mut _next_ordinal_to_read = 0;
17787            let mut next_offset = offset;
17788            let end_offset = offset + bytes_len;
17789            _next_ordinal_to_read += 1;
17790            if next_offset >= end_offset {
17791                return Ok(());
17792            }
17793
17794            // Decode unknown envelopes for gaps in ordinals.
17795            while _next_ordinal_to_read < 1 {
17796                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17797                _next_ordinal_to_read += 1;
17798                next_offset += envelope_size;
17799            }
17800
17801            let next_out_of_line = decoder.next_out_of_line();
17802            let handles_before = decoder.remaining_handles();
17803            if let Some((inlined, num_bytes, num_handles)) =
17804                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17805            {
17806                let member_inline_size = <fidl::encoding::BoundedString<65536> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
17807                if inlined != (member_inline_size <= 4) {
17808                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17809                }
17810                let inner_offset;
17811                let mut inner_depth = depth.clone();
17812                if inlined {
17813                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17814                    inner_offset = next_offset;
17815                } else {
17816                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17817                    inner_depth.increment()?;
17818                }
17819                let val_ref = self.url.get_or_insert_with(|| {
17820                    fidl::new_empty!(
17821                        fidl::encoding::BoundedString<65536>,
17822                        fidl::encoding::DefaultFuchsiaResourceDialect
17823                    )
17824                });
17825                fidl::decode!(
17826                    fidl::encoding::BoundedString<65536>,
17827                    fidl::encoding::DefaultFuchsiaResourceDialect,
17828                    val_ref,
17829                    decoder,
17830                    inner_offset,
17831                    inner_depth
17832                )?;
17833                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17834                {
17835                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17836                }
17837                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17838                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17839                }
17840            }
17841
17842            next_offset += envelope_size;
17843            _next_ordinal_to_read += 1;
17844            if next_offset >= end_offset {
17845                return Ok(());
17846            }
17847
17848            // Decode unknown envelopes for gaps in ordinals.
17849            while _next_ordinal_to_read < 2 {
17850                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17851                _next_ordinal_to_read += 1;
17852                next_offset += envelope_size;
17853            }
17854
17855            let next_out_of_line = decoder.next_out_of_line();
17856            let handles_before = decoder.remaining_handles();
17857            if let Some((inlined, num_bytes, num_handles)) =
17858                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17859            {
17860                let member_inline_size =
17861                    <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
17862                        decoder.context,
17863                    );
17864                if inlined != (member_inline_size <= 4) {
17865                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17866                }
17867                let inner_offset;
17868                let mut inner_depth = depth.clone();
17869                if inlined {
17870                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17871                    inner_offset = next_offset;
17872                } else {
17873                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17874                    inner_depth.increment()?;
17875                }
17876                let val_ref = self.title.get_or_insert_with(|| {
17877                    fidl::new_empty!(
17878                        fidl::encoding::UnboundedString,
17879                        fidl::encoding::DefaultFuchsiaResourceDialect
17880                    )
17881                });
17882                fidl::decode!(
17883                    fidl::encoding::UnboundedString,
17884                    fidl::encoding::DefaultFuchsiaResourceDialect,
17885                    val_ref,
17886                    decoder,
17887                    inner_offset,
17888                    inner_depth
17889                )?;
17890                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17891                {
17892                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17893                }
17894                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17895                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17896                }
17897            }
17898
17899            next_offset += envelope_size;
17900            _next_ordinal_to_read += 1;
17901            if next_offset >= end_offset {
17902                return Ok(());
17903            }
17904
17905            // Decode unknown envelopes for gaps in ordinals.
17906            while _next_ordinal_to_read < 3 {
17907                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17908                _next_ordinal_to_read += 1;
17909                next_offset += envelope_size;
17910            }
17911
17912            let next_out_of_line = decoder.next_out_of_line();
17913            let handles_before = decoder.remaining_handles();
17914            if let Some((inlined, num_bytes, num_handles)) =
17915                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17916            {
17917                let member_inline_size =
17918                    <PageType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
17919                if inlined != (member_inline_size <= 4) {
17920                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17921                }
17922                let inner_offset;
17923                let mut inner_depth = depth.clone();
17924                if inlined {
17925                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17926                    inner_offset = next_offset;
17927                } else {
17928                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17929                    inner_depth.increment()?;
17930                }
17931                let val_ref = self.page_type.get_or_insert_with(|| {
17932                    fidl::new_empty!(PageType, fidl::encoding::DefaultFuchsiaResourceDialect)
17933                });
17934                fidl::decode!(
17935                    PageType,
17936                    fidl::encoding::DefaultFuchsiaResourceDialect,
17937                    val_ref,
17938                    decoder,
17939                    inner_offset,
17940                    inner_depth
17941                )?;
17942                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17943                {
17944                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17945                }
17946                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17947                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17948                }
17949            }
17950
17951            next_offset += envelope_size;
17952            _next_ordinal_to_read += 1;
17953            if next_offset >= end_offset {
17954                return Ok(());
17955            }
17956
17957            // Decode unknown envelopes for gaps in ordinals.
17958            while _next_ordinal_to_read < 4 {
17959                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17960                _next_ordinal_to_read += 1;
17961                next_offset += envelope_size;
17962            }
17963
17964            let next_out_of_line = decoder.next_out_of_line();
17965            let handles_before = decoder.remaining_handles();
17966            if let Some((inlined, num_bytes, num_handles)) =
17967                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17968            {
17969                let member_inline_size =
17970                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
17971                if inlined != (member_inline_size <= 4) {
17972                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17973                }
17974                let inner_offset;
17975                let mut inner_depth = depth.clone();
17976                if inlined {
17977                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17978                    inner_offset = next_offset;
17979                } else {
17980                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17981                    inner_depth.increment()?;
17982                }
17983                let val_ref = self.can_go_forward.get_or_insert_with(|| {
17984                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
17985                });
17986                fidl::decode!(
17987                    bool,
17988                    fidl::encoding::DefaultFuchsiaResourceDialect,
17989                    val_ref,
17990                    decoder,
17991                    inner_offset,
17992                    inner_depth
17993                )?;
17994                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17995                {
17996                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17997                }
17998                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17999                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18000                }
18001            }
18002
18003            next_offset += envelope_size;
18004            _next_ordinal_to_read += 1;
18005            if next_offset >= end_offset {
18006                return Ok(());
18007            }
18008
18009            // Decode unknown envelopes for gaps in ordinals.
18010            while _next_ordinal_to_read < 5 {
18011                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18012                _next_ordinal_to_read += 1;
18013                next_offset += envelope_size;
18014            }
18015
18016            let next_out_of_line = decoder.next_out_of_line();
18017            let handles_before = decoder.remaining_handles();
18018            if let Some((inlined, num_bytes, num_handles)) =
18019                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18020            {
18021                let member_inline_size =
18022                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18023                if inlined != (member_inline_size <= 4) {
18024                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18025                }
18026                let inner_offset;
18027                let mut inner_depth = depth.clone();
18028                if inlined {
18029                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18030                    inner_offset = next_offset;
18031                } else {
18032                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18033                    inner_depth.increment()?;
18034                }
18035                let val_ref = self.can_go_back.get_or_insert_with(|| {
18036                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
18037                });
18038                fidl::decode!(
18039                    bool,
18040                    fidl::encoding::DefaultFuchsiaResourceDialect,
18041                    val_ref,
18042                    decoder,
18043                    inner_offset,
18044                    inner_depth
18045                )?;
18046                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18047                {
18048                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18049                }
18050                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18051                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18052                }
18053            }
18054
18055            next_offset += envelope_size;
18056            _next_ordinal_to_read += 1;
18057            if next_offset >= end_offset {
18058                return Ok(());
18059            }
18060
18061            // Decode unknown envelopes for gaps in ordinals.
18062            while _next_ordinal_to_read < 6 {
18063                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18064                _next_ordinal_to_read += 1;
18065                next_offset += envelope_size;
18066            }
18067
18068            let next_out_of_line = decoder.next_out_of_line();
18069            let handles_before = decoder.remaining_handles();
18070            if let Some((inlined, num_bytes, num_handles)) =
18071                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18072            {
18073                let member_inline_size =
18074                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18075                if inlined != (member_inline_size <= 4) {
18076                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18077                }
18078                let inner_offset;
18079                let mut inner_depth = depth.clone();
18080                if inlined {
18081                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18082                    inner_offset = next_offset;
18083                } else {
18084                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18085                    inner_depth.increment()?;
18086                }
18087                let val_ref = self.is_main_document_loaded.get_or_insert_with(|| {
18088                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
18089                });
18090                fidl::decode!(
18091                    bool,
18092                    fidl::encoding::DefaultFuchsiaResourceDialect,
18093                    val_ref,
18094                    decoder,
18095                    inner_offset,
18096                    inner_depth
18097                )?;
18098                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18099                {
18100                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18101                }
18102                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18103                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18104                }
18105            }
18106
18107            next_offset += envelope_size;
18108            _next_ordinal_to_read += 1;
18109            if next_offset >= end_offset {
18110                return Ok(());
18111            }
18112
18113            // Decode unknown envelopes for gaps in ordinals.
18114            while _next_ordinal_to_read < 7 {
18115                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18116                _next_ordinal_to_read += 1;
18117                next_offset += envelope_size;
18118            }
18119
18120            let next_out_of_line = decoder.next_out_of_line();
18121            let handles_before = decoder.remaining_handles();
18122            if let Some((inlined, num_bytes, num_handles)) =
18123                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18124            {
18125                let member_inline_size =
18126                    <Favicon as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18127                if inlined != (member_inline_size <= 4) {
18128                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18129                }
18130                let inner_offset;
18131                let mut inner_depth = depth.clone();
18132                if inlined {
18133                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18134                    inner_offset = next_offset;
18135                } else {
18136                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18137                    inner_depth.increment()?;
18138                }
18139                let val_ref = self.favicon.get_or_insert_with(|| {
18140                    fidl::new_empty!(Favicon, fidl::encoding::DefaultFuchsiaResourceDialect)
18141                });
18142                fidl::decode!(
18143                    Favicon,
18144                    fidl::encoding::DefaultFuchsiaResourceDialect,
18145                    val_ref,
18146                    decoder,
18147                    inner_offset,
18148                    inner_depth
18149                )?;
18150                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18151                {
18152                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18153                }
18154                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18155                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18156                }
18157            }
18158
18159            next_offset += envelope_size;
18160            _next_ordinal_to_read += 1;
18161            if next_offset >= end_offset {
18162                return Ok(());
18163            }
18164
18165            // Decode unknown envelopes for gaps in ordinals.
18166            while _next_ordinal_to_read < 8 {
18167                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18168                _next_ordinal_to_read += 1;
18169                next_offset += envelope_size;
18170            }
18171
18172            let next_out_of_line = decoder.next_out_of_line();
18173            let handles_before = decoder.remaining_handles();
18174            if let Some((inlined, num_bytes, num_handles)) =
18175                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18176            {
18177                let member_inline_size =
18178                    <ErrorDetail as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18179                if inlined != (member_inline_size <= 4) {
18180                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18181                }
18182                let inner_offset;
18183                let mut inner_depth = depth.clone();
18184                if inlined {
18185                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18186                    inner_offset = next_offset;
18187                } else {
18188                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18189                    inner_depth.increment()?;
18190                }
18191                let val_ref = self.error_detail.get_or_insert_with(|| {
18192                    fidl::new_empty!(ErrorDetail, fidl::encoding::DefaultFuchsiaResourceDialect)
18193                });
18194                fidl::decode!(
18195                    ErrorDetail,
18196                    fidl::encoding::DefaultFuchsiaResourceDialect,
18197                    val_ref,
18198                    decoder,
18199                    inner_offset,
18200                    inner_depth
18201                )?;
18202                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18203                {
18204                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18205                }
18206                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18207                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18208                }
18209            }
18210
18211            next_offset += envelope_size;
18212
18213            // Decode the remaining unknown envelopes.
18214            while next_offset < end_offset {
18215                _next_ordinal_to_read += 1;
18216                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18217                next_offset += envelope_size;
18218            }
18219
18220            Ok(())
18221        }
18222    }
18223
18224    impl PopupFrameCreationInfo {
18225        #[inline(always)]
18226        fn max_ordinal_present(&self) -> u64 {
18227            if let Some(_) = self.initiated_by_user {
18228                return 2;
18229            }
18230            if let Some(_) = self.initial_url {
18231                return 1;
18232            }
18233            0
18234        }
18235    }
18236
18237    impl fidl::encoding::ResourceTypeMarker for PopupFrameCreationInfo {
18238        type Borrowed<'a> = &'a mut Self;
18239        fn take_or_borrow<'a>(
18240            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
18241        ) -> Self::Borrowed<'a> {
18242            value
18243        }
18244    }
18245
18246    unsafe impl fidl::encoding::TypeMarker for PopupFrameCreationInfo {
18247        type Owned = Self;
18248
18249        #[inline(always)]
18250        fn inline_align(_context: fidl::encoding::Context) -> usize {
18251            8
18252        }
18253
18254        #[inline(always)]
18255        fn inline_size(_context: fidl::encoding::Context) -> usize {
18256            16
18257        }
18258    }
18259
18260    unsafe impl
18261        fidl::encoding::Encode<
18262            PopupFrameCreationInfo,
18263            fidl::encoding::DefaultFuchsiaResourceDialect,
18264        > for &mut PopupFrameCreationInfo
18265    {
18266        unsafe fn encode(
18267            self,
18268            encoder: &mut fidl::encoding::Encoder<
18269                '_,
18270                fidl::encoding::DefaultFuchsiaResourceDialect,
18271            >,
18272            offset: usize,
18273            mut depth: fidl::encoding::Depth,
18274        ) -> fidl::Result<()> {
18275            encoder.debug_check_bounds::<PopupFrameCreationInfo>(offset);
18276            // Vector header
18277            let max_ordinal: u64 = self.max_ordinal_present();
18278            encoder.write_num(max_ordinal, offset);
18279            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
18280            // Calling encoder.out_of_line_offset(0) is not allowed.
18281            if max_ordinal == 0 {
18282                return Ok(());
18283            }
18284            depth.increment()?;
18285            let envelope_size = 8;
18286            let bytes_len = max_ordinal as usize * envelope_size;
18287            #[allow(unused_variables)]
18288            let offset = encoder.out_of_line_offset(bytes_len);
18289            let mut _prev_end_offset: usize = 0;
18290            if 1 > max_ordinal {
18291                return Ok(());
18292            }
18293
18294            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
18295            // are envelope_size bytes.
18296            let cur_offset: usize = (1 - 1) * envelope_size;
18297
18298            // Zero reserved fields.
18299            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
18300
18301            // Safety:
18302            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
18303            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
18304            //   envelope_size bytes, there is always sufficient room.
18305            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<65536>, fidl::encoding::DefaultFuchsiaResourceDialect>(
18306            self.initial_url.as_ref().map(<fidl::encoding::BoundedString<65536> as fidl::encoding::ValueTypeMarker>::borrow),
18307            encoder, offset + cur_offset, depth
18308        )?;
18309
18310            _prev_end_offset = cur_offset + envelope_size;
18311            if 2 > max_ordinal {
18312                return Ok(());
18313            }
18314
18315            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
18316            // are envelope_size bytes.
18317            let cur_offset: usize = (2 - 1) * envelope_size;
18318
18319            // Zero reserved fields.
18320            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
18321
18322            // Safety:
18323            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
18324            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
18325            //   envelope_size bytes, there is always sufficient room.
18326            fidl::encoding::encode_in_envelope_optional::<
18327                bool,
18328                fidl::encoding::DefaultFuchsiaResourceDialect,
18329            >(
18330                self.initiated_by_user
18331                    .as_ref()
18332                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
18333                encoder,
18334                offset + cur_offset,
18335                depth,
18336            )?;
18337
18338            _prev_end_offset = cur_offset + envelope_size;
18339
18340            Ok(())
18341        }
18342    }
18343
18344    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
18345        for PopupFrameCreationInfo
18346    {
18347        #[inline(always)]
18348        fn new_empty() -> Self {
18349            Self::default()
18350        }
18351
18352        unsafe fn decode(
18353            &mut self,
18354            decoder: &mut fidl::encoding::Decoder<
18355                '_,
18356                fidl::encoding::DefaultFuchsiaResourceDialect,
18357            >,
18358            offset: usize,
18359            mut depth: fidl::encoding::Depth,
18360        ) -> fidl::Result<()> {
18361            decoder.debug_check_bounds::<Self>(offset);
18362            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
18363                None => return Err(fidl::Error::NotNullable),
18364                Some(len) => len,
18365            };
18366            // Calling decoder.out_of_line_offset(0) is not allowed.
18367            if len == 0 {
18368                return Ok(());
18369            };
18370            depth.increment()?;
18371            let envelope_size = 8;
18372            let bytes_len = len * envelope_size;
18373            let offset = decoder.out_of_line_offset(bytes_len)?;
18374            // Decode the envelope for each type.
18375            let mut _next_ordinal_to_read = 0;
18376            let mut next_offset = offset;
18377            let end_offset = offset + bytes_len;
18378            _next_ordinal_to_read += 1;
18379            if next_offset >= end_offset {
18380                return Ok(());
18381            }
18382
18383            // Decode unknown envelopes for gaps in ordinals.
18384            while _next_ordinal_to_read < 1 {
18385                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18386                _next_ordinal_to_read += 1;
18387                next_offset += envelope_size;
18388            }
18389
18390            let next_out_of_line = decoder.next_out_of_line();
18391            let handles_before = decoder.remaining_handles();
18392            if let Some((inlined, num_bytes, num_handles)) =
18393                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18394            {
18395                let member_inline_size = <fidl::encoding::BoundedString<65536> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18396                if inlined != (member_inline_size <= 4) {
18397                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18398                }
18399                let inner_offset;
18400                let mut inner_depth = depth.clone();
18401                if inlined {
18402                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18403                    inner_offset = next_offset;
18404                } else {
18405                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18406                    inner_depth.increment()?;
18407                }
18408                let val_ref = self.initial_url.get_or_insert_with(|| {
18409                    fidl::new_empty!(
18410                        fidl::encoding::BoundedString<65536>,
18411                        fidl::encoding::DefaultFuchsiaResourceDialect
18412                    )
18413                });
18414                fidl::decode!(
18415                    fidl::encoding::BoundedString<65536>,
18416                    fidl::encoding::DefaultFuchsiaResourceDialect,
18417                    val_ref,
18418                    decoder,
18419                    inner_offset,
18420                    inner_depth
18421                )?;
18422                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18423                {
18424                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18425                }
18426                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18427                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18428                }
18429            }
18430
18431            next_offset += envelope_size;
18432            _next_ordinal_to_read += 1;
18433            if next_offset >= end_offset {
18434                return Ok(());
18435            }
18436
18437            // Decode unknown envelopes for gaps in ordinals.
18438            while _next_ordinal_to_read < 2 {
18439                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18440                _next_ordinal_to_read += 1;
18441                next_offset += envelope_size;
18442            }
18443
18444            let next_out_of_line = decoder.next_out_of_line();
18445            let handles_before = decoder.remaining_handles();
18446            if let Some((inlined, num_bytes, num_handles)) =
18447                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18448            {
18449                let member_inline_size =
18450                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18451                if inlined != (member_inline_size <= 4) {
18452                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18453                }
18454                let inner_offset;
18455                let mut inner_depth = depth.clone();
18456                if inlined {
18457                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18458                    inner_offset = next_offset;
18459                } else {
18460                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18461                    inner_depth.increment()?;
18462                }
18463                let val_ref = self.initiated_by_user.get_or_insert_with(|| {
18464                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
18465                });
18466                fidl::decode!(
18467                    bool,
18468                    fidl::encoding::DefaultFuchsiaResourceDialect,
18469                    val_ref,
18470                    decoder,
18471                    inner_offset,
18472                    inner_depth
18473                )?;
18474                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18475                {
18476                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18477                }
18478                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18479                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18480                }
18481            }
18482
18483            next_offset += envelope_size;
18484
18485            // Decode the remaining unknown envelopes.
18486            while next_offset < end_offset {
18487                _next_ordinal_to_read += 1;
18488                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18489                next_offset += envelope_size;
18490            }
18491
18492            Ok(())
18493        }
18494    }
18495
18496    impl WebMessage {
18497        #[inline(always)]
18498        fn max_ordinal_present(&self) -> u64 {
18499            if let Some(_) = self.outgoing_transfer {
18500                return 3;
18501            }
18502            if let Some(_) = self.incoming_transfer {
18503                return 2;
18504            }
18505            if let Some(_) = self.data {
18506                return 1;
18507            }
18508            0
18509        }
18510    }
18511
18512    impl fidl::encoding::ResourceTypeMarker for WebMessage {
18513        type Borrowed<'a> = &'a mut Self;
18514        fn take_or_borrow<'a>(
18515            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
18516        ) -> Self::Borrowed<'a> {
18517            value
18518        }
18519    }
18520
18521    unsafe impl fidl::encoding::TypeMarker for WebMessage {
18522        type Owned = Self;
18523
18524        #[inline(always)]
18525        fn inline_align(_context: fidl::encoding::Context) -> usize {
18526            8
18527        }
18528
18529        #[inline(always)]
18530        fn inline_size(_context: fidl::encoding::Context) -> usize {
18531            16
18532        }
18533    }
18534
18535    unsafe impl fidl::encoding::Encode<WebMessage, fidl::encoding::DefaultFuchsiaResourceDialect>
18536        for &mut WebMessage
18537    {
18538        unsafe fn encode(
18539            self,
18540            encoder: &mut fidl::encoding::Encoder<
18541                '_,
18542                fidl::encoding::DefaultFuchsiaResourceDialect,
18543            >,
18544            offset: usize,
18545            mut depth: fidl::encoding::Depth,
18546        ) -> fidl::Result<()> {
18547            encoder.debug_check_bounds::<WebMessage>(offset);
18548            // Vector header
18549            let max_ordinal: u64 = self.max_ordinal_present();
18550            encoder.write_num(max_ordinal, offset);
18551            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
18552            // Calling encoder.out_of_line_offset(0) is not allowed.
18553            if max_ordinal == 0 {
18554                return Ok(());
18555            }
18556            depth.increment()?;
18557            let envelope_size = 8;
18558            let bytes_len = max_ordinal as usize * envelope_size;
18559            #[allow(unused_variables)]
18560            let offset = encoder.out_of_line_offset(bytes_len);
18561            let mut _prev_end_offset: usize = 0;
18562            if 1 > max_ordinal {
18563                return Ok(());
18564            }
18565
18566            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
18567            // are envelope_size bytes.
18568            let cur_offset: usize = (1 - 1) * envelope_size;
18569
18570            // Zero reserved fields.
18571            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
18572
18573            // Safety:
18574            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
18575            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
18576            //   envelope_size bytes, there is always sufficient room.
18577            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_mem::Buffer, fidl::encoding::DefaultFuchsiaResourceDialect>(
18578            self.data.as_mut().map(<fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
18579            encoder, offset + cur_offset, depth
18580        )?;
18581
18582            _prev_end_offset = cur_offset + envelope_size;
18583            if 2 > max_ordinal {
18584                return Ok(());
18585            }
18586
18587            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
18588            // are envelope_size bytes.
18589            let cur_offset: usize = (2 - 1) * envelope_size;
18590
18591            // Zero reserved fields.
18592            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
18593
18594            // Safety:
18595            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
18596            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
18597            //   envelope_size bytes, there is always sufficient room.
18598            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<IncomingTransferable>, fidl::encoding::DefaultFuchsiaResourceDialect>(
18599            self.incoming_transfer.as_mut().map(<fidl::encoding::UnboundedVector<IncomingTransferable> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
18600            encoder, offset + cur_offset, depth
18601        )?;
18602
18603            _prev_end_offset = cur_offset + envelope_size;
18604            if 3 > max_ordinal {
18605                return Ok(());
18606            }
18607
18608            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
18609            // are envelope_size bytes.
18610            let cur_offset: usize = (3 - 1) * envelope_size;
18611
18612            // Zero reserved fields.
18613            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
18614
18615            // Safety:
18616            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
18617            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
18618            //   envelope_size bytes, there is always sufficient room.
18619            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<OutgoingTransferable>, fidl::encoding::DefaultFuchsiaResourceDialect>(
18620            self.outgoing_transfer.as_mut().map(<fidl::encoding::UnboundedVector<OutgoingTransferable> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
18621            encoder, offset + cur_offset, depth
18622        )?;
18623
18624            _prev_end_offset = cur_offset + envelope_size;
18625
18626            Ok(())
18627        }
18628    }
18629
18630    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for WebMessage {
18631        #[inline(always)]
18632        fn new_empty() -> Self {
18633            Self::default()
18634        }
18635
18636        unsafe fn decode(
18637            &mut self,
18638            decoder: &mut fidl::encoding::Decoder<
18639                '_,
18640                fidl::encoding::DefaultFuchsiaResourceDialect,
18641            >,
18642            offset: usize,
18643            mut depth: fidl::encoding::Depth,
18644        ) -> fidl::Result<()> {
18645            decoder.debug_check_bounds::<Self>(offset);
18646            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
18647                None => return Err(fidl::Error::NotNullable),
18648                Some(len) => len,
18649            };
18650            // Calling decoder.out_of_line_offset(0) is not allowed.
18651            if len == 0 {
18652                return Ok(());
18653            };
18654            depth.increment()?;
18655            let envelope_size = 8;
18656            let bytes_len = len * envelope_size;
18657            let offset = decoder.out_of_line_offset(bytes_len)?;
18658            // Decode the envelope for each type.
18659            let mut _next_ordinal_to_read = 0;
18660            let mut next_offset = offset;
18661            let end_offset = offset + bytes_len;
18662            _next_ordinal_to_read += 1;
18663            if next_offset >= end_offset {
18664                return Ok(());
18665            }
18666
18667            // Decode unknown envelopes for gaps in ordinals.
18668            while _next_ordinal_to_read < 1 {
18669                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18670                _next_ordinal_to_read += 1;
18671                next_offset += envelope_size;
18672            }
18673
18674            let next_out_of_line = decoder.next_out_of_line();
18675            let handles_before = decoder.remaining_handles();
18676            if let Some((inlined, num_bytes, num_handles)) =
18677                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18678            {
18679                let member_inline_size =
18680                    <fidl_fuchsia_mem::Buffer as fidl::encoding::TypeMarker>::inline_size(
18681                        decoder.context,
18682                    );
18683                if inlined != (member_inline_size <= 4) {
18684                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18685                }
18686                let inner_offset;
18687                let mut inner_depth = depth.clone();
18688                if inlined {
18689                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18690                    inner_offset = next_offset;
18691                } else {
18692                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18693                    inner_depth.increment()?;
18694                }
18695                let val_ref = self.data.get_or_insert_with(|| {
18696                    fidl::new_empty!(
18697                        fidl_fuchsia_mem::Buffer,
18698                        fidl::encoding::DefaultFuchsiaResourceDialect
18699                    )
18700                });
18701                fidl::decode!(
18702                    fidl_fuchsia_mem::Buffer,
18703                    fidl::encoding::DefaultFuchsiaResourceDialect,
18704                    val_ref,
18705                    decoder,
18706                    inner_offset,
18707                    inner_depth
18708                )?;
18709                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18710                {
18711                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18712                }
18713                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18714                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18715                }
18716            }
18717
18718            next_offset += envelope_size;
18719            _next_ordinal_to_read += 1;
18720            if next_offset >= end_offset {
18721                return Ok(());
18722            }
18723
18724            // Decode unknown envelopes for gaps in ordinals.
18725            while _next_ordinal_to_read < 2 {
18726                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18727                _next_ordinal_to_read += 1;
18728                next_offset += envelope_size;
18729            }
18730
18731            let next_out_of_line = decoder.next_out_of_line();
18732            let handles_before = decoder.remaining_handles();
18733            if let Some((inlined, num_bytes, num_handles)) =
18734                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18735            {
18736                let member_inline_size = <fidl::encoding::UnboundedVector<IncomingTransferable> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18737                if inlined != (member_inline_size <= 4) {
18738                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18739                }
18740                let inner_offset;
18741                let mut inner_depth = depth.clone();
18742                if inlined {
18743                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18744                    inner_offset = next_offset;
18745                } else {
18746                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18747                    inner_depth.increment()?;
18748                }
18749                let val_ref = self.incoming_transfer.get_or_insert_with(|| {
18750                    fidl::new_empty!(
18751                        fidl::encoding::UnboundedVector<IncomingTransferable>,
18752                        fidl::encoding::DefaultFuchsiaResourceDialect
18753                    )
18754                });
18755                fidl::decode!(
18756                    fidl::encoding::UnboundedVector<IncomingTransferable>,
18757                    fidl::encoding::DefaultFuchsiaResourceDialect,
18758                    val_ref,
18759                    decoder,
18760                    inner_offset,
18761                    inner_depth
18762                )?;
18763                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18764                {
18765                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18766                }
18767                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18768                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18769                }
18770            }
18771
18772            next_offset += envelope_size;
18773            _next_ordinal_to_read += 1;
18774            if next_offset >= end_offset {
18775                return Ok(());
18776            }
18777
18778            // Decode unknown envelopes for gaps in ordinals.
18779            while _next_ordinal_to_read < 3 {
18780                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18781                _next_ordinal_to_read += 1;
18782                next_offset += envelope_size;
18783            }
18784
18785            let next_out_of_line = decoder.next_out_of_line();
18786            let handles_before = decoder.remaining_handles();
18787            if let Some((inlined, num_bytes, num_handles)) =
18788                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18789            {
18790                let member_inline_size = <fidl::encoding::UnboundedVector<OutgoingTransferable> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18791                if inlined != (member_inline_size <= 4) {
18792                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18793                }
18794                let inner_offset;
18795                let mut inner_depth = depth.clone();
18796                if inlined {
18797                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18798                    inner_offset = next_offset;
18799                } else {
18800                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18801                    inner_depth.increment()?;
18802                }
18803                let val_ref = self.outgoing_transfer.get_or_insert_with(|| {
18804                    fidl::new_empty!(
18805                        fidl::encoding::UnboundedVector<OutgoingTransferable>,
18806                        fidl::encoding::DefaultFuchsiaResourceDialect
18807                    )
18808                });
18809                fidl::decode!(
18810                    fidl::encoding::UnboundedVector<OutgoingTransferable>,
18811                    fidl::encoding::DefaultFuchsiaResourceDialect,
18812                    val_ref,
18813                    decoder,
18814                    inner_offset,
18815                    inner_depth
18816                )?;
18817                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18818                {
18819                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18820                }
18821                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18822                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18823                }
18824            }
18825
18826            next_offset += envelope_size;
18827
18828            // Decode the remaining unknown envelopes.
18829            while next_offset < end_offset {
18830                _next_ordinal_to_read += 1;
18831                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18832                next_offset += envelope_size;
18833            }
18834
18835            Ok(())
18836        }
18837    }
18838
18839    impl fidl::encoding::ResourceTypeMarker for IncomingTransferable {
18840        type Borrowed<'a> = &'a mut Self;
18841        fn take_or_borrow<'a>(
18842            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
18843        ) -> Self::Borrowed<'a> {
18844            value
18845        }
18846    }
18847
18848    unsafe impl fidl::encoding::TypeMarker for IncomingTransferable {
18849        type Owned = Self;
18850
18851        #[inline(always)]
18852        fn inline_align(_context: fidl::encoding::Context) -> usize {
18853            8
18854        }
18855
18856        #[inline(always)]
18857        fn inline_size(_context: fidl::encoding::Context) -> usize {
18858            16
18859        }
18860    }
18861
18862    unsafe impl
18863        fidl::encoding::Encode<IncomingTransferable, fidl::encoding::DefaultFuchsiaResourceDialect>
18864        for &mut IncomingTransferable
18865    {
18866        #[inline]
18867        unsafe fn encode(
18868            self,
18869            encoder: &mut fidl::encoding::Encoder<
18870                '_,
18871                fidl::encoding::DefaultFuchsiaResourceDialect,
18872            >,
18873            offset: usize,
18874            _depth: fidl::encoding::Depth,
18875        ) -> fidl::Result<()> {
18876            encoder.debug_check_bounds::<IncomingTransferable>(offset);
18877            encoder.write_num::<u64>(self.ordinal(), offset);
18878            match self {
18879            IncomingTransferable::MessagePort(ref mut val) => {
18880                fidl::encoding::encode_in_envelope::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<MessagePortMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
18881                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<MessagePortMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
18882                    encoder, offset + 8, _depth
18883                )
18884            }
18885            IncomingTransferable::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
18886        }
18887        }
18888    }
18889
18890    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
18891        for IncomingTransferable
18892    {
18893        #[inline(always)]
18894        fn new_empty() -> Self {
18895            Self::__SourceBreaking { unknown_ordinal: 0 }
18896        }
18897
18898        #[inline]
18899        unsafe fn decode(
18900            &mut self,
18901            decoder: &mut fidl::encoding::Decoder<
18902                '_,
18903                fidl::encoding::DefaultFuchsiaResourceDialect,
18904            >,
18905            offset: usize,
18906            mut depth: fidl::encoding::Depth,
18907        ) -> fidl::Result<()> {
18908            decoder.debug_check_bounds::<Self>(offset);
18909            #[allow(unused_variables)]
18910            let next_out_of_line = decoder.next_out_of_line();
18911            let handles_before = decoder.remaining_handles();
18912            let (ordinal, inlined, num_bytes, num_handles) =
18913                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
18914
18915            let member_inline_size = match ordinal {
18916            1 => <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<MessagePortMarker>> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
18917            0 => return Err(fidl::Error::UnknownUnionTag),
18918            _ => num_bytes as usize,
18919        };
18920
18921            if inlined != (member_inline_size <= 4) {
18922                return Err(fidl::Error::InvalidInlineBitInEnvelope);
18923            }
18924            let _inner_offset;
18925            if inlined {
18926                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
18927                _inner_offset = offset + 8;
18928            } else {
18929                depth.increment()?;
18930                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18931            }
18932            match ordinal {
18933                1 => {
18934                    #[allow(irrefutable_let_patterns)]
18935                    if let IncomingTransferable::MessagePort(_) = self {
18936                        // Do nothing, read the value into the object
18937                    } else {
18938                        // Initialize `self` to the right variant
18939                        *self = IncomingTransferable::MessagePort(fidl::new_empty!(
18940                            fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<MessagePortMarker>>,
18941                            fidl::encoding::DefaultFuchsiaResourceDialect
18942                        ));
18943                    }
18944                    #[allow(irrefutable_let_patterns)]
18945                    if let IncomingTransferable::MessagePort(ref mut val) = self {
18946                        fidl::decode!(
18947                            fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<MessagePortMarker>>,
18948                            fidl::encoding::DefaultFuchsiaResourceDialect,
18949                            val,
18950                            decoder,
18951                            _inner_offset,
18952                            depth
18953                        )?;
18954                    } else {
18955                        unreachable!()
18956                    }
18957                }
18958                #[allow(deprecated)]
18959                ordinal => {
18960                    for _ in 0..num_handles {
18961                        decoder.drop_next_handle()?;
18962                    }
18963                    *self = IncomingTransferable::__SourceBreaking { unknown_ordinal: ordinal };
18964                }
18965            }
18966            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
18967                return Err(fidl::Error::InvalidNumBytesInEnvelope);
18968            }
18969            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18970                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18971            }
18972            Ok(())
18973        }
18974    }
18975
18976    impl fidl::encoding::ResourceTypeMarker for NavigationDecision {
18977        type Borrowed<'a> = &'a mut Self;
18978        fn take_or_borrow<'a>(
18979            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
18980        ) -> Self::Borrowed<'a> {
18981            value
18982        }
18983    }
18984
18985    unsafe impl fidl::encoding::TypeMarker for NavigationDecision {
18986        type Owned = Self;
18987
18988        #[inline(always)]
18989        fn inline_align(_context: fidl::encoding::Context) -> usize {
18990            8
18991        }
18992
18993        #[inline(always)]
18994        fn inline_size(_context: fidl::encoding::Context) -> usize {
18995            16
18996        }
18997    }
18998
18999    unsafe impl
19000        fidl::encoding::Encode<NavigationDecision, fidl::encoding::DefaultFuchsiaResourceDialect>
19001        for &mut NavigationDecision
19002    {
19003        #[inline]
19004        unsafe fn encode(
19005            self,
19006            encoder: &mut fidl::encoding::Encoder<
19007                '_,
19008                fidl::encoding::DefaultFuchsiaResourceDialect,
19009            >,
19010            offset: usize,
19011            _depth: fidl::encoding::Depth,
19012        ) -> fidl::Result<()> {
19013            encoder.debug_check_bounds::<NavigationDecision>(offset);
19014            encoder.write_num::<u64>(self.ordinal(), offset);
19015            match self {
19016                NavigationDecision::Proceed(ref val) => fidl::encoding::encode_in_envelope::<
19017                    NoArgumentsAction,
19018                    fidl::encoding::DefaultFuchsiaResourceDialect,
19019                >(
19020                    <NoArgumentsAction as fidl::encoding::ValueTypeMarker>::borrow(val),
19021                    encoder,
19022                    offset + 8,
19023                    _depth,
19024                ),
19025                NavigationDecision::Abort(ref val) => fidl::encoding::encode_in_envelope::<
19026                    NoArgumentsAction,
19027                    fidl::encoding::DefaultFuchsiaResourceDialect,
19028                >(
19029                    <NoArgumentsAction as fidl::encoding::ValueTypeMarker>::borrow(val),
19030                    encoder,
19031                    offset + 8,
19032                    _depth,
19033                ),
19034            }
19035        }
19036    }
19037
19038    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
19039        for NavigationDecision
19040    {
19041        #[inline(always)]
19042        fn new_empty() -> Self {
19043            Self::Proceed(fidl::new_empty!(
19044                NoArgumentsAction,
19045                fidl::encoding::DefaultFuchsiaResourceDialect
19046            ))
19047        }
19048
19049        #[inline]
19050        unsafe fn decode(
19051            &mut self,
19052            decoder: &mut fidl::encoding::Decoder<
19053                '_,
19054                fidl::encoding::DefaultFuchsiaResourceDialect,
19055            >,
19056            offset: usize,
19057            mut depth: fidl::encoding::Depth,
19058        ) -> fidl::Result<()> {
19059            decoder.debug_check_bounds::<Self>(offset);
19060            #[allow(unused_variables)]
19061            let next_out_of_line = decoder.next_out_of_line();
19062            let handles_before = decoder.remaining_handles();
19063            let (ordinal, inlined, num_bytes, num_handles) =
19064                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
19065
19066            let member_inline_size = match ordinal {
19067                1 => {
19068                    <NoArgumentsAction as fidl::encoding::TypeMarker>::inline_size(decoder.context)
19069                }
19070                2 => {
19071                    <NoArgumentsAction as fidl::encoding::TypeMarker>::inline_size(decoder.context)
19072                }
19073                _ => return Err(fidl::Error::UnknownUnionTag),
19074            };
19075
19076            if inlined != (member_inline_size <= 4) {
19077                return Err(fidl::Error::InvalidInlineBitInEnvelope);
19078            }
19079            let _inner_offset;
19080            if inlined {
19081                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
19082                _inner_offset = offset + 8;
19083            } else {
19084                depth.increment()?;
19085                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
19086            }
19087            match ordinal {
19088                1 => {
19089                    #[allow(irrefutable_let_patterns)]
19090                    if let NavigationDecision::Proceed(_) = self {
19091                        // Do nothing, read the value into the object
19092                    } else {
19093                        // Initialize `self` to the right variant
19094                        *self = NavigationDecision::Proceed(fidl::new_empty!(
19095                            NoArgumentsAction,
19096                            fidl::encoding::DefaultFuchsiaResourceDialect
19097                        ));
19098                    }
19099                    #[allow(irrefutable_let_patterns)]
19100                    if let NavigationDecision::Proceed(ref mut val) = self {
19101                        fidl::decode!(
19102                            NoArgumentsAction,
19103                            fidl::encoding::DefaultFuchsiaResourceDialect,
19104                            val,
19105                            decoder,
19106                            _inner_offset,
19107                            depth
19108                        )?;
19109                    } else {
19110                        unreachable!()
19111                    }
19112                }
19113                2 => {
19114                    #[allow(irrefutable_let_patterns)]
19115                    if let NavigationDecision::Abort(_) = self {
19116                        // Do nothing, read the value into the object
19117                    } else {
19118                        // Initialize `self` to the right variant
19119                        *self = NavigationDecision::Abort(fidl::new_empty!(
19120                            NoArgumentsAction,
19121                            fidl::encoding::DefaultFuchsiaResourceDialect
19122                        ));
19123                    }
19124                    #[allow(irrefutable_let_patterns)]
19125                    if let NavigationDecision::Abort(ref mut val) = self {
19126                        fidl::decode!(
19127                            NoArgumentsAction,
19128                            fidl::encoding::DefaultFuchsiaResourceDialect,
19129                            val,
19130                            decoder,
19131                            _inner_offset,
19132                            depth
19133                        )?;
19134                    } else {
19135                        unreachable!()
19136                    }
19137                }
19138                ordinal => panic!("unexpected ordinal {:?}", ordinal),
19139            }
19140            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
19141                return Err(fidl::Error::InvalidNumBytesInEnvelope);
19142            }
19143            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
19144                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
19145            }
19146            Ok(())
19147        }
19148    }
19149
19150    impl fidl::encoding::ResourceTypeMarker for OutgoingTransferable {
19151        type Borrowed<'a> = &'a mut Self;
19152        fn take_or_borrow<'a>(
19153            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
19154        ) -> Self::Borrowed<'a> {
19155            value
19156        }
19157    }
19158
19159    unsafe impl fidl::encoding::TypeMarker for OutgoingTransferable {
19160        type Owned = Self;
19161
19162        #[inline(always)]
19163        fn inline_align(_context: fidl::encoding::Context) -> usize {
19164            8
19165        }
19166
19167        #[inline(always)]
19168        fn inline_size(_context: fidl::encoding::Context) -> usize {
19169            16
19170        }
19171    }
19172
19173    unsafe impl
19174        fidl::encoding::Encode<OutgoingTransferable, fidl::encoding::DefaultFuchsiaResourceDialect>
19175        for &mut OutgoingTransferable
19176    {
19177        #[inline]
19178        unsafe fn encode(
19179            self,
19180            encoder: &mut fidl::encoding::Encoder<
19181                '_,
19182                fidl::encoding::DefaultFuchsiaResourceDialect,
19183            >,
19184            offset: usize,
19185            _depth: fidl::encoding::Depth,
19186        ) -> fidl::Result<()> {
19187            encoder.debug_check_bounds::<OutgoingTransferable>(offset);
19188            encoder.write_num::<u64>(self.ordinal(), offset);
19189            match self {
19190            OutgoingTransferable::MessagePort(ref mut val) => {
19191                fidl::encoding::encode_in_envelope::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MessagePortMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
19192                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MessagePortMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
19193                    encoder, offset + 8, _depth
19194                )
19195            }
19196            OutgoingTransferable::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
19197        }
19198        }
19199    }
19200
19201    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
19202        for OutgoingTransferable
19203    {
19204        #[inline(always)]
19205        fn new_empty() -> Self {
19206            Self::__SourceBreaking { unknown_ordinal: 0 }
19207        }
19208
19209        #[inline]
19210        unsafe fn decode(
19211            &mut self,
19212            decoder: &mut fidl::encoding::Decoder<
19213                '_,
19214                fidl::encoding::DefaultFuchsiaResourceDialect,
19215            >,
19216            offset: usize,
19217            mut depth: fidl::encoding::Depth,
19218        ) -> fidl::Result<()> {
19219            decoder.debug_check_bounds::<Self>(offset);
19220            #[allow(unused_variables)]
19221            let next_out_of_line = decoder.next_out_of_line();
19222            let handles_before = decoder.remaining_handles();
19223            let (ordinal, inlined, num_bytes, num_handles) =
19224                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
19225
19226            let member_inline_size = match ordinal {
19227            1 => <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MessagePortMarker>> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
19228            0 => return Err(fidl::Error::UnknownUnionTag),
19229            _ => num_bytes as usize,
19230        };
19231
19232            if inlined != (member_inline_size <= 4) {
19233                return Err(fidl::Error::InvalidInlineBitInEnvelope);
19234            }
19235            let _inner_offset;
19236            if inlined {
19237                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
19238                _inner_offset = offset + 8;
19239            } else {
19240                depth.increment()?;
19241                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
19242            }
19243            match ordinal {
19244                1 => {
19245                    #[allow(irrefutable_let_patterns)]
19246                    if let OutgoingTransferable::MessagePort(_) = self {
19247                        // Do nothing, read the value into the object
19248                    } else {
19249                        // Initialize `self` to the right variant
19250                        *self = OutgoingTransferable::MessagePort(fidl::new_empty!(
19251                            fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MessagePortMarker>>,
19252                            fidl::encoding::DefaultFuchsiaResourceDialect
19253                        ));
19254                    }
19255                    #[allow(irrefutable_let_patterns)]
19256                    if let OutgoingTransferable::MessagePort(ref mut val) = self {
19257                        fidl::decode!(
19258                            fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MessagePortMarker>>,
19259                            fidl::encoding::DefaultFuchsiaResourceDialect,
19260                            val,
19261                            decoder,
19262                            _inner_offset,
19263                            depth
19264                        )?;
19265                    } else {
19266                        unreachable!()
19267                    }
19268                }
19269                #[allow(deprecated)]
19270                ordinal => {
19271                    for _ in 0..num_handles {
19272                        decoder.drop_next_handle()?;
19273                    }
19274                    *self = OutgoingTransferable::__SourceBreaking { unknown_ordinal: ordinal };
19275                }
19276            }
19277            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
19278                return Err(fidl::Error::InvalidNumBytesInEnvelope);
19279            }
19280            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
19281                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
19282            }
19283            Ok(())
19284        }
19285    }
19286}